text:
package edu.ucsc.dbtune.util;

import java.util.ArrayList;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

import static edu.ucsc.dbtune.DBTuneInstances.configureListOfIdentifiables;
import static edu.ucsc.dbtune.util.CollectionTest.checkAdd;
import static edu.ucsc.dbtune.util.CollectionTest.checkAddAll;
import static edu.ucsc.dbtune.util.CollectionTest.checkClear;
import static edu.ucsc.dbtune.util.CollectionTest.checkContains;
import static edu.ucsc.dbtune.util.CollectionTest.checkContainsAll;
import static edu.ucsc.dbtune.util.CollectionTest.checkEquals;
import static edu.ucsc.dbtune.util.CollectionTest.checkIsEmpty;
import static edu.ucsc.dbtune.util.CollectionTest.checkRemove;
import static edu.ucsc.dbtune.util.CollectionTest.checkRemoveAll;
import static edu.ucsc.dbtune.util.CollectionTest.checkRetainAll;
import static edu.ucsc.dbtune.util.CollectionTest.checkSize;
import static edu.ucsc.dbtune.util.CollectionTest.checkToArray;
import static edu.ucsc.dbtune.util.CollectionTest.checkToArrayT;
import static edu.ucsc.dbtune.util.SetTest.checkAdd;
import static edu.ucsc.dbtune.util.SetTest.checkAgainstJDKSets;
import static edu.ucsc.dbtune.util.SetTest.checkRemove;

/**
 * Unit test for BitArraySetTest.
 *
 * @author Ivo Jimenez
 */
public class BitArraySetTest
{
    private static List<Identifiable> listIdentifiables;

    /**
     * Setup for the test.
     */
    @BeforeClass
    public static void beforeClassSetUp()
    {
        listIdentifiables = configureListOfIdentifiables(100);
    }

    /**
     */
    @Test
    public void testCollectionInterfaceMethods()
    {
        List<Identifiable> intersection = new ArrayList<Identifiable>();

        intersection.add(listIdentifiables.get(0));
        intersection.add(listIdentifiables.get(1));
        intersection.add(listIdentifiables.get(3));
        intersection.add(listIdentifiables.get(5));

        checkAdd(new BitArraySet<Identifiable>(), listIdentifiables);
        checkAddAll(new BitArraySet<Identifiable>(), listIdentifiables);
        checkClear(new BitArraySet<Identifiable>(), listIdentifiables);
        checkContains(new BitArraySet<Identifiable>(), listIdentifiables);
        checkContainsAll(new BitArraySet<Identifiable>(), listIdentifiables);
        checkEquals(new BitArraySet<Identifiable>(), listIdentifiables);
        checkIsEmpty(new BitArraySet<Identifiable>(), listIdentifiables);
        checkRemove(new BitArraySet<Identifiable>(), listIdentifiables);
        checkRemoveAll(new BitArraySet<Identifiable>(), listIdentifiables);
        checkRetainAll(new BitArraySet<Identifiable>(), listIdentifiables, intersection);
        checkSize(new BitArraySet<Identifiable>(), listIdentifiables);
        checkToArray(new BitArraySet<Identifiable>(), listIdentifiables);
        checkToArrayT(new BitArraySet<Identifiable>(), listIdentifiables);
    }

    /**
     */
    @Test
    public void testSetInterfaceMethods()
    {
        checkAdd(new BitArraySet<Identifiable>(), listIdentifiables.get(0));
        checkRemove(new BitArraySet<Identifiable>(), listIdentifiables.get(0));
    }

    /**
     */
    @Test
    public void testAgainstOtherSetImplementations()
    {
        checkAgainstJDKSets(new BitArraySet<Identifiable>(), listIdentifiables);
    }
}


text:
Command line tool
=================

Basic usage
-----------

The senpy server is launched via the `senpy` command:

.. code:: text

    usage: senpy [-h] [--level logging_level] [--log-format log_format] [--debug]
                [--no-default-plugins] [--host HOST] [--port PORT]
                [--plugins-folder PLUGINS_FOLDER] [--only-install] [--only-test]
                [--test] [--only-list] [--data-folder DATA_FOLDER]
                [--no-threaded] [--no-deps] [--version] [--allow-fail]

    Run a Senpy server

    optional arguments:
      -h, --help            show this help message and exit
      --level logging_level, -l logging_level
                            Logging level
      --log-format log_format
                            Logging format
      --debug, -d           Run the application in debug mode
      --no-default-plugins  Do not load the default plugins
      --host HOST           Use 0.0.0.0 to accept requests from any host.
      --port PORT, -p PORT  Port to listen on.
      --plugins-folder PLUGINS_FOLDER, -f PLUGINS_FOLDER
                            Where to look for plugins.
      --only-install, -i    Do not run a server, only install plugin dependencies
      --only-test           Do not run a server, just test all plugins
      --test, -t            Test all plugins before launching the server
      --only-list, --list   Do not run a server, only list plugins found
      --data-folder DATA_FOLDER, --data DATA_FOLDER
                            Where to look for data. It be set with the SENPY_DATA
                            environment variable as well.
      --no-threaded         Run the server without threading
      --no-deps, -n         Skip installing dependencies
      --version, -v         Output the senpy version and exit
      --allow-fail, --fail  Do not exit if some plugins fail to activate

When launched, the server will recursively look for plugins in the specified plugins folder (the current working directory by default).
For every plugin found, it will download its dependencies, and try to activate it.
The default server includes a playground and an endpoint with all plugins found.

Let's run senpy with the default plugins:

.. code:: bash

    senpy -f .

Now open your browser and go to `http://localhost:5000 <http://localhost:5000>`_, where you should be greeted by the senpy playground:

.. image:: senpy-playground.png
   :width: 100%
   :alt: Playground

The playground is a user-friendly way to test your plugins, but you can always use the service directly:  `http://localhost:5000/api?input=hello <http://localhost:5000/api?input=hello>`_.

By default, senpy will listen only on `127.0.0.1`.
That means you can only access the API from your PC (i.e. localhost).
You can listen on a different address using the `--host` flag (e.g., 0.0.0.0, to allow any computer to access it).
The default port is 5000.
You can change it with the `--port` flag.

For instance, to accept connections on port 6000 on any interface:

.. code:: bash

    senpy --host 0.0.0.0 --port 6000

For more options, see the `--help` page.

Sentiment analysis in the command line
--------------------------------------

Although the main use of senpy is to publish services, the tool can also be used locally to analyze text in the command line.
This is a short video demonstration:

.. image:: https://asciinema.org/a/9uwef1ghkjk062cw2t4mhzpyk.png
   :width: 100%
   :target: https://asciinema.org/a/9uwef1ghkjk062cw2t4mhzpyk
   :alt: CLI demo

redpajama_set_name: RedPajamaGithub


text:
export default {
  name : 'usersList',
  config : {
    bindings         : {  users: '<', selected : '<', showDetails : '&onSelected' },
    templateUrl      : 'src/users/components/list/UsersList.html'
  }
};


text:
<?php

namespace Google\Service\Connectors;

class UserPassword extends \Google\Model
{
  protected $passwordType = Secret::class;
  protected $passwordDataType = '';
  /**
   * @var string
   */
  public $username;

  /**
   * @param Secret
   */
  public function setPassword(Secret $password)
  {
    $this->password = $password;
  }
  /**
   * @return Secret
   */
  public function getPassword()
  {
    return $this->password;
  }
  /**
   * @param string
   */
  public function setUsername($username)
  {
    $this->username = $username;
  }
  /**
   * @return string
   */
  public function getUsername()
  {
    return $this->username;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(UserPassword::class, 'Google_Service_Connectors_UserPassword');


text:
package app.api.base;

import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

import javax.servlet.http.HttpServletRequest;

import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.web.servlet.LocaleResolver;

import app.infra.cripto.CriptografyProvider;

public abstract class BaseController {

    @Autowired
    private MessageSource messageSource;

    @Autowired
    private LocaleResolver localeResolver;

    @Autowired
    private HttpServletRequest request;

    @Autowired
    private CriptografyProvider criptografyProvider;

    @Autowired
    private Mapper mapper;

    protected void fill(Object source, Object destination) {
        mapper.map(source, destination);
    }

    protected void fill(Object source, Object destination, String mapId) {
        mapper.map(source, destination, mapId);
    }

    protected <D> D convert(Object source, Class<D> clazz) {
        D result = null;
        if (source != null) {
            result = mapper.map(source, clazz);
        }
        return result;
    }

    protected <D> D convert(Object source, Class<D> clazz, String mapId) {
        D result = null;
        if (source != null) {
            result = mapper.map(source, clazz, mapId);
        }
        return result;
    }

    protected <D> List<D> convertList(List<?> source, Class<D> clazz) {
        return source.stream().map(s -> convert(s, clazz)).collect(Collectors.toList());
    }

    protected <D> List<D> convertList(List<?> source, Class<D> clazz, String mapId) {
        return source.stream().map(s -> convert(s, clazz, mapId)).collect(Collectors.toList());
    }

    protected String decryptId(String value) {
        return criptografyProvider.decrypt(value);
    }

    protected String encryptId(Long value) {
        return criptografyProvider.encrypt(String.valueOf(value));
    }

    protected Locale getLocale() {
        return localeResolver.resolveLocale(request);
    }

    protected String getMessage(String key, Object... args) {
        return messageSource.getMessage(key, args, getLocale());
    }

}


text:
/**
 */
package CIM.IEC61970.Informative.InfERPSupport.impl;

import CIM.IEC61968.Common.Status;

import CIM.IEC61970.Core.impl.IdentifiedObjectImpl;

import CIM.IEC61970.Informative.InfAssetModels.AssetModelCatalogueItem;
import CIM.IEC61970.Informative.InfAssetModels.InfAssetModelsPackage;

import CIM.IEC61970.Informative.InfERPSupport.ErpInvoiceLineItem;
import CIM.IEC61970.Informative.InfERPSupport.ErpQuote;
import CIM.IEC61970.Informative.InfERPSupport.ErpQuoteLineItem;
import CIM.IEC61970.Informative.InfERPSupport.ErpReqLineItem;
import CIM.IEC61970.Informative.InfERPSupport.InfERPSupportPackage;

import CIM.IEC61970.Informative.InfWork.Design;
import CIM.IEC61970.Informative.InfWork.InfWorkPackage;
import CIM.IEC61970.Informative.InfWork.Request;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 *
 * An implementation of the model object 'Erp Quote Line Item'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getStatus Status}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getRequest Request}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getDesign Design}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getErpInvoiceLineItem Erp Invoice Line Item}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getErpReqLineItem Erp Req Line Item}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getErpQuote Erp Quote}

 *
{@link CIM.IEC61970.Informative.InfERPSupport.impl.ErpQuoteLineItemImpl#getAssetModelCatalogueItem Asset Model Catalogue Item}

 *

 *
 * @generated
 */
public class ErpQuoteLineItemImpl extends IdentifiedObjectImpl implements ErpQuoteLineItem {
	/**
	 * The cached value of the '{@link #getStatus() Status}' reference.
	 *
	 *
	 * @see #getStatus()
	 * @generated
	 * @ordered
	 */
	protected Status status;

	/**
	 * The cached value of the '{@link #getRequest() Request}' reference.
	 *
	 *
	 * @see #getRequest()
	 * @generated
	 * @ordered
	 */
	protected Request request;

	/**
	 * The cached value of the '{@link #getDesign() Design}' reference.
	 *
	 *
	 * @see #getDesign()
	 * @generated
	 * @ordered
	 */
	protected Design design;

	/**
	 * The cached value of the '{@link #getErpInvoiceLineItem() Erp Invoice Line Item}' reference.
	 *
	 *
	 * @see #getErpInvoiceLineItem()
	 * @generated
	 * @ordered
	 */
	protected ErpInvoiceLineItem erpInvoiceLineItem;

	/**
	 * The cached value of the '{@link #getErpReqLineItem() Erp Req Line Item}' reference.
	 *
	 *
	 * @see #getErpReqLineItem()
	 * @generated
	 * @ordered
	 */
	protected ErpReqLineItem erpReqLineItem;

	/**
	 * The cached value of the '{@link #getErpQuote() Erp Quote}' reference.
	 *
	 *
	 * @see #getErpQuote()
	 * @generated
	 * @ordered
	 */
	protected ErpQuote erpQuote;

	/**
	 * The cached value of the '{@link #getAssetModelCatalogueItem() Asset Model Catalogue Item}' reference.
	 *
	 *
	 * @see #getAssetModelCatalogueItem()
	 * @generated
	 * @ordered
	 */
	protected AssetModelCatalogueItem assetModelCatalogueItem;

	/**
	 *
	 *
	 * @generated
	 */
	protected ErpQuoteLineItemImpl() {
		super();
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return InfERPSupportPackage.Literals.ERP_QUOTE_LINE_ITEM;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Status getStatus() {
		if (status != null && status.eIsProxy()) {
			InternalEObject oldStatus = (InternalEObject)status;
			status = (Status)eResolveProxy(oldStatus);
			if (status != oldStatus) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS, oldStatus, status));
			}
		}
		return status;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Status basicGetStatus() {
		return status;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setStatus(Status newStatus) {
		Status oldStatus = status;
		status = newStatus;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS, oldStatus, status));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Request getRequest() {
		if (request != null && request.eIsProxy()) {
			InternalEObject oldRequest = (InternalEObject)request;
			request = (Request)eResolveProxy(oldRequest);
			if (request != oldRequest) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST, oldRequest, request));
			}
		}
		return request;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Request basicGetRequest() {
		return request;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetRequest(Request newRequest, NotificationChain msgs) {
		Request oldRequest = request;
		request = newRequest;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST, oldRequest, newRequest);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setRequest(Request newRequest) {
		if (newRequest != request) {
			NotificationChain msgs = null;
			if (request != null)
				msgs = ((InternalEObject)request).eInverseRemove(this, InfWorkPackage.REQUEST__ERP_QUOTE_LINE_ITEM, Request.class, msgs);
			if (newRequest != null)
				msgs = ((InternalEObject)newRequest).eInverseAdd(this, InfWorkPackage.REQUEST__ERP_QUOTE_LINE_ITEM, Request.class, msgs);
			msgs = basicSetRequest(newRequest, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST, newRequest, newRequest));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Design getDesign() {
		if (design != null && design.eIsProxy()) {
			InternalEObject oldDesign = (InternalEObject)design;
			design = (Design)eResolveProxy(oldDesign);
			if (design != oldDesign) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, oldDesign, design));
			}
		}
		return design;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public Design basicGetDesign() {
		return design;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetDesign(Design newDesign, NotificationChain msgs) {
		Design oldDesign = design;
		design = newDesign;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, oldDesign, newDesign);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setDesign(Design newDesign) {
		if (newDesign != design) {
			NotificationChain msgs = null;
			if (design != null)
				msgs = ((InternalEObject)design).eInverseRemove(this, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, Design.class, msgs);
			if (newDesign != null)
				msgs = ((InternalEObject)newDesign).eInverseAdd(this, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, Design.class, msgs);
			msgs = basicSetDesign(newDesign, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, newDesign, newDesign));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpInvoiceLineItem getErpInvoiceLineItem() {
		if (erpInvoiceLineItem != null && erpInvoiceLineItem.eIsProxy()) {
			InternalEObject oldErpInvoiceLineItem = (InternalEObject)erpInvoiceLineItem;
			erpInvoiceLineItem = (ErpInvoiceLineItem)eResolveProxy(oldErpInvoiceLineItem);
			if (erpInvoiceLineItem != oldErpInvoiceLineItem) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM, oldErpInvoiceLineItem, erpInvoiceLineItem));
			}
		}
		return erpInvoiceLineItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpInvoiceLineItem basicGetErpInvoiceLineItem() {
		return erpInvoiceLineItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetErpInvoiceLineItem(ErpInvoiceLineItem newErpInvoiceLineItem, NotificationChain msgs) {
		ErpInvoiceLineItem oldErpInvoiceLineItem = erpInvoiceLineItem;
		erpInvoiceLineItem = newErpInvoiceLineItem;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM, oldErpInvoiceLineItem, newErpInvoiceLineItem);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setErpInvoiceLineItem(ErpInvoiceLineItem newErpInvoiceLineItem) {
		if (newErpInvoiceLineItem != erpInvoiceLineItem) {
			NotificationChain msgs = null;
			if (erpInvoiceLineItem != null)
				msgs = ((InternalEObject)erpInvoiceLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_INVOICE_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpInvoiceLineItem.class, msgs);
			if (newErpInvoiceLineItem != null)
				msgs = ((InternalEObject)newErpInvoiceLineItem).eInverseAdd(this, InfERPSupportPackage.ERP_INVOICE_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpInvoiceLineItem.class, msgs);
			msgs = basicSetErpInvoiceLineItem(newErpInvoiceLineItem, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM, newErpInvoiceLineItem, newErpInvoiceLineItem));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpReqLineItem getErpReqLineItem() {
		if (erpReqLineItem != null && erpReqLineItem.eIsProxy()) {
			InternalEObject oldErpReqLineItem = (InternalEObject)erpReqLineItem;
			erpReqLineItem = (ErpReqLineItem)eResolveProxy(oldErpReqLineItem);
			if (erpReqLineItem != oldErpReqLineItem) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM, oldErpReqLineItem, erpReqLineItem));
			}
		}
		return erpReqLineItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpReqLineItem basicGetErpReqLineItem() {
		return erpReqLineItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetErpReqLineItem(ErpReqLineItem newErpReqLineItem, NotificationChain msgs) {
		ErpReqLineItem oldErpReqLineItem = erpReqLineItem;
		erpReqLineItem = newErpReqLineItem;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM, oldErpReqLineItem, newErpReqLineItem);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setErpReqLineItem(ErpReqLineItem newErpReqLineItem) {
		if (newErpReqLineItem != erpReqLineItem) {
			NotificationChain msgs = null;
			if (erpReqLineItem != null)
				msgs = ((InternalEObject)erpReqLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_REQ_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpReqLineItem.class, msgs);
			if (newErpReqLineItem != null)
				msgs = ((InternalEObject)newErpReqLineItem).eInverseAdd(this, InfERPSupportPackage.ERP_REQ_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpReqLineItem.class, msgs);
			msgs = basicSetErpReqLineItem(newErpReqLineItem, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM, newErpReqLineItem, newErpReqLineItem));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpQuote getErpQuote() {
		if (erpQuote != null && erpQuote.eIsProxy()) {
			InternalEObject oldErpQuote = (InternalEObject)erpQuote;
			erpQuote = (ErpQuote)eResolveProxy(oldErpQuote);
			if (erpQuote != oldErpQuote) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE, oldErpQuote, erpQuote));
			}
		}
		return erpQuote;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public ErpQuote basicGetErpQuote() {
		return erpQuote;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetErpQuote(ErpQuote newErpQuote, NotificationChain msgs) {
		ErpQuote oldErpQuote = erpQuote;
		erpQuote = newErpQuote;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE, oldErpQuote, newErpQuote);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setErpQuote(ErpQuote newErpQuote) {
		if (newErpQuote != erpQuote) {
			NotificationChain msgs = null;
			if (erpQuote != null)
				msgs = ((InternalEObject)erpQuote).eInverseRemove(this, InfERPSupportPackage.ERP_QUOTE__ERP_QUOTE_LINE_ITEMS, ErpQuote.class, msgs);
			if (newErpQuote != null)
				msgs = ((InternalEObject)newErpQuote).eInverseAdd(this, InfERPSupportPackage.ERP_QUOTE__ERP_QUOTE_LINE_ITEMS, ErpQuote.class, msgs);
			msgs = basicSetErpQuote(newErpQuote, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE, newErpQuote, newErpQuote));
	}

	/**
	 *
	 *
	 * @generated
	 */
	public AssetModelCatalogueItem getAssetModelCatalogueItem() {
		if (assetModelCatalogueItem != null && assetModelCatalogueItem.eIsProxy()) {
			InternalEObject oldAssetModelCatalogueItem = (InternalEObject)assetModelCatalogueItem;
			assetModelCatalogueItem = (AssetModelCatalogueItem)eResolveProxy(oldAssetModelCatalogueItem);
			if (assetModelCatalogueItem != oldAssetModelCatalogueItem) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM, oldAssetModelCatalogueItem, assetModelCatalogueItem));
			}
		}
		return assetModelCatalogueItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public AssetModelCatalogueItem basicGetAssetModelCatalogueItem() {
		return assetModelCatalogueItem;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public NotificationChain basicSetAssetModelCatalogueItem(AssetModelCatalogueItem newAssetModelCatalogueItem, NotificationChain msgs) {
		AssetModelCatalogueItem oldAssetModelCatalogueItem = assetModelCatalogueItem;
		assetModelCatalogueItem = newAssetModelCatalogueItem;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM, oldAssetModelCatalogueItem, newAssetModelCatalogueItem);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 *
	 *
	 * @generated
	 */
	public void setAssetModelCatalogueItem(AssetModelCatalogueItem newAssetModelCatalogueItem) {
		if (newAssetModelCatalogueItem != assetModelCatalogueItem) {
			NotificationChain msgs = null;
			if (assetModelCatalogueItem != null)
				msgs = ((InternalEObject)assetModelCatalogueItem).eInverseRemove(this, InfAssetModelsPackage.ASSET_MODEL_CATALOGUE_ITEM__ERP_QUOTE_LINE_ITEMS, AssetModelCatalogueItem.class, msgs);
			if (newAssetModelCatalogueItem != null)
				msgs = ((InternalEObject)newAssetModelCatalogueItem).eInverseAdd(this, InfAssetModelsPackage.ASSET_MODEL_CATALOGUE_ITEM__ERP_QUOTE_LINE_ITEMS, AssetModelCatalogueItem.class, msgs);
			msgs = basicSetAssetModelCatalogueItem(newAssetModelCatalogueItem, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM, newAssetModelCatalogueItem, newAssetModelCatalogueItem));
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				if (request != null)
					msgs = ((InternalEObject)request).eInverseRemove(this, InfWorkPackage.REQUEST__ERP_QUOTE_LINE_ITEM, Request.class, msgs);
				return basicSetRequest((Request)otherEnd, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				if (design != null)
					msgs = ((InternalEObject)design).eInverseRemove(this, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, Design.class, msgs);
				return basicSetDesign((Design)otherEnd, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				if (erpInvoiceLineItem != null)
					msgs = ((InternalEObject)erpInvoiceLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_INVOICE_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpInvoiceLineItem.class, msgs);
				return basicSetErpInvoiceLineItem((ErpInvoiceLineItem)otherEnd, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				if (erpReqLineItem != null)
					msgs = ((InternalEObject)erpReqLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_REQ_LINE_ITEM__ERP_QUOTE_LINE_ITEM, ErpReqLineItem.class, msgs);
				return basicSetErpReqLineItem((ErpReqLineItem)otherEnd, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				if (erpQuote != null)
					msgs = ((InternalEObject)erpQuote).eInverseRemove(this, InfERPSupportPackage.ERP_QUOTE__ERP_QUOTE_LINE_ITEMS, ErpQuote.class, msgs);
				return basicSetErpQuote((ErpQuote)otherEnd, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				if (assetModelCatalogueItem != null)
					msgs = ((InternalEObject)assetModelCatalogueItem).eInverseRemove(this, InfAssetModelsPackage.ASSET_MODEL_CATALOGUE_ITEM__ERP_QUOTE_LINE_ITEMS, AssetModelCatalogueItem.class, msgs);
				return basicSetAssetModelCatalogueItem((AssetModelCatalogueItem)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				return basicSetRequest(null, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				return basicSetDesign(null, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				return basicSetErpInvoiceLineItem(null, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				return basicSetErpReqLineItem(null, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				return basicSetErpQuote(null, msgs);
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				return basicSetAssetModelCatalogueItem(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS:
				if (resolve) return getStatus();
				return basicGetStatus();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				if (resolve) return getRequest();
				return basicGetRequest();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				if (resolve) return getDesign();
				return basicGetDesign();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				if (resolve) return getErpInvoiceLineItem();
				return basicGetErpInvoiceLineItem();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				if (resolve) return getErpReqLineItem();
				return basicGetErpReqLineItem();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				if (resolve) return getErpQuote();
				return basicGetErpQuote();
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				if (resolve) return getAssetModelCatalogueItem();
				return basicGetAssetModelCatalogueItem();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS:
				setStatus((Status)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				setRequest((Request)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				setDesign((Design)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				setErpInvoiceLineItem((ErpInvoiceLineItem)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				setErpReqLineItem((ErpReqLineItem)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				setErpQuote((ErpQuote)newValue);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				setAssetModelCatalogueItem((AssetModelCatalogueItem)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS:
				setStatus((Status)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				setRequest((Request)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				setDesign((Design)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				setErpInvoiceLineItem((ErpInvoiceLineItem)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				setErpReqLineItem((ErpReqLineItem)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				setErpQuote((ErpQuote)null);
				return;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				setAssetModelCatalogueItem((AssetModelCatalogueItem)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 *
	 *
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__STATUS:
				return status != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__REQUEST:
				return request != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN:
				return design != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_INVOICE_LINE_ITEM:
				return erpInvoiceLineItem != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_REQ_LINE_ITEM:
				return erpReqLineItem != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ERP_QUOTE:
				return erpQuote != null;
			case InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__ASSET_MODEL_CATALOGUE_ITEM:
				return assetModelCatalogueItem != null;
		}
		return super.eIsSet(featureID);
	}

} //ErpQuoteLineItemImpl


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.androidpublisher.model;

/**
 * An Android app review.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Google Play Android Developer API. For a detailed
 * explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class Review extends com.google.api.client.json.GenericJson {

  /**
   * The name of the user who wrote the review.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String authorName;

  /**
   * A repeated field containing comments for the review.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<Comment> comments;

  static {
    // hack to force ProGuard to consider Comment used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(Comment.class);
  }

  /**
   * Unique identifier for this review.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String reviewId;

  /**
   * The name of the user who wrote the review.
   * @return value or {@code null} for none
   */
  public java.lang.String getAuthorName() {
    return authorName;
  }

  /**
   * The name of the user who wrote the review.
   * @param authorName authorName or {@code null} for none
   */
  public Review setAuthorName(java.lang.String authorName) {
    this.authorName = authorName;
    return this;
  }

  /**
   * A repeated field containing comments for the review.
   * @return value or {@code null} for none
   */
  public java.util.List<Comment> getComments() {
    return comments;
  }

  /**
   * A repeated field containing comments for the review.
   * @param comments comments or {@code null} for none
   */
  public Review setComments(java.util.List<Comment> comments) {
    this.comments = comments;
    return this;
  }

  /**
   * Unique identifier for this review.
   * @return value or {@code null} for none
   */
  public java.lang.String getReviewId() {
    return reviewId;
  }

  /**
   * Unique identifier for this review.
   * @param reviewId reviewId or {@code null} for none
   */
  public Review setReviewId(java.lang.String reviewId) {
    this.reviewId = reviewId;
    return this;
  }

  @Override
  public Review set(String fieldName, Object value) {
    return (Review) super.set(fieldName, value);
  }

  @Override
  public Review clone() {
    return (Review) super.clone();
  }

}


text: <tl-calendar [date]="date" (selectDay)="selectDay($event)" (today)="selectDay($event)"></tl-calendar>


text:
package com.datatorrent.bufferserver.packet;

import com.datatorrent.netlet.util.Slice;

/**
 *
PayloadTuple class.

 *
 * @since 0.3.2
 */
public class PayloadTuple extends Tuple
{
  public PayloadTuple(byte[] array, int offset, int length)
  {
    super(array, offset, length);
  }

  @Override
  public MessageType getType()
  {
    return MessageType.PAYLOAD;
  }

  @Override
  public int getPartition()
  {
    int p = buffer[offset + 1];
    p |= buffer[offset + 2] << 8;
    p |= buffer[offset + 3] << 16;
    p |= buffer[offset + 4] << 24;
    return p;
  }

  @Override
  public int getWindowId()
  {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  }

  @Override
  public Slice getData()
  {
    return new Slice(buffer, offset + 5, length - 5);
  }

  @Override
  public String toString()
  {
    return "PayloadTuple{" + getPartition() + ", " + getData() + '}';
  }

  @Override
  public int getBaseSeconds()
  {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  }

  @Override
  public int getWindowWidth()
  {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  }

  public static byte[] getSerializedTuple(int partition, int size)
  {
    byte[] array = new byte[size + 5];
    array[0] = MessageType.PAYLOAD_VALUE;
    array[1] = (byte)partition;
    array[2] = (byte)(partition >> 8);
    array[3] = (byte)(partition >> 16);
    array[4] = (byte)(partition >> 24);
    return array;
  }

  public static byte[] getSerializedTuple(int partition, Slice f)
  {
    byte[] array = new byte[5 + f.length];
    array[0] = MessageType.PAYLOAD_VALUE;
    array[1] = (byte)partition;
    array[2] = (byte)(partition >> 8);
    array[3] = (byte)(partition >> 16);
    array[4] = (byte)(partition >> 24);
    System.arraycopy(f.buffer, f.offset, array, 5, f.length);
    return array;
  }

}


text:
'use strict';

var _ = require('lodash');
var Promise = require('bluebird');
var elasticsearch = require('elasticsearch');
var exposeClient = require('./expose_client');
var migrateConfig = require('./migrate_config');
var createKibanaIndex = require('./create_kibana_index');
var checkEsVersion = require('./check_es_version');
var NoConnections = elasticsearch.errors.NoConnections;
var util = require('util');
var format = util.format;

module.exports = function (plugin, server) {
  var config = server.config();
  var client = server.plugins.elasticsearch.client;

  plugin.status.yellow('Waiting for Elasticsearch');

  function waitForPong() {
    return client.ping({ requestTimeout: 1500 })['catch'](function (err) {
      if (!(err instanceof NoConnections)) throw err;

      plugin.status.red(format('Unable to connect to Elasticsearch at %s. Retrying in 2.5 seconds.', config.get('elasticsearch.url')));

      return Promise.delay(2500).then(waitForPong);
    });
  }

  function waitForShards() {
    return client.cluster.health({
      timeout: '5s', // tells es to not sit around and wait forever
      index: config.get('kibana.index'),
      ignore: [408]
    }).then(function (resp) {
      // if "timed_out" === true then elasticsearch could not
      // find any idices matching our filter within 5 seconds
      if (!resp || resp.timed_out) {
        plugin.status.yellow('No existing Kibana index found');
        return createKibanaIndex(server);
      }

      // If status === "red" that means that index(es) were found
      // but the shards are not ready for queries
      if (resp.status === 'red') {
        plugin.status.red('Elasticsearch is still initializing the kibana index... Trying again in 2.5 second.');
        return Promise.delay(2500).then(waitForShards);
      }

      // otherwise we are g2g
      plugin.status.green('Kibana index ready');
    });
  }

  function check() {
    return waitForPong().then(_.partial(checkEsVersion, server)).then(waitForShards).then(_.partial(migrateConfig, server))['catch'](function (err) {
      return plugin.status.red(err);
    });
  }

  var timeoutId = null;

  function scheduleCheck(ms) {
    if (timeoutId) return;

    var myId = setTimeout(function () {
      check()['finally'](function () {
        if (timeoutId === myId) startorRestartChecking();
      });
    }, ms);

    timeoutId = myId;
  }

  function startorRestartChecking() {
    scheduleCheck(stopChecking() ? 2500 : 1);
  }

  function stopChecking() {
    if (!timeoutId) return false;
    clearTimeout(timeoutId);
    timeoutId = null;
    return true;
  }

  return {
    run: check,
    start: startorRestartChecking,
    stop: stopChecking,
    isRunning: function isRunning() {
      return !!timeoutId;
    }
  };
};


text:
const data = require('./form-data');

module.exports = {
    data
};


text:
import * as React from "react";
import { Component } from "react";

import { isMobile } from '../../../config'
import {
  FileButton,
  textAreaStyle,
  lightboxStyle,
  textTitleInputStyle,
  modalStyle,
  Modal
} from 'energetic-ui'
class AttributeEditor extends Component<any, any> {

  componentWillMount () {

    this.setState({
      activated: false,
      text: "",
      name: "",
      data: {},
      refreshing: false,
      validSyntax: true
    })

    if ( !this.props.editLoadedItemActivated )
      this.useTemplate("geometry.0")
  }

  componentWillReceiveProps(nextProps: any) {
    if ( nextProps.source == nextProps.editSource ) {
      if (this.props.itemId != nextProps.itemId || this.props.category != nextProps.category) {
        this.loadPropertyData(this.props, nextProps)
      }

      if (this.props.activated == false && nextProps.activated == true)
        this.setState({
          activated: true
        });

      let loadEditItemActiveChanged = this.props.editLoadedItemActivated == false && nextProps.editLoadedItemActivated,
        itemIndexChanged = this.props.loadedItemIndex != nextProps.loadedItemIndex,
        itemIdChanged = this.props.itemId != nextProps.itemId

      if (loadEditItemActiveChanged || itemIndexChanged || itemIdChanged) {

        this.loadPropertyData(this.props, nextProps)

        this.setState({
          index: nextProps.loadedItemIndex
        })

      }
    }
  }

  loadPropertyData ( props: any, nextProps: any ) {
    console.info("attributeEditor edit load property data: editSource, editData, ", nextProps.editSource, nextProps.loadedItemData)
    if ( nextProps.editSource == "componentEdit" ) { // load from component in inventory
      if ( nextProps.loadedItemData ) {
        this.setState( nextProps.loadedItemData )
        this.setText( nextProps.loadedItemData.name, nextProps.loadedItemData.data, false )
      } else {
          console.warn("missing property action data")
          this.setState({activated: false})
      }
    } else { // load from inventory
      let inventoryData;

      if (nextProps.itemIndex || nextProps.itemId) {
        inventoryData = nextProps.properties[ nextProps.itemIndex || nextProps.itemId ]
      }

      if ( inventoryData ) {
        this.setState( inventoryData )
        this.setText( inventoryData.name, inventoryData.data, false )
      } else {
        console.warn("missing property inventory data")
        this.setState({activated: false})
      }
    }
  }

  componentWillUpdate ( nextProps: any, nextState: any ) {
  }

  useTemplate( name: string ) {
    let template: any = "",
        propName: string = ""

    template = this.props.convolvrAttrs.find( (prop: any) => { return prop.name == name} )
    propName = name.split(".")[0]
    this.setText( propName, template.data, true )
  }

  setText ( propName: string, data: Object, addName: boolean ) {
    this.setState({
      name: propName,
      text: JSON.stringify( addName ? { [propName]: data } : data, null, "\t"),
      refreshing: true
    }, ()=>{
      this.setState({
        refreshing: false
      })
    })
  }

  handleTextChange(e: any) {
    this.setState({
      name: e.target.value
    });
  }

  handleTextArea(e: any) {
    this.setState({
      text: e.target.value
    });
  }

    save () {
        let name: string = this.state.name,
            newId: number = typeof this.props.properties == 'object' ? this.props.properties.length : 0

        if ( name == "" ) {
            alert("Name is required.")
            return
        }

        if (this.validate() != null) {
          alert("Property must be valid JSON.")
          return
        }

        if ( this.props.onSave ) {
          this.props.onSave( { name, data: JSON.parse(this.state.text) } )
        } else if (this.state.activated) {
          if ( this.state.id != -1)
            newId = this.state.id

          this.props.addInventoryItem( this.props.username, "Properties", { id: newId, name, data: JSON.parse(this.state.text) } )
        }
        this.toggleModal()
    }

    validate(text?: string) {
        let valid: boolean = null,
            output: Object = {}

        try {
          output = JSON.parse(text || this.state.text)
        } catch (e) {
          console.warn("invalid json ", e)
          return true
        }

        return valid
    }

  toggleModal (open?: boolean) {
    if (this.state.activated || open === false) {
      this.props.closeAttributeEditor()
    }
    this.setState({
      activated: open === undefined ? !this.state.activated : open
    })
  }

  render() {
    return (
      <Modal title={this.props.title || "New Attribute Preset"} open={this.state.activated} onToggle={ (open: boolean) => { this.toggleModal(open)}}>

               Attribute Edit
                { !this.state.refreshing ?
                  <input type="text" defaultValue={ this.state.name }  style={ styles.text }
                         onChange={ (e) => { this.handleTextChange(e) }}
                  />
                  : ""
                }
                <select onChange={ e=> { this.useTemplate( e.target.value ) } } >
                  {
                    this.props.convolvrAttrs.map( (prop: any, p: number) => {
                      let propName = `${prop.name}`
                      return (
                        <option key={p} value={propName}>{propName}</option>
                      )
                    })
                  }
                </select>

             { !this.state.refreshing ? (
                <textarea defaultValue={ this.state.text }
                  style={ styles.textArea( this.state.validSyntax, isMobile() ) }
                  onBlur={ e=> this.handleTextArea(e) }
                  onKeyUp={ (e) => { this.setState({validSyntax: !this.validate((e.target as any).value)})} }
                />
              ) : ""}
              <FileButton title="Save" onClick={ () => { this.save() } } />
              <FileButton title="Cancel" onClick={ () => { this.toggleModal() } } style={ styles.cancelButton } />

        </Modal>
      )
  }
}

import { connect } from 'react-redux'
import {
  readText,
  writeText
} from '../../redux/actions/file-actions'
import {
    getInventory,
    addInventoryItem,
    updateInventoryItem
} from '../../redux/actions/inventory-actions'
import {
    closeAttributeEditor,
    launchEditLoadedItem
} from '../../redux/actions/util-actions'

export default connect(
  (state: any, ownProps: any) => {
    return {
        section: state.app.navigateToUrl.pathname,
        menuOpen: state.app.menuOpen,
        username: state.users.loggedIn ? state.users.loggedIn.name : "public",
        activated: state.util.attributeEdit.activated,
        itemId: state.util.attributeEdit.itemId,
        properties: state.inventory.items.properties,
        editLoadedItemActivated: state.util.loadedItemEdit.activated.property && state.util.loadedItemEdit.category == "Properties",
        loadedItemIndex: state.util.loadedItemEdit.index,
        loadedItemData: state.util.loadedItemEdit.data.property,
        instances: state.util.attributeEdit.windowsOpen,
        editSource: state.util.loadedItemEdit.source.property,
        category: state.util.loadedItemEdit.category
    }
  },
  (dispatch: any) => {
    return {
      editLoadedItem: ( source: string, username: string, category: string, index: number, data: any ) => {
        dispatch(launchEditLoadedItem( source, username, category, index, data ))
      },
      getInventory: (userId: any, category: string) => {
        dispatch(getInventory(userId, category))
      },
      addInventoryItem: (userId: any, category: string, data: any) => {
        dispatch(addInventoryItem(userId, category, data))
      },
      updateInventoryItem: (userId: any, category: string, data: any) => {
        dispatch(updateInventoryItem(userId, category, data))
      },
      closeAttributeEditor: () => {
        dispatch( closeAttributeEditor() )
      }
    }
  }
)(AttributeEditor)

let styles = {
  modal: () => {
    return Object.assign({}, modalStyle(isMobile()), {
        maxWidth: '960px',
        height: '84%',
        left: ! isMobile() ? '72px' : '0px'
      })
  },
  lightbox: lightboxStyle,
  resultingPath: {
      marginBottom: '1em'
  },
  cancelButton: {
      borderLeft: 'solid 0.2em #005aff'
  },
  header: {
      width: '100%',
      marginTop: '0.5em',
      marginBotto: '0.5em'
  },
  text: textTitleInputStyle,
  textArea: (validSyntax = true, isMobile: boolean) => {
    const areaStyle = textAreaStyle(isMobile);

    return validSyntax ? areaStyle : {
      ...areaStyle,
      background: 'rgba(255, 0, 0, 0.16) none'
    }
  },
  body: {
  },
  title: {

  }
}


text:
AliAnalysisGrid* CreateAlienHandler(const char* uniqueName, const char* gridDir, const char* gridMode, const char* runNumbers,
                                     const char* pattern, TString additionalCode, TString additionalHeaders, Int_t maxFilesPerWorker,
                                     Int_t workerTTL, Bool_t isMC);

//______________________________________________________________________________
void runEMCalAnalysis(
         Bool_t         useGrid             = kFALSE,                      // local or grid
         const char*    gridMode            = "test",                      // set the grid run mode (can be "full", "test", "offline", "submit" or "terminate")
         const char*    dataType            = "ESD",                       // set the analysis type, AOD, ESD or sESD
         const char*    pattern             = "*ESDs/pass2/AOD145/*AOD.root",    // file pattern (here one can specify subdirs like passX etc.) (used on grid)
         const char*    gridDir             = "/alice/data/2011/LHC11h_2",   // dir on alien, where the files live (used on grid)
         const char*    runNumbers          = "167903 167915",             // considered run numbers (used on grid)
         UInt_t         numLocalFiles       = 100,                          // number of files analyzed locally
         const char*    runPeriod           = "LHC11h",                    // set the run period (used on grid)
         const char*    uniqueName          = "EMCal_LEGOTrainTest",     // sets base string for the name of the task on the grid
         UInt_t         pSel                = AliVEvent::kAny,             // used event selection for every task except for the analysis tasks
         Bool_t         useTender           = kTRUE,                       // trigger, if tender, track and cluster selection should be used (always)
         Bool_t         isMC                = kFALSE,                      // trigger, if MC handler should be used
         // Here you have to specify additional code files you want to use but that are not in aliroot
         const char*    addCXXs             = "AliAnalysisTaskPJ.cxx",
         const char*    addHs               = "AliAnalysisTaskPJ.h",

         // These two settings depend on the dataset and your quotas on the AliEN services
         Int_t          maxFilesPerWorker   = 4,
         Int_t          workerTTL           = 7200

         )
{

  // Some pre-settings and constants
  enum AlgoType {kKT, kANTIKT};
  enum JetType  {kFULLJETS, kCHARGEDJETS, kNEUTRALJETS};
  gSystem->SetFPEMask();
  gSystem->Setenv("ETRAIN_ROOT", ".");
  gSystem->Setenv("ETRAIN_PERIOD", runPeriod);
  // change this objects to strings
  TString usedData(dataType);
  TString additionalCXXs(addCXXs);
  TString additionalHs(addHs);
  cout << dataType << " analysis chosen" << endl;
  if (useGrid)
  {
    cout << "-- using AliEn grid.\n";
    if (usedData == "sESD")
    {
      cout << "Skimmed ESD analysis not available on the grid!" << endl;
      return;
    }
  }
  else
    cout << "-- using local analysis.\n";

  // Load necessary libraries
  LoadLibs();

  // Create analysis manager
  AliAnalysisManager* mgr = new AliAnalysisManager("testAnalysis");

  // Check type of input and create handler for it
  TString localFiles("-1");
  if(usedData == "AOD")
  {
    localFiles = "files_aod.txt";
    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddAODHandler.C");
    AliAODInputHandler* aodH = AddAODHandler();
  }
  else if((usedData == "ESD") || (usedData == "sESD"))
  {
    if (usedData == "ESD")
      localFiles = "run_152367NoB.txt";
    else
      localFiles = "files_sesd.txt";

    gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/train/AddESDHandler.C");
    AliESDInputHandler* esdH = AddESDHandler();
  }
  else
  {
    cout << "Data type not recognized! You have to specify ESD, AOD, or sESD!\n";
  }

  if(!useGrid)
    cout << "Using " << localFiles.Data() << " as input file list.\n";

  // Create MC handler, if MC is demanded
  if (isMC && (usedData != "AOD"))
  {
    AliMCEventHandler* mcH = new AliMCEventHandler();
    mcH->SetPreReadMode(AliMCEventHandler::kLmPreRead);
    mcH->SetReadTR(kTRUE);
    mgr->SetMCtruthEventHandler(mcH);
  }

  // ################# Now: Add some basic tasks

  // Physics selection task
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
  AliPhysicsSelectionTask *physSelTask = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE, pSel, 5, 5, 10, kTRUE, -1, -1, -1, -1);

  if (!physSelTask)
  {
    cout << "no physSelTask";
    return;
  }

  // Centrality task
  if (usedData == "ESD") {
    gROOT->LoadMacro("$ALICE_PHYSICS/OADB/macros/AddTaskCentrality.C");
    AliCentralitySelectionTask *centralityTask = AddTaskCentrality(kTRUE);
  }

  // Compatibility task, only needed for skimmed ESD
  if (usedData == "sESD") {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalCompat.C");
    AliEmcalCompatTask *comptask = AddTaskEmcalCompat();
  }

  // Setup task
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
  AliEmcalSetupTask *setupTask = AddTaskEmcalSetup("$ALICE_PHYSICS/OADB/EMCAL","$ALICE_PHYSICS/OADB/EMCAL", "uselocal");
  setupTask->SetGeoPath("$ALICE_PHYSICS/OADB/EMCAL");

  // Tender Supplies
  if (useTender) {
    gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskEmcalPreparation.C");
    //adjust pass when running locally. On grid give empty string, will be picked up automatically from path to ESD/AOD file
    AliAnalysisTaskSE *clusm = AddTaskEmcalPreparation();
  }

  // Names of the different objects passed around; these are the default names; added here mostly for documentation purposes
  // rhoName is only set if the background subtraction is switched on (doBkg)
  TString tracksName = "AODFilterTracks";
  TString clustersName = "EmcCaloClusters";

  // ################# Now: Call jet preparation macro (picotracks, hadronic corrected caloclusters, ...)
  gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/AddTaskMatchingChain.C");
  AddTaskMatchingChain(runPeriod,pSel,
		       clustersName,1.,kTRUE,
		       0.1,kTRUE,kTRUE);

  // ################# Now: Add analysis task
  // Here you can put in your AddTaskMacro for your task
  gROOT->LoadMacro("run1.C");
  AliAnalysisTask* PJtask = run1();

  // Set the physics selection for all given tasks
  TObjArray *toptasks = mgr->GetTasks();
  for (Int_t i=0; i<toptasks->GetEntries(); ++i)
  {
    AliAnalysisTaskSE *task = dynamic_cast<AliAnalysisTaskSE*>(toptasks->At(i));
    if (!task)
      continue;
    if (task->InheritsFrom("AliPhysicsSelectionTask"))
      continue;
    ::Info("setPSel", "Set physics selection for %s (%s)", task->GetName(), task->ClassName());
    task->SelectCollisionCandidates(pSel);
  }

  mgr->SetUseProgressBar(1, 25);

  if (!mgr->InitAnalysis())
    return;
  mgr->PrintStatus();

  if (useGrid)
  {  // GRID CALCULATION

    AliAnalysisGrid *plugin = CreateAlienHandler(uniqueName, gridDir, gridMode, runNumbers, pattern, additionalCXXs, additionalHs, maxFilesPerWorker, workerTTL, isMC);
    mgr->SetGridHandler(plugin);

    // start analysis
    cout << "Starting GRID Analysis...";
    mgr->SetDebugLevel(0);
    mgr->StartAnalysis("grid",10);
  }
  else
  {  // LOCAL CALCULATION

    TChain* chain = 0;
    if (usedData == "AOD")
    {
      gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateAODChain.C");
      chain = CreateAODChain(localFiles.Data(), numLocalFiles);
    }
    else
    {  // ESD or skimmed ESD
      gROOT->LoadMacro("$ALICE_PHYSICS/PWG/EMCAL/macros/CreateESDChain.C");
      chain = CreateESDChain(localFiles.Data(), numLocalFiles);
    }

    // start analysis
    cout << "Starting LOCAL Analysis...";
    mgr->SetDebugLevel(2);
    mgr->StartAnalysis("local", chain);
  }
}

//______________________________________________________________________________
void LoadLibs()
{
  // Load common libraries (better too many than too few)
  gSystem->Load("libTree");
  gSystem->Load("libVMC");
  gSystem->Load("libGeom");
  gSystem->Load("libGui");
  gSystem->Load("libXMLParser");
  gSystem->Load("libMinuit");
  gSystem->Load("libMinuit2");
  gSystem->Load("libProof");
  gSystem->Load("libPhysics");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libOADB");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libCDB");
  gSystem->Load("libRAWDatabase");
  gSystem->Load("libSTEER");
  gSystem->Load("libEVGEN");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libCORRFW");
  gSystem->Load("libTOFbase");
  //gSystem->Load("libTOFrec");
  gSystem->Load("libRAWDatabase");
  gSystem->Load("libRAWDatarec");
  gSystem->Load("libTPCbase");
  gSystem->Load("libTPCrec");
  gSystem->Load("libITSbase");
  gSystem->Load("libITSrec");
  gSystem->Load("libTRDbase");
  gSystem->Load("libTender");
  gSystem->Load("libSTAT");
  gSystem->Load("libTRDrec");
  gSystem->Load("libHMPIDbase");
  gSystem->Load("libPWGPP");
  gSystem->Load("libPWGHFbase");
  gSystem->Load("libPWGDQdielectron");
  gSystem->Load("libPWGHFhfe");
  gSystem->Load("libEMCALUtils");
  gSystem->Load("libPHOSUtils");
  gSystem->Load("libPWGCaloTrackCorrBase");
  gSystem->Load("libEMCALraw");
  gSystem->Load("libEMCALbase");
  gSystem->Load("libEMCALrec");
  gSystem->Load("libTRDbase");
  gSystem->Load("libVZERObase");
  gSystem->Load("libVZEROrec");
  gSystem->Load("libTender");
  gSystem->Load("libTenderSupplies");
  gSystem->Load("libPWGTools");
  gSystem->Load("libPWGEMCAL");
  gSystem->Load("libESDfilter");
  gSystem->Load("libPWGGAEMCALTasks");
  gSystem->Load("libPWGCFCorrelationsBase");
  gSystem->Load("libPWGCFCorrelationsDPhi");

  // include paths
//gSystem->AddIncludePath("-Wno-deprecated");
  //gSystem->AddIncludePath("-I$ALICE_PHYSICS -I$ALICE_PHYSICS/include -I$ALICE_PHYSICS/EMCAL");
  //gSystem->AddIncludePath("-I$ALICE_PHYSICS/PWGDQ/dielectron -I$ALICE_PHYSICS/PWGHF/hfe");
}

AliAnalysisGrid* CreateAlienHandler(const char* uniqueName, const char* gridDir, const char* gridMode, const char* runNumbers,
                                     const char* pattern, TString additionalCode, TString additionalHeaders, Int_t maxFilesPerWorker,
                                     Int_t workerTTL, Bool_t isMC)
{
  TDatime currentTime;
  TString tmpName(uniqueName);

  // Only add current date and time when not in terminate mode! In this case the exact name has to be supplied by the user
  if(strcmp(gridMode, "terminate"))
  {
    tmpName += "_";
    tmpName += currentTime.GetDate();
    tmpName += "_";
    tmpName += currentTime.GetTime();
  }

  TString tmpAdditionalLibs("");
  tmpAdditionalLibs = Form("libTree.so libVMC.so libGeom.so libGui.so libXMLParser.so libMinuit.so libMinuit2.so libProof.so libPhysics.so libSTEERBase.so libESD.so libAOD.so libOADB.so libANALYSIS.so libCDB.so libRAWDatabase.so libSTEER.so libANALYSISalice.so libCORRFW.so libTOFbase.so libRAWDatabase.so libRAWDatarec.so libTPCbase.so libTPCrec.so libITSbase.so libITSrec.so libTRDbase.so libTender.so libSTAT.so libTRDrec.so libHMPIDbase.so libPWGPP.so libPWGHFbase.so libPWGDQdielectron.so libPWGHFhfe.so libEMCALUtils.so libPHOSUtils.so libPWGCaloTrackCorrBase.so libEMCALraw.so libEMCALbase.so libEMCALrec.so libTRDbase.so libVZERObase.so libVZEROrec.so libTender.so libTenderSupplies.so libESDfilter.so libPWGTools.so libPWGEMCAL.so libPWGGAEMCALTasks.so libPWGCFCorrelationsBase.so libPWGCFCorrelationsDPhi.so %s %s",additionalCode.Data(),additionalHeaders.Data());

  TString macroName("");
  TString execName("");
  TString jdlName("");
  macroName = Form("%s.C", tmpName.Data());
  execName = Form("%s.sh", tmpName.Data());
  jdlName = Form("%s.jdl", tmpName.Data());

  AliAnalysisAlien *plugin = new AliAnalysisAlien();
  plugin->SetOverwriteMode();
  plugin->SetRunMode(gridMode);

  // Here you can set the (Ali)ROOT version you want to use
  plugin->SetAPIVersion("V1.1x");
  plugin->SetROOTVersion("v5-34-08-6");
  plugin->SetAliROOTVersion("vAN-20140525");

  plugin->SetGridDataDir(gridDir); // e.g. "/alice/sim/LHC10a6"
  plugin->SetDataPattern(pattern); //dir structure in run directory
  if (!isMC)
   plugin->SetRunPrefix("000");

  plugin->AddRunList(runNumbers);

  plugin->SetGridWorkingDir(Form("work/%s",tmpName.Data()));
  plugin->SetGridOutputDir("output"); // In this case will be $HOME/work/output

  plugin->SetAnalysisSource(additionalCode.Data());
  plugin->SetAdditionalLibs(tmpAdditionalLibs.Data());

  plugin->SetDefaultOutputs(kTRUE);
  //plugin->SetMergeExcludes("");
  plugin->SetAnalysisMacro(macroName.Data());
  plugin->SetSplitMaxInputFileNumber(maxFilesPerWorker);
  plugin->SetExecutable(execName.Data());
  plugin->SetTTL(workerTTL);
  plugin->SetInputFormat("xml-single");
  plugin->SetJDLName(jdlName.Data());
  plugin->SetPrice(1);
  plugin->SetSplitMode("se");
  plugin->SetNtestFiles(1);

  return plugin;
}