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

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

Introduction

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

Prototype

public static double[] add(double[] array, int index, double element) 

Source Link

Document

Inserts the specified element at the specified position in the array.

Usage

From source file:org.polymap.core.runtime.recordstore.lucene.ValueCoders.java

public void addValueCoder(LuceneValueCoder valueCoder) {
    // add first, keep StringValueCoder last
    valueCoders = (LuceneValueCoder[]) ArrayUtils.add(valueCoders, 0, valueCoder);
}

From source file:org.sipfoundry.sipxconfig.site.conference.EditBridgeTestUi.java

protected Object[] getExpectedTableRow(String[] paramValues) {
    Object[] expected = super.getExpectedTableRow(paramValues);
    expected = ArrayUtils.add(expected, 2, "Disabled");
    return ArrayUtils.add(expected, "");
}

From source file:org.sipfoundry.sipxconfig.site.gateway.EditGateway.java

/**
 * Names of the tabs that are not in navigation components
 *//*from  w w  w .  j ava 2  s  .  c  om*/
public String[] getTabNames() {
    String[] tabs = new String[] { "config", "gcai", "dialplan" };
    if (getGateway().getModel().getMaxPorts() > 0) {
        tabs = (String[]) ArrayUtils.add(tabs, 1, "ports");
    }
    return tabs;
}

From source file:org.sipfoundry.sipxconfig.site.ListWebTestCase.java

/**
 * Returns the table row view of the tested item.
 *
 * By default table displays exactly the same values as entered on add form - override it to
 * change it./* w w  w.  j  av a 2s  . c o m*/
 *
 * @param paramValues generated by getParamValues function
 * @return array of values that correspond to what we need to see in the table
 */
protected Object[] getExpectedTableRow(String[] paramValues) {
    return ArrayUtils.add(paramValues, 0, "unchecked");
}

From source file:org.snaker.engine.access.AbstractDBAccess.java

public List<CCOrder> getCCOrder(String orderId, String... actorIds) {
    StringBuilder where = new StringBuilder(QUERY_CCORDER);
    where.append(" where 1 = 1 ");

    if (StringHelper.isNotEmpty(orderId)) {
        where.append(" and order_Id = ?");
    }/*w ww  . ja  v  a2  s . c o  m*/
    if (actorIds != null && actorIds.length > 0) {
        where.append(" and actor_Id in (");
        where.append(StringUtils.repeat("?,", actorIds.length));
        where.deleteCharAt(where.length() - 1);
        where.append(") ");
    }
    return queryList(CCOrder.class, where.toString(), ArrayUtils.add(actorIds, 0, orderId));
}

From source file:org.soaplab.clients.spinet.Service.java

/*************************************************************************
 *
 *************************************************************************/
protected String createSelect(String name, String defaultValue, String[] allowedValues) {
    StringBuilder buf = new StringBuilder();
    if (StringUtils.isNotEmpty(defaultValue)) {
        buf.append(h.list(name, (String[]) ArrayUtils.add(allowedValues, 0, DEFAULT_SELECT_TEXT)));
    } else {//from w  w w .  java 2 s.  c  o  m
        buf.append(h.list(name, allowedValues));
    }
    return buf.toString();
}

From source file:org.talend.designer.runprocess.ui.views.ProcessView.java

private EComponentCategory[] getCategories() {
    EComponentCategory[] categories = EElementType.RUN_PROCESS.getCategories();
    if (processContext != null && processContext.getProcess() != null) {
        if (processContext.getProcess().getComponentsType()
                .equals(ComponentCategory.CATEGORY_4_MAPREDUCE.getName())) {
            categories = (EComponentCategory[]) ArrayUtils.remove(categories,
                    ArrayUtils.indexOf(categories, EComponentCategory.DEBUGRUN));
            categories = (EComponentCategory[]) ArrayUtils.add(categories, 1,
                    EComponentCategory.MAPREDUCE_JOB_CONFIG_FOR_HADOOP);
        }//from  w ww  .j  a va  2 s .  c  o m
        if (processContext.getProcess().getComponentsType()
                .equals(ComponentCategory.CATEGORY_4_STORM.getName())) {
            categories = (EComponentCategory[]) ArrayUtils.add(categories, 1,
                    EComponentCategory.STORM_JOB_CONFIG);
        }

        if (processContext.getProcess().getComponentsType().equals(ComponentCategory.CATEGORY_4_SPARK.getName())
                || processContext.getProcess().getComponentsType()
                        .equals(ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName())) {
            categories = (EComponentCategory[]) ArrayUtils.add(categories, 1,
                    EComponentCategory.SPARK_JOB_CONFIG);
        }
    }
    return categories;
}

From source file:org.wso2.carbon.apimgt.everywhere.webapp.publisher.APIPublisherLifecycleListener.java

public void scanStandardContext(StandardContext context) throws IOException {
    // Set<String> entityClasses = getAnnotatedClassesStandardContext(context, Path.class);
    //todo pack the annotation db with feature
    Set<String> entityClasses = null;

    AnnotationDB db = new AnnotationDB();
    db.addIgnoredPackages("org.apache");
    db.addIgnoredPackages("org.codehaus");
    db.addIgnoredPackages("org.springframework");

    final String path = context.getRealPath("/WEB-INF/classes");
    //TODO follow the above line for "WEB-INF/lib" as well

    URL[] libPath = WarUrlFinder.findWebInfLibClasspaths(context.getServletContext());
    URL classPath = WarUrlFinder.findWebInfClassesPath(context.getServletContext());
    URL[] urls = (URL[]) ArrayUtils.add(libPath, libPath.length, classPath);

    db.scanArchives(urls);/*from w ww .  j  ava2 s .  c  o m*/
    entityClasses = db.getAnnotationIndex().get(Path.class.getName());

    if (entityClasses != null && !entityClasses.isEmpty()) {
        for (String className : entityClasses) {
            try {

                List<URL> fileUrls = convertToFileUrl(libPath, classPath, context.getServletContext());

                URLClassLoader cl = new URLClassLoader(fileUrls.toArray(new URL[fileUrls.size()]),
                        this.getClass().getClassLoader());

                ClassLoader cl2 = context.getServletContext().getClassLoader();
                Class<?> clazz = cl2.loadClass(className);

                Class<Path> pathClazz = (Class<Path>) cl2.loadClass(Path.class.getName());

                showAPIinfo(context.getServletContext(), clazz, pathClazz);

            } catch (ClassNotFoundException e) {
                //log the error and continue the loop
                log.error(e.getMessage(), e);
            }
        }
    }
}

From source file:org.wso2.carbon.apimgt.webapp.publisher.lifecycle.util.AnnotationUtil.java

/**
 * Scan the context for classes with annotations
 * @return/*from  www.  j av a2  s  .  c om*/
 * @throws IOException
 */
public Set<String> scanStandardContext(String className) throws IOException {
    AnnotationDB db = new AnnotationDB();
    db.addIgnoredPackages(PACKAGE_ORG_APACHE);
    db.addIgnoredPackages(PACKAGE_ORG_CODEHAUS);
    db.addIgnoredPackages(PACKAGE_ORG_SPRINGFRAMEWORK);

    URL[] libPath = WarUrlFinder.findWebInfLibClasspaths(servletContext);
    URL classPath = WarUrlFinder.findWebInfClassesPath(servletContext);
    URL[] urls = (URL[]) ArrayUtils.add(libPath, libPath.length, classPath);

    db.scanArchives(urls);

    //Returns a list of classes with given Annotation
    return db.getAnnotationIndex().get(className);
}

From source file:org.wso2.carbon.device.mgt.extensions.feature.mgt.util.AnnotationUtil.java

/**
 * Scan the context for classes with annotations
 *//*  ww  w  .jav a2 s  . c om*/
public Set<String> scanStandardContext(String className) throws IOException {
    AnnotationDB db = new AnnotationDB();
    db.addIgnoredPackages(PACKAGE_ORG_APACHE);
    db.addIgnoredPackages(PACKAGE_ORG_CODEHAUS);
    db.addIgnoredPackages(PACKAGE_ORG_SPRINGFRAMEWORK);
    URL[] libPath = WarUrlFinder.findWebInfLibClasspaths(servletContext);
    URL classPath = WarUrlFinder.findWebInfClassesPath(servletContext);
    URL[] urls = (URL[]) ArrayUtils.add(libPath, libPath.length, classPath);
    db.scanArchives(urls);

    //Returns a list of classes with given Annotation
    return db.getAnnotationIndex().get(className);
}