/** * Gets the root SummaryEntry in the map, usually identified by a key in the map set to 0. * * @return the root SummaryEntry in the map */ public SummaryEntry getSummaryRoot() { return get(new IdRef("0").toString()); }
@OperationMethod public void run(IdRef idRef) throws Exception { setLabels(idRef.toString()); }
@Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<String>(); items.add(getPrefix()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String uri = Joiner.on("/").join(items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; }
@Override public String getUrlFromDocumentView(DocumentView docView) { DocumentLocation docLoc = docView.getDocumentLocation(); if (docLoc != null) { List<String> items = new ArrayList<>(); items.add(getPrefix()); items.add(docLoc.getServerName()); IdRef docRef = docLoc.getIdRef(); if (docRef == null) { return null; } items.add(docRef.toString()); String viewId = docView.getViewId(); if (viewId != null) { items.add(viewId); } String uri = String.join("/", items); return URIUtils.addParametersToURIQuery(uri, docView.getParameters()); } return null; }
@Override public Resource getResource(Serializable object, Map<String, Object> context) { if (object instanceof DocumentModel) { DocumentModel doc = (DocumentModel) object; String localName = doc.getRepositoryName() + '/' + doc.getId(); return new QNameResourceImpl(namespace, localName); } else if (object instanceof DocumentLocation) { DocumentLocation docLoc = (DocumentLocation) object; String localName = docLoc.getServerName() + '/' + docLoc.getIdRef().toString(); return new QNameResourceImpl(namespace, localName); } else { throw new IllegalArgumentException(String.format("cannot build resource for '%s'", object)); } }