public List<ResourceName> queryMDS(PackageName packageName) { MDSInstance mdsInstance; List<ResourceName> resources = new ArrayList<ResourceName>(); try { mdsInstance = storeInitializer.getMDSInstance(); packageName = (packageName == null) ? PackageName.createPackageName("/") : packageName; NameCondition condition = ConditionFactory.createNameCondition(packageName.getAbsoluteName(), "%"); ResourceQuery query = QueryFactory.createResourceQuery(mdsInstance, condition); Iterator<QueryResult> contents = query.execute(); if (contents == null) { return resources; } while (contents.hasNext()) { QueryResult result = contents.next(); if (result.getResultType() == QueryResult.ResultType.PACKAGE_RESULT) { PackageResult pack = (PackageResult) result; resources.add(pack.getPackageName()); } else { DocumentResult doc = (DocumentResult) result; resources.add(doc.getDocumentName()); } } return resources; } catch (MDSAccessException e) { throw new IllegalArgumentException("Could not connect to MDS, check login data", e); } catch (InvalidReferenceException e) { throw new IllegalArgumentException("Could not find/read " + packageName, e); } catch (InvalidReferenceTypeException e) { throw new IllegalArgumentException("No correct type!", e); } }
public ViewCondition newViewCondition( EntitlementCondition ec, ConditionFactory conditionTypeFactory) { assert (ec instanceof NotCondition); NotCondition nc = (NotCondition) ec; NotViewCondition nvc = (NotViewCondition) newViewCondition(); if (nc.getECondition() != null) { ViewCondition vc = conditionTypeFactory.getViewCondition(nc.getECondition()); nvc.addViewCondition(vc); } return nvc; }
protected String createDesctiption() { final String simpleCondition = Resources.getInstance().getResourceString(ConditionFactory.FILTER_DOES_NOT_EXIST); return ConditionFactory.createDescription(attribute, simpleCondition, null, false); }