Example usage for org.apache.commons.lang ArrayUtils clone

List of usage examples for org.apache.commons.lang ArrayUtils clone

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils clone.

Prototype

public static boolean[] clone(boolean[] array) 

Source Link

Document

Clones an array returning a typecast result and handling null.

Usage

From source file:org.opens.kbaccess.utils.MailingServiceProperties.java

public void setWebarchiveCreationNotificationMailingList(String[] webarchiveCreationNotificationMailingList) {
    this.webarchiveCreationNotificationMailingList = (String[]) ArrayUtils
            .clone(webarchiveCreationNotificationMailingList);
}

From source file:org.opentestsystem.authoring.testitembank.apipzip.domain.ApipItemContent.java

public byte[] getItemZip() {
    return ArrayUtils.clone(itemZip);
}

From source file:org.opentestsystem.authoring.testitembank.apipzip.domain.ApipItemContent.java

public void setItemZip(final byte[] itemZipFile) {
    this.itemZip = ArrayUtils.clone(itemZipFile);
}

From source file:org.springframework.ldap.control.PagedResultsCookie.java

/**
 * Constructor.//from  w  w  w. j  av a2  s.  co  m
 * 
 * @param cookie
 *            the cookie returned by a PagedResultsResponseControl.
 */
public PagedResultsCookie(byte[] cookie) {
    this.cookie = ArrayUtils.clone(cookie);
}

From source file:org.springframework.ldap.control.PagedResultsCookie.java

/**
 * Get the cookie.
 * 
 * @return the cookie.
 */
public byte[] getCookie() {
    return ArrayUtils.clone(cookie);
}

From source file:org.talend.core.model.metadata.types.ContextParameterJavaTypeManager.java

public static String[] getJavaTypesLabels() {
    int lstSize = javaTypes.size();
    if (javaTypesLabelsArray.length != lstSize) {
        javaTypesLabelsArray = new String[lstSize];
        for (int i = 0; i < lstSize; i++) {
            javaTypesLabelsArray[i] = javaTypes.get(i).getLabel();
        }/*  w  w  w .  j  a va 2 s. c  o  m*/
    }
    return (String[]) ArrayUtils.clone(javaTypesLabelsArray);
}

From source file:org.talend.core.model.metadata.types.ContextParameterJavaTypeManager.java

/**
 * qzhang Comment method "getPerlTypesLabels".
 * /*from w  w  w .  j av  a  2s .  c o m*/
 * @return
 */
public static String[] getPerlTypesLabels() {
    return (String[]) ArrayUtils.clone(perlTypes.toArray(new String[0]));
}

From source file:org.talend.designer.core.model.process.DataProcess.java

private void copyElementParametersValue(IElement sourceElement, IElement targetElement) {
    for (IElementParameter sourceParam : sourceElement.getElementParameters()) {
        IElementParameter targetParam = targetElement.getElementParameter(sourceParam.getName());
        if (targetParam != null) {
            if (sourceParam.getName().equals(EParameterName.DB_TYPE.getName())
                    && sourceParam.getValue().toString().matches("^.*[a|A][c|C][c|C][e|E][s|S][s|S].*$")) {

                sourceElement.getElementParameter(EParameterName.DBNAME.getName()).setValue(
                        sourceElement.getElementParameter(EParameterName.DBFILE.getName()).getValue());
            }//w w  w . ja  v  a2s  .  c om

            targetParam.setContextMode(sourceParam.isContextMode());
            targetParam.setValue(sourceParam.getValue());
            if (sourceParam.getValue() instanceof List) {
                List sourceList = (List) sourceParam.getValue();
                List targetList = new ArrayList();
                // if HashMap in List ,need clone deeply
                for (Object map : sourceList) {
                    if (map instanceof HashMap) {
                        HashMap oldMap = (HashMap) map;
                        targetList.add(oldMap.clone());
                    }
                }
                if (targetList.size() > 0) {
                    targetParam.setValue(targetList);
                } else {
                    targetParam.setValue(new ArrayList(sourceList));
                }
            }
            if (targetParam.getFieldType() == EParameterFieldType.TABLE) {

                // targetParam.setValue( sourceParam.getValue());
                targetParam.setListItemsValue(ArrayUtils.clone(sourceParam.getListItemsValue()));
                targetParam.setListItemsDisplayCodeName(sourceParam.getListItemsDisplayCodeName());
            }
            for (String name : targetParam.getChildParameters().keySet()) {
                IElementParameter targetChildParam = targetParam.getChildParameters().get(name);
                if (sourceParam.getChildParameters() == null) {
                    continue;
                }
                IElementParameter sourceChildParam = sourceParam.getChildParameters().get(name);
                targetChildParam.setValue(sourceChildParam.getValue());
                if (targetChildParam.getFieldType() == EParameterFieldType.TABLE) {
                    targetChildParam.setListItemsValue(sourceChildParam.getListItemsValue());
                    targetChildParam
                            .setListItemsDisplayCodeName(sourceChildParam.getListItemsDisplayCodeName());
                }
            }
        } else { // for feature TDI-24448,we need the new parameter here,do not init() it in the Connnection
            ElementParameter newParam = (ElementParameter) sourceParam.getClone();
            List<IElementParameter> listParam = (List<IElementParameter>) targetElement.getElementParameters();
            listParam.add(newParam);
        }
    }
}

From source file:org.talend.designer.core.ui.editor.properties.controllers.ConnectionListController.java

public static void updateConnectionList(IElement elem, IElementParameter param) {
    IConnection[] connections;//w w  w. j a va 2  s.  c  om
    INode source = null;
    if (elem instanceof INode) {
        source = ((INode) elem);
    } else if (elem instanceof IConnection) {
        source = ((IConnection) elem).getSource();
    } else {
        return;
    }
    String filter = param.getFilter();

    if (filter.startsWith("INPUT:")) { //$NON-NLS-1$
        Set<IConnection> conns = new HashSet<IConnection>();
        conns.addAll(source.getIncomingConnections());
        String[] f = filter.substring("INPUT:".length()).split("\\|"); //$NON-NLS-1$ //$NON-NLS-2$
        List<String> filterArray = new ArrayList<String>(f.length);
        for (String element : f) {
            filterArray.add(element.trim());
        }

        for (Iterator<IConnection> iter = conns.iterator(); iter.hasNext();) {
            IConnection con = iter.next();
            if (!filterArray.contains(con.getLineStyle().toString())) {
                iter.remove();
            }
        }
        connections = conns.toArray(new IConnection[conns.size()]);
    } else if (filter.startsWith("OUTPUT:")) { //$NON-NLS-1$
        Set<IConnection> conns = new HashSet<IConnection>();
        conns.addAll(source.getOutgoingConnections());
        String[] f = filter.substring("OUTPUT:".length()).split("\\|"); //$NON-NLS-1$ //$NON-NLS-2$
        List<String> filterArray = new ArrayList<String>(f.length);
        for (String element : f) {
            filterArray.add(element.trim());
        }

        for (Iterator<IConnection> iter = conns.iterator(); iter.hasNext();) {
            IConnection con = iter.next();
            if (!filterArray.contains(con.getLineStyle().toString())) {
                iter.remove();
            }
        }
        connections = conns.toArray(new IConnection[conns.size()]);
    } else {
        connections = source.getProcess().getAllConnections(filter);
    }

    String[] connectionNames = new String[connections.length + 1];
    connectionNames[0] = "";
    for (int i = 0; i < connections.length; i++) {
        connectionNames[i + 1] = connections[i].getUniqueName();
    }

    Arrays.sort(connectionNames);

    String[] connectionNameList = (String[]) ArrayUtils.clone(connectionNames);
    String[] connectionValueList = connectionNames;
    connectionNameList[0] = "<Empty>";

    param.setListItemsDisplayName(connectionNameList);
    param.setListItemsValue(connectionValueList);

    if (!ArrayUtils.contains(connectionValueList, param.getValue())) {
        param.setValue(""); //$NON-NLS-1$
    }
}

From source file:org.talend.designer.xmlmap.ui.tabs.table.TreeSchemaJavaTypeComboValueAdapter.java

public String[] getTalendTypesLabels() {
    JavaType[] javaTypes = getFilterdJavaTypes();
    int lstSize = javaTypes.length;
    if (javaTypesLabelsArray.length != lstSize) {
        javaTypesLabelsArray = new String[lstSize];
        for (int i = 0; i < lstSize; i++) {
            javaTypesLabelsArray[i] = javaTypes[i].getLabel();
        }/*www .j  a  va 2 s . c o m*/
    }
    return (String[]) ArrayUtils.clone(javaTypesLabelsArray);

}