List of usage examples for java.util List removeAll
boolean removeAll(Collection<?> c);
From source file:bammerbom.ultimatecore.spongeapi.UltimateCommands.java
@Override public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) { if (Overrider.checkOverridden(sender, cmd, label, args)) { return null; }//from ww w .j av a 2 s.c o m List<String> rtrn = null; if (label.startsWith("ultimatecore:")) { label = label.replaceFirst("ultimatecore:", ""); } for (UltimateCommand cmdr : cmds) { if (cmdr.getName().equals(label) || cmdr.getAliases().contains(label)) { try { rtrn = cmdr.onTabComplete(sender, cmd, label, args, args[args.length - 1], args.length - 1); } catch (Exception ex) { ErrorLogger.log(ex, "Failed tabcompleting for " + label); } break; } } if (rtrn == null) { rtrn = new ArrayList<>(); for (Player p : r.getOnlinePlayers()) { rtrn.add(p.getName()); } } if (!StringUtil.nullOrEmpty(args[args.length - 1])) { List<String> remv = new ArrayList<>(); for (String s : rtrn) { if (!StringUtils.startsWithIgnoreCase(s, args[args.length - 1])) { remv.add(s); } } rtrn.removeAll(remv); } return rtrn; }
From source file:ca.sqlpower.wabit.AbstractWabitObjectTest.java
/** * Tests that calling//from www .j a va2s.co m * {@link SPPersister#persistObject(String, String, String, int)} for a * session persister will create a new object and set all of the properties * on the object. */ public void testPersisterAddsNewObject() throws Exception { SPObject wo = getObjectUnderTest(); wo.setMagicEnabled(false); WabitSessionPersister persister = new WabitSessionPersister("test persister", session, session.getWorkspace(), true); WorkspacePersisterListener listener = new WorkspacePersisterListener(session, persister, true); WabitSessionPersisterSuperConverter converterFactory = new WabitSessionPersisterSuperConverter( new StubWabitSession(new StubWabitSessionContext()), new WabitWorkspace(), true); List<PropertyDescriptor> settableProperties; settableProperties = Arrays.asList(PropertyUtils.getPropertyDescriptors(wo.getClass())); //Set all possible values to new values for testing. Set<String> propertiesToIgnoreForEvents = getPropertiesToIgnoreForEvents(); for (PropertyDescriptor property : settableProperties) { Object oldVal; if (propertiesToIgnoreForEvents.contains(property.getName())) continue; if (property.getName().equals("parent")) continue; //Changing the parent causes headaches. try { oldVal = PropertyUtils.getSimpleProperty(wo, property.getName()); // check for a setter if (property.getWriteMethod() == null) continue; } catch (NoSuchMethodException e) { logger.debug( "Skipping non-settable property " + property.getName() + " on " + wo.getClass().getName()); continue; } Object newVal = valueMaker.makeNewValue(property.getPropertyType(), oldVal, property.getName()); try { logger.debug("Setting property '" + property.getName() + "' to '" + newVal + "' (" + newVal.getClass().getName() + ")"); BeanUtils.copyProperty(wo, property.getName(), newVal); } catch (InvocationTargetException e) { logger.debug("(non-fatal) Failed to write property '" + property.getName() + " to type " + wo.getClass().getName()); } } SPObject parent = wo.getParent(); int oldChildCount = parent.getChildren().size(); listener.transactionStarted(null); listener.childRemoved( new SPChildEvent(parent, wo.getClass(), wo, parent.getChildren().indexOf(wo), EventType.REMOVED)); listener.transactionEnded(null); //persist the object wo.setParent(parent); listener.transactionStarted(null); listener.childAdded( new SPChildEvent(parent, wo.getClass(), wo, parent.getChildren().size(), EventType.ADDED)); listener.transactionEnded(null); //the object must now be added to the super parent assertEquals(oldChildCount, parent.getChildren().size()); SPObject persistedObject = parent.getChildren().get(parent.childPositionOffset(wo.getClass())); persistedObject.setMagicEnabled(false); //check all the properties are what we expect on the new object Set<String> ignorableProperties = getPropertiesToNotPersistOnObjectPersist(); List<String> settablePropertyNames = new ArrayList<String>(); for (PropertyDescriptor pd : settableProperties) { settablePropertyNames.add(pd.getName()); } settablePropertyNames.removeAll(ignorableProperties); for (String persistedPropertyName : settablePropertyNames) { Class<?> classType = null; for (PropertyDescriptor propertyDescriptor : settableProperties) { if (propertyDescriptor.getName().equals(persistedPropertyName)) { classType = propertyDescriptor.getPropertyType(); break; } } logger.debug("Persisted object is of type " + persistedObject.getClass()); Object oldVal = PropertyUtils.getSimpleProperty(wo, persistedPropertyName); Object newVal = PropertyUtils.getSimpleProperty(persistedObject, persistedPropertyName); //XXX will replace this later List<Object> additionalVals = new ArrayList<Object>(); if (wo instanceof OlapQuery && persistedPropertyName.equals("currentCube")) { additionalVals.add(((OlapQuery) wo).getOlapDataSource()); } Object basicOldVal = converterFactory.convertToBasicType(oldVal, additionalVals.toArray()); Object basicNewVal = converterFactory.convertToBasicType(newVal, additionalVals.toArray()); logger.debug("Property " + persistedPropertyName + ". oldVal is \"" + basicOldVal + "\" but newVal is \"" + basicNewVal + "\""); assertPersistedValuesAreEqual(oldVal, newVal, basicOldVal, basicNewVal, classType); } }
From source file:at.ac.tuwien.dsg.quelle.elasticityQuantification.engines.RequirementsMatchingEngine.java
/** * Tries to match as many requirements on a single ServiceUnit. If the unit * can have multiple Optional_Associations to Quality, Resource, each * possible association is inspected, and the SMALLEST (in terms of * quality/resources) that matches the requirements is chosen (intuitively * this should be the cheapest) in a greedy manner. Then, for all the * MANDATORY service unit associations, their concrete configurations are * chosen, and the number of requirements that they match also reported * * 1 Requirements group means that it should be instantiated on one cloud * offered ServiceUnit//from w ww.j av a 2 s . co m * * @param unitToMatch * @param requirements * @return */ public ServiceUnitOptions analyzeServiceUnitMatching(CloudOfferedService unitToMatch, Requirements requirements) { //hold matched requirements by type Map<Metric.MetricType, List<Requirement>> matchedRequirementsMap = new EnumMap<Metric.MetricType, List<Requirement>>( Metric.MetricType.class); matchedRequirementsMap.put(Metric.MetricType.RESOURCE, new ArrayList<Requirement>()); matchedRequirementsMap.put(Metric.MetricType.COST, new ArrayList<Requirement>()); matchedRequirementsMap.put(Metric.MetricType.QUALITY, new ArrayList<Requirement>()); matchedRequirementsMap.put(Metric.MetricType.ELASTICITY, new ArrayList<Requirement>()); ServiceUnitOptions serviceUnitOptions = new ServiceUnitOptions(unitToMatch); // serviceUnitOptions.setMatchedRequirementsByServiceUnit(matchedRequirementsMap); serviceUnitOptions.setOverallUnMatched(new ArrayList<Requirement>(requirements.getRequirements())); if (requirements == null || unitToMatch == null) { return serviceUnitOptions; } //1 split requirements by type: Cost, Quality, Resource, Elasticity Map<Metric.MetricType, List<Requirement>> requirementsMapByType = new EnumMap<Metric.MetricType, List<Requirement>>( Metric.MetricType.class); for (Requirement requirement : requirements.getRequirements()) { Metric.MetricType requirementType = requirement.getMetric().getType(); if (requirementsMapByType.containsKey(requirementType)) { requirementsMapByType.get(requirementType).add(requirement); } else { List<Requirement> list = new ArrayList<Requirement>(); list.add(requirement); requirementsMapByType.put(requirementType, list); } } //2 match requirements //2.1 match Resource requirements if (requirementsMapByType.containsKey(Metric.MetricType.RESOURCE)) { List<Requirement> matchedRequirements = matchedRequirementsMap.get(Metric.MetricType.RESOURCE); List<Requirement> resourceRequirements = requirementsMapByType.get(Metric.MetricType.RESOURCE); //2.1.1 match requirements on fixed resources for (Resource resource : unitToMatch.getResourceProperties()) { Map<Metric, MetricValue> resourceProperties = resource.getProperties(); List<Requirement> requirementsMatchedForThisResource = matchRequirementsToProperties( resourceProperties, resourceRequirements); resourceRequirements.removeAll(requirementsMatchedForThisResource); matchedRequirements.addAll(requirementsMatchedForThisResource); serviceUnitOptions.addMatchedRequirements(requirementsMatchedForThisResource); } //the rest of the unmatched requirements are matched on the optional resources, //and the optional resource which matches the most requirements is selected //I need set cover here //2.1.2 match requirements on optional resources //first on mandatory reqs for (ElasticityCapability optionalResourceCapability : unitToMatch.getResourceAssociations()) { //get optional resources BECAUSE it is more tricky to get them //the unitToMatch.getOptionalResourceAssociations() ACTUAllY returns the target of the ElasticityCharacteristic, //which is a generic Entity: Example Computing. //The ResourceDAO returns example Computing x64, Computing x86 // List<Resource> optionalResourcesOptions = ResourceDAO.geResourceOptionsForServiceUnitNode(unitToMatch.getId(), optionalResource.getId()); //now match the remaining requirements on these options and sort them after how many req they fulfill Set<RequirementsMatchingReport<Resource>> matchingReports = matchOptionalResourceConfiguration( optionalResourceCapability.getMandatoryDependencies(), resourceRequirements); if (!matchingReports.isEmpty()) { serviceUnitOptions.addResourceOptions(optionalResourceCapability, matchingReports); //remove the requirements matched by the LARGEST match //get iterator next as the first in the matchingReports must be the BEST match (sorted in decreasing nr of matched policies) List<Requirement> matched = matchingReports.iterator().next().matchedRequirements .get(Metric.MetricType.RESOURCE); serviceUnitOptions.addMatchedRequirements(matched); resourceRequirements.removeAll(matched); } } for (ElasticityCapability optionalResourceCapability : unitToMatch.getResourceAssociations()) { //get optional resources BECAUSE it is more tricky to get them //the unitToMatch.getOptionalResourceAssociations() ACTUAllY returns the target of the ElasticityCharacteristic, //which is a generic Entity: Example Computing. //The ResourceDAO returns example Computing x64, Computing x86 // List<Resource> optionalResourcesOptions = ResourceDAO.geResourceOptionsForServiceUnitNode(unitToMatch.getId(), optionalResource.getId()); //now match the remaining requirements on these options and sort them after how many req they fulfill Set<RequirementsMatchingReport<Resource>> matchingReports = matchOptionalResourceConfiguration( optionalResourceCapability.getOptionalDependencies(), resourceRequirements); if (!matchingReports.isEmpty()) { serviceUnitOptions.addResourceOptions(optionalResourceCapability, matchingReports); //remove the requirements matched by the LARGEST match //get iterator next as the first in the matchingReports must be the BEST match (sorted in decreasing nr of matched policies) List<Requirement> matched = matchingReports.iterator().next().matchedRequirements .get(Metric.MetricType.RESOURCE); serviceUnitOptions.addMatchedRequirements(matched); resourceRequirements.removeAll(matched); } } } //2.2 match Quality requirements if (requirementsMapByType.containsKey(Metric.MetricType.QUALITY)) { List<Requirement> matchedRequirements = matchedRequirementsMap.get(Metric.MetricType.QUALITY); List<Requirement> qualityRequirements = requirementsMapByType.get(Metric.MetricType.QUALITY); //2.2.1 match requirements on fixed Quality for (Quality quality : unitToMatch.getQualityProperties()) { Map<Metric, MetricValue> properties = quality.getProperties(); List<Requirement> requirementsMatchedForThisResource = matchRequirementsToProperties(properties, qualityRequirements); qualityRequirements.removeAll(requirementsMatchedForThisResource); matchedRequirements.addAll(requirementsMatchedForThisResource); serviceUnitOptions.addMatchedRequirements(requirementsMatchedForThisResource); } //the rest of the unmatched requirements are matched on the optional resources, //and the optional resource which matches the most requirements is selected //I need set cover here //2.2.2 match requirements on optional Quality //first on mandatory quality for (ElasticityCapability optionalQualityCapability : unitToMatch.getQualityAssociations()) { //now match the remaining requirements on these options and sort them after how many req they fulfill Set<RequirementsMatchingReport<Quality>> matchingReports = matchOptionalQualityConfiguration( optionalQualityCapability.getMandatoryDependencies(), qualityRequirements); if (!matchingReports.isEmpty()) { serviceUnitOptions.addQualityOptions(optionalQualityCapability, matchingReports); //remove the requirements matched by the LARGEST match List<Requirement> matched = matchingReports.iterator().next().matchedRequirements .get(Metric.MetricType.QUALITY); serviceUnitOptions.addMatchedRequirements(matched); qualityRequirements.removeAll(matched); } } for (ElasticityCapability optionalQualityCapability : unitToMatch.getQualityAssociations()) { //now match the remaining requirements on these options and sort them after how many req they fulfill Set<RequirementsMatchingReport<Quality>> matchingReports = matchOptionalQualityConfiguration( optionalQualityCapability.getOptionalDependencies(), qualityRequirements); if (!matchingReports.isEmpty()) { serviceUnitOptions.addQualityOptions(optionalQualityCapability, matchingReports); //remove the requirements matched by the LARGEST match List<Requirement> matched = matchingReports.iterator().next().matchedRequirements .get(Metric.MetricType.QUALITY); serviceUnitOptions.addMatchedRequirements(matched); qualityRequirements.removeAll(matched); } } } //2.3 Get all MANDATORY association ServiceUnits and check how much do they fill requirements. for (ElasticityCapability serviceUnitElasticityCapability : unitToMatch.getServiceUnitAssociations()) { Requirements r = new Requirements(); r.setRequirements(serviceUnitOptions.getOverallUnMatched()); for (Unit entity : serviceUnitElasticityCapability.getMandatoryDependencies()) { ServiceUnitOptions options = analyzeServiceUnitMatching((CloudOfferedService) entity, r); if (options != null) { serviceUnitOptions.addMandatoryServiceUnitRaport(options); } } } // 2.4 The requirements left unmatched are matched with OptionalServiceUnit Associations //thus, for example, if one requires a VM with X resources, and Y IOperformance, //it could get a VM which optionally could have EBS, if (!serviceUnitOptions.getOverallUnMatched().isEmpty()) { for (ElasticityCapability optionalServiceUnitElasticityCapability : unitToMatch .getServiceUnitAssociations()) { Requirements r = new Requirements(); r.setRequirements(serviceUnitOptions.getOverallUnMatched()); //go and analyze each optional target from the elasticity stuff. not good though. I need to select one or the other? //TODO: structure reports after ElasticityCapabilities. Example: for capability A we have Reports for units B,C,D for (Unit entity : optionalServiceUnitElasticityCapability.getOptionalDependencies()) { ServiceUnitOptions options = analyzeServiceUnitMatching((CloudOfferedService) entity, r); if (options != null) { serviceUnitOptions.addOptionalServiceUnitRaport(options); } } } } // //2.5 match Cost requirements (cost needs to also include the cost of the MANDATORY associations // //TODO: to be implemented (Continue) // match to cost properties // if (requirementsMapByType.containsKey(Metric.MetricType.COST)) { // List<Requirement> matchedRequirements = matchedRequirementsMap.get(Metric.MetricType.COST); // List<Requirement> costRequirements = requirementsMapByType.get(Metric.MetricType.COST); // // List<CostFunction> costFunctions = unitToMatch.getCostFunctions(); // // for (CostFunction costFunction : unitToMatch.getCostFunctions()) { // for (CostElement element : costFunction.getCostElements()) { // Metric costMetric = element.getCostMetric(); // Map<MetricValue, Double> properties = element.getCostIntervalFunction(); // // // List<Requirement> requirementsMatchedForThisResource = new ArrayList<Requirement>(); // // Iterator<Requirement> requirementsIterator = costRequirements.iterator(); // while (requirementsIterator.hasNext()) { // Requirement requirement = requirementsIterator.next(); // // Metric requirementMetric = requirement.getMetric(); // if (costMetric.equals(requirementMetric)) { // boolean respectsAllConditions = true; // // for (Condition condition : requirement.getConditions()) { // //consider we only evaluate cost, not interval // boolean conditionIsRespected = true; // for (Double d : properties.values()) { // MetricValue costValue = new MetricValue(d); // if (condition.isRespectedByValue(costValue)) { // conditionIsRespected = true; // break; // } // } // if (!conditionIsRespected) { // respectsAllConditions = false; // break; // } // } // if (respectsAllConditions) { // //add requirement to matched requirements list // requirementsMatchedForThisResource.add(requirement); // //remove requirement so it is not matched again in the next searches // requirementsIterator.remove(); // } // } else { // continue; // } // // } // // costRequirements.removeAll(requirementsMatchedForThisResource); // matchedRequirements.addAll(requirementsMatchedForThisResource); // serviceUnitOptions.addMatchedRequirements(requirementsMatchedForThisResource); // } // } // } // // //TODO: to process also cost to apply an utility in conjunction with another // if (!serviceUnitOptions.getOverallUnMatched().isEmpty()) { // //here I must check and apply it for quality, resource or ServiceUnit // // for (CostFunction costFunction : unitToMatch.getCostFunctions()) { // for (Quality quality : costFunction.getAppliedInConjunctionWithQuality()) { // Map<Metric, MetricValue> properties = quality.getProperties(); // List<Requirement> requirementsMatchedForThisResource = matchRequirementsToProperties(properties, qualityRequirements); // qualityRequirements.removeAll(requirementsMatchedForThisResource); // matchedRequirements.addAll(requirementsMatchedForThisResource); // serviceUnitOptions.addMatchedRequirements(requirementsMatchedForThisResource); // } // } // // } //2.6 match Elasticity requirements (also need to consider the MANDATORY associations, which reduce the elasticity) //TODO: to be implemented return serviceUnitOptions; }
From source file:net.devietti.ArchConfMapServlet.java
/** Fetch info for all tracked conferences from WikiCFP */ private void getconfs(HttpServletRequest req, HttpServletResponse resp) throws IOException { // pull conference info from WikiCFP List<Conf> confs = new LinkedList<Conf>(); // NB: WikiCFP's search only recognizes the first 8 terms, so we have multiple // *serialized* requests :-( final int BATCH_SIZE = 8; for (int i = 0; i < CONFERENCE_NAMES.length; i += BATCH_SIZE) { String[] slice = Arrays.copyOfRange(CONFERENCE_NAMES, i, Math.min(i + BATCH_SIZE, CONFERENCE_NAMES.length)); confs.addAll(getConfInfo(Arrays.asList(slice))); }//from ww w . j av a2s. c o m // sort conferences by start date Collections.sort(confs); List<Conf> toRemove = new LinkedList<Conf>(); for (Conf c : confs) { DateTime now = new DateTime(); // conference is already over; don't display it if (c.end.isBefore(now)) { toRemove.add(c); continue; } c.deadlineStatus = "pre"; if (c.deadline.isBefore(now)) { c.deadlineStatus = "post"; } } confs.removeAll(toRemove); resp.setContentType("application/json"); resp.getWriter().println(GSON.toJson(confs)); }
From source file:com.phresco.pom.util.PomProcessor.java
/** * @param reportCategories/*from ww w . ja v a 2 s . c om*/ */ public void removeProjectInfoReportCategory(List<ReportCategories> reportCategories) { if (reportCategories != null) { List<String> removeList = new ArrayList<String>(); List<String> projectInfoReportCategories = getProjectInfoReportCategories(); for (String string : projectInfoReportCategories) { for (ReportCategories reportCategoriesList : reportCategories) { if (reportCategoriesList.getName().equals(string)) { removeList.add(string); } } } projectInfoReportCategories.removeAll(removeList); } }
From source file:ca.sqlpower.sqlobject.TestSQLTable.java
/** * This tests inheriting a column at the end of the primary key list and * defining the inherited column to be a primary key does indeed set the * column to be a member of the primary key. *///from ww w .ja v a2 s. c o m public void testInheritDefinesPK() throws Exception { SQLTable t2 = new SQLTable(table.getParentDatabase(), true); t2.setName("Another Test Table"); SQLColumn newcol = new SQLColumn(t2, "newcol", Types.INTEGER, 10, 0); t2.addColumn(newcol, 0); t2.addToPK(newcol); assertTrue("Column should start in primary key", newcol.isPrimaryKey()); List<SQLColumn> columns = new ArrayList<SQLColumn>(table.getColumns()); //Defining the column to be a primary key table.inherit(table.getPkSize(), newcol, true, TransferStyles.COPY, true); List<SQLColumn> newColumns = new ArrayList<SQLColumn>(table.getColumns()); newColumns.removeAll(columns); assertEquals(1, newColumns.size()); SQLColumn copyCol = newColumns.get(0); assertTrue(copyCol.isPrimaryKey()); }
From source file:com.linkedin.pinot.core.startree.StarTreeSegmentCreator.java
/** Returns the user-defined split order, or dimensions in order of descending cardinality (removes excludes too) */ private List<String> computeSplitOrder(final Map<String, ColumnIndexCreationInfo> columnInfo) { List<String> splitOrder; if (starTreeIndexSpec.getSplitOrder() == null) { splitOrder = new ArrayList<String>(schema.getDimensionNames()); Collections.sort(splitOrder, new Comparator<String>() { @Override//from ww w . j a v a2 s. co m public int compare(String o1, String o2) { int o1DistinctValueCount = columnInfo.get(o1).getDistinctValueCount(); int o2DistinctValueCount = columnInfo.get(o2).getDistinctValueCount(); return o2DistinctValueCount - o1DistinctValueCount; // descending } }); } else { splitOrder = new ArrayList<String>(starTreeIndexSpec.getSplitOrder()); } if (starTreeIndexSpec.getSplitExcludes() != null) { splitOrder.removeAll(starTreeIndexSpec.getSplitExcludes()); } return splitOrder; }
From source file:com.microsoft.alm.plugin.idea.git.ui.vcsimport.ImportPageModelImpl.java
private boolean doFirstCommitIfRequired(final Project project, final GitRepository localRepository, final VirtualFile rootVirtualFile, final ServerContext localContext, final ProgressIndicator indicator) { //Do first commit if there are no commits in the repository if (localRepository.isFresh()) { try {/*from w ww . j av a 2s . c om*/ final ChangeListManager changeListManager = ChangeListManager.getInstance(project); final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); final List<VirtualFile> trackedFiles = changeListManager.getAffectedFiles(); final Collection<VirtualFile> untrackedFiles = ContainerUtil.filter( localRepository.getUntrackedFilesHolder().retrieveUntrackedFiles(), new Condition<VirtualFile>() { @Override public boolean value(VirtualFile file) { return !changeListManager.isIgnoredFile(file) && !vcsManager.isIgnored(file); } }); trackedFiles.removeAll(untrackedFiles); final List<VirtualFile> allFiles = new ArrayList<VirtualFile>(); allFiles.addAll(trackedFiles); allFiles.addAll(untrackedFiles); final List<VirtualFile> filesToCommit = new ArrayList<VirtualFile>(); IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { final SelectFilesDialog dialog = SelectFilesDialog.init(project, allFiles, TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_SELECT_FILES), VcsShowConfirmationOption.STATIC_SHOW_CONFIRMATION, true, false, false); dialog.setTitle( TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_SELECT_FILES_DIALOG_TITLE)); DialogManager.show(dialog); if (dialog.isOK()) { //add files only if user clicked OK on the SelectFilesDialog filesToCommit.addAll(dialog.getSelectedFiles()); } } }, true, indicator.getModalityState()); indicator .setText(TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ADDING_FILES, project.getName())); GitFileUtils.addFiles(project, rootVirtualFile, filesToCommit); if (filesToCommit.size() > 0) { final GitSimpleHandler hCommit = new GitSimpleHandler(project, rootVirtualFile, GitCommand.COMMIT); hCommit.addParameters("-m", TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ADDING_FILES, project.getName())); GitHandlerUtil.runInCurrentThread(hCommit, null, true, TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ADDING_FILES, project.getName())); if (hCommit.getExitCode() != 0) { //unable to commit logger.error( "doFirstCommitIfRequired: git commit failed for project: {}, repoRoot: {} with error: {}", project.getName(), rootVirtualFile.getUrl(), hCommit.getStderr()); notifyImportError(project, TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ADDING_FILES_ERROR, project.getName(), hCommit.getStderr()), ACTION_NAME, localContext); return false; } VfsUtil.markDirtyAndRefresh(false, true, false, ArrayUtil.toObjectArray(filesToCommit, VirtualFile.class)); VcsFileUtil.markFilesDirty(project, getFilePaths(filesToCommit)); } else { logger.error( "doFirstCommitIfRequired: No files to do first commit in project: {}, repoRoot: {}", project.getName(), rootVirtualFile.getUrl()); notifyImportError(project, TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_NO_SELECTED_FILES), ACTION_NAME, localContext); return false; } } catch (VcsException ve) { logger.error( "doFirstCommitIfRequired: VcsException occurred when trying to do a commit on project: {}, repoRoot: {}", project.getName(), rootVirtualFile.getUrl()); logger.warn("doFirstCommitIfRequired", ve); // Log the exact exception here TfsTelemetryHelper.getInstance().sendException(ve, new TfsTelemetryHelper.PropertyMapBuilder() .currentOrActiveContext(localContext).actionName(ACTION_NAME).success(false).build()); notifyImportError(project, TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ADDING_FILES_ERROR, project.getName(), ve.getMessage()), ACTION_NAME, localContext); return false; } } return true; }
From source file:de.iteratec.iteraplan.businesslogic.exchange.visio.informationflow.VisioInformationFlowExport.java
/** * @param edgeProps/*from w w w . java 2 s . c om*/ * @param noDirectionBOs * @param secondToFirstBOs * @param firstToSecondBOs * @param bidirectionalBOs * @param iface * * @return the edge count */ private int calculateEdgeCount(Map<String, String> edgeProps, InformationSystemInterface iface, List<String> bidirectionalBOs, List<String> firstToSecondBOs, List<String> secondToFirstBOs, List<String> noDirectionBOs) { List<Direction> directions = Lists.newArrayList(); List<String> transportsLabels = Lists.newArrayList(); if (ArrayUtils.contains(lineCaptionSelected, InformationFlowOptionsBean.LINE_DESCR_BUSINESS_OBJECTS)) { addTransportLabelAndDirection(transportsLabels, directions, bidirectionalBOs, Direction.BOTH_DIRECTIONS); addTransportLabelAndDirection(transportsLabels, directions, noDirectionBOs, Direction.NO_DIRECTION); addTransportLabelAndDirection(transportsLabels, directions, firstToSecondBOs, Direction.FIRST_TO_SECOND); addTransportLabelAndDirection(transportsLabels, directions, secondToFirstBOs, Direction.SECOND_TO_FIRST); if (transportsLabels.isEmpty() && directions.isEmpty()) { transportsLabels.add(""); directions.add(Direction.NO_DIRECTION); } } else { transportsLabels.add(""); directions.add(iface.getInterfaceDirection()); } int edgeCount = transportsLabels.size(); List<String> commonTransportLabels = determineCommonLabels(iface); // add edges for (int i = 0; i < edgeCount; i++) { List<String> allEdgeLabels = Lists.newArrayList(commonTransportLabels); allEdgeLabels.add(transportsLabels.get(i)); allEdgeLabels.removeAll(Lists.newArrayList("")); edgeProps.put(PROP_FLOW_INFORMATION_OBJECTS, StringUtils.join(allEdgeLabels, "; ")); addEdgeWithDirection(iface, directions.get(i), edgeProps); } return edgeCount; }