private static void mapCollection(RcCollectionMetadata rcCollMd, Map<String, RcCollectionMetadata> rcCollMdMap, boolean allCollections) { if (allCollections) { rcCollMdMap.put(rcCollMd.getId(), rcCollMd); } else if (rcCollMd.getObjectMap().size() > 0) { rcCollMdMap.put(rcCollMd.getId(), rcCollMd); } for (RcCollectionMetadata rcSubCollMd : rcCollMd.getCollectionMap().values()) { mapCollection(rcSubCollMd, rcCollMdMap, allCollections); } } }
private void addCollections(List<RcCollectionMetadata> rcCollMdLst, DefaultMutableTreeNode parentNode) { Collections.sort(rcCollMdLst, COLL_TITLE_COMPARATOR); HashSet<String> collIdSet; for (RcCollectionMetadata rcCollMd : rcCollMdLst) { DefaultMutableTreeNode collNode = new DefaultMutableTreeNode(rcCollMd); parentNode.add(collNode); this.collectionNodeMap.put(rcCollMd.getId(), collNode); for (String objId : rcCollMd.getObjectMap().keySet()) { collIdSet = this.assignedObjectMap.get(objId); if (collIdSet == null) { collIdSet = new HashSet<String>(); this.assignedObjectMap.put(objId, collIdSet); } collIdSet.add(rcCollMd.getId()); } this.addCollections(new ArrayList<RcCollectionMetadata>(rcCollMd.getCollectionMap().values()), collNode); } }
/** * Adds a collection and all it's sub-collections to the collection map. * * @param rcCollMd * The collection to map. */ private void mapCollection(RcCollectionMetadata rcCollMd) { this.rcCollectionMetadataIdMap.put(rcCollMd.getId(), rcCollMd); this.rcCollectionMetadataFacetPathMap.put(RcWebSearchUtils.getFacetPathForCollection(rcCollMd), rcCollMd); for (String rcObjId : rcCollMd.getObjectMap().keySet()) { if (!this.rcObjIdToCollIdMap.containsKey(rcObjId)) { this.rcObjIdToCollIdMap.put(rcObjId, rcCollMd.getId()); } } for (RcCollectionMetadata rcSubCollMd : rcCollMd.getCollectionMap().values()) { mapCollection(rcSubCollMd); } }
public static RcIrFacetPath getFacetPathForCollection(RcCollectionMetadata rcCollMd) { if (rcCollMd == null) { return null; } ArrayList<String> catPathComponents = new ArrayList<String>(); catPathComponents.add(rcCollMd.getId().trim()); RcMetadata rcParentMetadata = rcCollMd.getParentMetadata(); while (rcParentMetadata instanceof RcCollectionMetadata) { catPathComponents.add(((RcCollectionMetadata) rcParentMetadata).getId()); rcParentMetadata = rcParentMetadata.getParentMetadata(); } catPathComponents.add(RcIrStaticField.COLLECTION.getFieldName()); Collections.reverse(catPathComponents); return new RcIrFacetPath(catPathComponents.toArray(new String[0])); } }
public static String getCollectionIdForFacetPath(RcIrFacetPath facetPath) { RcCollectionMetadata rcCollMd = RcWebApp.getInstance().getCollectionMetadata(facetPath); if (rcCollMd == null) { return null; } return rcCollMd.getId(); }
/** * Select the specified collection. * * @param rcCollMd * The collection to select. */ private void selectCollection(RcCollectionMetadata rcCollMd) { DefaultMutableTreeNode n = this.collectionNodeMap.get(rcCollMd.getId()); if (n != null) { TreePath p = new TreePath(n.getPath()); this.collectionsJTree.expandPath(p); this.collectionsJTree.scrollPathToVisible(p); this.collectionsJTree.setSelectionPath(p); } }
subCollection.put("@id", this.getBaseUrl(request) + IIIF_PRESENTATION_API_PATH + "/collection/" + rcSubCollMd.getId()); subCollection.put("@type", "sc:Collection"); subCollection.put("label", rcSubCollMd.getTitle());
collectionsDataMap.put(rcCollMd.getId(), this.getJSONCollectionObject(rcCollMd, objStartIndex, objCount));
RcIrQueryClause collClause = new RcIrTextQueryClause(RcIrQueryClauseModifier.AND, RcIrStaticField.COLLECTION, rcCollMd.getId()); manifest.put("@id", this.getBaseUrl(request) + IIIF_PRESENTATION_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + "/manifest"); manifest.put("@type", "sc:Manifest"); subCollection.put("@id", this.getBaseUrl(request) + IIIF_PRESENTATION_API_PATH + "/collection/" + rcSubCollMd.getId()); subCollection.put("@type", "sc:Collection"); subCollection.put("label", rcSubCollMd.getTitle());
File rcObjDir = rcFsDsMd.getDirectory(rcObjMd); RcIrPageQuery rcIrPgQuery = new RcIrPageQuery(rcCollMd.getId() + "/" + rcObjMd.getId(), new ArrayList<RcIrQueryClause>()); RcIrPageQueryResults rcIrPgQueryResults = this.rcWebApp.getRcIrSearcher().searchPages(rcIrPgQuery); canvas.put("@id", baseUrl + IIIF_PRESENTATION_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + "/canvas/" + i); canvas.put("@type", "sc:Canvas"); canvas.put("label", new JSONArray().put(rcImgMd.getPageName())); image.put("@id", baseUrl + IIIF_PRESENTATION_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + "/annotation/" + i); image.put("@type", "oa:Annotation"); image.put("motivation", "sc:painting"); image.put("on", baseUrl + IIIF_PRESENTATION_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + "/canvas/" + i); resource.put("@id", baseUrl + IIIF_PRESENTATION_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + "/res/" + i + ".jpg"); resource.put("@type", "dctypes:Image"); resource.put("format", "image/jpeg"); service.put("@id", baseUrl + IIIF_IMAGE_API_PATH + "/" + rcCollMd.getId() + RC_ID_PATH_SEPARATOR + rcObjMd.getId().replace("/", RC_ID_PATH_SEPARATOR) + RC_ID_PATH_SEPARATOR + i); service.put("profile", "http://iiif.io/api/image/2/level2.json");
rcParentCollMd.getCollectionMap().put(newMeta.getId(), newMeta);
this.assignedObjectMap.get(((RcObjectMetadata) this.objectListModel.getElementAt(selectedObjectIdices[i])).getId()).remove(this.rcCollectionMetadata.getId());
((RcCollectionMetadata) this.selectedCollection.getParentMetadata()).getCollectionMap().remove(this.selectedCollection.getId());
collIdSet.add(this.rcCollectionMetadata.getId());