List of usage examples for java.util SortedSet contains
boolean contains(Object o);
From source file:com.espertech.esper.schedule.ScheduleComputeHelper.java
private static int determineDayOfMonth(ScheduleSpec spec, Calendar after, ScheduleCalendar result) { SortedSet<Integer> daysOfMonthSet = spec.getUnitValues().get(ScheduleUnit.DAYS_OF_MONTH); SortedSet<Integer> daysOfWeekSet = spec.getUnitValues().get(ScheduleUnit.DAYS_OF_WEEK); SortedSet<Integer> secondsSet = spec.getUnitValues().get(ScheduleUnit.SECONDS); SortedSet<Integer> minutesSet = spec.getUnitValues().get(ScheduleUnit.MINUTES); SortedSet<Integer> hoursSet = spec.getUnitValues().get(ScheduleUnit.HOURS); int dayOfMonth; // If days of week is a wildcard, just go by days of month if (spec.getOptionalDayOfMonthOperator() != null || spec.getOptionalDayOfWeekOperator() != null) { boolean isWeek = false; CronParameter op = spec.getOptionalDayOfMonthOperator(); if (spec.getOptionalDayOfMonthOperator() == null) { op = spec.getOptionalDayOfWeekOperator(); isWeek = true;//from w w w .ja va 2 s . com } // may return the current day or a future day in the same month, // and may advance the "after" date to the next month int currentYYMMDD = getTimeYYYYMMDD(after); increaseAfterDayOfMonthSpecialOp(op.getOperator(), op.getDay(), op.getMonth(), isWeek, after); int rolledYYMMDD = getTimeYYYYMMDD(after); // if rolled then reset time portion if (rolledYYMMDD > currentYYMMDD) { result.setSecond(nextValue(secondsSet, 0)); result.setMinute(nextValue(minutesSet, 0)); result.setHour(nextValue(hoursSet, 0)); return after.get(Calendar.DAY_OF_MONTH); } // rolling backwards is not allowed else if (rolledYYMMDD < currentYYMMDD) { throw new IllegalStateException( "Failed to evaluate special date op, rolled date less then current date"); } else { Calendar work = (Calendar) after.clone(); work.set(Calendar.SECOND, result.getSecond()); work.set(Calendar.MINUTE, result.getMinute()); work.set(Calendar.HOUR_OF_DAY, result.getHour()); if (!work.after(after)) { // new date is not after current date, so bump after.add(Calendar.DAY_OF_MONTH, 1); result.setSecond(nextValue(secondsSet, 0)); result.setMinute(nextValue(minutesSet, 0)); result.setHour(nextValue(hoursSet, 0)); increaseAfterDayOfMonthSpecialOp(op.getOperator(), op.getDay(), op.getMonth(), isWeek, after); } return after.get(Calendar.DAY_OF_MONTH); } } else if (daysOfWeekSet == null) { dayOfMonth = nextValue(daysOfMonthSet, after.get(Calendar.DAY_OF_MONTH)); if (dayOfMonth != after.get(Calendar.DAY_OF_MONTH)) { result.setSecond(nextValue(secondsSet, 0)); result.setMinute(nextValue(minutesSet, 0)); result.setHour(nextValue(hoursSet, 0)); } if (dayOfMonth == -1) { dayOfMonth = nextValue(daysOfMonthSet, 0); after.add(Calendar.MONTH, 1); } } // If days of weeks is not a wildcard and days of month is a wildcard, go by days of week only else if (daysOfMonthSet == null) { // Loop to find the next day of month that works for the specified day of week values while (true) { dayOfMonth = after.get(Calendar.DAY_OF_MONTH); int dayOfWeek = after.get(Calendar.DAY_OF_WEEK) - 1; // If the day matches neither the day of month nor the day of week if (!daysOfWeekSet.contains(dayOfWeek)) { result.setSecond(nextValue(secondsSet, 0)); result.setMinute(nextValue(minutesSet, 0)); result.setHour(nextValue(hoursSet, 0)); after.add(Calendar.DAY_OF_MONTH, 1); } else { break; } } } // Both days of weeks and days of month are not a wildcard else { // Loop to find the next day of month that works for either day of month OR day of week while (true) { dayOfMonth = after.get(Calendar.DAY_OF_MONTH); int dayOfWeek = after.get(Calendar.DAY_OF_WEEK) - 1; // If the day matches neither the day of month nor the day of week if ((!daysOfWeekSet.contains(dayOfWeek)) && (!daysOfMonthSet.contains(dayOfMonth))) { result.setSecond(nextValue(secondsSet, 0)); result.setMinute(nextValue(minutesSet, 0)); result.setHour(nextValue(hoursSet, 0)); after.add(Calendar.DAY_OF_MONTH, 1); } else { break; } } } return dayOfMonth; }
From source file:jp.zippyzip.impl.GeneratorServiceImpl.java
String toJsonAdd1s(ParentChild data, SortedSet<String> children) throws JSONException { LinkedList<String> zips = new LinkedList<String>(); Set<String> add1s = new HashSet<String>(); Set<String> add2s = new HashSet<String>(); boolean start = true; JSONObject pref = new JSONObject(data.getParents().getFirst()); JSONObject city = new JSONObject(data.getParents().getLast()); StringBuilder ret = new StringBuilder("{\"pref\":"); pref.remove("yomi"); ret.append(pref.toString());//from w w w . j a v a2 s.com ret.append(",\"city\":"); city.remove("yomi"); city.remove("expiration"); ret.append(city.toString()); ret.append(",\"zips\":["); for (String json : data.getChildren()) { String add1 = new JSONObject(json).optString("add1", ""); zips.add(json); if (add1s.add(add1)) { continue; } add2s.add(add1); } for (String json : zips) { JSONObject jo = new JSONObject(json); String add1 = jo.optString("add1", ""); jo.remove("x0402"); jo.remove("corp"); jo.remove("add1Yomi"); jo.remove("add2Yomi"); jo.remove("corpYomi"); if (add2s.contains(add1)) { if (!children.contains(add1)) { if (start) { start = false; } else { ret.append(","); } jo.remove("code"); jo.remove("add2"); jo.remove("note"); jo.put("code", toHex(add1)); ret.append(jo.toString()); children.add(add1); } } else { if (start) { start = false; } else { ret.append(","); } String zip = jo.optString("code", ""); jo.remove("code"); jo.put("zip1", zip.substring(0, 3)); jo.put("zip2", zip.substring(3)); ret.append(jo.toString()); } } return ret.append("]}").toString(); }
From source file:com.gtwm.pb.model.manageSchema.DatabaseDefn.java
public SortedSet<TableInfo> getDirectlyDependentTables(TableInfo baseTable, HttpServletRequest request) throws ObjectNotFoundException { CompanyInfo company = this.authManager.getCompanyForLoggedInUser(request); Set<TableInfo> tables = company.getTables(); SortedSet<TableInfo> dependentTables = new TreeSet<TableInfo>(); for (TableInfo table : tables) { if (table.equals(baseTable)) { continue; }//from w ww . j av a 2 s .com if (table.isDependentOn(baseTable)) { if (!dependentTables.contains(table)) { dependentTables.add(table); } } } return dependentTables; }
From source file:org.apache.accumulo.test.RewriteTabletDirectoriesIT.java
@Test public void test() throws Exception { try (AccumuloClient c = Accumulo.newClient().from(getClientProperties()).build()) { c.securityOperations().grantTablePermission(c.whoami(), MetadataTable.NAME, TablePermission.WRITE); final String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); // Write some data to a table and add some splits final SortedSet<Text> splits = new TreeSet<>(); try (BatchWriter bw = c.createBatchWriter(tableName)) { for (String split : "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")) { splits.add(new Text(split)); Mutation m = new Mutation(new Text(split)); m.put(new byte[] {}, new byte[] {}, new byte[] {}); bw.addMutation(m);/*from w w w. jav a 2s. co m*/ } } c.tableOperations().addSplits(tableName, splits); try (BatchScanner scanner = c.createBatchScanner(MetadataTable.NAME)) { DIRECTORY_COLUMN.fetch(scanner); TableId tableId = TableId.of(c.tableOperations().tableIdMap().get(tableName)); assertNotNull("TableID for " + tableName + " was null", tableId); scanner.setRanges(Collections.singletonList(TabletsSection.getRange(tableId))); // verify the directory entries are all on v1, make a few entries relative int count = 0; try (BatchWriter bw = c.createBatchWriter(MetadataTable.NAME)) { for (Entry<Key, Value> entry : scanner) { assertTrue("Expected " + entry.getValue() + " to contain " + v1, entry.getValue().toString().contains(v1.toString())); count++; if (count % 2 == 0) { String[] parts = entry.getValue().toString().split("/"); Key key = entry.getKey(); Mutation m = new Mutation(key.getRow()); m.put(key.getColumnFamily(), key.getColumnQualifier(), new Value((Path.SEPARATOR + parts[parts.length - 1]).getBytes())); bw.addMutation(m); } } } assertEquals(splits.size() + 1, count); // This should fail: only one volume assertEquals(1, cluster.exec(RandomizeVolumes.class, "-c", cluster.getClientPropsPath(), "-t", tableName) .getProcess().waitFor()); cluster.stop(); // add the 2nd volume PropertiesConfiguration conf = new PropertiesConfiguration(); conf.load(cluster.getAccumuloPropertiesPath()); conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2); conf.save(cluster.getAccumuloPropertiesPath()); // initialize volume assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").getProcess().waitFor()); cluster.start(); // change the directory entries assertEquals(0, cluster.exec(Admin.class, "randomizeVolumes", "-t", tableName).getProcess().waitFor()); // verify a more equal sharing int v1Count = 0, v2Count = 0; for (Entry<Key, Value> entry : scanner) { if (entry.getValue().toString().contains(v1.toString())) { v1Count++; } if (entry.getValue().toString().contains(v2.toString())) { v2Count++; } } log.info("Count for volume1: {}", v1Count); log.info("Count for volume2: {}", v2Count); assertEquals(splits.size() + 1, v1Count + v2Count); // a fair chooser will differ by less than count(volumes) assertTrue("Expected the number of files to differ between volumes by less than 10. " + v1Count + " " + v2Count, Math.abs(v1Count - v2Count) < 2); // verify we can read the old data count = 0; for (Entry<Key, Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) { assertTrue("Found unexpected entry in table: " + entry, splits.contains(entry.getKey().getRow())); count++; } assertEquals(splits.size(), count); } } }
From source file:au.org.ala.delta.editor.slotfile.model.VOCharacterAdaptor.java
protected ControllingInfo checkApplicability(VOItemDesc item, VOCharBaseDesc charBase, int recurseLevel, List<Integer> testedControlledChars) { int controllingId = 0; if (item == null || charBase == null || charBase.getNControlling() == 0) { return new ControllingInfo(); }/*w ww.j a va2 s . c om*/ boolean unknownOk = false; List<Integer> controlling = charBase.readControllingInfo(); if (controlling != null && controlling.size() > 1) { Collections.sort(controlling, new CompareCharNos(false)); } List<Integer> controllingChars = new ArrayList<Integer>(); SortedSet<Integer> controllingStates = new TreeSet<Integer>(); List<Integer> newContStates = new ArrayList<Integer>(); int testCharId = VOUID_NULL; controlling.add(VOUID_NULL); // Append dummy value, to ease handling of // the last element // Loop through all controlling attributes which directly control this // character... for (Integer i : controlling) { int newContCharId = 0; if (i == VOUID_NULL) { newContCharId = VOUID_NULL; } else { VOControllingDesc contAttrDesc = (VOControllingDesc) ((DeltaVOP) charBase.getVOP()) .getDescFromId(i); newContStates = contAttrDesc.readStateIds(); Collections.sort(newContStates); newContCharId = contAttrDesc.getCharId(); } if (newContCharId == testCharId) { // / Build up all relevant controlling attributes under the // control of a // / single controlling character, merging the state lists as we // go.... controllingStates.addAll(newContStates); } else { // Do checks when changing controlling state if (testCharId != VOUID_NULL) { VOCharBaseDesc testCharBase = getDescFromId(testCharId); if (!CharType.isMultistate(testCharBase.getCharType())) { throw new RuntimeException("Controlling characters must be multistate!"); } controllingId = testCharId; // If the controlling character is coded, see whether it // makes us inapplicable if (item.hasAttribute(controllingId)) { Attribute attrib = item.readAttribute(controllingId); List<Integer> codedStates = new ArrayList<Integer>(); short[] pseudoValues = new short[] { 0 }; attrib.getEncodedStates(testCharBase, codedStates, pseudoValues); // If controlling character is "variable", we are NOT // controlled if ((pseudoValues[0] & VOItemDesc.PSEUDO_VARIABLE) == 0) { if (codedStates.isEmpty()) { // If there are no states for the controlling // character, // but it is explicitly coded with the "unknown" // pseudo-value, // allow the controlled character to also be // unknown. if ((pseudoValues[0] & VOItemDesc.PSEUDO_UNKNOWN) != 0) { unknownOk = true; } else { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } else if (controllingStates.containsAll(codedStates)) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } } else if (testCharBase.getUncodedImplicit() != VOCharBaseDesc.STATEID_NULL) { // if the controlling character is not encoded, see if // there is an implicit value for it if (controllingStates.contains(testCharBase.getUncodedImplicit())) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } else { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); // /// This should probably be handled as a somewhat // special case, // /// so the user can be pointed in the right direction } } controllingId = VOUID_NULL; testCharId = newContCharId; if (testCharId != VOUID_NULL) { controllingChars.add(testCharId); } controllingStates.clear(); controllingStates.addAll(newContStates); } } // Up to this point, nothing has made this character inapplicable. // But it is possible that one of the controlling characters has itself // been made inapplicable. // Is this check really necessary? I suppose it is, but it slows things // down... for (int j : controllingChars) { if (++recurseLevel >= getDeltaMaster().getNContAttrs()) { try { List<Integer> contChars = new ArrayList<Integer>(); getControlledChars(testedControlledChars, _charDesc, contChars, true); } catch (CircularDependencyException ex) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } VOCharBaseDesc testCharBase = getDescFromId(j); ControllingInfo info = checkApplicability(item, testCharBase, recurseLevel, testedControlledChars); if (info.isInapplicable()) { return info; } } return unknownOk ? new ControllingInfo(ControlledStateType.InapplicableOrUnknown, controllingId) : new ControllingInfo(); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java
/** * Builds form for upload UI.// www.j av a 2 s . c om */ protected void buildMainUI() { mainPanel = new UploadMainPanel(isUpdateUpload()); SortedSet<UploadInfoRenderable> uts = new TreeSet<UploadInfoRenderable>(); for (UploadTable ut : uploadTables) { UploadInfoRenderable render = new UploadInfoRenderable(ut); if (uts.contains(render)) { for (UploadInfoRenderable r : uts) { if (r.equals(render)) { r.addTable(ut); break; } } } else { uts.add(new UploadInfoRenderable(ut)); } } mainPanel.addAffectedTables(uts.iterator()); mainPanel.setActionListener(this); }
From source file:br.gov.jfrj.siga.ex.bl.ExBL.java
/** * Obtem a lista de formas de documentos a partir dos modelos selecionados e * das restries de tipo (interno, externo) e de tipo da forma (expediente, * processo)/*w w w. j av a 2 s. co m*/ * * @param modelos * @param tipoDoc * @param tipoForma * @return * @throws Exception */ public SortedSet<ExFormaDocumento> obterFormasDocumento(List<ExModelo> modelos, ExTipoDocumento tipoDoc, ExTipoFormaDoc tipoForma) { SortedSet<ExFormaDocumento> formasSet = new TreeSet<ExFormaDocumento>(); SortedSet<ExFormaDocumento> formasFinal = new TreeSet<ExFormaDocumento>(); // Por enquanto, os parmetros tipoForma e tipoDoc no podem ser // preenchidos simultaneamente. Melhorar isso. if (tipoDoc != null && tipoForma != null) { formasSet.addAll(SetUtils.intersection(tipoDoc.getExFormaDocumentoSet(), tipoForma.getExFormaDocSet())); } else if (tipoDoc != null) formasSet.addAll(tipoDoc.getExFormaDocumentoSet()); else if (tipoForma != null) formasSet.addAll(tipoForma.getExFormaDocSet()); else formasSet = null; for (ExModelo mod : modelos) { if (mod.getExFormaDocumento() == null) continue; if (formasSet == null || formasSet.contains(mod.getExFormaDocumento())) formasFinal.add(mod.getExFormaDocumento()); } return formasFinal; }
From source file:org.sakaiproject.content.tool.ResourcesAction.java
/** * Read user inputs from options form and update accordingly *//*w w w . j av a 2 s . c o m*/ public void doUpdateOptions(RunData data) { logger.debug(this + ".doUpdateOptions()"); if (!"POST".equals(data.getRequest().getMethod())) { return; } // get the state object SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); //get the ParameterParser from RunData ParameterParser params = data.getParameters(); ResourceTypeRegistry registry = (ResourceTypeRegistry) state.getAttribute(STATE_RESOURCES_TYPE_REGISTRY); if (registry == null) { registry = (ResourceTypeRegistry) ComponentManager .get("org.sakaiproject.content.api.ResourceTypeRegistry"); state.setAttribute(STATE_RESOURCES_TYPE_REGISTRY, registry); } List<ResourceType> typeDefs = new ArrayList<ResourceType>(registry.getTypes()); String siteId = params.getString("siteId"); if (siteId == null || siteId.trim().equals("")) { String home = (String) state.getAttribute(STATE_HOME_COLLECTION_ID); Reference ref = EntityManager.newReference(ContentHostingService.getReference(home)); siteId = ref.getContext(); } Map<String, Boolean> statusMap = new HashMap<String, Boolean>(); String[] types = params.getStrings("types"); SortedSet enabledTypes = new TreeSet(); if (types != null) { enabledTypes.addAll(Arrays.asList(types)); } for (ResourceType typeDef : typeDefs) { if (typeDef instanceof SiteSpecificResourceType) { statusMap.put(typeDef.getId(), Boolean.valueOf(enabledTypes.contains(typeDef.getId()))); } } registry.setMapOfResourceTypesForContext(siteId, statusMap); state.setAttribute(STATE_MODE, MODE_LIST); }
From source file:org.sakaiproject.content.impl.BaseContentService.java
/** * Make a deep copy of a collection. /*from w w w . j a v a2s .co m*/ * Creates a new collection with an id similar to new_folder_id and recursively copies all nested collections and resources within thisCollection to the new collection. * Only used in "copyIntoFolder" for now * * @param thisCollection * The collection to be copied * @param new_folder_id * The desired id of the new collection. * @return The full id of the copied collection (which may be a slight variation on the desired id to ensure uniqueness). * @exception PermissionException * if the user does not have permissions to perform the operations * @exception IdUnusedException * if the collection id is not found. ??? * @exception TypeException * if the resource is not a collection. * @exception InUseException * if the collection is locked by someone else. * @exception IdUsedException * if a unique id cannot be found for the new collection after some arbitrary number of attempts to find a unique variation of the new_folder_id (@see MAXIMUM_ATTEMPTS_FOR_UNIQUENESS). * @exception ServerOverloadException * if the server is configured to save content bodies in the server's filesystem and an error occurs trying to access the filesystem. */ protected String deepcopyCollection(ContentCollection thisCollection, String new_folder_id) throws PermissionException, IdUnusedException, TypeException, InUseException, IdLengthException, IdUniquenessException, OverQuotaException, IdUsedException, ServerOverloadException { String name = isolateName(new_folder_id); ResourceProperties properties = thisCollection.getProperties(); ResourcePropertiesEdit newProps = duplicateResourceProperties(properties, thisCollection.getId()); if (newProps.getProperty(ResourceProperties.PROP_DISPLAY_NAME) == null) { name = Validator.escapeResourceName(name); newProps.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name); } if (M_log.isDebugEnabled()) M_log.debug("deepCopyCollection adding colletion=" + new_folder_id + " name=" + name); String base_id = new_folder_id + "-"; boolean still_trying = true; int attempt = 0; ContentCollection newCollection = null; try { try { newCollection = addCollection(new_folder_id, newProps); // use the creator and creation-date of the original instead of the copy BaseCollectionEdit collection = (BaseCollectionEdit) m_storage .editCollection(newCollection.getId()); if (isPubView(thisCollection.getId())) { collection.setPublicAccess(); } collection.setAvailability(thisCollection.isHidden(), thisCollection.getReleaseDate(), thisCollection.getReleaseDate()); m_storage.commitCollection(collection); if (M_log.isDebugEnabled()) M_log.debug("deepCopyCollection top level created successful"); still_trying = false; } catch (IdUsedException e) { try { checkCollection(new_folder_id); } catch (Exception ee) { throw new IdUniquenessException(new_folder_id); } } String containerId = this.isolateContainingId(new_folder_id); ContentCollection containingCollection = findCollection(containerId); SortedSet<String> siblings = new TreeSet<String>(); siblings.addAll(containingCollection.getMembers()); while (still_trying) { attempt++; if (attempt >= MAXIMUM_ATTEMPTS_FOR_UNIQUENESS) { throw new IdUniquenessException(new_folder_id); } new_folder_id = base_id + attempt; if (!siblings.contains(new_folder_id)) { newProps.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name + "-" + attempt); try { newCollection = addCollection(new_folder_id, newProps); BaseCollectionEdit collection = (BaseCollectionEdit) m_storage .editCollection(newCollection.getId()); if (isPubView(thisCollection.getId())) { collection.setPublicAccess(); } collection.setAvailability(thisCollection.isHidden(), thisCollection.getReleaseDate(), thisCollection.getReleaseDate()); m_storage.commitCollection(collection); still_trying = false; } catch (IdUsedException inner_e) { // try again } } } List<String> members = thisCollection.getMembers(); if (M_log.isDebugEnabled()) M_log.debug("deepCopyCollection size=" + members.size()); Iterator<String> memberIt = members.iterator(); while (memberIt.hasNext()) { String member_id = (String) memberIt.next(); if (isAvailable(member_id)) { copyIntoFolder(member_id, new_folder_id); } } } catch (InconsistentException e) { throw new TypeException(new_folder_id); } catch (IdInvalidException e) { throw new TypeException(new_folder_id); } return new_folder_id; }
From source file:org.sakaiproject.content.impl.BaseContentService.java
public ContentResourceEdit addResource(String collectionId, String basename, String extension, int maximum_tries) throws PermissionException, IdUniquenessException, IdLengthException, IdInvalidException, IdUnusedException, OverQuotaException, ServerOverloadException { // check the id's validity (this may throw IdInvalidException) // use only the "name" portion, separated at the end try {//from w w w . j ava2 s . c o m checkCollection(collectionId); } catch (TypeException e) { throw new IdUnusedException(collectionId); } if (basename == null) { throw new IdInvalidException(""); } if (extension == null) { extension = ""; } else { extension = extension.trim(); if (extension.equals("") || extension.startsWith(".")) { // do nothing } else { extension = "." + extension; } } basename = Validator.escapeResourceName(basename.trim()); extension = Validator.escapeResourceName(extension); String name = basename + extension; String id = collectionId + name; if (id.length() > ContentHostingService.MAXIMUM_RESOURCE_ID_LENGTH) { throw new IdLengthException(id); } BaseResourceEdit edit = null; int attempts = 0; boolean done = false; while (!done && attempts < maximum_tries) { try { edit = (BaseResourceEdit) addResource(id); done = true; // add live properties addLiveResourceProperties(edit); ResourceProperties props = edit.getPropertiesEdit(); props.addProperty(ResourceProperties.PROP_DISPLAY_NAME, name); // track event edit.setEvent(EVENT_RESOURCE_ADD); } catch (InconsistentException inner_e) { throw new IdInvalidException(id); } catch (IdUsedException e) { SortedSet<String> siblings = new TreeSet<String>(); try { ContentCollection collection = findCollection(collectionId); siblings.addAll(collection.getMembers()); } catch (TypeException inner_e) { throw new IdUnusedException(collectionId); } // see end of loop for condition that enforces attempts <= limit) do { attempts++; name = basename + "-" + attempts + extension; id = collectionId + name; if (attempts >= maximum_tries) { throw new IdUniquenessException(id); } if (id.length() > MAXIMUM_RESOURCE_ID_LENGTH) { throw new IdLengthException(id); } } while (siblings.contains(id)); } } threadLocalManager.set("members@" + collectionId, null); //threadLocalManager.set("getCollections@" + collectionId, null); threadLocalManager.set("getResources@" + collectionId, null); // if (edit == null) // { // throw new IdUniquenessException(id); // } return edit; }