예제 #1
0
  /** @return map of roles Role -> DocumentPermissionSet instances. */
  public Map<Role, DocumentPermissionSet> getRolesMappedToPermissions() {
    RoleIdToDocumentPermissionSetTypeMappings roleIdToDocumentPermissionSetTypeMappings =
        internalDocument.getRoleIdsMappedToDocumentPermissionSetTypes();

    Map<RoleDomainObject, DocumentPermissionSetDomainObject> result = new HashMap<>();
    RoleIdToDocumentPermissionSetTypeMappings.Mapping[] mappings =
        roleIdToDocumentPermissionSetTypeMappings.getMappings();
    RoleGetter roleGetter = contentManagementSystem.getInternal().getRoleGetter();
    for (RoleIdToDocumentPermissionSetTypeMappings.Mapping mapping : mappings) {
      RoleId roleId = mapping.getRoleId();
      RoleDomainObject role = roleGetter.getRole(roleId);
      DocumentPermissionSetTypeDomainObject documentPermissionSetType =
          mapping.getDocumentPermissionSetType();
      if (DocumentPermissionSetTypeDomainObject.FULL.equals(documentPermissionSetType)) {
        result.put(role, DocumentPermissionSetDomainObject.FULL);
      } else if (DocumentPermissionSetTypeDomainObject.RESTRICTED_1.equals(
          documentPermissionSetType)) {
        result.put(role, internalDocument.getPermissionSets().getRestricted1());
      } else if (DocumentPermissionSetTypeDomainObject.RESTRICTED_2.equals(
          documentPermissionSetType)) {
        result.put(role, internalDocument.getPermissionSets().getRestricted2());
      } else if (DocumentPermissionSetTypeDomainObject.READ.equals(documentPermissionSetType)) {
        result.put(role, DocumentPermissionSetDomainObject.READ);
      } else if (!DocumentPermissionSetTypeDomainObject.NONE.equals(documentPermissionSetType)) {
        log.warn("A missing mapping in DocumentPermissionSetMapper");
      }
    }

    return wrapDomainObjectsInMap(result);
  }
예제 #2
0
 /**
  * @param permissionSetId One of the constants in {@link DocumentPermissionSet}.
  * @since 2.0
  * @deprecated Use {@link #setPermissionSetTypeForRole(Role, DocumentPermissionSetType)}
  */
 public void setPermissionSetIdForRole(Role role, int permissionSetId) {
   if (null != role) {
     internalDocument.setDocumentPermissionSetTypeForRoleId(
         role.getInternal().getId(),
         DocumentPermissionSetTypeDomainObject.fromInt(permissionSetId));
   }
 }
예제 #3
0
 public User getPublisher() {
   Integer publisherId = internalDocument.getPublisherId();
   if (null != publisherId) {
     return contentManagementSystem.getUserService().getUser(publisherId);
   } else {
     return null;
   }
 }
예제 #4
0
 /**
  * @param categoryType
  * @return an array of Categories, empty array if no one found.
  */
 public Category[] getCategoriesOfType(CategoryType categoryType) {
   CategoryMapper categoryMapper = contentManagementSystem.getInternal().getCategoryMapper();
   Set<CategoryDomainObject> categoriesOfType =
       categoryMapper.getCategoriesOfType(
           categoryType.getInternal(), internalDocument.getCategoryIds());
   CategoryDomainObject[] categories =
       categoriesOfType.toArray(new CategoryDomainObject[categoriesOfType.size()]);
   return getCategoryArrayFromCategoryDomainObjectArray(categories);
 }
예제 #5
0
 /** @return An array of Categories, an empty if no one found. */
 public Category[] getCategories() {
   Set<CategoryDomainObject> categories =
       contentManagementSystem
           .getInternal()
           .getCategoryMapper()
           .getCategories(internalDocument.getCategoryIds());
   CategoryDomainObject[] categoryDomainObjects =
       categories.toArray(new CategoryDomainObject[categories.size()]);
   return getCategoryArrayFromCategoryDomainObjectArray(categoryDomainObjects);
 }
예제 #6
0
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Document)) {
      return false;
    }

    final Document document = (Document) o;

    return internalDocument.equals(document.internalDocument);
  }
예제 #7
0
 public boolean isVisibleInMenusForUnauthorizedUsers() {
   return internalDocument.isLinkedForUnauthorizedUsers();
 }
예제 #8
0
 /** @deprecated Use {@link #getPublicationStatus} instead. */
 public int getStatus() {
   return internalDocument.getPublicationStatus().status;
 }
예제 #9
0
 public void setVisibleInMenusForUnauthorizedUsers(boolean visibleInMenusForUnauthorizedUsers) {
   internalDocument.setLinkedForUnauthorizedUsers(visibleInMenusForUnauthorizedUsers);
 }
예제 #10
0
 /**
  * @since 2.0
  * @deprecated Use {@link #getPermissionSetTypeForRole(Role)}
  */
 public int getPermissionSetIdForRole(Role role) {
   return internalDocument
       .getDocumentPermissionSetTypeForRoleId(role.getInternal().getId())
       .getId();
 }
예제 #11
0
 public Date getPublicationEndDatetime() {
   return internalDocument.getPublicationEndDatetime();
 }
예제 #12
0
 public PublicationStatus getPublicationStatus() {
   return internalDocument.getPublicationStatus();
 }
예제 #13
0
 public int getId() {
   return internalDocument.getId();
 }
예제 #14
0
 public Date getModifiedDatetime() {
   return internalDocument.getModifiedDatetime();
 }
예제 #15
0
 /** Whether the document is archived. * */
 public boolean isArchived() {
   return internalDocument.isArchived();
 }
예제 #16
0
 public void setArchivedDatetime(Date datetime) {
   internalDocument.setArchivedDatetime(datetime);
 }
예제 #17
0
 public void setPublisher(User user) {
   internalDocument.setPublisher(user.getInternal());
 }
예제 #18
0
 public Date getArchivedDatetime() {
   return internalDocument.getArchivedDatetime();
 }
예제 #19
0
 public String getTarget() {
   return internalDocument.getTarget();
 }
예제 #20
0
 /** @since 3.0 */
 public void setPermissionSetTypeForRole(
     Role role, DocumentPermissionSetType documentPermissionSetType) {
   internalDocument.setDocumentPermissionSetTypeForRoleId(
       role.getInternal().getId(), documentPermissionSetType.getInternal());
 }
예제 #21
0
 public boolean isLinkableByOtherUsers() {
   return internalDocument.isLinkableByOtherUsers();
 }
예제 #22
0
 public void removeCategory(Category category) {
   internalDocument.removeCategoryId(category.getId());
 }
예제 #23
0
 public void setLinkableByOtherUsers(boolean linkableByOtherUsers) {
   internalDocument.setLinkableByOtherUsers(linkableByOtherUsers);
 }
예제 #24
0
 /** @deprecated Use {@link #setPublicationStatus} instead. */
 public void setStatus(int status) {
   internalDocument.setPublicationStatus(new PublicationStatus(status));
 }
예제 #25
0
 public void setPublicationStatus(PublicationStatus publicationStatus) {
   internalDocument.setPublicationStatus(publicationStatus);
 }
예제 #26
0
 public void setPublicationEndDatetime(Date datetime) {
   internalDocument.setPublicationEndDatetime(datetime);
 }
예제 #27
0
 public void setModifiedDatetime(Date date) {
   internalDocument.setModifiedDatetime(date);
 }
예제 #28
0
 /** @since 3.0 */
 public DocumentPermissionSetType getPermissionSetTypeForRole(Role role) {
   return new DocumentPermissionSetType(
       internalDocument.getDocumentPermissionSetTypeForRoleId(role.getInternal().getId()));
 }
예제 #29
0
 /** Whether the document is published and not archived. * */
 public boolean isActive() {
   return internalDocument.isActive();
 }
예제 #30
0
 public Date getCreatedDatetime() {
   return internalDocument.getCreatedDatetime();
 }