Esempio n. 1
0
 /**
  * Initialize the elements of the page
  *
  * @return
  */
 @Override
 public String getInitPage() {
   uri = ObjectHelper.getURI(CollectionImeji.class, id);
   collection = ObjectLoader.loadCollectionLazy(uri, sb.getUser());
   browseInit();
   browseContext = getNavigationString() + id;
   return "";
 }
Esempio n. 2
0
 /** Load the collection */
 public void loadCollection() {
   if (id != null) {
     collection =
         ObjectLoader.loadCollectionLazy(
             ObjectHelper.getURI(CollectionImeji.class, id), sessionBean.getUser());
     if (collection != null && getCollection().getId() != null) {
       ItemController ic = new ItemController(sessionBean.getUser());
       collectionSize = ic.countContainerSize(collection.getId());
     }
   } else {
     BeanHelper.error(sessionBean.getLabel("error") + "No ID in URL");
   }
 }
Esempio n. 3
0
 public String changeTemplate() throws Exception {
   profile.getStatements().clear();
   MetadataProfile tp = ObjectLoader.loadProfile(URI.create(this.template), sessionBean.getUser());
   if (!tp.getStatements().isEmpty()) {
     profile.setStatements(tp.getStatements());
   } else {
     profile.getStatements().add(ImejiFactory.newStatement());
   }
   for (Statement s : profile.getStatements()) {
     s.setId(
         URI.create(
             s.getId().toString().replace(tp.getId().toString(), profile.getId().toString())));
   }
   collectionSession.setProfile(profile);
   initBeanObjects(profile);
   return getNavigationString();
 }
Esempio n. 4
0
 /**
  * Search for an item in the current collection with the same filename. The filename must be
  * unique!
  *
  * @param filename
  * @return
  */
 private Item findItemByFileName(String filename) {
   Search s = new Search(SearchType.ITEM, null);
   List<String> sr =
       s.searchSimpleForQuery(
           SPARQLQueries.selectContainerItemByFilename(
               collection.getId(), FilenameUtils.getBaseName(filename)),
           null);
   if (sr.size() == 0)
     throw new RuntimeException(
         "No item found with the filename " + FilenameUtils.getBaseName(filename));
   if (sr.size() > 1)
     throw new RuntimeException(
         "Filename "
             + FilenameUtils.getBaseName(filename)
             + " not unique ("
             + sr.size()
             + " found).");
   return ObjectLoader.loadItem(URI.create(sr.get(0)), user);
 }