/** @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); }
/** * @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)); } }
public User getPublisher() { Integer publisherId = internalDocument.getPublisherId(); if (null != publisherId) { return contentManagementSystem.getUserService().getUser(publisherId); } else { return null; } }
/** * @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); }
/** @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); }
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); }
public boolean isVisibleInMenusForUnauthorizedUsers() { return internalDocument.isLinkedForUnauthorizedUsers(); }
/** @deprecated Use {@link #getPublicationStatus} instead. */ public int getStatus() { return internalDocument.getPublicationStatus().status; }
public void setVisibleInMenusForUnauthorizedUsers(boolean visibleInMenusForUnauthorizedUsers) { internalDocument.setLinkedForUnauthorizedUsers(visibleInMenusForUnauthorizedUsers); }
/** * @since 2.0 * @deprecated Use {@link #getPermissionSetTypeForRole(Role)} */ public int getPermissionSetIdForRole(Role role) { return internalDocument .getDocumentPermissionSetTypeForRoleId(role.getInternal().getId()) .getId(); }
public Date getPublicationEndDatetime() { return internalDocument.getPublicationEndDatetime(); }
public PublicationStatus getPublicationStatus() { return internalDocument.getPublicationStatus(); }
public int getId() { return internalDocument.getId(); }
public Date getModifiedDatetime() { return internalDocument.getModifiedDatetime(); }
/** Whether the document is archived. * */ public boolean isArchived() { return internalDocument.isArchived(); }
public void setArchivedDatetime(Date datetime) { internalDocument.setArchivedDatetime(datetime); }
public void setPublisher(User user) { internalDocument.setPublisher(user.getInternal()); }
public Date getArchivedDatetime() { return internalDocument.getArchivedDatetime(); }
public String getTarget() { return internalDocument.getTarget(); }
/** @since 3.0 */ public void setPermissionSetTypeForRole( Role role, DocumentPermissionSetType documentPermissionSetType) { internalDocument.setDocumentPermissionSetTypeForRoleId( role.getInternal().getId(), documentPermissionSetType.getInternal()); }
public boolean isLinkableByOtherUsers() { return internalDocument.isLinkableByOtherUsers(); }
public void removeCategory(Category category) { internalDocument.removeCategoryId(category.getId()); }
public void setLinkableByOtherUsers(boolean linkableByOtherUsers) { internalDocument.setLinkableByOtherUsers(linkableByOtherUsers); }
/** @deprecated Use {@link #setPublicationStatus} instead. */ public void setStatus(int status) { internalDocument.setPublicationStatus(new PublicationStatus(status)); }
public void setPublicationStatus(PublicationStatus publicationStatus) { internalDocument.setPublicationStatus(publicationStatus); }
public void setPublicationEndDatetime(Date datetime) { internalDocument.setPublicationEndDatetime(datetime); }
public void setModifiedDatetime(Date date) { internalDocument.setModifiedDatetime(date); }
/** @since 3.0 */ public DocumentPermissionSetType getPermissionSetTypeForRole(Role role) { return new DocumentPermissionSetType( internalDocument.getDocumentPermissionSetTypeForRoleId(role.getInternal().getId())); }
/** Whether the document is published and not archived. * */ public boolean isActive() { return internalDocument.isActive(); }
public Date getCreatedDatetime() { return internalDocument.getCreatedDatetime(); }