Example usage for java.util Collection removeAll

List of usage examples for java.util Collection removeAll

Introduction

In this page you can find the example usage for java.util Collection removeAll.

Prototype

boolean removeAll(Collection<?> c);

Source Link

Document

Removes all of this collection's elements that are also contained in the specified collection (optional operation).

Usage

From source file:org.kuali.kra.proposaldevelopment.lookup.keyvalue.ProposalNarrativeTypeValuesFinder.java

protected Collection<NarrativeType> filterCollection(Collection<NarrativeType> narrativeTypes) {
    ProposalDevelopmentDocument document = getDocumentFromForm();
    Collection<NarrativeType> forRemoval = new ArrayList<NarrativeType>();
    for (NarrativeType narrativeType : narrativeTypes) {
        for (Narrative narrative : document.getDevelopmentProposal().getNarratives()) {
            if (filterCondition(narrative.getNarrativeType(), narrativeType)) {
                forRemoval.add(narrativeType);
            } else {
                LOG.debug("Not removing narrative type " + narrativeType.getDescription());
            }//from  w w  w.j a v  a2s . c o  m
        }
    }

    // Remove any instances for with these type codes already in the document
    narrativeTypes.removeAll(forRemoval);

    return narrativeTypes;
}

From source file:ubic.gemma.web.controller.diff.DifferentialExpressionSearchController.java

/**
 * AJAX entry which returns results on a non-meta analysis basis. That is, the differential expression results for
 * the gene with the id, geneId, are returned. This method is just like getDifferentialExpression but any analyses
 * with the 'batch' factor are filtered out because they are not biologically relevant
 *//*  ww  w .  ja va 2  s .  co m*/
public Collection<DifferentialExpressionValueObject> getDifferentialExpressionWithoutBatch(Long geneId,
        double threshold, Integer limit) {

    Collection<DifferentialExpressionValueObject> analyses = getDifferentialExpression(geneId, threshold,
            limit);

    // for each DifferentialExpressionValueObject, check if its factors includes a batch factor and if so, remove
    // the batch factor
    Collection<DifferentialExpressionValueObject> toRemove = new ArrayList<>();
    for (DifferentialExpressionValueObject analysis : analyses) {
        for (ExperimentalFactorValueObject factor : analysis.getExperimentalFactors()) {
            if (ExperimentalDesignUtils.isBatch(factor)) {
                toRemove.add(analysis);
            }
        }
    }
    analyses.removeAll(toRemove);

    return analyses;
}

From source file:xmlconverter.controller.logic.GetFileCount.java

/**
 * This method is going to update file called "Anlagenbaum.xml" The updates
 * that are done to this file are essential when adding new site witch is
 * done automatically. It needs to be done for GMA-manager software to
 * detect changes/ that folder/site has been added.
 *
 * @throws javax.xml.parsers.ParserConfigurationException
 * @throws org.xml.sax.SAXException/*from   w  ww . ja v  a 2  s.  c o  m*/
 * @throws javax.xml.transform.TransformerException
 * @throws java.io.IOException
 */
public void updateAnlage()
        throws DOMException, ParserConfigurationException, TransformerException, IOException, SAXException {
    File anlageFile = new File(home.getAbsolutePath() + slash + "Anlagenbaum.xml");
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(anlageFile);
    // Get the root element
    Node root = doc.getFirstChild();
    NodeList staff = doc.getElementsByTagName("GraphicsContainerNode");
    ArrayList<String> staffList = new ArrayList<>();

    for (int i = 0; i < staff.getLength(); i++) {
        NamedNodeMap attr = staff.item(i).getAttributes();
        Node nodeAttr = attr.getNamedItem("id");
        String content = nodeAttr.getTextContent();
        staffList.add(content);
    }

    File[] siteName = home.listFiles(directoryFilter);
    ArrayList<String> siteNameList = new ArrayList<>();

    for (File f : siteName) {
        siteNameList.add(f.getName());
    }

    Collection site = siteNameList;
    Collection staffCollection = staffList;

    if (staff.getLength() == 0) {
        for (String s : siteNameList) {
            Element graphicsNode = doc.createElement("GraphicsContainerNode");
            graphicsNode.setAttribute("id", s);
            graphicsNode.setAttribute("load", s + slash + s);
            graphicsNode.setAttribute("name", s);
            root.appendChild(graphicsNode);
        }
    } else if (staff.getLength() <= siteName.length || staff.getLength() > 0) {
        site.removeAll(staffCollection);
        for (Object s : site) {
            Element graphicsNode = doc.createElement("GraphicsContainerNode");
            graphicsNode.setAttribute("id", s.toString());
            graphicsNode.setAttribute("load", s.toString() + slash + s.toString());
            graphicsNode.setAttribute("name", s.toString());
            root.appendChild(graphicsNode);
        }
    }
    writeDocument(doc, anlageFile);
    log.info("updating site tree successful!");
}

From source file:com.liferay.ide.alloy.core.webresources.PortalResourcesProvider.java

@Override
public File[] getResources(IWebResourcesContext context) {
    File[] retval = null;/*w w  w . j av  a2s  . com*/
    final IFile htmlFile = context.getHtmlFile();
    final ILiferayProject project = LiferayCore.create(htmlFile.getProject());

    if (htmlFile != null && project != null) {
        final ILiferayPortal portal = project.adapt(ILiferayPortal.class);

        if (portal != null && ProjectUtil.isPortletProject(htmlFile.getProject())) {
            final IPath portalDir = portal.getAppServerPortalDir();

            if (portalDir != null) {
                final IPath cssPath = portalDir.append("html/themes/_unstyled/css");

                if (cssPath.toFile().exists()) {
                    synchronized (fileCache) {
                        final Collection<File> cachedFiles = fileCache.get(cssPath);

                        if (cachedFiles != null) {
                            retval = cachedFiles.toArray(new File[0]);
                        } else {
                            final Collection<File> files = FileUtils.listFiles(cssPath.toFile(),
                                    new String[] { "css", "scss" }, true);

                            final Collection<File> cached = new HashSet<File>();

                            for (File file : files) {
                                if (file.getName().endsWith("scss")) {
                                    final File cachedFile = new File(file.getParent(),
                                            ".sass-cache/" + file.getName().replaceAll("scss$", "css"));

                                    if (cachedFile.exists()) {
                                        cached.add(file);
                                    }
                                }
                            }

                            files.removeAll(cached);

                            if (files != null) {
                                retval = files.toArray(new File[0]);
                            }

                            fileCache.put(cssPath, files);
                        }
                    }
                }
            }
        } else if (portal != null && ProjectUtil.isLayoutTplProject(htmlFile.getProject())) {
            // return the static css resource for layout template names based on the version

            final String version = portal.getVersion();

            try {
                if (version != null && (version.startsWith("6.0") || version.startsWith("6.1"))) {
                    retval = createLayoutHelperFiles("resources/layouttpl-6.1.css");
                } else if (version != null) {
                    retval = createLayoutHelperFiles("resources/layouttpl-6.2.css");
                }
            } catch (IOException e) {
                AlloyCore.logError("Unable to load layout template helper css files", e);
            }
        }
    }

    return retval;
}

From source file:com.liferay.ide.alloy.core.webresources_src.PortalResourcesProvider.java

@Override
public File[] getResources(IWebResourcesContext context) {
    File[] retval = null;/*w  w w.  j  av a  2 s .c  o  m*/
    IFile htmlFile = context.getHtmlFile();

    ILiferayProject project = LiferayCore.create(htmlFile.getProject());

    if ((htmlFile != null) && (project != null)) {
        ILiferayPortal portal = project.adapt(ILiferayPortal.class);

        if ((portal != null) && ProjectUtil.isPortletProject(htmlFile.getProject())) {
            IPath portalDir = portal.getAppServerPortalDir();

            if (portalDir != null) {
                IPath cssPath = portalDir.append("html/themes/_unstyled/css");

                if (FileUtil.exists(cssPath)) {
                    synchronized (_fileCache) {
                        Collection<File> cachedFiles = _fileCache.get(cssPath);

                        if (cachedFiles != null) {
                            retval = cachedFiles.toArray(new File[0]);
                        } else {
                            String types = new String[] { "css", "scss" };

                            Collection<File> files = FileUtils.listFiles(cssPath.toFile(), types, true);

                            Collection<File> cached = new HashSet<>();

                            for (File file : files) {
                                String fileName = file.getName();

                                if (fileName.endsWith("scss")) {
                                    File cachedFile = new File(file.getParent(),
                                            ".sass-cache/" + fileName.replaceAll("scss$", "css"));

                                    if (FileUtil.exists(cachedFile)) {
                                        cached.add(file);
                                    }
                                }
                            }

                            files.removeAll(cached);

                            if (files != null) {
                                retval = files.toArray(new File[0]);
                            }

                            _fileCache.put(cssPath, files);
                        }
                    }
                }
            }
        } else if ((portal != null) && ProjectUtil.isLayoutTplProject(htmlFile.getProject())) {

            // return the static css resource for layout template names based on the version

            String version = portal.getVersion();

            try {
                if ((version != null) && (version.startsWith("6.0") || version.startsWith("6.1"))) {
                    retval = _createLayoutHelperFiles("resources/layouttpl-6.1.css");
                } else if (version != null) {
                    retval = _createLayoutHelperFiles("resources/layouttpl-6.2.css");
                }
            } catch (IOException ioe) {
                AlloyCore.logError("Unable to load layout template helper css files", ioe);
            }
        }
    }

    return retval;
}

From source file:org.sakaiproject.tool.impl.ToolComponent.java

/**
 * Final initialization, once all dependencies are set.
 *//*from   w w  w.  ja  v a2 s  .co  m*/
public void init() {
    // compute the tools to hide: these are the stealth tools plus the hidden tools, minus the visible ones
    Collection<String> toHide = new HashSet<String>();

    if (m_stealthToolIds != null) {
        toHide.addAll(m_stealthToolIds);
    }

    if (m_hiddenToolIds != null) {
        toHide.addAll(m_hiddenToolIds);
    }

    if (m_visibleToolIds != null) {
        toHide.removeAll(m_visibleToolIds);
    }

    // collect the hiddens for logging
    StringBuilder hidden = new StringBuilder();

    if (!toHide.isEmpty()) {
        m_toolIdsToHide = new String[toHide.size()];
        int pos = 0;

        for (String i : toHide) {

            m_toolIdsToHide[pos] = i;

            hidden.append(m_toolIdsToHide[pos]);
            hidden.append(" ");

            pos++;
        }
        Arrays.sort(m_toolIdsToHide);
    }

    M_log.info("init(): hidden tools: " + hidden.toString());
}

From source file:org.clickframes.mavenplugin.TechspecRunnerPlugin.java

public void processProject1(Techspec techspec, Appspec appspec) throws IOException, MojoExecutionException {
    List<String> classpathEntries = getMavenRuntimeClasspathEntries();
    List<String> autoscanTemplatesFromClasspath = RuntimeManifestGenerator
            .getAutoscanTemplatesFromClasspath(classpathEntries);

    // snapshot 1
    Collection<File> snapshot1 = FileUtils.listFiles(new File("."), FileFilterUtils.trueFileFilter(),
            FileFilterUtils.trueFileFilter());

    TechspecRunner.run(techspec, appspec, autoscanTemplatesFromClasspath);

    // snapshot 2
    Collection<File> snapshot2 = FileUtils.listFiles(new File("."), FileFilterUtils.trueFileFilter(),
            FileFilterUtils.trueFileFilter());

    TechspecManifest techspecManifest;//from ww w .  jav a 2  s  .c  om

    File techspecManifestFile = new File(clickframesDirectory, "techspec-manifest.xml");

    if (!techspecManifestFile.exists()) {
        techspecManifest = TechspecManifest.create();
    } else {
        try {
            techspecManifest = TechspecManifest.readTechspecManifest(new FileInputStream(techspecManifestFile));
        } catch (JAXBException e) {
            throw new MojoExecutionException("Invalid manifest file", e);
        }
    }

    // add to manifest if present in snapshot2, but not in 1
    snapshot2.removeAll(snapshot1);

    for (File newFile : snapshot2) {
        techspecManifest.addOrUpdateEntry(techspec.getOutputDirectory(), newFile);
    }

    // save techspec manifest
    try {
        techspecManifestFile.getParentFile().mkdirs();
        FileUtils.writeStringToFile(techspecManifestFile, techspecManifest.toXml());
        getLog().info(snapshot2.size() + " changes detected, wrote " + techspecManifestFile.getCanonicalPath());
    } catch (JAXBException e) {
        throw new MojoExecutionException("Error saving manifest", e);
    }
}

From source file:ubic.gemma.core.analysis.report.WhatsNewServiceImpl.java

@Override
public WhatsNew getReport(Date date) {
    WhatsNew wn = new WhatsNew(date);

    Collection<Auditable> updatedObjects = auditEventService.getUpdatedSinceDate(date);
    wn.setUpdatedObjects(updatedObjects);
    WhatsNewServiceImpl.log.info(wn.getUpdatedObjects().size() + " updated objects since " + date);

    Collection<Auditable> newObjects = auditEventService.getNewSinceDate(date);
    wn.setNewObjects(newObjects);/*  w  ww.  j av a 2 s.  c  o  m*/
    WhatsNewServiceImpl.log.info(wn.getNewObjects().size() + " new objects since " + date);

    Collection<ExpressionExperiment> updatedExpressionExperiments = this
            .getExpressionExperiments(updatedObjects);
    Collection<ExpressionExperiment> newExpressionExperiments = this.getExpressionExperiments(newObjects);
    Collection<ArrayDesign> updatedArrayDesigns = this.getArrayDesigns(updatedObjects);
    Collection<ArrayDesign> newArrayDesigns = this.getArrayDesigns(newObjects);

    // don't show things that are "new" as "updated" too (if they were updated after being loaded)
    updatedExpressionExperiments.removeAll(newExpressionExperiments);
    updatedArrayDesigns.removeAll(newArrayDesigns);

    // build total, new and updated counts by taxon to display in data summary widget on front page
    wn.setNewEEIdsPerTaxon(this.getExpressionExperimentIdsByTaxon(newExpressionExperiments));
    wn.setUpdatedEEIdsPerTaxon(this.getExpressionExperimentIdsByTaxon(updatedExpressionExperiments));

    wn.setNewBioMaterialCount(this.getBioMaterialCount(newExpressionExperiments));

    return wn;
}

From source file:org.apache.ambari.server.checks.CheckDatabaseHelper.java

protected void checkServiceConfigs() {
    String GET_SERVICES_WITHOUT_CONFIGS_QUERY = "select c.cluster_name, service_name from clusterservices cs "
            + "join clusters c on cs.cluster_id=c.cluster_id "
            + "where service_name not in (select service_name from serviceconfig sc where sc.cluster_id=cs.cluster_id and sc.service_name=cs.service_name and sc.group_id is null)";
    String GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY = "select c.cluster_name, sc.service_name, sc.version from serviceconfig sc "
            + "join clusters c on sc.cluster_id=c.cluster_id "
            + "where service_config_id not in (select service_config_id from serviceconfigmapping) and group_id is null";
    String GET_STACK_NAME_VERSION_QUERY = "select c.cluster_name, s.stack_name, s.stack_version from clusters c "
            + "join stack s on c.desired_stack_id = s.stack_id";
    String GET_SERVICES_WITH_CONFIGS_QUERY = "select c.cluster_name, cs.service_name, cc.type_name, sc.version from clusterservices cs "
            + "join serviceconfig sc on cs.service_name=sc.service_name and cs.cluster_id=sc.cluster_id "
            + "join serviceconfigmapping scm on sc.service_config_id=scm.service_config_id "
            + "join clusterconfig cc on scm.config_id=cc.config_id and sc.cluster_id=cc.cluster_id "
            + "join clusters c on cc.cluster_id=c.cluster_id and sc.stack_id=c.desired_stack_id "
            + "where sc.group_id is null and sc.service_config_id=(select max(service_config_id) from serviceconfig sc2 where sc2.service_name=sc.service_name and sc2.cluster_id=sc.cluster_id) "
            + "group by c.cluster_name, cs.service_name, cc.type_name, sc.version";
    String GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY = "select c.cluster_name, cs.service_name, cc.type_name from clusterservices cs "
            + "join serviceconfig sc on cs.service_name=sc.service_name and cs.cluster_id=sc.cluster_id "
            + "join serviceconfigmapping scm on sc.service_config_id=scm.service_config_id "
            + "join clusterconfig cc on scm.config_id=cc.config_id and cc.cluster_id=sc.cluster_id "
            + "join clusterconfigmapping ccm on cc.type_name=ccm.type_name and cc.version_tag=ccm.version_tag and cc.cluster_id=ccm.cluster_id "
            + "join clusters c on ccm.cluster_id=c.cluster_id "
            + "where sc.group_id is null and sc.service_config_id = (select max(service_config_id) from serviceconfig sc2 where sc2.service_name=sc.service_name and sc2.cluster_id=sc.cluster_id) "
            + "group by c.cluster_name, cs.service_name, cc.type_name " + "having sum(ccm.selected) < 1";
    Multimap<String, String> clusterServiceMap = HashMultimap.create();
    Map<String, Map<String, String>> clusterStackInfo = new HashMap<>();
    Map<String, Multimap<String, String>> clusterServiceVersionMap = new HashMap<>();
    Map<String, Multimap<String, String>> clusterServiceConfigType = new HashMap<>();
    ResultSet rs = null;// ww  w.j  av a  2  s.c  o m

    try {
        Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                ResultSet.CONCUR_UPDATABLE);

        rs = statement.executeQuery(GET_SERVICES_WITHOUT_CONFIGS_QUERY);
        if (rs != null) {
            while (rs.next()) {
                clusterServiceMap.put(rs.getString("cluster_name"), rs.getString("service_name"));
            }

            for (String clusterName : clusterServiceMap.keySet()) {
                LOG.error("Service(s): {}, from cluster {} has no config(s) in serviceconfig table!",
                        StringUtils.join(clusterServiceMap.get(clusterName), ","), clusterName);
                errorAvailable = true;
            }

        }

        rs = statement.executeQuery(GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY);
        if (rs != null) {
            String serviceName = null, version = null, clusterName = null;
            while (rs.next()) {
                serviceName = rs.getString("service_name");
                clusterName = rs.getString("cluster_name");
                version = rs.getString("version");

                if (clusterServiceVersionMap.get(clusterName) != null) {
                    Multimap<String, String> serviceVersion = clusterServiceVersionMap.get(clusterName);
                    serviceVersion.put(serviceName, version);
                } else {
                    Multimap<String, String> serviceVersion = HashMultimap.create();
                    ;
                    serviceVersion.put(serviceName, version);
                    clusterServiceVersionMap.put(clusterName, serviceVersion);
                }
            }

            for (String clName : clusterServiceVersionMap.keySet()) {
                Multimap<String, String> serviceVersion = clusterServiceVersionMap.get(clName);
                for (String servName : serviceVersion.keySet()) {
                    LOG.error(
                            "In cluster {}, service config mapping is unavailable (in table serviceconfigmapping) for service {} with version(s) {}! ",
                            clName, servName, StringUtils.join(serviceVersion.get(servName), ","));
                    errorAvailable = true;
                }
            }

        }

        //get stack info from db
        rs = statement.executeQuery(GET_STACK_NAME_VERSION_QUERY);
        if (rs != null) {
            while (rs.next()) {
                Map<String, String> stackInfoMap = new HashMap<>();
                stackInfoMap.put(rs.getString("stack_name"), rs.getString("stack_version"));
                clusterStackInfo.put(rs.getString("cluster_name"), stackInfoMap);
            }
        }

        Set<String> serviceNames = new HashSet<>();
        Map<String, Map<Integer, Multimap<String, String>>> dbClusterServiceVersionConfigs = new HashMap<>();
        Multimap<String, String> stackServiceConfigs = HashMultimap.create();

        rs = statement.executeQuery(GET_SERVICES_WITH_CONFIGS_QUERY);
        if (rs != null) {
            String serviceName = null, configType = null, clusterName = null;
            Integer serviceVersion = null;
            while (rs.next()) {
                clusterName = rs.getString("cluster_name");
                serviceName = rs.getString("service_name");
                configType = rs.getString("type_name");
                serviceVersion = rs.getInt("version");

                serviceNames.add(serviceName);

                //collect data about mapped configs to services from db
                if (dbClusterServiceVersionConfigs.get(clusterName) != null) {
                    Map<Integer, Multimap<String, String>> dbServiceVersionConfigs = dbClusterServiceVersionConfigs
                            .get(clusterName);

                    if (dbServiceVersionConfigs.get(serviceVersion) != null) {
                        dbServiceVersionConfigs.get(serviceVersion).put(serviceName, configType);
                    } else {
                        Multimap<String, String> dbServiceConfigs = HashMultimap.create();
                        dbServiceConfigs.put(serviceName, configType);
                        dbServiceVersionConfigs.put(serviceVersion, dbServiceConfigs);
                    }
                } else {
                    Map<Integer, Multimap<String, String>> dbServiceVersionConfigs = new HashMap<>();
                    Multimap<String, String> dbServiceConfigs = HashMultimap.create();
                    dbServiceConfigs.put(serviceName, configType);
                    dbServiceVersionConfigs.put(serviceVersion, dbServiceConfigs);
                    dbClusterServiceVersionConfigs.put(clusterName, dbServiceVersionConfigs);
                }
            }
        }

        //compare service configs from stack with configs that we got from db
        for (Map.Entry<String, Map<String, String>> clusterStackInfoEntry : clusterStackInfo.entrySet()) {
            //collect required configs for all services from stack
            String clusterName = clusterStackInfoEntry.getKey();
            Map<String, String> stackInfo = clusterStackInfoEntry.getValue();
            String stackName = stackInfo.keySet().iterator().next();
            String stackVersion = stackInfo.get(stackName);
            Map<String, ServiceInfo> serviceInfoMap = ambariMetaInfo.getServices(stackName, stackVersion);
            for (String serviceName : serviceNames) {
                ServiceInfo serviceInfo = serviceInfoMap.get(serviceName);
                Set<String> configTypes = serviceInfo.getConfigTypeAttributes().keySet();
                for (String configType : configTypes) {
                    stackServiceConfigs.put(serviceName, configType);
                }
            }

            //compare required service configs from stack with mapped service configs from db
            Map<Integer, Multimap<String, String>> dbServiceVersionConfigs = dbClusterServiceVersionConfigs
                    .get(clusterName);
            for (Integer serviceVersion : dbServiceVersionConfigs.keySet()) {
                Multimap<String, String> dbServiceConfigs = dbServiceVersionConfigs.get(serviceVersion);
                for (String serviceName : dbServiceConfigs.keySet()) {
                    Collection<String> serviceConfigsFromStack = stackServiceConfigs.get(serviceName);
                    Collection<String> serviceConfigsFromDB = dbServiceConfigs.get(serviceName);
                    if (serviceConfigsFromDB != null && serviceConfigsFromStack != null) {
                        serviceConfigsFromStack.removeAll(serviceConfigsFromDB);
                        if (!serviceConfigsFromStack.isEmpty()) {
                            LOG.error(
                                    "Required config(s): {} is(are) not available for service {} with service config version {} in cluster {}",
                                    StringUtils.join(serviceConfigsFromStack, ","), serviceName,
                                    Integer.toString(serviceVersion), clusterName);
                            errorAvailable = true;
                        }
                    }
                }
            }
        }

        //getting services which has mapped configs which are not selected in clusterconfigmapping
        rs = statement.executeQuery(GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY);
        if (rs != null) {
            String serviceName = null, configType = null, clusterName = null;
            while (rs.next()) {
                clusterName = rs.getString("cluster_name");
                serviceName = rs.getString("service_name");
                configType = rs.getString("type_name");

                if (clusterServiceConfigType.get(clusterName) != null) {
                    Multimap<String, String> serviceConfigs = clusterServiceConfigType.get(clusterName);
                    serviceConfigs.put(serviceName, configType);
                } else {

                    Multimap<String, String> serviceConfigs = HashMultimap.create();
                    serviceConfigs.put(serviceName, configType);
                    clusterServiceConfigType.put(clusterName, serviceConfigs);

                }

            }
        }

        for (String clusterName : clusterServiceConfigType.keySet()) {
            Multimap<String, String> serviceConfig = clusterServiceConfigType.get(clusterName);
            for (String serviceName : serviceConfig.keySet()) {
                LOG.error("You have non selected configs: {} for service {} from cluster {}!",
                        StringUtils.join(serviceConfig.get(serviceName), ","), serviceName, clusterName);
                errorAvailable = true;
            }
        }
    } catch (SQLException e) {
        LOG.error("Exception occurred during complex service check procedure: ", e);
    } catch (AmbariException e) {
        LOG.error("Exception occurred during complex service check procedure: ", e);
    } finally {
        if (rs != null) {
            try {
                rs.close();
            } catch (SQLException e) {
                LOG.error("Exception occurred during result set closing procedure: ", e);
            }
        }
    }

}

From source file:jp.primecloud.auto.ui.WinServiceEdit.java

public void valueChangeValidate(ValueChangeEvent event, final ServerSelect serverSelect) {
    Set<String> selectedItemsProperty = (Set<String>) event.getProperty().getValue();
    final Collection<String> notSelectedList = new ArrayList<String>();
    for (Object item : serverSelect.getItemIds()) {
        notSelectedList.add(item.toString());
    }//from   w  ww.  j  a va  2  s . c o m
    notSelectedList.removeAll(selectedItemsProperty);

    Collection<Object> moveList = new ArrayList<Object>();
    //?STOPPED?????????
    for (String notSelectedItem : notSelectedList) {
        if (!StringUtils.contains(notSelectedItem.toUpperCase(),
                "(" + ComponentInstanceStatus.STOPPED.toString() + ")")
                && StringUtils.contains(notSelectedItem, "(")) {
            moveList.add(notSelectedItem);
        }
    }
    //?????????
    serverSelect.select(moveList);

    //?????????
    if (!moveList.isEmpty()) {
        String message = ViewMessages.getMessage("IUI-000039");
        DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"), message,
                Buttons.OK);
        dialog.setCallback(new DialogConfirm.Callback() {
            @Override
            public void onDialogResult(Result result) {
                if (result != Result.OK) {
                    return;
                }
            }
        });
        getApplication().getMainWindow().addWindow(dialog);
        return;
    }

    // ????????????????????????
    notSelectedList.removeAll(moveList);
    moveList = new ArrayList<Object>();

    for (String notSelectedItem : notSelectedList) {
        int index = notSelectedItem.indexOf(" ");
        String instanceName = index == -1 ? notSelectedItem : notSelectedItem.substring(0, index);
        // pcc-api??????????
        ComponentService componentService = BeanContext.getBean(ComponentService.class);
        moveList = componentService.checkAttachDisk(ViewContext.getFarmNo(), componentNo, instanceName,
                notSelectedItem, moveList);
    }

    if (!moveList.isEmpty()) {
        // ?????????????
        serverSelect.select(moveList);

        // 
        String message = ViewMessages.getMessage("IUI-000096");
        DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.error"), message,
                Buttons.OK);
        dialog.setCallback(new DialogConfirm.Callback() {
            @Override
            public void onDialogResult(Result result) {
                if (result != Result.OK) {
                    return;
                }
            }
        });
        getApplication().getMainWindow().addWindow(dialog);
        return;
    }
}