List of usage examples for com.google.common.collect Sets newHashSetWithExpectedSize
public static <E> HashSet<E> newHashSetWithExpectedSize(int expectedSize)
From source file:com.opengamma.financial.analytics.model.curve.interestrate.MarketInstrumentImpliedYieldCurveFunction.java
@Override public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) { String forwardCurveName = null; String fundingCurveName = null; for (final Map.Entry<ValueSpecification, ValueRequirement> input : inputs.entrySet()) { if (ValueRequirementNames.YIELD_CURVE_SPEC.equals(input.getKey().getValueName())) { final String curveName = input.getKey().getProperty(ValuePropertyNames.CURVE); final String type = input.getValue().getConstraint(REQUIREMENT_PROPERTY_TYPE); if (type == null) { assert forwardCurveName == null; assert fundingCurveName == null; forwardCurveName = curveName; fundingCurveName = curveName; } else { if (TYPE_FORWARD.equals(type)) { assert forwardCurveName == null; forwardCurveName = curveName; } else { assert TYPE_FUNDING.equals(type); assert fundingCurveName == null; fundingCurveName = curveName; }//from w ww . ja v a2 s . c o m } } } assert forwardCurveName != null; assert fundingCurveName != null; final Set<ValueSpecification> results = Sets.newHashSetWithExpectedSize(4); final ComputationTargetSpecification targetSpec = target.toSpecification(); final ValueProperties.Builder properties = createValueProperties() .with(ValuePropertyNames.CURVE_CALCULATION_METHOD, getCalculationType()) .with(YieldCurveFunction.PROPERTY_FORWARD_CURVE, forwardCurveName) .with(YieldCurveFunction.PROPERTY_FUNDING_CURVE, fundingCurveName); results.add( new ValueSpecification(ValueRequirementNames.YIELD_CURVE_JACOBIAN, targetSpec, properties.get())); if (getCalculationType().equals(PRESENT_VALUE_STRING)) { results.add(new ValueSpecification(ValueRequirementNames.PRESENT_VALUE_COUPON_SENSITIVITY, targetSpec, createValueProperties().withAny(YieldCurveFunction.PROPERTY_FORWARD_CURVE) .withAny(YieldCurveFunction.PROPERTY_FUNDING_CURVE).get())); } results.add(new ValueSpecification(ValueRequirementNames.YIELD_CURVE, targetSpec, properties.with(ValuePropertyNames.CURVE, forwardCurveName).get())); if (!forwardCurveName.equals(fundingCurveName)) { results.add(new ValueSpecification(ValueRequirementNames.YIELD_CURVE, targetSpec, properties .withoutAny(ValuePropertyNames.CURVE).with(ValuePropertyNames.CURVE, fundingCurveName).get())); } return results; }
From source file:com.opengamma.financial.analytics.model.sabrcube.SABRYCNSFunction.java
@Override public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context, final ComputationTarget target, final ValueRequirement desiredValue) { final ValueProperties constraints = desiredValue.getConstraints(); Set<String> requestedCurveNames = constraints.getValues(ValuePropertyNames.CURVE); final boolean permissive = OpenGammaCompilationContext.isPermissive(context); if (!permissive && ((requestedCurveNames == null) || requestedCurveNames.isEmpty())) { s_logger.error("Must ask for a single named curve"); return null; }//from w w w. j a va 2 s. c o m final Set<String> cubeNames = constraints.getValues(ValuePropertyNames.CUBE); if (cubeNames == null || cubeNames.size() != 1) { return null; } final Set<String> fittingMethods = constraints .getValues(SmileFittingPropertyNamesAndValues.PROPERTY_FITTING_METHOD); if (fittingMethods == null || fittingMethods.size() != 1) { return null; } final Set<String> curveCalculationConfigNames = constraints .getValues(ValuePropertyNames.CURVE_CALCULATION_CONFIG); if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) { return null; } final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next(); final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context); final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource( configSource); final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource .getConfig(curveCalculationConfigName); if (curveCalculationConfig == null) { s_logger.error("Could not find curve calculation configuration named " + curveCalculationConfigName); return null; } final Currency currency = FinancialSecurityUtils.getCurrency(target.getSecurity()); if (!ComputationTargetSpecification.of(currency).equals(curveCalculationConfig.getTarget())) { s_logger.error("Security currency and curve calculation config id were not equal; have {} and {}", currency, curveCalculationConfig.getTarget()); return null; } final String[] availableCurveNames = curveCalculationConfig.getYieldCurveNames(); if ((requestedCurveNames == null) || requestedCurveNames.isEmpty()) { requestedCurveNames = Sets.newHashSet(availableCurveNames); } else { final Set<String> intersection = YieldCurveFunctionUtils.intersection(requestedCurveNames, availableCurveNames); if (intersection.isEmpty()) { s_logger.error( "None of the requested curves {} are available in curve calculation configuration called {}", requestedCurveNames, curveCalculationConfigName); return null; } requestedCurveNames = intersection; } if (!permissive && (requestedCurveNames.size() != 1)) { s_logger.error("Must specify single curve name constraint, got {}", requestedCurveNames); return null; } final String curveName = requestedCurveNames.iterator().next(); final String cubeName = cubeNames.iterator().next(); final String fittingMethod = fittingMethods.iterator().next(); final FinancialSecurity security = (FinancialSecurity) target.getSecurity(); final Set<ValueRequirement> curveRequirements = YieldCurveFunctionUtils .getCurveRequirements(curveCalculationConfig, curveCalculationConfigSource); final Set<ValueRequirement> requirements = Sets.newHashSetWithExpectedSize(curveRequirements.size() + 3); for (final ValueRequirement curveRequirement : curveRequirements) { final ValueProperties.Builder properties = curveRequirement.getConstraints().copy(); properties.with(PROPERTY_REQUESTED_CURVE, curveName).withOptional(PROPERTY_REQUESTED_CURVE); requirements.add(new ValueRequirement(curveRequirement.getValueName(), curveRequirement.getTargetReference(), properties.get())); } requirements.add(getCubeRequirement(cubeName, currency, fittingMethod)); final String curveCalculationMethod = curveCalculationConfig.getCalculationMethod(); if (!curveCalculationMethod.equals(FXImpliedYieldCurveFunction.FX_IMPLIED)) { requirements.add(getCurveSpecRequirement(currency, curveName)); } requirements.add(getJacobianRequirement(currency, curveCalculationConfigName, curveCalculationMethod)); if (curveCalculationMethod.equals(MultiYieldCurvePropertiesAndDefaults.PRESENT_VALUE_STRING)) { requirements.add(getCouponSensitivitiesRequirement(currency, curveCalculationConfigName)); } final Set<ValueRequirement> timeSeriesRequirements = _definitionConverter .getConversionTimeSeriesRequirements(security, security.accept(_securityVisitor)); if (timeSeriesRequirements == null) { return null; } requirements.addAll(timeSeriesRequirements); return requirements; }
From source file:org.zenoss.zep.index.impl.lucene.LuceneEventIndexBackend.java
private EventSummaryResult searchToEventSummaryResult(IndexSearcher searcher, Query query, Sort sort, Set<String> fieldsToLoad, int offset, int limit) throws IOException, ZepException { if (limit < 0) { throw new ZepException(messages.getMessage("invalid_query_limit", limit)); }// w ww. j a v a 2 s. c om if (limit > queryLimit) { limit = queryLimit; } if (offset < 0) { offset = 0; } // Lucene doesn't like querying for 0 documents - search for at least one here final int numDocs = Math.max(limit + offset, 1); final TopDocs docs = this.timeLimitedSearch(searcher, query, sort, offset, limit, numDocs); this.indexResultsCount = docs.totalHits; logger.debug("Found {} results", docs.totalHits); EventSummaryResult.Builder result = EventSummaryResult.newBuilder(); result.setTotal(docs.totalHits); result.setLimit(limit); if (docs.totalHits > limit + offset) { result.setNextOffset(limit + offset); } // Return the number of results they asked for (the query has to return at least one match // but the request may specified a limit of zero). final int lastDocument = Math.min(limit + offset, docs.scoreDocs.length); if (this.archive && !UUID_FIELDS.equals(fieldsToLoad)) { // Event archive only stores UUID & last_seen - have to query results from database Map<String, EventSummary> sortedResults = Maps.newLinkedHashMap(); Set<EventSummary> toLookup = Sets.newHashSetWithExpectedSize(lastDocument); Set<String> uuidAndLastSeen = Sets.newHashSet(FIELD_UUID, FIELD_LAST_SEEN_TIME); for (int i = offset; i < lastDocument; i++) { Document doc = searcher.doc(docs.scoreDocs[i].doc, uuidAndLastSeen); EventSummary event = LuceneEventIndexMapper.toEventSummary(doc); sortedResults.put(event.getUuid(), null); toLookup.add(event); } if (!toLookup.isEmpty()) { final long beforeLookup = System.currentTimeMillis(); logger.debug("Looking up {} events by UUID", toLookup.size()); List<EventSummary> events = eventSummaryBaseDao.findByKey(toLookup); if (events.size() != toLookup.size()) { logger.info("Event archive index out of sync - expected {} results, found {} results", toLookup.size(), events.size()); } for (EventSummary event : events) sortedResults.put(event.getUuid(), event); // a re-insertion -- lucene sort is preserved. for (EventSummary event : sortedResults.values()) if (event != null) result.addEvents(event); logger.debug("Query spent {} milliseconds to lookup {} events by UUID.", System.currentTimeMillis() - beforeLookup, toLookup.size()); } else { logger.debug("Query did not have to lookup any events by UUID"); } } else { for (int i = offset; i < lastDocument; i++) { result.addEvents( LuceneEventIndexMapper.toEventSummary(searcher.doc(docs.scoreDocs[i].doc, fieldsToLoad))); } } return result.build(); }
From source file:com.android.tools.idea.rendering.LayoutlibCallbackImpl.java
/** * Searches for cycles in the {@code <include>} tag graph of the layout files we've * been asked to provide parsers for//from w w w. ja v a 2 s . c o m */ private boolean findCycles() { Map<File, String> fileToLayout = Maps.newHashMap(); Map<String, File> layoutToFile = Maps.newHashMap(); Multimap<String, String> includeMap = ArrayListMultimap.create(); for (File file : myParserFiles) { String layoutName = LintUtils.getLayoutName(file); layoutToFile.put(layoutName, file); fileToLayout.put(file, layoutName); try { String xml = Files.toString(file, Charsets.UTF_8); Document document = XmlUtils.parseDocumentSilently(xml, true); if (document != null) { NodeList includeNodeList = document.getElementsByTagName(VIEW_INCLUDE); for (int i = 0, n = includeNodeList.getLength(); i < n; i++) { Element include = (Element) includeNodeList.item(i); String included = include.getAttribute(ATTR_LAYOUT); if (included.startsWith(LAYOUT_RESOURCE_PREFIX)) { String resource = included.substring(LAYOUT_RESOURCE_PREFIX.length()); includeMap.put(layoutName, resource); } } // Deals with tools:layout attribute from fragments NodeList fragmentNodeList = document.getElementsByTagName(VIEW_FRAGMENT); for (int i = 0, n = fragmentNodeList.getLength(); i < n; i++) { Element fragment = (Element) fragmentNodeList.item(i); String included = fragment.getAttributeNS(TOOLS_URI, ATTR_LAYOUT); if (included.startsWith(LAYOUT_RESOURCE_PREFIX)) { String resource = included.substring(LAYOUT_RESOURCE_PREFIX.length()); includeMap.put(layoutName, resource); } } } } catch (IOException e) { LOG.warn("Could not check file " + file + " for cyclic dependencies", e); } } // We now have a DAG over the include dependencies in the layouts // Do a DFS to detect cycles // Perform DFS on the include graph and look for a cycle; if we find one, produce // a chain of includes on the way back to show to the user if (includeMap.size() > 0) { for (String from : includeMap.keySet()) { Set<String> visiting = Sets.newHashSetWithExpectedSize(includeMap.size()); List<String> chain = dfs(from, visiting, includeMap); if (chain != null) { if (myLogger != null) { RenderProblem.Html problem = RenderProblem.create(WARNING); HtmlBuilder builder = problem.getHtmlBuilder(); builder.add("Found cyclical <include> chain: "); boolean first = true; Collections.reverse(chain); for (String layout : chain) { if (first) { first = false; } else { builder.add(" includes "); } File file = layoutToFile.get(layout); if (file != null) { try { String url = SdkUtils.fileToUrlString(file); builder.addLink(layout, url); } catch (MalformedURLException e) { builder.add(layout); } } else { builder.add(layout); } } myLogger.addMessage(problem); } return true; } } } return false; }
From source file:com.attribyte.relay.wp.WPSupplier.java
/** * Builds the replication message.//from w w w .j av a2 s . com * @return The message or {@code absent} if no new entries. * @throws SQLException on database error. */ protected Optional<Message> buildMessage() throws SQLException { List<Post> nextPosts = selectNextPosts(startMeta); logger.info(String.format("Selected %d modified posts", nextPosts.size())); if (nextPosts.isEmpty()) { return Optional.absent(); } final Timer.Context ctx = messageBuilds.time(); try { Set<Long> allEntries = Sets.newHashSetWithExpectedSize(maxSelected > 1024 ? 1024 : maxSelected); Set<Long> allAuthors = Sets.newHashSetWithExpectedSize(maxSelected > 1024 ? 1024 : maxSelected); ClientProtos.WireMessage.Replication.Builder replicationMessage = ClientProtos.WireMessage.Replication .newBuilder(); ClientProtos.WireMessage.Site parentSite = ClientProtos.WireMessage.Site.newBuilder() .setTitle(site.title).setDescription(site.description).setUrl(site.baseURL).build(); replicationMessage.addSites(parentSite); replicationMessage.setOrigin(MessageUtil.buildServerOrigin(originId)); for (Post post : nextPosts) { if (!allEntries.contains(post.id)) { allEntries.add(post.id); if (postFilter != null && !postFilter.accept(post)) { continue; } if (allowedStatus.contains(post.status)) { if (post.author == null) { logger.error(String.format("Skipping post with missing author (%d)", post.id)); continue; } if (post.modifiedTimestamp > System.currentTimeMillis()) { long offsetHours = (post.modifiedTimestamp - System.currentTimeMillis()) / 3600L / 1000L; logger.info(String.format( "Post has future modified time: offset hours: %d - writing the current time (%d)", offsetHours, post.id)); post = post.modifiedNow(); } if (metaDB != null) { try { PostMeta currMeta = new PostMeta(post); PostMeta prevMeta = metaDB.read(post.id); if (prevMeta != null) { if (currMeta.fingerprint.equals(prevMeta.fingerprint)) { logger.info(String.format("Skipping identical post (%d)", post.id)); continue; } else { metaDB.write(currMeta); } } else { metaDB.write(currMeta); } } catch (IOException ioe) { logger.error("Problem reading/writing metadata", ioe); } } ClientProtos.WireMessage.Author author = fromUser(post.author); if (!allAuthors.contains(author.getId())) { allAuthors.add(author.getId()); replicationMessage.addAuthors(author); } ClientProtos.WireMessage.Entry.Builder entry = ClientProtos.WireMessage.Entry.newBuilder(); entry.setId(post.id); entry.setPermanent(true); entry.setAuthor(author); entry.setParentSite(parentSite); entry.setCanonicalLink(site.buildPermalink(post)); if (post.title != null) { entry.setTitle(post.title); } if (post.excerpt != null) { switch (excerptOutputField) { case "summary": entry.setSummary(post.excerpt); break; case "dek": entry.setDek(post.excerpt); break; } } if (!Strings.isNullOrEmpty(post.content)) { entry.setContent(contentTransformer == null ? post.content : contentTransformer.transform(post.content)); } else { entry.setContent(String.format(NO_CONTENT_TEMPLATE, post.id)); } if (post.publishTimestamp > 0L) { entry.setPublishTimeMillis(post.publishTimestamp); } if (post.modifiedTimestamp > 0L) { entry.setLastModifiedMillis(post.modifiedTimestamp); } switch (post.status) { case PUBLISH: entry.setStatus("published"); break; case PENDING: if (replicatePendingState) { entry.setStatus("draft"); } else if (replicateScheduledState) { entry.setStatus("scheduled"); } else { entry.setStatus("published"); } break; case FUTURE: if (replicateScheduledState) { entry.setStatus("scheduled"); } else { entry.setStatus("published"); } break; default: entry.setStatus("draft"); break; } long featuredImageId = featuredImageId(post.metadata); for (Post attachmentPost : post.children) { if (attachmentPost.type == Post.Type.ATTACHMENT && isImageAttachment(attachmentPost)) { final List<ClientProtos.WireMessage.Meta> protoImageMeta; if (allowedImageMeta.isEmpty()) { protoImageMeta = ImmutableList.of(); } else { List<Meta> imageMeta = db.selectPostMeta(attachmentPost.id); protoImageMeta = imageMeta.isEmpty() ? ImmutableList.of() : Lists.newArrayListWithExpectedSize(imageMeta.size()); imageMeta.forEach(meta -> { if (allowedImageMeta.contains(meta.key)) { protoImageMeta.add(ClientProtos.WireMessage.Meta.newBuilder() .setName(meta.key).setValue(meta.value).build()); } }); } if (featuredImageId > 0 && attachmentPost.id == featuredImageId) { entry.setPrimaryImage( ClientProtos.WireMessage.Image.newBuilder().addAllMeta(protoImageMeta) .setOriginalSrc(new ImageAttachment(attachmentPost).path()) .setTitle(Strings.nullToEmpty(attachmentPost.excerpt))); } else { entry.addImagesBuilder().addAllMeta(protoImageMeta) .setOriginalSrc(new ImageAttachment(attachmentPost).path()) .setTitle(Strings.nullToEmpty(attachmentPost.excerpt)); } } } extractLinks(entry, site.baseURL); //Other images, citations... if (dusterClient != null) { dusterClient.enableImages(entry); } for (TaxonomyTerm tag : post.tags()) { entry.addTag(unescapeHTML(tag.term.name)); } for (TaxonomyTerm category : post.categories()) { entry.addTopic(unescapeHTML(category.term.name)); } if (!allowedPostMeta.isEmpty() && !post.metadata.isEmpty()) { for (Meta meta : post.metadata) { if (allowedPostMeta.contains(meta.key)) { entry.addMetaBuilder().setName(metaKey(meta.key)).setValue(meta.value); } } } if (postTransformer != null) { postTransformer.transform(post, entry); } replicationMessage.addEntries(entry.build()); } else { replicationMessage.addEntriesBuilder().setId(post.id).setDeleted(true); } } else { replicationMessage.addEntriesBuilder().setId(post.id).setDeleted(true); } } String messageId = this.startMeta.toBytes().toStringUtf8(); Post lastPost = lastNonFutureModified(nextPosts); if (lastPost != null) { this.startMeta = new PostMeta(lastPost.id, lastPost.modifiedTimestamp); } else { logger.error("All modified timestamps were in the future! Resetting."); lastPost = nextPosts.get(nextPosts.size() - 1); this.startMeta = new PostMeta(lastPost.id, System.currentTimeMillis() - 60000L); } if (logReplicationMessage) { logger.info("Replication Message"); logger.info("-------------------"); logger.info(TextFormat.printToString(replicationMessage.build())); } return Optional.of(Message.publish(messageId, replicationMessage.build().toByteString())); } finally { ctx.stop(); } }
From source file:it.unibo.alchemist.model.implementations.actions.LsaAbstractAction.java
/** * Sets #NEIGH equal to the passed node list. * //w ww . ja v a 2 s . c om * @param list * the list of nodes to use */ protected void setSyntheticNeigh(final Collection<Node<List<ILsaMolecule>>> list) { final Set<ITreeNode<?>> l = Sets.newHashSetWithExpectedSize(list.size()); for (final Node<List<ILsaMolecule>> n : list) { l.add(new NumTreeNode(n.getId())); } matches.put(LsaMolecule.SYN_NEIGH, new ListTreeNode(l)); }
From source file:org.lilyproject.linkindex.LinkIndex.java
public Set<RecordId> getForwardLinks(RecordId record, SchemaId vtag, SchemaId sourceField) throws LinkIndexException, InterruptedException { Set<AbsoluteRecordId> absoluteLinks = getForwardLinks(getAbsoluteId(record), vtag, sourceField); Set<RecordId> relativeLinks = Sets.newHashSetWithExpectedSize(absoluteLinks.size()); for (AbsoluteRecordId absoluteLink : absoluteLinks) { relativeLinks.add(absoluteLink.getRecordId()); }//from www . j a v a 2s. com return relativeLinks; }
From source file:com.opengamma.engine.exec.plan.MultipleNodeExecutionPlanner.java
private GraphExecutionPlan createMultipleNodePlan(final DependencyGraph graph, final ExecutionLogModeSource logModeSource, final long functionInitializationId) { final GraphFragmentContext context = new GraphFragmentContext(logModeSource, functionInitializationId); context.setTerminalOutputs(graph.getTerminalOutputs().keySet()); final Set<GraphFragment> allFragments = Sets.newHashSetWithExpectedSize(graph.getSize()); final Set<GraphFragment> rootFragments = Sets.newHashSetWithExpectedSize(graph.getRootNodes().size()); createGraphFragments(graph, rootFragments, allFragments); int failCount = 0; do {/*from w w w .j a va 2 s. c o m*/ if (mergeSharedInputs(rootFragments, allFragments)) { failCount = 0; } else { if (++failCount >= 2) { break; } } if (mergeSingleDependencies(context, allFragments)) { failCount = 0; } else { if (++failCount >= 2) { break; } } } while (true); findTailFragments(allFragments); long totalSize = 0; long totalInvocationCost = 0; long totalDataCost = 0; final Collection<PlannedJob> jobs = new LinkedList<PlannedJob>(); for (GraphFragment fragment : allFragments) { final Collection<GraphFragment> inputs = fragment.getInputFragments(); totalSize += fragment.getJobItems(); totalInvocationCost += fragment.getInvocationCost(); totalDataCost += fragment.getDataIOCost(); if ((inputs != null) && inputs.isEmpty()) { jobs.add(fragment.getOrCreateJob(context)); } } final int totalJobs = allFragments.size(); return new GraphExecutionPlan(graph.getCalculationConfigurationName(), functionInitializationId, jobs, allFragments.size(), (double) totalSize / (double) totalJobs, (double) totalInvocationCost / (double) totalJobs, (double) totalDataCost / (double) totalJobs); }
From source file:de.devsurf.components.cmis.RepositoryService.java
private ObjectData getRootFolder(ObjectInfoHandler objectInfos) { ObjectDataImpl result = new ObjectDataImpl(); ObjectInfoImpl objectInfo = new ObjectInfoImpl(); result.setAllowableActions(compileAllowableActions(true, true, null)); String typeId = TypeManager.FOLDER_TYPE_ID; objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER); objectInfo.setTypeId(typeId);//from w w w . java2 s .c o m objectInfo.setContentType(null); objectInfo.setFileName(null); objectInfo.setHasAcl(true); objectInfo.setHasContent(false); objectInfo.setVersionSeriesId(null); objectInfo.setIsCurrentVersion(true); objectInfo.setRelationshipSourceIds(null); objectInfo.setRelationshipTargetIds(null); objectInfo.setRenditionInfos(null); objectInfo.setSupportsDescendants(true); objectInfo.setSupportsFolderTree(true); objectInfo.setSupportsPolicies(false); objectInfo.setSupportsRelationships(false); objectInfo.setWorkingCopyId(null); objectInfo.setWorkingCopyOriginalId(null); PropertiesImpl properties = new PropertiesImpl(); Set<String> filter = Sets.newHashSetWithExpectedSize(0); addPropertyId(properties, typeId, filter, PropertyIds.OBJECT_ID, ROOT_ID); objectInfo.setId(ROOT_ID); addPropertyString(properties, typeId, filter, PropertyIds.NAME, "ROOT"); objectInfo.setName("ROOT"); addPropertyString(properties, typeId, filter, PropertyIds.CREATED_BY, "system"); // switch to SYSCREATEUSER addPropertyString(properties, typeId, filter, PropertyIds.LAST_MODIFIED_BY, "system"); objectInfo.setCreatedBy("system"); // creation and modification date GregorianCalendar lastModified = millisToCalendar(System.currentTimeMillis()); addPropertyDateTime(properties, typeId, filter, PropertyIds.CREATION_DATE, lastModified); // SYSCREATEDATE addPropertyDateTime(properties, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified); // SYSTIMESTAMP objectInfo.setCreationDate(lastModified); objectInfo.setLastModificationDate(lastModified); // change token - always null addPropertyString(properties, typeId, filter, PropertyIds.CHANGE_TOKEN, null); // CMIS 1.1 properties addPropertyString(properties, typeId, filter, PropertyIds.DESCRIPTION, null); addPropertyIdList(properties, typeId, filter, PropertyIds.SECONDARY_OBJECT_TYPE_IDS, null); // base type and type name addPropertyId(properties, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_FOLDER.value()); addPropertyId(properties, typeId, filter, PropertyIds.OBJECT_TYPE_ID, TypeManager.FOLDER_TYPE_ID); addPropertyString(properties, typeId, filter, PropertyIds.PATH, "/"); // folder properties addPropertyId(properties, typeId, filter, PropertyIds.PARENT_ID, null); objectInfo.setHasParent(false); addPropertyIdList(properties, typeId, filter, PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS, null); result.setProperties(properties); if (context.isObjectInfoRequired()) { objectInfo.setObject(result); objectInfos.addObjectInfo(objectInfo); } return result; }
From source file:com.opengamma.engine.view.calcnode.SimpleCalculationNode.java
private static Set<ValueRequirement> plat2290(final Set<ValueSpecification> outputs) { final Set<ValueRequirement> result = Sets.newHashSetWithExpectedSize(outputs.size()); for (ValueSpecification output : outputs) { result.add(output.toRequirementSpecification()); }//from ww w .j a v a2 s . c o m return result; }