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 static List<RcCollectionMetadata> readColletionMetadata(File rcDataVolDir) throws IOException, SAXException, RcMetadataException, RcOutdatedMetadataException { if (!rcDataVolDir.getName().equals("RCDATA01")) { throw new IOException("ResCarta data volume directory must be RCDATA01."); } File collMdFile = new File(rcDataVolDir.getPath() + File.separator + "metadata.xml"); return RcCollectionMetadata.readMets(collMdFile); }
/** * * @param rcCollectionMetadataList * * @return * * @throws RcIndexerException */ private static List<String> getAllExtendedObjectIds(List<RcCollectionMetadata> rcCollectionMetadataList) throws RcIndexerException { List<String> allObjectsIdList = new ArrayList<String>(); String currentCollectionTitle = null; ListIterator<RcCollectionMetadata> collIt = rcCollectionMetadataList.listIterator(); RcCollectionMetadata rcCollMd; while (collIt.hasNext()) { rcCollMd = (RcCollectionMetadata) collIt.next(); currentCollectionTitle = rcCollMd.getTitle(); if (currentCollectionTitle.endsWith("/")) { throw new RcIndexerException("Invalid Collection Title Found. An illegal forward slash character found in string."); } currentCollectionTitle += "/"; Iterator<RcObjectMetadata> rcObjMdIt = rcCollMd.getObjectMap().values().iterator(); while (rcObjMdIt.hasNext()) { String rcFullObjectID = currentCollectionTitle; rcFullObjectID += rcObjMdIt.next().getId(); allObjectsIdList.add(rcFullObjectID); } } Collections.sort(allObjectsIdList); return allObjectsIdList; }
private static int countObjects(RcCollectionMetadata rcCollMd) { int objCnt = rcCollMd.getObjectMap().size(); for (RcCollectionMetadata rcSubCollMd : rcCollMd.getCollectionMap().values()) { objCnt += countObjects(rcSubCollMd); } return objCnt; }
private static RcIrFacetPath getFacetPath(RcCollectionMetadata rcCollMd) { if (rcCollMd != null) { List<String> facetPathList = new ArrayList<String>(); facetPathList.add(rcCollMd.getTitle()); while (rcCollMd.getParentMetadata() != null && rcCollMd.getParentMetadata() instanceof RcCollectionMetadata) { rcCollMd = (RcCollectionMetadata) rcCollMd.getParentMetadata(); facetPathList.add(rcCollMd.getTitle()); } facetPathList.add(RcIrStaticField.COLLECTION.getFieldName()); Collections.reverse(facetPathList); return new RcIrFacetPath(facetPathList.toArray(new String[0])); } else { return null; } } /*
collection.put("@id", request.getRequestURL().toString()); collection.put("@type", "sc:Collection"); collection.put("label", rcCollMd.getTitle()); collection.put("description", this.getDescriptions(rcCollMd.getAbstracts())); RcIrQueryClause collClause = new RcIrTextQueryClause(RcIrQueryClauseModifier.AND, RcIrStaticField.COLLECTION, rcCollMd.getId()); rcObjMdList.add(rcCollMd.getObjectMap().get(r.getExtObjId().split("/", 2)[1])); 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"); for (RcCollectionMetadata rcSubCollMd : rcCollMd.getCollectionMap().values()) { subCollection.put("@id", this.getBaseUrl(request) + IIIF_PRESENTATION_API_PATH + "/collection/" + rcSubCollMd.getId()); subCollection.put("@type", "sc:Collection"); subCollection.put("label", rcSubCollMd.getTitle()); subCollection.put("description", this.getDescriptions(rcSubCollMd.getAbstracts()));
response = RcJOptionPane.showConfirmDialog(this.getWindow(), "Are you sure you want to remove " + this.selectedObject.getTitle() + " from " + this.rcCollectionMetadata.getTitle() + "?", "Confirm Object Removal", RcJOptionPane.YES_NO_OPTION); response = RcJOptionPane.showConfirmDialog(this.getWindow(), "Are you sure you want to remove the " + selectedObjectIdices.length + " selected objects from " + this.rcCollectionMetadata.getTitle() + "?", "Confirm Object Removal", RcJOptionPane.YES_NO_OPTION); this.rcCollectionMetadata.getObjectMap().remove(((RcObjectMetadata) this.objectListModel.getElementAt(selectedObjectIdices[i])).getId()); this.assignedObjectMap.get(((RcObjectMetadata) this.objectListModel.getElementAt(selectedObjectIdices[i])).getId()).remove(this.rcCollectionMetadata.getId());
int response = RcJOptionPane.showConfirmDialog(this.getWindow(), "Are you sure you want to remove " + this.selectedCollection.getTitle() + "?", "Confirm Collection Removal", RcJOptionPane.YES_NO_OPTION); else if (this.selectedCollection.getParentMetadata() instanceof RcCollectionMetadata) { nextSelection = (RcCollectionMetadata) this.selectedCollection.getParentMetadata(); if (this.selectedCollection.getParentMetadata() instanceof RcCollectionMetadata) { ((RcCollectionMetadata) this.selectedCollection.getParentMetadata()).getCollectionMap().remove(this.selectedCollection.getId());
newMeta = new RcCollectionMetadata(RcDataVolumeDirectoryMetadata.getInstance(this.currentResCartaVolumeDirectory)); newMeta = new RcCollectionMetadata(rcParentCollMd); siblingCollections = new ArrayList<RcCollectionMetadata>(rcParentCollMd.getCollectionMap().values()); if (rcCollMd.getTitle().trim().toLowerCase().equals(newMeta.getTitle().trim().toLowerCase())) { this.showErrorMessageDialog("A collection titled " + newMeta.getTitle() + " already exists.", "Unable to Add New Collection"); return; rcParentCollMd.getCollectionMap().put(newMeta.getId(), newMeta);
subCollection.put("@id", this.getBaseUrl(request) + IIIF_PRESENTATION_API_PATH + "/collection/" + rcSubCollMd.getId()); subCollection.put("@type", "sc:Collection"); subCollection.put("label", rcSubCollMd.getTitle()); subCollection.put("description", this.getDescriptions(rcSubCollMd.getAbstracts()));
List<RcCollectionMetadata> rcCollMdList = RcCollectionMetadata.readMets(metsFile); endTimeMs = System.currentTimeMillis(); System.out.println("(Done in " + RcTimeUtils.formatElapsedTimeMs(startTimeMs, endTimeMs) + ")"); for (RcCollectionMetadata rcCollMd : rcCollMdListAll) { if (rcCollMd.getTitle().trim().length() > maxCollTitleLen) { maxCollTitleLen = rcCollMd.getTitle().trim().length(); format, idx + 1, rcCollMd.getTitle().trim(), countObjects(rcCollMd), countObjects(rcIrSearcher, rcCollMd),
/** * * @param rcCollectionMetadataList * * @return */ private static long countRcObjects(List<RcCollectionMetadata> rcCollectionMetadataList) { long objCnt = 0; ListIterator<RcCollectionMetadata> rcCollMdLit = rcCollectionMetadataList.listIterator(); while (rcCollMdLit.hasNext()) { objCnt += rcCollMdLit.next().getObjectMap().size(); } return objCnt; }
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])); } }
RcCollectionMetadata modifiedCollMd = new RcCollectionMetadata(null); modifiedCollMd.setTitle(selectedCollMd.getTitle()); rcCollMd.getTitle().trim().equals(modifiedCollMd.getTitle().trim())) { this.showErrorMessageDialog("A collection titled " + modifiedCollMd.getTitle() + " already exists.", "Unable to Modify Collection Metadata"); return; selectedCollMd.setTitle(modifiedCollMd.getTitle());
rcCollMdList = RcCollectionMetadata.readMets(metsFile); rcCollMdLit.next().sortObjectMap(c);
public static String getCollectionIdForFacetPath(RcIrFacetPath facetPath) { RcCollectionMetadata rcCollMd = RcWebApp.getInstance().getCollectionMetadata(facetPath); if (rcCollMd == null) { return null; } return rcCollMd.getId(); }
public static RcObjectMetadata getRcObjMd(String extObjId) throws RcMetadataException { RcWebApp rcWebApp = RcWebApp.getInstance(); String extObjIdParts[] = extObjId.split("/", 2); String collId = extObjIdParts[0]; String objId = extObjIdParts[1]; RcCollectionMetadata rcCollMd = rcWebApp.getCollectionMetadata(collId); if (rcCollMd == null) { throw new RcMetadataException("Unable to find collection metadata for " + collId + "."); } RcObjectMetadata rcObjMd = rcCollMd.getObject(objId); if (rcObjMd == null) { throw new RcMetadataException("Unable to find object metadata for " + objId + " in collection " + collId + "."); } return rcObjMd; }
private void rcRefreshAbstractsJList() { this.abstractsJList.setSelectedIndex(-1); this.abstractsListModel.removeAllElements(); for (RcAbstractMetadata rcAbstractMd : this.rcCollectionMetadata.getAbstracts()) { this.abstractsListModel.addElement(rcAbstractMd); } if (this.abstractsJList.getModel().getSize() > 0) { this.abstractsJList.setSelectedIndex(0); } this.rcRefreshAbstractsJPanelState(); }