/** * Copies the criteria with possibly modified types setting. * * @param types the new value for the criterion * @return the new criteria */ public MatchCriteria types(String... types) { MatchCriteria r = new MatchCriteria(this); r.types = types; return r; }
/** * Copy constructor. * * @param crit the criteria to copy */ public MatchCriteria(MatchCriteria crit) { this.types = copy(crit.getTypes()); String[][] tc = crit.getTagConstraint(); this.tags = new String[tc.length][]; for (int i = 0; i < tc.length; i++) this.tags[i] = copy(tc[i]); this.tagPrefixes = crit.getTagPrefixesConstraint(); this.from = crit.getFrom(); this.until = crit.getUntil(); this.creationTimestampFrom = crit.getCreationTimestampFrom(); this.creationTimestampUntil = crit.getCreationTimestampUntil(); this.usePartStamps = crit.isUsingPartStamps(); this.psk = crit.getPartSearchKey(); }
/** * Copies the criteria with possibly modified tags setting. * * @param tags the new value for the criterion * @return the new criteria */ public MatchCriteria tags(String... tags) { MatchCriteria r = new MatchCriteria(this); r.tags = simpleTagsConjunction(tags); return r; }
IEditorFacade<?> ef = (IEditorFacade<?>) getBean(bf, CommonContextHelper.BEAN_EDITOR_FACADE, "EditorFacade"); CountingIterator<CatalogObjectMeta> it = cf.findObjects(new MatchCriteria().until(cleanBefore).tags(tag)); int elementsToClean=0; while (it.hasNext()) {
MatchCriteria spec = new MatchCriteria(); if (typedCtxPathDTO.getType()!=null) { spec = spec.types(typedCtxPathDTO.getType()); spec = spec.partSearchKey(psk); Iterator<CatalogObjectMeta> it = catalogFacade.findObjects(spec); List<String> foundResults = new ArrayList<String>();
@Override protected List<DbObjectMeta> findMetasPage(MatchCriteria spec, Date pageEnd, Long pk, int limit) throws DataAccessException { spec = spec.usingPartStamps(spec.isUsingPartStamps() && getProvidedFeatures().contains(ICatalog.FEATURE_PART_STAMPS)); // ignore if the DAO does not provide the feature List<Object> constParams = new ArrayList<Object>(4); StringBuilder constQuery = new StringBuilder();
String whereExtra(String sep, MatchCriteria spec, StringBuilder where, List<Object> params) { PartSearchKey sk = spec.getPartSearchKey(); if (sk != null) { PartSearchOperation op = sk.getOperation(); switch (op) { case EQ: where.append(sep).append(PART_SEARCH_KEY).append("=?"); params.add(sk.getValue()); sep = " AND "; break; default: throw new UnsupportedOperationException("Unsupported match operation: "+op); } } return sep; } }
/** * Copies the criteria with possibly modified tags setting. * * @param tags the new value for the criterion * @return the new criteria */ public MatchCriteria tags(Collection<String> tags) { MatchCriteria r = new MatchCriteria(this); r.tags = simpleTagsConjunction(tags.toArray(new String[tags.size()])); return r; }
" LEFT JOIN "+tt+" ON "+mt+"."+META_PK+"="+tt+"."+TAG_FK); String[][] tags = spec.getTagConstraint(); String[] tagPrefixes = spec.getTagPrefixesConstraint(); if (spec.isUsingPartStamps()) { sep = whereCommon(spec.getTypes(), null, null, null, null, where, params); sep = wherePartStamps(sep, spec.getTypes(), spec.getFrom(), spec.getUntil(), where, params); } else sep = whereCommon(spec.getTypes(), spec.getFrom(), spec.getUntil(), spec.getCreationTimestampFrom(), spec.getCreationTimestampUntil(), where, params);
/** * Copies the criteria with possibly modified usePartStamps setting. * * @param usePartStamps the new value for the criterion * @return the new criteria */ public MatchCriteria usingPartStamps(boolean usePartStamps) { MatchCriteria r = new MatchCriteria(this); r.usePartStamps = usePartStamps; return r; }
/** * Copies the criteria with possibly modified partSearchKey setting. * * @param psk the new value for the criterion * @return the new criteria */ public MatchCriteria partSearchKey(PartSearchKey psk) { MatchCriteria r = new MatchCriteria(this); r.psk = psk; return r; }
/** * Copies the criteria with possibly modified tag prefixes setting. * * @param tagPrefixes the new value for the criterion * @return the new criteria */ public MatchCriteria tagPrefixes(String... tagPrefixes) { MatchCriteria r = new MatchCriteria(this); r.tagPrefixes = tagPrefixes; return r; }
/** * Copies the criteria with possibly modified until setting. * * @param creationTimestampFrom the new value for the criterion * @return the new criteria */ public MatchCriteria creationTimestampFrom(Date creationTimestampFrom) { MatchCriteria r = new MatchCriteria(this); r.creationTimestampFrom = creationTimestampFrom; return r; }
/** * Copies the criteria with possibly modified until setting. * * @param creationTimestampUntil the new value for the criterion * @return the new criteria */ public MatchCriteria creationTimestampUntil(Date creationTimestampUntil) { MatchCriteria r = new MatchCriteria(this); r.creationTimestampUntil = creationTimestampUntil; return r; }
/** * Copies the criteria with possibly modified tags setting. * * @param tags the new value for the criterion * @return the new criteria */ public MatchCriteria tagConstraint(String[][] tags) { MatchCriteria r = new MatchCriteria(this); r.tags = tags; return r; }
/** * Copies the criteria with possibly modified from setting. * * @param from the new value for the criterion * @return the new criteria */ public MatchCriteria from(Date from) { MatchCriteria r = new MatchCriteria(this); r.from = from; return r; }
/** * Copies the criteria with possibly modified until setting. * * @param until the new value for the criterion * @return the new criteria */ public MatchCriteria until(Date until) { MatchCriteria r = new MatchCriteria(this); r.until = until; return r; }
/** * Copies the criteria with possibly modified types setting. * * @param types the new value for the criterion * @return the new criteria */ public MatchCriteria types(Collection<String> types) { MatchCriteria r = new MatchCriteria(this); r.types = types.toArray(new String[types.size()]); return r; }
@Override public ListObjectsResponse listObjects(ListObjectsRequest request) { ListObjectsResponse resp = new ListObjectsResponse(); try { String rt = request.getResumptionToken(); if (rt == null) { CatalogDAO dao; if (request.isHistory()) dao = histdao; else dao = curdao; rt = metaPager.add(dao.findMetas(new MatchCriteria(request))); } resp.setCount(metaPager.nextPage(rt, resp)); } catch (Exception e) { log.error("Exception caught", e); resp.setError(new YaddaError(ERROR_CODE, "exception caught", e)); } return resp; }