Exemplo n.º 1
0
  public String getPrivateCollection() {
    String collectionId =
        Entity.SEPARATOR
            + "private"
            + REFERENCE_ROOT
            + Entity.SEPARATOR
            + ToolManager.getCurrentPlacement().getContext()
            + Entity.SEPARATOR;

    try {
      AssessmentService.getContentHostingService().checkCollection(collectionId);
    } catch (IdUnusedException e) {
      try {
        ResourcePropertiesEdit resourceProperties =
            AssessmentService.getContentHostingService().newResourceProperties();
        resourceProperties.addProperty(
            ResourceProperties.PROP_DISPLAY_NAME, ToolManager.getCurrentPlacement().getContext());
        // resourceProperties.addProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT,
        // "true");

        ContentCollectionEdit edit =
            (ContentCollectionEdit)
                AssessmentService.getContentHostingService()
                    .addCollection(collectionId, resourceProperties);

        edit.setPublicAccess();
        AssessmentService.getContentHostingService().commitCollection(edit);
      } catch (Exception ee) {
        log.warn(ee.getMessage());
      }
    } catch (Exception e) {
      log.warn(e.getMessage());
    }

    try {
      if (
      /*!"true".equals(AssessmentService.getContentHostingService().getProperties(Entity.SEPARATOR + "private"+ Entity.SEPARATOR).get(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT)) || */ !AssessmentService
          .getContentHostingService()
          .isPubView(collectionId)) {

        ContentCollectionEdit edit =
            AssessmentService.getContentHostingService().editCollection(collectionId);
        ResourcePropertiesEdit resourceProperties = edit.getPropertiesEdit();
        // resourceProperties.addProperty(ResourceProperties.PROP_HIDDEN_WITH_ACCESSIBLE_CONTENT,
        // "true");

        edit.setPublicAccess();

        AssessmentService.getContentHostingService().commitCollection(edit);
      }
    } catch (Exception e) {
      log.warn(e.getMessage());
    }

    return collectionId + "uploads" + Entity.SEPARATOR;
  }
 /** {@inheritDoc} */
 public ContentCollectionEdit putCollection(String id) {
   ContentEntity ce = getVirtualChild(id, getRealParent(id), false);
   if (ce != null) {
     ContentHostingHandler chh = ce.getContentHandler();
     if (chh != null) {
       ContentCollectionEdit cce = chh.getContentCollectionEdit(id);
       cce.setVirtualContentEntity(
           getVirtualChild(id, getRealParent(id), false).getVirtualContentEntity());
       return cce;
     }
   }
   return storage.putCollection(id);
 }
 /** {@inheritDoc} */
 public void removeCollection(ContentCollectionEdit edit) {
   ContentHostingHandler chh = edit.getContentHandler();
   if (chh != null) {
     chh.removeCollection(edit);
   } else {
     storage.removeCollection(edit);
   }
 }
Exemplo n.º 4
0
 public void cancelCollection(ContentCollectionEdit edit) {
   boolean goin = in();
   try {
     if (resolver != null && goin) {
       resolver.cancelCollection(edit);
     } else {
       m_collectionStore.cancelResource(edit);
     }
     collectionCache.remove(edit.getId());
   } finally {
     out();
   }
 }