Example usage for java.util Set removeAll

List of usage examples for java.util Set removeAll

Introduction

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

Prototype

boolean removeAll(Collection<?> c);

Source Link

Document

Removes from this set all of its elements that are contained in the specified collection (optional operation).

Usage

From source file:com.ephesoft.dcma.webservice.EphesoftWebServiceAPI.java

/**
 * To delete Batch Instance.//from w ww  . j av  a2 s. c o  m
 * @param identifier {@link String}
 * @param resp {@link HttpServletResponse}
 * @param req {@link HttpServletRequest}
 * @return
 */
@RequestMapping(value = "/deleteBatchInstance/{batchInstanceIdentifier}", method = RequestMethod.GET)
@ResponseBody
public String deleteBatchInstance(@PathVariable("batchInstanceIdentifier") final String identifier,
        final HttpServletResponse resp, final HttpServletRequest req) {
    LOGGER.info("Start processing web service for delete batch instance");
    String respStr = WebServiceUtil.EMPTY_STRING;
    boolean isSuccess = false;
    if (identifier != null && !identifier.isEmpty()) {
        final BatchInstance batchInstance = biService.getBatchInstanceByIdentifier(identifier);
        try {
            // Status for which a batch can be deleted:
            if (batchInstance != null && (batchInstance.getStatus().equals(BatchInstanceStatus.ERROR)
                    || batchInstance.getStatus().equals(BatchInstanceStatus.READY_FOR_REVIEW)
                    || batchInstance.getStatus().equals(BatchInstanceStatus.READY_FOR_VALIDATION)
                    || batchInstance.getStatus().equals(BatchInstanceStatus.RUNNING))) {

                Set<String> batchInstanceRoles = biService.getRolesForBatchInstance(batchInstance);
                Set<String> loggedInUserRole = getUserRoles(req);
                if (isSuperAdmin(req) || batchInstanceRoles.removeAll(loggedInUserRole)) {
                    LOGGER.info("Deleting the batch instance:" + identifier);
                    pluginPropertiesService.clearCache(identifier);
                    jbpmService.deleteProcessInstance(batchInstance.getProcessInstanceKey());
                    batchInstance.setStatus(BatchInstanceStatus.DELETED);
                    biService.updateBatchInstance(batchInstance);
                    final File uncFile = new File(batchInstance.getUncSubfolder());
                    LOGGER.info("uncFile for the batch instance:" + uncFile);
                    if (null != uncFile) {
                        FileUtils.deleteDirectoryAndContentsRecursive(uncFile);
                        LOGGER.info(
                                "Deleted the unc folders of batch instance:" + identifier + " successfully.");
                    }
                    isSuccess = true;
                } else {
                    respStr = "User is not authorized to perform operation on this batch instance."
                            + identifier;
                    LOGGER.error(SERVER_ERROR_MSG + respStr);
                }
            } else {
                respStr = "Either Batch instance does not exist with batch instance identifier " + identifier
                        + " or batch exists with incorrect status to be deleted. Batch instance should be of status:-"
                        + "ERROR, READY_FOR_REVIEW, READY_FOR_VALIDATION, RUNNING";
                LOGGER.error(SERVER_ERROR_MSG + respStr);
            }
        } catch (final Exception e) {
            respStr = "Error while deleting batch instance id:" + identifier
                    + ".Please check logs for further details." + e;
            LOGGER.error(SERVER_ERROR_MSG + respStr);

        }
    }
    if (!respStr.isEmpty()) {
        try {
            resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, respStr);
            LOGGER.error(SERVER_ERROR_MSG + respStr);
        } catch (final IOException ioe) {
            LOGGER.info(ERROR_WHILE_SENDING_ERROR_RESPONSE_TO_CLIENT + ioe, ioe);

        }
    }
    return (isSuccess ? "Batch deleted successfully." : "Failure while deleting batch instance.");
}

From source file:com.ephesoft.dcma.webservice.util.WebServiceHelper.java

/**
 * This Web Service Helper restarts the batch Instance whose identifier is passed as an argument. This whill throw an exception if
 * it could not restart the Batch else would process the request and return a success/failure Message
 * //from ww  w.  jav  a2s. c  o  m
 * @param identifier {@link String} The identity of the Batch instance Batch Instance Identifier
 * @param moduleName {@link String} name of the Module from which the batch is supposed to be restarted
 * @param loggedInUserRole {@link Set} The roles assigned to the logged in user
 * @param isSuperAdmin {@link Boolean} The flag which determines whether the user is a super admin or not
 * @return Success or error message after processing the request. Which is the information regarding the process
 * @throws UnAuthorisedAccessException When the user is not authenticated to make the request
 * @throws ValidationException When the input parameters are not validated
 * @throws InternalServerException When the Server could not process the request due to some reason or some lock acquired on the
 *             batch class
 */
public String restartBatchInstance(final String identifier, final String moduleName,
        final Set<String> loggedInUserRole, final boolean isSuperAdmin)
        throws UnAuthorisedAccessException, ValidationException, InternalServerException {
    boolean isRestarted = false;
    String moduleWorkflowNameToRestart = null;
    if (!EphesoftStringUtil.isNullOrEmpty(moduleName)) {
        if (StringUtils.isNotBlank(identifier)) {
            boolean isSuccess = false;
            LOGGER.info("Start processing of restarting batch for batch instance:" + identifier);
            final BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(identifier);
            // only batch instance with these status can be restarted
            if (batchInstance == null) {
                throw new ValidationException(
                        WebServiceConstants.INVALID_BATCH_INSTANCE_IDENTIFIER_MESSAGE
                                + getAdditionalInfo(identifier),
                        createUnprocessableEntityRestError(
                                WebServiceConstants.INVALID_BATCH_INSTANCE_IDENTIFIER_MESSAGE
                                        + getAdditionalInfo(identifier),
                                WebServiceConstants.INVALID_BATCH_INSTANCE_IDENTIFIER_CODE));
            } else if (BatchInstanceStatus.DELETED.equals(batchInstance.getStatus())) {
                LOGGER.error("Error response at server: "
                        + WebServiceConstants.BATCH_INSTANCE_ALREADY_DELETED_MESSAGE
                        + getAdditionalInfo(identifier));
                throw new ValidationException(
                        WebServiceConstants.BATCH_INSTANCE_ALREADY_DELETED_MESSAGE
                                + getAdditionalInfo(identifier),
                        createUnprocessableEntityRestError(
                                WebServiceConstants.BATCH_INSTANCE_ALREADY_DELETED_MESSAGE
                                        + getAdditionalInfo(identifier),
                                WebServiceConstants.BATCH_INSTANCE_ALREADY_DELETED_CODE));

            } else if (!BatchInstanceStatus.restartableStatusList().contains(batchInstance.getStatus())) {
                throw new ValidationException(
                        WebServiceConstants.BATCH_INSTANCE_CANNOT_BE_RESTARTED_MESSAGE
                                + getAdditionalInfo(identifier + " " + batchInstance.getStatus()),
                        createUnprocessableEntityRestError(
                                WebServiceConstants.BATCH_INSTANCE_CANNOT_BE_RESTARTED_MESSAGE
                                        + getAdditionalInfo(identifier + " " + batchInstance.getStatus()),
                                WebServiceConstants.BATCH_INSTANCE_CANNOT_BE_DELETED_CODE));
            } else if (StringUtils.isNotBlank(batchInstance.getCurrentUser())) {
                // the batch is locked by some user, cannot be
                // restarted/deleted
                LOGGER.error("Error response at server: " + WebServiceConstants.BATCH_INSTANCE_LOCKED_MESSAGE
                        + getAdditionalInfo(identifier));
                throw new InternalServerException(
                        WebServiceConstants.BATCH_INSTANCE_LOCKED_MESSAGE + getAdditionalInfo(identifier),
                        createUnprocessableEntityRestError(
                                WebServiceConstants.BATCH_INSTANCE_LOCKED_MESSAGE
                                        + getAdditionalInfo(identifier),
                                WebServiceConstants.BATCH_INSTANCE_LOCKED_CODE));
            } else {
                LOGGER.info(
                        "Batch is in the valid state to restart.Restarting batch instance:" + batchInstance);
                final Set<String> batchInstanceRoles = batchInstanceService
                        .getRolesForBatchInstance(batchInstance);
                if (isSuperAdmin || batchInstanceRoles.removeAll(loggedInUserRole)) {
                    LOGGER.info("User is authorized to perform operation on the batch instance:" + identifier);
                    final String batchClassIdentifier = batchInstanceService
                            .getBatchClassIdentifier(identifier);
                    final String executedBatchInstanceModules = batchInstance.getExecutedModules();
                    // if some of the modules are already executed
                    if (StringUtils.isNotBlank(executedBatchInstanceModules)) {
                        final String[] executedModulesArray = executedBatchInstanceModules.split(";");
                        if (batchClassIdentifier != null) {
                            LOGGER.info("Restarting the batch instance for the  batch class:"
                                    + batchClassIdentifier);
                            final BatchClassModule batchClassModuleItem = batchClassModuleService
                                    .getBatchClassModuleByName(batchClassIdentifier, moduleName);
                            if (batchClassModuleItem != null) {
                                for (final String executedModule : executedModulesArray) {
                                    if (executedModule.equalsIgnoreCase(
                                            String.valueOf(batchClassModuleItem.getModule().getId()))) {
                                        moduleWorkflowNameToRestart = batchClassModuleItem.getWorkflowName();
                                        isSuccess = true;
                                        break;
                                    }
                                }
                            }
                        }
                    } else {
                        // if none of the modules has executed
                        isSuccess = true;
                        final List<BatchClassModule> batchClassModuleList = batchInstance.getBatchClass()
                                .getBatchClassModules();
                        moduleWorkflowNameToRestart = batchClassModuleList.get(0).getWorkflowName();
                        LOGGER.info("Restarting the batch from first module." + moduleWorkflowNameToRestart
                                + " as the executed module list is empty.");
                    }
                    final boolean isZipSwitchOn = batchSchemaService.isZipSwitchOn();
                    LOGGER.info("Zipped Batch XML switch is: " + isZipSwitchOn);

                    if (isSuccess) {
                        LOGGER.info("All parameters for restarting the batch are valid.");
                        try {
                            isRestarted = processRestartingBatchInternal(identifier,
                                    moduleWorkflowNameToRestart, batchInstance, batchClassIdentifier,
                                    isZipSwitchOn);
                        } catch (final Exception exception) {
                            LOGGER.error("Error in restarting batch instance " + identifier + exception,
                                    exception);

                            // update the batch instance to ERROR state and
                            // get Exception
                            if (null != workflowService) {
                                workflowService.handleErrorBatch(batchInstance, exception,
                                        exception.getMessage());
                            }
                        }
                    } else {
                        final List<BatchClassModule> batchClassModules = batchClassModuleService
                                .getAllBatchClassModulesByIdentifier(batchClassIdentifier);
                        final String[] executedModulesArray = executedBatchInstanceModules.split(";");
                        final Set<String> executedWorkflows = new HashSet<String>();
                        String batchInstanceModuleName = "";
                        for (final String executedModuleId : executedModulesArray) {
                            for (final BatchClassModule batchClassModule : batchClassModules) {
                                if (batchClassModule != null && executedModuleId.equalsIgnoreCase(
                                        String.valueOf(batchClassModule.getModule().getId()))) {
                                    batchInstanceModuleName = batchClassModule.getModule().getName();
                                    executedWorkflows.add(batchClassModule.getWorkflowName());
                                    break;
                                }
                            }
                        }
                        final String errorMessage = WebServiceConstants.INVALID_MODULE_NAME_TO_RESTART_MESSAGE
                                + (StringUtils.isNotBlank(batchInstanceModuleName)
                                        ? "Batch instance is currently in " + batchInstanceModuleName
                                                + " state. It cannot be restarted from " + moduleName
                                        : "");
                        LOGGER.error("Error response at server:" + errorMessage);
                        throw new ValidationException(errorMessage, createUnprocessableEntityRestError(
                                errorMessage, WebServiceConstants.INVALID_MODULE_NAME_TO_RESTART_CODE));
                    }
                } else {
                    throw new UnAuthorisedAccessException();
                }
            }
        } else {
            throw new ValidationException(WebServiceConstants.NO_INSTANCE_NAME,
                    createUnprocessableEntityRestError(WebServiceConstants.NO_INSTANCE_NAME,
                            WebServiceConstants.NO_INSTANCE_NAME_CODE));
        }
        if (!isRestarted) {
            throw new InternalServerException(WebServiceConstants.MODULE_CANNOT_BE_RESTARTED_MESSAGE,
                    createUnprocessableEntityRestError(WebServiceConstants.MODULE_CANNOT_BE_RESTARTED_MESSAGE,
                            WebServiceConstants.MODULE_CANNOT_BE_RESTARTED_CODE));
        }
    } else {
        throw new ValidationException(WebServiceConstants.NO_MODULE_NAME, createUnprocessableEntityRestError(
                WebServiceConstants.NO_MODULE_NAME, WebServiceConstants.NO_MODULE_NAME_CODE));
    }
    return WebServiceConstants.BATCH_RESTARTED_SUCCESS_MESSAGE + getAdditionalInfo(identifier);
}

From source file:edu.stanford.epad.epadws.queries.DefaultEpadOperations.java

@Override
public Set<String> getDeletedDcm4CheeSeries() {
    Set<String> allReadyDcm4CheeSeriesUIDs = dcm4CheeDatabaseOperations.getAllDcm4CheeSeriesUIDs();
    Set<String> allEPADSeriesUIDs = epadDatabaseOperations.getAllSeriesUIDsFromEPadDatabase();
    //log.info("Series in dcm4chee:" + allReadyDcm4CheeSeriesUIDs.size()+ " Series in epad:" + allEPADSeriesUIDs.size());
    allEPADSeriesUIDs.removeAll(allReadyDcm4CheeSeriesUIDs);

    return allEPADSeriesUIDs;
}

From source file:be.fgov.kszbcss.rhq.websphere.support.measurement.PMIMeasurementHandler.java

public void getValues(WebSphereServer server, MeasurementReport report,
        Map<String, MeasurementScheduleRequest> requests) {
    purgeFailedAttemptsToEnableStat();//from ww  w.ja va2 s .  c om

    StatDescriptor descriptor;
    WSStats stats;
    boolean isFreshDescriptor;
    synchronized (this) {
        descriptor = this.descriptor;
        if (descriptor == null) {
            log.debug("Initial load of descriptor");
            descriptor = loadDescriptor();
            if (descriptor == null) {
                return;
            }
            this.descriptor = descriptor;
            isFreshDescriptor = true;
        } else {
            isFreshDescriptor = false;
        }
    }
    while (true) {
        if (log.isDebugEnabled()) {
            log.debug("Attempting to get stats for " + descriptor);
        }
        try {
            stats = server.getWSStats(descriptor);
        } catch (Exception ex) {
            log.error("Failed to get statistics object", ex);
            return;
        }
        if (stats == null) {
            if (isFreshDescriptor) {
                log.debug("Stats not available");
                return;
            } else {
                synchronized (this) {
                    log.debug("Refreshing descriptor");
                    descriptor = loadDescriptor();
                    if (Arrays.equals(this.descriptor.getPath(), descriptor.getPath())) {
                        log.debug("Descriptor didn't change; abandon.");
                        return;
                    } else {
                        log.debug("Descriptor changed; retrying...");
                        this.descriptor = descriptor;
                        isFreshDescriptor = true;
                    }
                }
            }
        } else {
            break;
        }
    }

    PmiModuleConfig pmiModuleConfig;
    try {
        pmiModuleConfig = server.getPmiModuleConfig(stats);
    } catch (Exception ex) {
        log.error("Failed to get PMI module configuration", ex);
        return;
    }
    Set<Integer> statisticsToEnable = null;

    for (Map.Entry<String, MeasurementScheduleRequest> entry : requests.entrySet()) {
        MeasurementScheduleRequest request = entry.getValue();
        String name = request.getName();
        String statisticName = entry.getKey();
        if (log.isDebugEnabled()) {
            log.debug("Starting to get value for " + name);
        }
        int dataId = pmiModuleConfig.getDataId(statisticName);
        if (dataId == -1) {
            if (log.isDebugEnabled()) {
                log.debug("Could not find statistic with name " + statisticName + " as is (stats type "
                        + stats.getStatsType()
                        + ") in the PMI module configuration; attempting to find a matching prefixed name among the existing statistics");
            }
            // WebSphere 8.5 prefixes some stat names with a given string within a given type;
            // most of the time, this prefix will be the shortened type name (i.e. QueueStats),
            // but sometimes it isn't, which makes generalization impossible. The prefixed format being
            // a stable <Prefix>.<StatisticName>, we will seek for a ".statisticName" in all
            // available PmiDataInfo in the considered pmiConfigModule.
            for (PmiDataInfo pdi : pmiModuleConfig.listAllData()) {
                if (pdi.getName().endsWith("." + statisticName)) {
                    dataId = pdi.getId();
                    break;
                }
            }
        }
        if (dataId == -1) {
            log.error("Could not find statistic with name " + statisticName + " (stats type "
                    + stats.getStatsType() + ") in the PMI module configuration");
            continue;
        }
        // For some WSStats objects, the statistic names don't match the names used by PMI.
        // Therefore we translate all names to data IDs. This also makes it easier to
        // automatically enable the statistics if necessary.
        WSStatistic statistic = stats.getStatistic(dataId);
        if (statistic == null) {
            if (failedAttemptsToEnableStat.containsKey(dataId)) {
                if (log.isDebugEnabled()) {
                    Date nextAttempt = new Date(
                            failedAttemptsToEnableStat.get(dataId) + STAT_ENABLE_ATTEMPT_INTERVAL);
                    log.debug("Statistic with name " + statisticName + " (ID " + dataId
                            + ") not available, but a previous attempt to enable the statistic failed; will retry at "
                            + SimpleDateFormat.getInstance().format(nextAttempt));
                }
            } else {
                log.info("Statistic with name " + statisticName + " (ID " + dataId
                        + ") not available; will attempt to enable it");
                if (statisticsToEnable == null) {
                    statisticsToEnable = new HashSet<Integer>();
                }
                statisticsToEnable.add(dataId);
            }
            continue;
        }
        if (log.isDebugEnabled()) {
            log.debug("Loaded Statistic with name " + statisticName + " (ID " + dataId + ") and type "
                    + statistic.getClass().getName());
        }
        double value;
        if (statistic instanceof WSCountStatistic) {
            value = ((WSCountStatistic) statistic).getCount();
        } else if (statistic instanceof WSRangeStatistic) {
            value = getValue(statisticName, (WSRangeStatistic) statistic);
        } else if (statistic instanceof WSAverageStatistic) {
            WSAverageStatistic currentStatistic = (WSAverageStatistic) statistic;
            WSAverageStatistic prevStatistic = lastStats.get(statisticName);
            lastStats.put(statisticName, currentStatistic);
            if (log.isDebugEnabled()) {
                if (prevStatistic == null) {
                    log.debug("Previous value: <not available>");
                } else {
                    log.debug("Previous value: " + dumpStatistic(prevStatistic));
                }
                log.debug("Current value: " + dumpStatistic(currentStatistic));
            }
            // We need to detect a statistic reset in a reliable way. Checking delta(count) > 0 is not sufficient.
            // In fact, delta(count) < 0 implies that the statistic has been reset, but it can happen that
            // after a statistic reset, delta(count) > 0. In this case, delta(total) may be negative, so that
            // we end up with a negative measurement. Therefore we also compare the startTime values to check
            // that the two statistics have the same baseline.
            if (prevStatistic == null || currentStatistic.getStartTime() != prevStatistic.getStartTime()) {
                continue;
            } else {
                long countDelta = currentStatistic.getCount() - prevStatistic.getCount();
                if (countDelta > 0) {
                    value = ((double) (currentStatistic.getTotal() - prevStatistic.getTotal()))
                            / ((double) countDelta);
                } else {
                    continue;
                }
            }
        } else {
            log.error("Unknown or unsupported statistic type " + statistic.getClass().getName());
            continue;
        }
        if (log.isDebugEnabled()) {
            log.debug("Adding measurement for " + name + "; value=" + value);
        }
        report.addData(new MeasurementDataNumeric(request, value));
    }
    if (statisticsToEnable != null) {
        statisticsToEnable.removeAll(server.enableStatistics(descriptor, statisticsToEnable));
        if (!statisticsToEnable.isEmpty()) {
            Long currentTime = System.currentTimeMillis();
            for (Integer dataId : statisticsToEnable) {
                failedAttemptsToEnableStat.put(dataId, currentTime);
            }
            if (log.isDebugEnabled()) {
                log.debug("failedAttemptsToEnable = " + failedAttemptsToEnableStat);
            }
        }
    }
}

From source file:edu.stanford.epad.epadws.queries.DefaultEpadOperations.java

/**
 * Called by {@link Dcm4CheeDatabaseWatcher} to see if new series have been uploaded to DCM4CHEE that ePAD does not
 * know about./*from   w w  w .j  a va  2s  . c  o m*/
 * <p>
 * We might want to consider getting series from dcm4chee where their upload time (DCM4CHEESeries.createdTime) is
 * after ePAD's processing time (EPADSeries.createdTime), indicating a repeat upload.
 */
@Override
public List<DCM4CHEESeries> getNewDcm4CheeSeries() {
    List<DCM4CHEESeries> newDcm4CheeSeries = new ArrayList<DCM4CHEESeries>();

    Set<String> allReadyDcm4CheeSeriesUIDs = dcm4CheeDatabaseOperations.getAllReadyDcm4CheeSeriesUIDs();
    Set<String> allEPADSeriesUIDs = epadDatabaseOperations.getAllSeriesUIDsFromEPadDatabase();
    //log.info("Series in dcm4chee:" + allReadyDcm4CheeSeriesUIDs.size()+ " Series in epad:" + allEPADSeriesUIDs.size());
    allReadyDcm4CheeSeriesUIDs.removeAll(allEPADSeriesUIDs);

    List<String> newSeriesUIDs = new ArrayList<String>(allReadyDcm4CheeSeriesUIDs);
    //if (newSeriesUIDs.size() > 0) log.info("newSeriesUIDs:" + newSeriesUIDs.size());

    for (String seriesUID : newSeriesUIDs) {
        DCM4CHEESeries dcm4CheeSeries = Dcm4CheeQueries.getSeries(seriesUID);
        if (dcm4CheeSeries != null) {
            newDcm4CheeSeries.add(dcm4CheeSeries);
        } else
            log.warning("Could not find new series " + seriesUID + " in dcm4chee");
    }
    return newDcm4CheeSeries;
}

From source file:gov.nih.nci.security.dao.AuthorizationDAOImpl.java

public Set getGroups(String userId) throws CSObjectNotFoundException {
    Session s = null;//from w  w w.  j a va2s .c  o  m
    Set groups = new HashSet();
    try {
        s = HibernateSessionFactoryHelper.getAuditSession(sf);

        User user = (User) this.getObjectByPrimaryKey(s, User.class, new Long(userId));
        groups = user.getGroups();

        Iterator groupIterator = groups.iterator();
        Set removedGroups = new HashSet();
        while (groupIterator.hasNext()) {
            Group g = (Group) groupIterator.next();
            if (g.getApplication().getApplicationId().intValue() != this.application.getApplicationId()
                    .intValue()) {
                removedGroups.add(g);
            }
        }
        groups.removeAll(removedGroups);
        List list = new ArrayList();
        Iterator toSortIterator = groups.iterator();
        while (toSortIterator.hasNext()) {
            list.add(toSortIterator.next());
        }
        Collections.sort(list);
        groups.clear();
        groups.addAll(list);

        log.debug("The result size:" + groups.size());

    } catch (Exception ex) {
        log.error(ex);
        if (log.isDebugEnabled())
            log.debug("Authorization|||getGroups|Failure|Error in obtaining Groups for User Id " + userId + "|"
                    + ex.getMessage());
        throw new CSObjectNotFoundException(
                "An error occurred while obtaining Associated Groups for the User\n" + ex.getMessage(), ex);
    } finally {
        try {
            s.close();
        } catch (Exception ex2) {
            if (log.isDebugEnabled())
                log.debug("Authorization|||getGroups|Failure|Error in Closing Session |" + ex2.getMessage());
        }
    }
    if (log.isDebugEnabled())
        log.debug(
                "Authorization|||getGroups|Success|Successful in obtaining Groups for User Id " + userId + "|");
    return groups;

}

From source file:com.ah.ui.actions.hiveap.HiveApUpdateAction.java

private void storeIdListToSession(String sessionKey, Set<Long> newIds, Set<Long> pageIds) {
    if (null != pageIds) {
        Set<Long> previousIds = getIdListFromSession(sessionKey);
        if (null != previousIds) {
            previousIds.removeAll(pageIds);
        }//from w  w  w . ja  v a 2s.c om
    }
    if (null != newIds) {
        Set<Long> previousIds = getIdListFromSession(sessionKey);
        if (null != previousIds) {
            previousIds.addAll(newIds);
        } else {
            MgrUtil.setSessionAttribute(sessionKey, newIds);
        }
    }
}

From source file:com.stratelia.webactiv.beans.admin.Admin.java

/**
 * @param spaces list of authorized spaces built by this method
 * @param componentsId list of components' id (base to get authorized spaces)
 * @param space a space candidate to be in authorized spaces list
 *///from  ww w. j a va2 s.com
void addAuthorizedSpace(Set<String> spaces, Set<String> componentsId, SpaceInstLight space) {
    SilverTrace.debug("admin", "Admin.addAuthorizedSpace", "root.MSG_GEN_ENTER_METHOD",
            "#componentIds = " + componentsId.size());
    if (space != null && !SpaceInst.STATUS_REMOVED.equals(space.getStatus())
            && !spaces.contains(space.getShortId())) {
        SilverTrace.debug("admin", "Admin.addAuthorizedSpace", PARAM_MSG_KEY, "space = " + space.getFullId());
        String spaceId = getDriverSpaceId(space.getFullId());
        spaces.add(spaceId);
        componentsId.removeAll(TreeCache.getComponentIds(spaceId));
        if (!space.isRoot()) {
            String fatherId = getDriverSpaceId(space.getFatherId());
            if (!spaces.contains(fatherId)) {
                SpaceInstLight parent = TreeCache.getSpaceInstLight(fatherId);
                addAuthorizedSpace(spaces, componentsId, parent);
            }
        }
    }
}

From source file:com.net2plan.interfaces.networkDesign.NetPlan.java

/**
 * <p>Returns the set of nodes that are up (iteration order correspond to ascending order of indexes).</p>
 *
 * @return The {@code Set} of nodes that are up
 *//* w w  w .j  av  a  2  s . co  m*/
public Set<Node> getNodesUp() {
    Set<Node> res = new HashSet<Node>(nodes);
    res.removeAll(cache_nodesDown);
    return res;
}