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