示例#1
0
 /**
  * Remove aspect from document or folder
  *
  * @param userName login username
  * @param password login password
  * @param siteName site name
  * @param contentName file or folder name
  * @param aspectToRemove aspect to be removed
  * @throws Exception if error
  */
 public void removeAspect(
     final String userName,
     final String password,
     final String siteName,
     final String contentName,
     DocumentAspect aspectToRemove)
     throws Exception {
   try {
     String contentNodeRef = getNodeRef(userName, password, siteName, contentName);
     Session session = getCMISSession(userName, password);
     CmisObject contentObj = session.getObject(contentNodeRef);
     List<SecondaryType> secondaryTypesList = contentObj.getSecondaryTypes();
     List<String> secondaryTypes = new ArrayList<String>();
     for (SecondaryType secondaryType : secondaryTypesList) {
       secondaryTypes.add(secondaryType.getId());
     }
     secondaryTypes.remove(aspectToRemove.getProperty());
     Map<String, Object> properties = new HashMap<String, Object>();
     {
       properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);
     }
     contentObj.updateProperties(properties);
   } catch (CmisInvalidArgumentException ia) {
     throw new CmisRuntimeException("Invalid content " + contentName, ia);
   }
 }