@Override public int count() { int res = -1; if(it instanceof CountingIterator<?>) { res = ((CountingIterator<?>)it).count(); } return res; } }
public SimpleCriteria(ListObjectsRequest req) { types = req.getTypes(); tags = req.getTags(); tagPrefixes = req.getTagPrefixes(); fromDate = req.getFrom(); untilDate = req.getUntil(); creationTimestampFrom = req.getCreationTimestampFrom(); creationTimestampUntil = req.getCreationTimestampUntil(); }
public CatalogBwmetaIterator(ICatalogFacade<String> catalogFacade, Date from, Date to, String collection) throws CatalogException { this.catalogFacade = catalogFacade; String[] tags = null; if (collection!=null) { tags = new String[] { CatalogParamConstants.TAG_COLLECTION_PREFIX+collection }; } metaIterator = catalogFacade.iterateObjects(BWMETA_TYPE, from, to, tags, false); }
/** * Creates a list objects request from these criteria. * * @return the new request */ public ListObjectsRequest toRequest() { ListObjectsRequest lor; String[] stc = simpleTagsConjunction(); if (stc != null) { lor = new ListObjectsRequest(); lor.setTags(stc); } else { lor = new ListObjectsRequest2(); ((ListObjectsRequest2) lor).setTagConstraint(tags); } lor.setTagPrefixes(tagPrefixes); lor.setTypes(types); lor.setFrom(from); lor.setUntil(until); lor.setCreationTimestampFrom(creationTimestampFrom); lor.setCreationTimeStampUntil(creationTimestampUntil); lor.setUsePartStamps(usePartStamps); lor.setPartSearchKey(psk); return lor; }
/** * Creates match criteria from a ListObjectsRequest. * * @param req the request to extract the criteria from */ public MatchCriteria(ListObjectsRequest req) { types = req.getTypes(); tags = tagsOfRequest(req); tagPrefixes = req.getTagPrefixes(); from = req.getFrom(); until = req.getUntil(); creationTimestampFrom = req.getCreationTimestampFrom(); creationTimestampUntil = req.getCreationTimestampUntil(); usePartStamps = req.isUsingPartStamps(); psk = req.getPartSearchKey(); }
@Override public GetPartResponse<String> getPart(GetPartRequest request) { GetObjectRequest oReq = new GetObjectRequest(); oReq.setObject(request.getObject()); SAMLObject[] samlObjects = securityRequestHandler.extract(request); securityRequestHandler.attach(oReq, samlObjects); GetObjectResponse<String> oResp = this.getObject(oReq); if(!oResp.isOK()) { GetPartResponse<String> resp = new GetPartResponse<String>(); resp.setError(oResp.getError()); return resp; } else { return catalog.getPart(request); } }
@SuppressWarnings("unchecked") public FlatElementIterator(ICatalogFacade<String> catalogFacade, String[] tags) throws CatalogException{ super(catalogFacade); CountingIterator<CatalogObjectMeta> metas = catalogFacade.iterateObjects(new String[]{CatalogParamConstants.TYPE_BWMETA1}, new Date(0), new Date(), tags, false); count = metas.count(); //TODO what about counting deleted ones ? iterator = new FilterIterator(metas, new Predicate() { @Override public boolean evaluate(Object o) { CatalogObjectMeta item = (CatalogObjectMeta)o; return !item.getStatus().isDeleted(); } }); }
public void showElementPart(String id, String partType) { try { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID(id), partType, null); if (part == null) { os.println("Part doesn't exist"); } else { os.println(part.getData()); } } catch (CatalogException e) { e.printStackTrace(os); } }
@Override public ListObjectsResponse call(final String t) { final ListObjectsRequest r = new ListObjectsRequest(); r.setResumptionToken(t); resumptionToken = t; return catalogFacadeProvider.getCatalog().listObjects(r); } });
/** * Retrieves the requested tags from a <code>ListObjectsRequest</code>. * * @param req a <code>ListObjectsRequest</code> * @return the tags required by the request */ private String[][] tagsOfRequest(ListObjectsRequest req) { if (req instanceof ListObjectsRequest2) return ((ListObjectsRequest2) req).getTagConstraint(); else return simpleTagsConjunction(req.getTags()); } }
@Override public PagedListResponse<YaddaObjectID> listObjectIds( LimitedListObjectsRequest request) { return catalog.listObjectIds(request); }
@Override public ListObjectsRequest copy() { return new ListObjectsRequest2(this); };
public LimitedListObjectsRequest copy() { return new LimitedListObjectsRequest(this); }
public ListObjectsRequest copy() { return new ListObjectsRequest(this); }
/** * Sets the requested constraint on tags to the conjunction of the given tags. * * @param tags the tags to use * * @see #setTagConstraint(String[][]) */ @Override public void setTags(String[] tags) { String[][] tc = null; if (tags != null) { int n = tags.length; tc = new String[n][]; for (int i = 0; i < n; i++) tc[i] = new String[] {tags[i]}; } setTagConstraint(tc); }
@Override public ListTypesResponse listTypes() { return catalog.listTypes(); }
@Override public ObjectResponse<GroupedCount> getRecordStats(ParameterRequest<CatalogRecordStatisticsRequest> request) { return catalog.getRecordStats(request); }
public int count() { int count = 0; for (Object iterator : iteratorChain) { if (iterator instanceof CountingIterator) { CountingIterator ci = (CountingIterator)iterator; int localCount = ci.count(); if (localCount >= 0) count+= localCount; } } return count; }
@Override public int count() { if(it instanceof CountingIterator<?>) { return ((CountingIterator<?>)it).count(); } else return -1; } }
@Override public int getEstimatedSize() throws UnsupportedOperationException { if (it instanceof CountingIterator<?>) { return ((CountingIterator<CatalogObjectMeta>) it).count(); } else { throw new UnsupportedOperationException("getting estimated size is unsupported"); } }