public List<DownloadItem> getDownloadItems() throws RecognitionException, TokenStreamException, IOException { List<DownloadItem> items = new ArrayList<DownloadOriginalViewObject.DownloadItem>(); List params = getPidsParams(); for (Object param : params) { boolean accessed = false; ObjectPidsPath[] path = solrAccess.getPath(param.toString()); for (ObjectPidsPath objectPidsPath : path) { objectPidsPath = objectPidsPath.injectRepository(); if (isActionAllowed.isActionAllowed( SecuredActions.READ.getFormalName(), param.toString(), FedoraUtils.IMG_FULL_STREAM, objectPidsPath)) { accessed = true; break; } } String dctitle = DCUtils.titleFromDC(fedoraAccess.getDC(param.toString())); items.add( new DownloadItem( dctitle, "img?uuid=" + param.toString() + "&stream=IMG_FULL&action=GETRAW&asFile=true", fedoraAccess.getKrameriusModelName(param.toString()), accessed, fedoraAccess.isImageFULLAvailable(param.toString()))); } return items; }
public static Map<String, String> getTitleInfo(String pid, FedoraAccess fedoraAccess) throws XPathExpressionException, IOException { Map<String, String> map = new HashMap<String, String>(); Document biblioMods = fedoraAccess.getBiblioMods(pid); XPath xpath = FACTORY.newXPath(); xpath.setNamespaceContext(new FedoraNamespaceContext()); XPathExpression expr = xpath.compile("//mods:titleInfo/mods:title"); NodeList set = (NodeList) expr.evaluate(biblioMods, XPathConstants.NODESET); for (int i = 0, ll = set.getLength(); i < ll; i++) { Node node = set.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element elm = (Element) node; if (elm.hasAttributeNS(FedoraNamespaces.BIBILO_MODS_URI, "type")) { String type = elm.getAttributeNS(FedoraNamespaces.BIBILO_MODS_URI, "type"); map.put(type, elm.getTextContent().trim()); } else { if (!map.containsKey("default")) { map.put("default", elm.getTextContent().trim()); } } } } return map; }