List of usage examples for java.util List removeAll
boolean removeAll(Collection<?> c);
From source file:info.raack.appliancelabeler.data.JDBCDatabase.java
public List<EnergyMonitor> getEnergyMonitors() { List<EnergyMonitor> monitors = jdbcTemplate.query(queryForExistingEnergyMonitors, energyMonitorRowMapper); monitors.removeAll(Collections.singletonList(null)); return monitors; }
From source file:org.gbif.portal.web.controller.dataset.IndexingHistoryController.java
/** * Calculate the processing time for a history of activities. * @param hideNonstarters/*from w ww. j a v a 2s. co m*/ * @param processShowThreshold * @param activityHistory * @return */ private long calculateProcessingTime(boolean hideNonstarters, long processShowThreshold, List<LoggedActivityDTO> activityHistory) { List<LoggedActivityDTO> toBeRemoved = new ArrayList<LoggedActivityDTO>(); long totalHarvesting = 0; for (LoggedActivityDTO laDTO : activityHistory) { if (hideNonstarters && (laDTO.getDurationInMillisecs() == null || laDTO.getDurationInMillisecs() < processShowThreshold)) { toBeRemoved.add(laDTO); } if (laDTO.getDurationInMillisecs() != null) { totalHarvesting += laDTO.getDurationInMillisecs(); } } activityHistory.removeAll(toBeRemoved); return totalHarvesting; }
From source file:com.che.software.testato.business.IterationManager.java
/** * Retrieves the remaining scripts count for given prioritization and item. * //from w ww .ja v a2s . c om * @author Clement HELIOU (clement.heliou@che-software.com). * @param prioritization the given prioritization. * @param parentItemId the parent item id. Null if we are looking for the first level * @return the resulting count. * @since July, 2011. * @throws IterationSearchManagerException if an error occurs during the search. */ public int getRemainingScriptsCountFromPrioritization(Prioritization prioritization, Integer parentItemId) throws IterationSearchManagerException { LOGGER.debug("getRemainingScriptsCountFromPrioritization(" + prioritization.getHierarchyId() + "," + parentItemId + ")."); int count = 0; ScriptSearch searchBean = new ScriptSearch(prioritization.getHierarchyId()); searchBean.setParentScriptItem((null != parentItemId) ? parentItemId : 0); try { List<Script> scripts = scriptDAO.searchScript(searchBean); if (null != scripts && !scripts.isEmpty()) { IterationSearch iterationSearchBean = new IterationSearch(); iterationSearchBean.setScriptId(scripts.get(0).getScriptId()); List<Iteration> iterations = iterationDAO.searchIteration(iterationSearchBean); if (null == iterations || iterations.isEmpty()) { count++; } else { searchBean = new ScriptSearch(prioritization.getHierarchyId()); searchBean.setIterationId(iterations.get(0).getIterationId()); searchBean.setSelected(false); scripts.removeAll(scriptDAO.searchScript(searchBean)); } for (Script script : scripts) { ScriptItemSearch scriptItemSearchBean = new ScriptItemSearch(); scriptItemSearchBean.setScriptId(script.getScriptId()); for (ScriptItem item : scriptItemDAO.searchScriptItem(scriptItemSearchBean)) { count += getRemainingScriptsCountFromPrioritization(prioritization, item.getScriptItemId()); } } } } catch (Exception e) { LOGGER.error("Error during the remaining scripts counting from current prioritization.", e); } return count; }
From source file:com.foya.noms.service.st.ST009Service.java
/** * siteBuildApply//w ww . j a v a 2 s . c om * * @param siteBuildApply * @return */ @Transactional public void update(SiteBuildApplyDTO siteBuildApply, String[] orderIdArray, String mdUser, String siteStatus) throws UpdateFailException, Exception { Date mdTime = new Date(); String workId = siteBuildApply.getWorkId(); for (String orderId : orderIdArray) { log.debug("orderIdArray : " + orderId); } // TbSiteMain main = siteMainDao.findByPk(siteBuildApply.getSiteId()); TbSiteWork siteWorkTarget = workDao.findByPk(workId); TbSiteWork siteWork = this.getSiteWorkBySiteBuildApplyDTO(siteBuildApply, workId); siteWork.setMD_USER(mdUser); siteWork.setMD_TIME(mdTime); siteWork.setEQP_MODEL_ID(main.getEQP_MODEL_ID()); siteWork.setCOVERAGE_TYPE(main.getCOVERAGE_TYPE()); siteWork.setBTS_CONFIG(main.getBTS_CONFIG()); siteWork.setDONOR_SITE(main.getDONOR_SITE()); siteWork.setFEEDERLESS(main.getFEEDERLESS()); siteWork.setMASTER_SITE(main.getMASTER_SITE()); siteWork.setOS_TYPE(PurchaseOrderType.P.name()); String[] ignoreProperties = { "WORK_TYPE", "CR_USER", "CR_TIME", "APP_DEPT", "APL_USER", "APL_TIME", "END_TIME", "SR_ID", "SR_COVER_RANG", "END_DATE", "CPL_NO", "PERMIT_NO", "LICENSE_NO" }; BeanUtils.copyProperties(siteWork, siteWorkTarget, ignoreProperties); int siteWorkItem = workDao.update(siteWorkTarget); if (siteWorkItem == 0) { log.error("siteWorkItem update count= " + siteWorkItem + " , workId = " + siteWork.getWORK_ID()); throw new UpdateFailException(""); } // if (orderIdArray != null) { TbSiteWorkOrderExample example = new TbSiteWorkOrderExample(); example.createCriteria().andWORK_IDEqualTo(workId); List<TbSiteWorkOrder> workOrderList = workOrderDao.findByConditions(example); List<String> orderIdList_source = new ArrayList<String>(); for (TbSiteWorkOrder workOrder : workOrderList) { orderIdList_source.add(workOrder.getORDER_ID()); } List<String> orderIdList_target = new ArrayList<String>(); //???isActive=Y for (String orderId : orderIdArray) { TbSiteWorkOrder siteWorkOrder = workOrderDao.findOrderByPk(orderId); siteWorkOrder.setIS_ACTIVE("Y"); siteWorkOrder.setORDER_ID(orderId); siteWorkOrder.setPRIORITY(siteBuildApply.getPriority()); siteWorkOrder.setMD_USER(mdUser); siteWorkOrder.setMD_TIME(mdTime); siteWorkOrder.setORDER_TYPE(siteBuildApply.getSiteOrderType()); int workOrderItem = workOrderDao.updateSelective(siteWorkOrder); if (workOrderItem == 0) { log.error("workOrderItem update count= " + workOrderItem + " , orderId = " + siteWorkOrder.getORDER_ID()); throw new UpdateFailException(""); } orderIdList_target.add(orderId); } //DB??isActive=N List<String> orderIdList_isNotActive = new ArrayList<String>(orderIdList_source); orderIdList_isNotActive.removeAll(orderIdList_target); //???isActive=N if (orderIdList_isNotActive.size() > 0) { for (String orderId : orderIdList_isNotActive) { TbSiteWorkOrder siteWorkOrder = workOrderDao.findOrderByPk(orderId); siteWorkOrder.setIS_ACTIVE("N"); siteWorkOrder.setORDER_ID(orderId); siteWorkOrder.setPRIORITY(siteBuildApply.getPriority()); siteWorkOrder.setMD_USER(mdUser); siteWorkOrder.setMD_TIME(mdTime); int workOrderItem = workOrderDao.updateSelective(siteWorkOrder); if (workOrderItem == 0) { log.error("workOrderItem update count= " + workOrderItem + " , orderId = " + siteWorkOrder.getORDER_ID()); throw new UpdateFailException(""); } } } } // ? TbSiteMain siteMain = this.getSiteMainBySiteWork(siteWork, mdTime, siteStatus); int mainItem = 0; siteMain.setMD_USER(mdUser); siteMain.setMD_TIME(mdTime); mainItem = siteMainDao.update(siteMain); if (mainItem == 0) { log.error("mainItem update count= " + mainItem + " , siteId = " + siteMain.getSITE_ID()); throw new UpdateFailException(""); } }
From source file:com.aurel.track.exchange.track.importer.TrackImportBL.java
/** * Get the key based matches for the dropdowns * //from w w w . j a v a 2 s . co m * @param externalDropDowns * @param internalDropDowns * @return */ private static Map<String, Map<Integer, Integer>> getDropDownMatcherMap( SortedMap<String, List<ISerializableLabelBean>> externalDropDowns, Map<String, List<ISerializableLabelBean>> internalDropDowns, Map<Integer, Integer> fieldsMatcherMap, Set<Integer> presentFieldIDs) throws ImportExceptionList { ImportExceptionList importExceptionList = new ImportExceptionList(); Map<String, Map<Integer, Integer>> matcherMap = new HashMap<String, Map<Integer, Integer>>(); matcherMap.put(ExchangeFieldNames.FIELD, fieldsMatcherMap); /** * the roles assignments will be added only to the new projects */ List<Integer> internalProjectIDsBeforeMatch = GeneralUtils.createIntegerListFromBeanList( internalDropDowns.get(MergeUtil.mergeKey(SystemFields.INTEGER_PROJECT, null))); /** * the custom lists should be in the correct order because of the * hierarchical relations between them */ List<ISerializableLabelBean> listBeans = externalDropDowns.get(ExchangeFieldNames.LIST); if (listBeans != null) { Collections.sort(listBeans, new Comparator<ISerializableLabelBean>() { public int compare(ISerializableLabelBean o1, ISerializableLabelBean o2) { // suppose the objectID order is enough return o1.getObjectID().compareTo(o2.getObjectID()); } }); } externalDropDowns.put(ExchangeFieldNames.LIST, listBeans); /** * prepare the options by list */ Map<Integer, List<ISerializableLabelBean>> externalOptionsMap = new HashMap<Integer, List<ISerializableLabelBean>>(); List<ISerializableLabelBean> optionBeans = externalDropDowns.get(ExchangeFieldNames.OPTION); if (optionBeans != null) { Iterator<ISerializableLabelBean> itrOptionBeans = optionBeans.iterator(); while (itrOptionBeans.hasNext()) { TOptionBean optionBean = (TOptionBean) itrOptionBeans.next(); Integer listID = optionBean.getList(); List<ISerializableLabelBean> optionBeansList = externalOptionsMap.get(listID); if (optionBeansList == null) { optionBeansList = new ArrayList<ISerializableLabelBean>(); externalOptionsMap.put(listID, optionBeansList); } optionBeansList.add(optionBean); } } List<ISerializableLabelBean> externalList; List<ISerializableLabelBean> internalList; List<String> firstKeys = new ArrayList<String>(); // projectType should be matched before project firstKeys.add(ExchangeFieldNames.PROJECTTYPE); // systemStates should be matched before account, release, project firstKeys.add(ExchangeFieldNames.SYSTEMSTATE); // costcenter should be matched before account and department! firstKeys.add(ExchangeFieldNames.COSTCENTER); // account firstKeys.add(ExchangeFieldNames.ACCOUNT); // department should be matched before person but after costcenter firstKeys.add(ExchangeFieldNames.DEPARTMENT); // role should be matched before role assignments firstKeys.add(ExchangeFieldNames.ROLE); // priority and severity should be matched before person (email reminder // level) firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_PRIORITY, null)); firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_SEVERITY, null)); // status should be matched before project (initial status) firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_STATE, null)); // issue types (and project and projectType) should be matched before // fieldConfig firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_ISSUETYPE, null)); // person should be matched before project (default responsible, default // manager) firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_PERSON, null)); // project should be matched before release, but after person, state, // issueType, priority, severity system state and project type firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_PROJECT, null)); firstKeys.add(MergeUtil.mergeKey(SystemFields.INTEGER_RELEASE, null)); // lists should be matched after project (the project specific lists) firstKeys.add(ExchangeFieldNames.LIST); /** * process the entities which should be processed first */ for (String key : firstKeys) { externalList = externalDropDowns.get(key); // remove the processed entities to not to process again in // remaining entities loop // externalDropDowns.remove(key); internalList = internalDropDowns.get(key); try { addEntityMatchMap(externalList, internalList, key, matcherMap); } catch (ImportExceptionList e) { importExceptionList.getErrorDataList().addAll(e.getErrorDataList()); } } /** * all additional (non-fieldType specific) entities should be processed * now because they can't be broken in parts by MergeUtil like the * remaining entities */ /** * process the custom list options (after the lists are matched) */ if (listBeans != null) { // by now the lists are already matched Map<Integer, Integer> listMatches = matcherMap.get(ExchangeFieldNames.LIST); Iterator<ISerializableLabelBean> itrListBean = listBeans.iterator(); while (itrListBean.hasNext()) { TListBean listBean = (TListBean) itrListBean.next(); Integer externalListID = listBean.getObjectID(); Integer internalListID = listMatches.get(externalListID); // options are not loaded in the internal dropdowns but are // loaded now for each list separately try { addEntityMatchMap(externalOptionsMap.get(externalListID), (List) OptionBL.loadDataSourceByList(internalListID), ExchangeFieldNames.OPTION, matcherMap); } catch (ImportExceptionList e) { importExceptionList.getErrorDataList().addAll(e.getErrorDataList()); } } // externalDropDowns.remove(ExchangeFieldNames.OPTION); } /** * process the fieldConfigs */ List<ISerializableLabelBean> externalFieldConfigBeans = externalDropDowns .get(ExchangeFieldNames.FIELDCONFIG); List<TFieldConfigBean> internalFieldConfigBeans = FieldConfigBL.loadAllForFields(presentFieldIDs); try { addEntityMatchMap(externalFieldConfigBeans, (List) internalFieldConfigBeans, ExchangeFieldNames.FIELDCONFIG, matcherMap); } catch (ImportExceptionList e) { importExceptionList.getErrorDataList().addAll(e.getErrorDataList()); } Map<Integer, Integer> fieldConfigMatch = matcherMap.get(ExchangeFieldNames.FIELDCONFIG); // externalDropDowns.remove(ExchangeFieldNames.FIELDCONFIG); // gather the internalFieldConfigIDs for the field settings List<Integer> internalFieldConfigIDs = new ArrayList<Integer>(); if (fieldConfigMatch != null) { Iterator<Integer> itrFieldConfig = fieldConfigMatch.values().iterator(); while (itrFieldConfig.hasNext()) { Integer fieldConfigID = itrFieldConfig.next(); internalFieldConfigIDs.add(fieldConfigID); } } /** * process the fieldSettings */ List<ISerializableLabelBean> externalOptionSettingsBeans = externalDropDowns .get(ExchangeFieldNames.OPTIONSETTINGS); List<TOptionSettingsBean> internalOptionSettingsBeans = OptionSettingsBL .loadByConfigList(internalFieldConfigIDs); try { addEntityMatchMap(externalOptionSettingsBeans, (List) internalOptionSettingsBeans, ExchangeFieldNames.OPTIONSETTINGS, matcherMap); } catch (ImportExceptionList e) { importExceptionList.getErrorDataList().addAll(e.getErrorDataList()); } // externalDropDowns.remove(ExchangeFieldNames.OPTIONSETTINGS); List<ISerializableLabelBean> externalTextBoxSettingsBeans = externalDropDowns .get(ExchangeFieldNames.TEXTBOXSETTINGS); List<TTextBoxSettingsBean> internalTextBoxSettingsBeans = TextBoxSettingsBL .loadByConfigList(internalFieldConfigIDs); try { addEntityMatchMap(externalTextBoxSettingsBeans, (List) internalTextBoxSettingsBeans, ExchangeFieldNames.TEXTBOXSETTINGS, matcherMap); } catch (ImportExceptionList e) { importExceptionList.getErrorDataList().addAll(e.getErrorDataList()); } // externalDropDowns.remove(ExchangeFieldNames.TEXTBOXSETTINGS); // TODO implement special handling for general settings: specific for // each custom picker /* * List<ISerializableLabelBean> externalGeneralSettingsBeans = * externalDropDowns.get(ExchangeFieldNames.GENERALSETTINGS); * List<TGeneralSettingsBean> internalGeneralSettingsBeans = * generalSettingsDAO.loadByConfigList(internalFieldConfigIDs); * addEntityMatchMap(externalGeneralSettingsBeans, * (List)internalGeneralSettingsBeans, * ExchangeFieldNames.GENERALSETTINGS, matcherMap); */ // externalDropDowns.remove(ExchangeFieldNames.GENERALSETTINGS); /** * process role assignments (after role, person and project match) */ List<Integer> internalProjectIDsAfterMatch = GeneralUtils .createIntegerListFromBeanList(ProjectBL.loadAll()); // add the role assignments only for new projects internalProjectIDsAfterMatch.removeAll(internalProjectIDsBeforeMatch); if (internalProjectIDsAfterMatch != null && !internalProjectIDsAfterMatch.isEmpty()) { Map<Integer, Integer> projectMatch = matcherMap.get(MergeUtil.mergeKey(SystemFields.PROJECT, null)); List<ISerializableLabelBean> externalAccessControlLists = externalDropDowns.get(ExchangeFieldNames.ACL); if (externalAccessControlLists != null) { for (ISerializableLabelBean serializableLabelBean : externalAccessControlLists) { TAccessControlListBean externalAccessControlListBean = (TAccessControlListBean) serializableLabelBean; Integer externalProjectID = externalAccessControlListBean.getProjectID(); Integer internalProjectID = projectMatch.get(externalProjectID); if (internalProjectID != null && internalProjectIDsAfterMatch.contains(internalProjectID)) { externalAccessControlListBean.saveBean(externalAccessControlListBean, matcherMap); } } } } // the workItemIDs of the exported issues will be added during the // processing of each workItem Map<Integer, Integer> workItemIDsMatcherMap = new HashMap<Integer, Integer>(); matcherMap.put(MergeUtil.mergeKey(SystemFields.INTEGER_ISSUENO, null), workItemIDsMatcherMap); // but an attempt will be made to match the only linked but not // explicitly exported workItemIDs through the uuids List<ISerializableLabelBean> externalLinkedItems = externalDropDowns.get(ExchangeFieldNames.LINKED_ITEMS); if (externalLinkedItems != null) { // get the uuid list of the only linked external workItems List<String> externalLinkedUuidsList = new ArrayList<String>(); Iterator<ISerializableLabelBean> itrExternalLinkedItems = externalLinkedItems.iterator(); while (itrExternalLinkedItems.hasNext()) { ISerializableLabelBean externalLinkedItem = itrExternalLinkedItems.next(); externalLinkedUuidsList.add(externalLinkedItem.getUuid()); } if (!externalLinkedUuidsList.isEmpty()) { // get the internal workItems by the linked external uuids Map<String, Integer> internalUuidToObjectIDMap = new HashMap<String, Integer>(); List<TWorkItemBean> internalWorkItemBeanList = workItemDAO.loadByUuids(externalLinkedUuidsList); if (internalWorkItemBeanList != null && !internalWorkItemBeanList.isEmpty()) { // found internal workItems by external uuids Iterator<TWorkItemBean> itrWorkItemBean = internalWorkItemBeanList.iterator(); while (itrWorkItemBean.hasNext()) { TWorkItemBean workItemBean = itrWorkItemBean.next(); internalUuidToObjectIDMap.put(workItemBean.getUuid(), workItemBean.getObjectID()); } itrExternalLinkedItems = externalLinkedItems.iterator(); while (itrExternalLinkedItems.hasNext()) { // match the extarnal and internal workItemIDs by uuids ISerializableLabelBean externalLinkedItem = itrExternalLinkedItems.next(); Integer externObjectID = externalLinkedItem.getObjectID(); Integer internObjectID = internalUuidToObjectIDMap.get(externalLinkedItem.getUuid()); if (internObjectID != null) { workItemIDsMatcherMap.put(externObjectID, internObjectID); } } } } } // force reloading all lists LookupContainer.resetAll(); if (importExceptionList.containsException()) { throw importExceptionList; } return matcherMap; }
From source file:de.dentrassi.pm.storage.web.channel.ChannelController.java
protected List<DeployGroup> getGroupsForChannel(final Channel channel) { final List<DeployGroup> groups = this.deployAuthService.listGroups(0, -1); groups.removeAll(channel.getDeployGroups()); Collections.sort(groups, DeployGroup.NAME_COMPARATOR); return groups; }
From source file:com.thinkbiganalytics.ingest.TableMergeSyncSupport.java
/** * Returns the list of columns that are common to both the source and target tables. * * <p>The column names are quoted and escaped for use in a SQL query.</p> * * @param sourceSchema the name of the source table schema or database * @param sourceTable the name of the source table * @param targetSchema the name of the target table schema or database * @param targetTable the name of the target table * @param partitionSpec the partition specifications, or {@code null} if none * @return the columns for a SELECT statement */// w ww. j ava2 s. c o m protected String[] getSelectFields(@Nonnull final String sourceSchema, @Nonnull final String sourceTable, @Nonnull final String targetSchema, @Nonnull final String targetTable, @Nullable final PartitionSpec partitionSpec) { List<String> srcFields = resolveTableSchema(sourceSchema, sourceTable); List<String> destFields = resolveTableSchema(targetSchema, targetTable); // Find common fields destFields.retainAll(srcFields); // Eliminate any partition columns if (partitionSpec != null) { destFields.removeAll(partitionSpec.getKeyNames()); } String[] fields = destFields.toArray(new String[0]); for (int i = 0; i < fields.length; i++) { fields[i] = HiveUtils.quoteIdentifier(fields[i]); } return fields; }
From source file:io.lavagna.service.BulkOperationService.java
private ImmutablePair<List<Integer>, List<Integer>> addLabelOrUpdate(String projectShortName, List<Integer> cardIds, LabelValue value, User user, String labelName, LabelDomain labelDomain) { List<Integer> filteredCardIds = keepCardIdsInProject(cardIds, projectShortName); int labelId = findBy(projectShortName, labelName, labelDomain).getId(); Map<Integer, List<LabelAndValue>> cardsWithDueDate = keepCardWithMatching(filteredCardIds, new FilterByLabelId(labelId)); List<Integer> updatedCardIds = new ArrayList<>(); // to update only if the label value has changed for (LabelAndValue lv : flatten(cardsWithDueDate.values())) { if (!lv.labelValue().getValue().equals(value)) { labelService.updateLabelValue(lv.labelValue().newValue(lv.getLabelType(), value), user, new Date()); updatedCardIds.add(lv.getLabelValueCardId()); }//from w w w . j a v a 2 s . c o m } // to add filteredCardIds.removeAll(cardsWithDueDate.keySet()); labelService.addLabelValueToCards(labelId, filteredCardIds, value, user, new Date()); return ImmutablePair.of(updatedCardIds, filteredCardIds); }
From source file:com.haulmont.cuba.web.gui.components.WebGroupTable.java
protected Object[] getNewColumnOrder(Object[] newGroupProperties) { //noinspection unchecked List<Object> allProps = new ArrayList<>(containerDatasource.getContainerPropertyIds()); List<Object> newGroupProps = Arrays.asList(newGroupProperties); allProps.removeAll(newGroupProps); allProps.addAll(0, newGroupProps);// w w w . j ava2 s. com return allProps.toArray(); }
From source file:fr.inria.atlanmod.instantiator.neoEMF.GenericMetamodelConfig.java
@Override public ImmutableSet<EClass> possibleRootEClasses() { List<EClass> eClasses = new LinkedList<EClass>(); // creating a subtypes map Map<EClass, Set<EClass>> eSubtypesMap = computeSubtypesMap(); // Eclasses.filter( instance of EClass && not abstract && not interface) for (Iterator<EObject> it = metamodelResource.getAllContents(); it.hasNext();) { EObject eObject = (EObject) it.next(); if (eObject instanceof EClass) { EClass eClass = (EClass) eObject; if (!eClass.isAbstract() && !eClass.isInterface()) { eClasses.add(eClass);/*from w w w.j av a 2 s . co m*/ } } } //copying the list of eClasses List<EClass> result = new LinkedList<EClass>(eClasses); // Collections.copy(result , eClasses); // iterating eClasses and removing elements (along with subtypes) being // subject to a container reference for (EClass cls : eClasses) { for (EReference cont : cls.getEAllContainments()) { Set<EClass> list = eSubtypesClosure(eSubtypesMap, (EClass) cont.getEType()); if (list.size() == 0) { result.remove((EClass) cont.getEType()); } else { result.removeAll(list); } } } return ImmutableSet.copyOf(result); }