Example usage for java.util HashSet addAll

List of usage examples for java.util HashSet addAll

Introduction

In this page you can find the example usage for java.util HashSet addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

From source file:eu.tango.energymodeller.datastore.DataGatherer.java

/**
 * This gets a list of the VMs that are currently on a host machine.
 *
 * @param host The host machine to get the VM list for
 * @param activeVMs The list of VMs known to be active on the host.
 * @return The list of VMs on the specified host
 *//*from   w w w  .j  av  a  2  s  . c om*/
public ArrayList<VmDeployed> getVMsOnHost(Host host, List<VmDeployed> activeVMs) {
    HashSet<VmDeployed> currentVMs = new HashSet<>();
    currentVMs.addAll(activeVMs);
    ArrayList<VmDeployed> answer = new ArrayList<>();
    for (VmDeployed vm : knownVms.values()) {
        validateVMInformation(vm);
        if (host.equals(vm.getAllocatedTo()) && currentVMs.contains(vm)) {
            answer.add(vm);
        }
    }
    return answer;
}

From source file:org.bhavaya.ui.view.ChartView.java

private JFreeChart createScatterChart() {
    JFreeChart chart;//from  w w w .  j  a va 2s .co  m
    GroupedXYDataSet dataset = new GroupedXYDataSet(beanCollection);
    HashSet allLocators = new HashSet();
    allLocators.addAll(configuration.getDomainAxisLocators());
    allLocators.addAll(configuration.getRangeAxisLocators());
    dataset.setColumnLocators(allLocators);

    chart = ChartFactory.createScatterPlot("", getDomainName(), getRangeName(), dataset,
            PlotOrientation.VERTICAL, true, true, false);

    Plot plot = chart.getPlot();
    if (plot instanceof XYPlot && dataset.isXAxisDateAxis()) {
        ValueAxis axis = ((XYPlot) plot).getDomainAxis();
        DateAxis dateAxis = new DateAxis(axis.getLabel());
        /*dateAxis.setAutoRange(true);
        dateAxis.setAutoTickUnitSelection(true);*/
        //dateAxis.setDateFormatOverride(new SimpleDateFormat("dd-MMM-yyyy"));
        ((XYPlot) plot).setDomainAxis(dateAxis);
    }
    return chart;
}

From source file:org.paxle.tools.charts.impl.gui.ChartServlet.java

private void serviceChanged(ServiceReference reference, int eventType) {
    if (reference == null)
        return;//from w  ww  .  ja  va 2s .  co  m
    if (eventType == ServiceEvent.MODIFIED)
        return;

    // ignoring unknown services
    String pid = (String) reference.getProperty(Constants.SERVICE_PID);
    if (!variableTree.containsKey(pid))
        return;

    // getting currently monitored variables
    final HashSet<String> currentVariableNames = new HashSet<String>();
    if (this.currentMonitorJob != null) {
        String[] temp = this.currentMonitorJob.getStatusVariableNames();
        if (temp != null) {
            currentVariableNames.addAll(Arrays.asList(temp));
        }

        try {
            // stopping old monitoring-job
            this.currentMonitorJob.stop();
        } catch (NullPointerException e) {
            // XXX this is a bug in the MA implementation and should be ignored for now
            this.logger.debug(e);
        }
        this.currentMonitorJob = null;
    }

    // getting variables of changed service
    final HashSet<String> diffVariableNames = new HashSet<String>();
    this.addVariables4Monitor(reference, diffVariableNames, eventType == ServiceEvent.REGISTERED,
            eventType == ServiceEvent.REGISTERED);

    if (eventType == ServiceEvent.REGISTERED) {
        // adding new variable
        currentVariableNames.addAll(diffVariableNames);
    } else if (eventType == ServiceEvent.UNREGISTERING) {
        currentVariableNames.removeAll(diffVariableNames);
    }

    // restarting monitoring job
    this.startScheduledJob(currentVariableNames);
}

From source file:org.bhavaya.ui.view.ChartView.java

/**
 * make changes to the bean table in order to apply the current config to the data models
 *///from www . j  ava  2s . c o m
private void applyConfigToModels() {
    beanTable.removeAllColumnLocators();
    HashSet allLocators = new HashSet();
    allLocators.addAll(configuration.getDomainAxisLocators());
    allLocators.addAll(configuration.getRangeAxisLocators());

    String seriesColumnLocator = configuration.getSeriesColumnLocator();
    boolean needsPivoting = configuration.isPivoted();
    if (needsPivoting) {
        allLocators.add(seriesColumnLocator);
    }
    beanTable.addColumnLocators(allLocators);

    if (needsPivoting) {
        String dataColumnLocator = (String) configuration.getRangeAxisLocators().iterator().next();
        analyticsModel.setPivotColumn(dataColumnLocator);
        analyticsModel.setPivotColumn(configuration.getSeriesColumnLocator());

        String pivotDataName = beanTable.getColumnName(beanTable.getColumnIndex(dataColumnLocator));
        setRangeName(pivotDataName);
    } else {
        setRangeName(tableModelDataSet.getRangeName());
    }
    analyticsModel.setPivoted(needsPivoting);

    updateAxesNames();
    reRangeGraph();
}

From source file:ch.simas.jtoggl.JToggl.java

/**
 * All users in all workspaces./*w w  w. j a  va 2s  . c  om*/
 * 
 * @return all users in all workspaces
 */
public List<User> getUsers() {
    HashSet<User> result = new HashSet<User>();
    List<Workspace> workspaces = getWorkspaces();
    for (Workspace workspace : workspaces) {
        List<User> workspaceUsers = getWorkspaceUsers(workspace.getId());
        result.addAll(workspaceUsers);
    }
    return new ArrayList<User>(result);
}

From source file:org.apache.taverna.activities.dependencyactivity.AbstractAsynchronousDependencyActivity.java

/**
 * Finds dependencies for a nested workflow.
 */// w  w  w .j a  va2s  .  co m
private HashSet<URL> findNestedDependencies(String dependencyType, JsonNode json, Dataflow nestedWorkflow) {
    ClassLoaderSharing classLoaderSharing;
    if (json.has("classLoaderSharing")) {
        classLoaderSharing = ClassLoaderSharing.fromString(json.get("classLoaderSharing").textValue());
    } else {
        classLoaderSharing = ClassLoaderSharing.workflow;
    }

    // Files of dependencies for all activities in the nested workflow that share the classloading policy
    HashSet<File> dependencies = new HashSet<File>();
    // Urls of all dependencies
    HashSet<URL> dependenciesURLs = new HashSet<URL>();

    for (Processor proc : nestedWorkflow.getProcessors()) {
        // Another nested workflow
        if (!proc.getActivityList().isEmpty() && proc.getActivityList().get(0) instanceof NestedDataflow) {
            // Get the nested workflow
            Dataflow nestedNestedWorkflow = ((NestedDataflow) proc.getActivityList().get(0))
                    .getNestedDataflow();
            dependenciesURLs.addAll(findNestedDependencies(dependencyType, json, nestedNestedWorkflow));
        } else { // Not nested - go through all of the processor's activities
            Activity<?> activity = proc.getActivityList().get(0);
            if (activity instanceof AbstractAsynchronousDependencyActivity) {
                AbstractAsynchronousDependencyActivity dependencyActivity = (AbstractAsynchronousDependencyActivity) activity;
                //                  if (dependencyType.equals(LOCAL_JARS)){
                // Collect the files of all found local dependencies
                if (dependencyActivity.getConfiguration().has("localDependency")) {
                    for (JsonNode jar : dependencyActivity.getConfiguration().get("localDependency")) {
                        try {
                            dependencies.add(new File(libDir, jar.textValue()));
                        } catch (Exception ex) {
                            logger.warn("Invalid URL for " + jar, ex);
                            continue;
                        }
                    }
                }
                //                  } else if (dependencyType.equals(ARTIFACTS) && this.getClass().getClassLoader() instanceof LocalArtifactClassLoader){
                //                     LocalArtifactClassLoader cl = (LocalArtifactClassLoader) this.getClass().getClassLoader(); // this class is always loaded with LocalArtifactClassLoader
                //                     LocalRepository rep  = (LocalRepository) cl.getRepository();
                //                     for (BasicArtifact art : ((DependencyActivityConfigurationBean) activity
                //                                 .getConfiguration())
                //                                 .getArtifactDependencies()){
                //                        dependencies.add(rep.jarFile(art));
                //                     }
                //                  }
            }
        }
    }

    // Collect the URLs of all found dependencies
    for (File file : dependencies) {
        try {
            dependenciesURLs.add(file.toURI().toURL());
        } catch (Exception ex) {
            logger.warn("Invalid URL for " + file.getAbsolutePath(), ex);
            continue;
        }
    }
    return dependenciesURLs;
}

From source file:org.fusesource.meshkeeper.distribution.LaunchClient.java

/**
 * Requests the specified number of tcp ports from the specified process
 * launcher.//  w  w w . j a  v a  2s.co m
 * 
 * @param agentName The name of the process launcher
 * @param count The number of ports.
 * @return The reserved ports
 * @throws Exception If there is an error reserving the requested number of
 *             ports.
 */
public synchronized List<Integer> reserveTcpPorts(String agentName, int count) throws Exception {
    agentName = agentName.toUpperCase();
    LaunchAgentService agent = getAgent(agentName);

    List<Integer> ports = agent.reserveTcpPorts(count);
    HashSet<Integer> reserved = reservedPorts.get(agentName);
    if (reserved == null) {
        reserved = new HashSet<Integer>();
        reservedPorts.put(agentName, reserved);
    }
    reserved.addAll(ports);
    return ports;
}

From source file:isl.FIMS.servlet.imports.ImportXML.java

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    this.initVars(request);
    String username = getUsername(request);

    Config conf = new Config("EisagwghXML_RDF");
    String xsl = ApplicationConfig.SYSTEM_ROOT + "formating/xsl/import/ImportXML.xsl";
    String displayMsg = "";
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    StringBuilder xml = new StringBuilder(
            this.xmlStart(this.topmenu, username, this.pageTitle, this.lang, "", request));
    //  ArrayList<String> notValidMXL = new ArrayList<String>();
    HashMap<String, ArrayList> notValidMXL = new <String, ArrayList>HashMap();
    if (!ServletFileUpload.isMultipartContent(request)) {
        displayMsg = "form";
    } else {/*from   w  w  w  .  ja v  a 2 s.  co  m*/
        // configures some settings
        String filePath = this.export_import_Folder;
        java.util.Date date = new java.util.Date();
        Timestamp t = new Timestamp(date.getTime());
        String currentDir = filePath + t.toString().replaceAll(":", "");
        File saveDir = new File(currentDir);
        if (!saveDir.exists()) {
            saveDir.mkdir();
        }
        DiskFileItemFactory factory = new DiskFileItemFactory();
        factory.setSizeThreshold(DiskFileItemFactory.DEFAULT_SIZE_THRESHOLD);
        factory.setRepository(saveDir);
        ArrayList<String> savedIDs = new ArrayList<String>();

        ServletFileUpload upload = new ServletFileUpload(factory);
        upload.setSizeMax(REQUEST_SIZE);
        // constructs the directory path to store upload file
        String uploadPath = currentDir;
        int xmlCount = 0;
        String[] id = null;
        try {
            // parses the request's content to extract file data
            List formItems = upload.parseRequest(request);
            Iterator iter = formItems.iterator();
            // iterates over form's fields
            File storeFile = null;
            while (iter.hasNext()) {
                FileItem item = (FileItem) iter.next();
                // processes only fields that are not form fields
                if (!item.isFormField()) {
                    String fileName = new File(item.getName()).getName();
                    filePath = uploadPath + File.separator + fileName;
                    storeFile = new File(filePath);
                    item.write(storeFile);
                    Utils.unzip(fileName, uploadPath);
                    File dir = new File(uploadPath);

                    String[] extensions = new String[] { "xml", "x3ml" };
                    List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
                    xmlCount = files.size();
                    for (File file : files) {
                        // saves the file on disk
                        Document doc = ParseXMLFile.parseFile(file.getPath());
                        String xmlContent = doc.getDocumentElement().getTextContent();
                        String uri_name = "";
                        try {
                            uri_name = DMSTag.valueOf("uri_name", "target", type, this.conf)[0];
                        } catch (DMSException ex) {
                            ex.printStackTrace();
                        }
                        String uriValue = this.URI_Reference_Path + uri_name + "/";
                        boolean insertEntity = false;
                        if (xmlContent.contains(uriValue) || file.getName().contains(type)) {
                            insertEntity = true;
                        }
                        Element root = doc.getDocumentElement();
                        Node admin = Utils.removeNode(root, "admin", true);

                        //  File rename = new File(uploadPath + File.separator + id[0] + ".xml");
                        //  boolean isRename = storeFile.renameTo(rename);
                        //   ParseXMLFile.saveXMLDocument(rename.getPath(), doc);
                        String schemaFilename = "";
                        schemaFilename = type;

                        SchemaFile sch = new SchemaFile(schemaFolder + schemaFilename + ".xsd");
                        TransformerFactory tf = TransformerFactory.newInstance();
                        Transformer transformer = tf.newTransformer();
                        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
                        StringWriter writer = new StringWriter();
                        transformer.transform(new DOMSource(doc), new StreamResult(writer));
                        String xmlString = writer.getBuffer().toString().replaceAll("\r", "");

                        //without admin
                        boolean isValid = sch.validate(xmlString);
                        if ((!isValid && insertEntity)) {
                            notValidMXL.put(file.getName(), null);
                        } else if (insertEntity) {
                            id = initInsertFile(type, false);
                            doc = createAdminPart(id[0], type, doc, username);
                            writer = new StringWriter();
                            transformer.transform(new DOMSource(doc), new StreamResult(writer));
                            xmlString = writer.getBuffer().toString().replaceAll("\r", "");
                            DBCollection col = new DBCollection(this.DBURI, id[1], this.DBuser,
                                    this.DBpassword);
                            DBFile dbF = col.createFile(id[0] + ".xml", "XMLDBFile");
                            dbF.setXMLAsString(xmlString);
                            dbF.store();
                            ArrayList<String> externalFiles = new <String>ArrayList();
                            ArrayList<String> externalDBFiles = new <String>ArrayList();

                            String q = "//*[";
                            for (String attrSet : this.uploadAttributes) {
                                String[] temp = attrSet.split("#");
                                String func = temp[0];
                                String attr = temp[1];
                                if (func.contains("text")) {
                                    q += "@" + attr + "]/text()";
                                } else {
                                    q = "data(//*[@" + attr + "]/@" + attr + ")";
                                }
                                String[] res = dbF.queryString(q);
                                for (String extFile : res) {
                                    externalFiles.add(extFile + "#" + attr);
                                }
                            }
                            q = "//";
                            if (!dbSchemaPath[0].equals("")) {
                                for (String attrSet : this.dbSchemaPath) {
                                    String[] temp = attrSet.split("#");
                                    String func = temp[0];
                                    String path = temp[1];
                                    if (func.contains("text")) {
                                        q += path + "//text()";
                                    } else {
                                        q = "data(//" + path + ")";
                                    }
                                    String[] res = dbF.queryString(q);
                                    for (String extFile : res) {
                                        externalDBFiles.add(extFile);
                                    }
                                }
                            }
                            ArrayList<String> missingExternalFiles = new <String>ArrayList();
                            for (String extFile : externalFiles) {
                                extFile = extFile.substring(0, extFile.lastIndexOf("#"));

                                List<File> f = (List<File>) FileUtils.listFiles(dir,
                                        FileFilterUtils.nameFileFilter(extFile), TrueFileFilter.INSTANCE);
                                if (f.size() == 0) {
                                    missingExternalFiles.add(extFile);
                                }
                            }
                            if (missingExternalFiles.size() > 0) {
                                notValidMXL.put(file.getName(), missingExternalFiles);
                            }

                            XMLEntity xmlNew = new XMLEntity(this.DBURI, this.systemDbCollection + type,
                                    this.DBuser, this.DBpassword, type, id[0]);

                            ArrayList<String> worngFiles = Utils.checkReference(xmlNew, this.DBURI, id[0], type,
                                    this.DBuser, this.DBpassword);
                            if (worngFiles.size() > 0) {
                                //dbF.remove();
                                notValidMXL.put(file.getName(), worngFiles);
                            }
                            //remove duplicates from externalFiles if any
                            HashSet hs = new HashSet();
                            hs.addAll(missingExternalFiles);
                            missingExternalFiles.clear();
                            missingExternalFiles.addAll(hs);
                            if (missingExternalFiles.isEmpty() && worngFiles.isEmpty()) {

                                for (String extFile : externalFiles) {
                                    String attr = extFile.substring(extFile.lastIndexOf("#") + 1,
                                            extFile.length());
                                    extFile = extFile.substring(0, extFile.lastIndexOf("#"));

                                    List<File> f = (List<File>) FileUtils.listFiles(dir,
                                            FileFilterUtils.nameFileFilter(extFile), TrueFileFilter.INSTANCE);
                                    File uploadFile = f.iterator().next();
                                    String content = FileUtils.readFileToString(uploadFile);

                                    DBFile uploadsDBFile = new DBFile(this.DBURI, this.adminDbCollection,
                                            "Uploads.xml", this.DBuser, this.DBpassword);
                                    String mime = Utils.findMime(uploadsDBFile, uploadFile.getName(), attr);
                                    String uniqueName = Utils.createUniqueFilename(uploadFile.getName());
                                    File uploadFileUnique = new File(uploadFile.getPath().substring(0,
                                            uploadFile.getPath().lastIndexOf(File.separator)) + File.separator
                                            + uniqueName);
                                    uploadFile.renameTo(uploadFileUnique);
                                    xmlString = xmlString.replaceAll(uploadFile.getName(), uniqueName);
                                    String upload_path = this.systemUploads + type;
                                    File upload_dir = null;
                                    ;
                                    if (mime.equals("Photos")) {
                                        upload_path += File.separator + mime + File.separator + "original"
                                                + File.separator;
                                        upload_dir = new File(upload_path + uniqueName);
                                        FileUtils.copyFile(uploadFileUnique, upload_dir);
                                        Utils.resizeImage(uniqueName, upload_path,
                                                upload_path.replaceAll("original", "thumbs"), thumbSize);
                                        Utils.resizeImage(uniqueName, upload_path,
                                                upload_path.replaceAll("original", "normal"), normalSize);
                                        xmlString = xmlString.replace("</versions>",
                                                "</versions>" + "\n" + "<type>Photos</type>");
                                    } else {
                                        upload_path += File.separator + mime + File.separator;
                                        upload_dir = new File(upload_path + uniqueName);
                                        FileUtils.copyFile(uploadFileUnique, upload_dir);
                                    }
                                    if (!dbSchemaFolder.equals("")) {
                                        if (externalDBFiles.contains(extFile)) {
                                            try {
                                                DBCollection colSchema = new DBCollection(this.DBURI,
                                                        dbSchemaFolder, this.DBuser, this.DBpassword);
                                                DBFile dbFSchema = colSchema.createFile(uniqueName,
                                                        "XMLDBFile");
                                                dbFSchema.setXMLAsString(content);
                                                dbFSchema.store();
                                            } catch (Exception e) {
                                            }
                                        }
                                    }
                                    uploadFileUnique.renameTo(uploadFile);

                                }
                                dbF.setXMLAsString(xmlString);
                                dbF.store();
                                Utils.updateReferences(xmlNew, this.DBURI, id[0].split(type)[1], type,
                                        this.DBpassword, this.DBuser);
                                Utils.updateVocabularies(xmlNew, this.DBURI, id[0].split(type)[1], type,
                                        this.DBpassword, this.DBuser, lang);
                                savedIDs.add(id[0]);
                            } else {
                                dbF.remove();
                            }

                        }
                    }

                }
            }
            Document doc = ParseXMLFile.parseFile(ApplicationConfig.SYSTEM_ROOT + "formating/multi_lang.xml");
            Element root = doc.getDocumentElement();
            Element contextTag = (Element) root.getElementsByTagName("context").item(0);
            String uri_name = "";
            try {
                uri_name = DMSTag.valueOf("uri_name", "target", type, this.conf)[0];
            } catch (DMSException ex) {
            }
            if (notValidMXL.size() == 0) {
                xsl = conf.DISPLAY_XSL;
                displayMsg = Messages.ACTION_SUCCESS;
                displayMsg += Messages.NL + Messages.NL + Messages.URI_ID;
                String uriValue = "";
                xml.append("<Display>").append(displayMsg).append("</Display>\n");
                xml.append("<backPages>").append('2').append("</backPages>\n");

                for (String saveId : savedIDs) {
                    uriValue = this.URI_Reference_Path + uri_name + "/" + saveId + Messages.NL;
                    xml.append("<codeValue>").append(uriValue).append("</codeValue>\n");

                }

            } else if (notValidMXL.size() >= 1) {
                xsl = ApplicationConfig.SYSTEM_ROOT + "formating/xsl/import/ImportXML.xsl";

                Iterator it = notValidMXL.keySet().iterator();
                while (it.hasNext()) {

                    String key = (String) it.next();
                    ArrayList<String> value = notValidMXL.get(key);

                    if (value != null) {
                        displayMsg += "<line>";
                        Element select = (Element) contextTag.getElementsByTagName("missingReferences").item(0);
                        displayMsg += select.getElementsByTagName(lang).item(0).getTextContent();
                        displayMsg = displayMsg.replace("?", key);
                        for (String mis_res : value) {

                            displayMsg += mis_res + ",";
                        }
                        displayMsg = displayMsg.substring(0, displayMsg.length() - 1);
                        displayMsg += ".";
                        displayMsg += "</line>";

                    } else {
                        displayMsg += "<line>";
                        Element select = (Element) contextTag.getElementsByTagName("NOT_VALID_XML").item(0);
                        displayMsg += select.getElementsByTagName(lang).item(0).getTextContent();
                        displayMsg = displayMsg.replace(";", key);
                        displayMsg += "</line>";
                    }
                    displayMsg += "<line>";
                    displayMsg += "</line>";
                }
                if (notValidMXL.size() < xmlCount) {
                    displayMsg += "<line>";
                    Element select = (Element) contextTag.getElementsByTagName("rest_valid").item(0);
                    displayMsg += select.getElementsByTagName(lang).item(0).getTextContent();
                    displayMsg += "</line>";
                    for (String saveId : savedIDs) {
                        displayMsg += "<line>";
                        String uriValue = this.URI_Reference_Path + uri_name + "/" + saveId;
                        select = (Element) contextTag.getElementsByTagName("URI_ID").item(0);
                        displayMsg += select.getElementsByTagName(lang).item(0).getTextContent() + ": "
                                + uriValue;
                        displayMsg += "</line>";
                    }
                }
            }
            Utils.deleteDir(currentDir);
        } catch (Exception ex) {
            ex.printStackTrace();
            displayMsg += Messages.NOT_VALID_IMPORT;
        }

    }
    xml.append("<Display>").append(displayMsg).append("</Display>\n");
    xml.append("<EntityType>").append(type).append("</EntityType>\n");
    xml.append(this.xmlEnd());
    try {
        XMLTransform xmlTrans = new XMLTransform(xml.toString());
        xmlTrans.transform(out, xsl);
    } catch (DMSException e) {
        e.printStackTrace();
    }
    out.close();
}

From source file:com.dell.asm.asmcore.asmmanager.client.networkconfiguration.NetworkConfiguration.java

/**
 * Loops through all the fabrics, then interfaces, and then partitions to retrieve ALL of the Networks.
 * //from   w  ww  .j  a va  2  s.c  o  m
 * @return all of the Networks that art part of this NetworkConfiguration.
 */
public Set<String> getAllNetworkIds() {
    HashSet<String> networkIds = new HashSet<String>();

    // Get from interfaces  
    for (Fabric fabric : this.interfaces) {
        List<Interface> interfaces = fabric.getInterfaces();
        if (interfaces != null) {
            for (Interface fInterface : interfaces) {
                if (fInterface != null && fInterface.getPartitions() != null) {
                    List<Partition> partitions = fInterface.getPartitions();
                    for (Partition partition : partitions) {
                        if (partition != null && partition.getNetworks() != null) {
                            networkIds.addAll(partition.getNetworks());
                        }
                    }
                }
            }
        }
    }

    return networkIds;
}

From source file:org.compass.core.lucene.engine.store.AbstractLuceneSearchEngineStore.java

public String[] calcSubIndexes(String[] subIndexes, String[] aliases) {
    if (aliases == null) {
        if (subIndexes == null) {
            return getSubIndexes();
        }/*from  ww  w.j av  a 2 s.c o m*/
        return subIndexes;
    }
    HashSet<String> ret = new HashSet<String>();
    for (String aliase : aliases) {
        List<String> subIndexesList = subIndexesByAlias.get(aliase);
        if (subIndexesList == null) {
            throw new IllegalArgumentException("No sub-index is mapped to alias [" + aliase + "]");
        }
        for (String subIndex : subIndexesList) {
            ret.add(subIndex);
        }
    }
    if (subIndexes != null) {
        ret.addAll(Arrays.asList(subIndexes));
    }
    return ret.toArray(new String[ret.size()]);
}