CCM NG: Abstrakte Methode getIdAttributeName in AbstractEntityRepository erstellen (#2804)
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5253 8810af33-2d31-482b-a856-94f89814c4df
parent
75fd8cc41d
commit
756e317b92
|
|
@ -60,6 +60,8 @@ import javax.transaction.Transactional;
|
||||||
public class AssetRepository
|
public class AssetRepository
|
||||||
extends AbstractAuditedEntityRepository<Long, Asset> {
|
extends AbstractAuditedEntityRepository<Long, Asset> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7190032071018013125L;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager
|
private static final Logger LOGGER = LogManager
|
||||||
.getLogger(AssetRepository.class);
|
.getLogger(AssetRepository.class);
|
||||||
|
|
||||||
|
|
@ -97,6 +99,11 @@ public class AssetRepository
|
||||||
return Asset.class;
|
return Asset.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Asset asset) {
|
public boolean isNew(final Asset asset) {
|
||||||
return asset.getObjectId() == 0;
|
return asset.getObjectId() == 0;
|
||||||
|
|
@ -200,7 +207,8 @@ public class AssetRepository
|
||||||
|
|
||||||
final List<Permission> permissions = asset.getPermissions();
|
final List<Permission> permissions = asset.getPermissions();
|
||||||
for (final Permission permission : permissions) {
|
for (final Permission permission : permissions) {
|
||||||
permissionManager.revokePrivilege(permission.getGrantedPrivilege(),
|
permissionManager.revokePrivilege(permission
|
||||||
|
.getGrantedPrivilege(),
|
||||||
permission.getGrantee(),
|
permission.getGrantee(),
|
||||||
asset);
|
asset);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,11 @@ public class ContentItemRepository
|
||||||
return ContentItem.class;
|
return ContentItem.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final ContentItem item) {
|
public boolean isNew(final ContentItem item) {
|
||||||
return ccmObjectRepo.isNew(item);
|
return ccmObjectRepo.isNew(item);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,8 @@ import javax.transaction.Transactional;
|
||||||
public class ContentSectionRepository
|
public class ContentSectionRepository
|
||||||
extends AbstractEntityRepository<Long, ContentSection> {
|
extends AbstractEntityRepository<Long, ContentSection> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4616599498399330865L;
|
||||||
|
|
||||||
public Optional<ContentSection> findByLabel(final String label) {
|
public Optional<ContentSection> findByLabel(final String label) {
|
||||||
if (label == null || label.isEmpty()) {
|
if (label == null || label.isEmpty()) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
|
@ -62,6 +64,11 @@ public class ContentSectionRepository
|
||||||
return ContentSection.class;
|
return ContentSection.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final ContentSection section) {
|
public boolean isNew(final ContentSection section) {
|
||||||
return section.getObjectId() == 0;
|
return section.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,11 @@ public class ContentTypeRepository
|
||||||
return ContentType.class;
|
return ContentType.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final ContentType type) {
|
public boolean isNew(final ContentType type) {
|
||||||
return type.getObjectId() == 0;
|
return type.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ import javax.transaction.Transactional;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class FolderRepository extends AbstractEntityRepository<Long, Folder> {
|
public class FolderRepository extends AbstractEntityRepository<Long, Folder> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -2588848483908283604L;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
FolderRepository.class);
|
FolderRepository.class);
|
||||||
|
|
||||||
|
|
@ -54,6 +56,11 @@ public class FolderRepository extends AbstractEntityRepository<Long, Folder> {
|
||||||
return Folder.class;
|
return Folder.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Folder folder) {
|
public boolean isNew(final Folder folder) {
|
||||||
return folder.getObjectId() == 0;
|
return folder.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,18 @@ import javax.transaction.Transactional;
|
||||||
public class MultiPartArticleSectionRepository
|
public class MultiPartArticleSectionRepository
|
||||||
extends AbstractAuditedEntityRepository<Long, MultiPartArticleSection> {
|
extends AbstractAuditedEntityRepository<Long, MultiPartArticleSection> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -3392120236224057234L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getEntityId(final MultiPartArticleSection entity) {
|
public Long getEntityId(final MultiPartArticleSection entity) {
|
||||||
return entity.getSectionId();
|
return entity.getSectionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "sectionId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<MultiPartArticleSection> getEntityClass() {
|
public Class<MultiPartArticleSection> getEntityClass() {
|
||||||
return MultiPartArticleSection.class;
|
return MultiPartArticleSection.class;
|
||||||
|
|
|
||||||
|
|
@ -30,16 +30,21 @@ import javax.enterprise.context.RequestScoped;
|
||||||
public class LifecycleDefinitionRepository
|
public class LifecycleDefinitionRepository
|
||||||
extends AbstractEntityRepository<Long, LifecycleDefinition> {
|
extends AbstractEntityRepository<Long, LifecycleDefinition> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -6388883975391235155L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<LifecycleDefinition> getEntityClass() {
|
public Class<LifecycleDefinition> getEntityClass() {
|
||||||
return LifecycleDefinition.class;
|
return LifecycleDefinition.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "definitionId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final LifecycleDefinition lifecycleDefinition) {
|
public boolean isNew(final LifecycleDefinition lifecycleDefinition) {
|
||||||
return lifecycleDefinition.getDefinitionId() == 0;
|
return lifecycleDefinition.getDefinitionId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ public class LifecycleRepository extends AbstractEntityRepository<Long, Lifecycl
|
||||||
return Lifecycle.class;
|
return Lifecycle.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "lifecycleId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Lifecycle lifecycle) {
|
public boolean isNew(final Lifecycle lifecycle) {
|
||||||
return lifecycle.getLifecycleId() == 0;
|
return lifecycle.getLifecycleId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,11 @@ public class PhaseDefinititionRepository
|
||||||
return PhaseDefinition.class;
|
return PhaseDefinition.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "definitionId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final PhaseDefinition phaseDefinition) {
|
public boolean isNew(final PhaseDefinition phaseDefinition) {
|
||||||
return phaseDefinition.getDefinitionId() == 0;
|
return phaseDefinition.getDefinitionId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ public class PhaseRepository extends AbstractEntityRepository<Long, Phase>{
|
||||||
return Phase.class;
|
return Phase.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "phaseId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Phase phase) {
|
public boolean isNew(final Phase phase) {
|
||||||
return phase.getPhaseId() == 0;
|
return phase.getPhaseId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,11 @@ public class PageRepository extends AbstractEntityRepository<Long, Page> {
|
||||||
return Page.class;
|
return Page.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Page page) {
|
public boolean isNew(final Page page) {
|
||||||
return page.getObjectId() == 0;
|
return page.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,11 @@ public class PagesRepository extends AbstractEntityRepository<Long, Pages> {
|
||||||
return Pages.class;
|
return Pages.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Pages pages) {
|
public boolean isNew(final Pages pages) {
|
||||||
return pages.getObjectId() == 0;
|
return pages.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,11 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
return Category.class;
|
return Category.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Category entity) {
|
public boolean isNew(final Category entity) {
|
||||||
return entity.getObjectId() == 0;
|
return entity.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
return Domain.class;
|
return Domain.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Domain entity) {
|
public boolean isNew(final Domain entity) {
|
||||||
return entity.getObjectId() == 0;
|
return entity.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,14 @@ public abstract class AbstractEntityRepository<K, E> implements Serializable {
|
||||||
*/
|
*/
|
||||||
public abstract Class<E> getEntityClass();
|
public abstract Class<E> getEntityClass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by some methods to create queries using the JPA Criteria API.
|
||||||
|
*
|
||||||
|
* @return The name of the ID attribute/property for entities managed by
|
||||||
|
* a repository.
|
||||||
|
*/
|
||||||
|
public abstract String getIdAttributeName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds an entity by it ID.
|
* Finds an entity by it ID.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ public class CcmObjectRepository extends AbstractEntityRepository<Long, CcmObjec
|
||||||
return CcmObject.class;
|
return CcmObject.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final CcmObject entity) {
|
public boolean isNew(final CcmObject entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ public class ResourceRepository extends AbstractEntityRepository<Long,
|
||||||
return Resource.class;
|
return Resource.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Resource entity) {
|
public boolean isNew(final Resource entity) {
|
||||||
return entity.getObjectId() == 0;
|
return entity.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@ import java.util.Optional;
|
||||||
* {@link ResourceType}s from the database. This is the responsibility of the
|
* {@link ResourceType}s from the database. This is the responsibility of the
|
||||||
* application using the {@link ResourceType}.
|
* application using the {@link ResourceType}.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
* @version created the 8/10/17
|
*
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class ResourceTypeRepository extends AbstractEntityRepository<Long,
|
public class ResourceTypeRepository
|
||||||
ResourceType> {
|
extends AbstractEntityRepository<Long, ResourceType> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6313169146990554867L;
|
private static final long serialVersionUID = -6313169146990554867L;
|
||||||
|
|
||||||
|
|
@ -44,6 +44,11 @@ public class ResourceTypeRepository extends AbstractEntityRepository<Long,
|
||||||
return ResourceType.class;
|
return ResourceType.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "resourceTypeId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final ResourceType entity) {
|
public boolean isNew(final ResourceType entity) {
|
||||||
return entity.getTitle() == null;
|
return entity.getTitle() == null;
|
||||||
|
|
@ -67,4 +72,5 @@ public class ResourceTypeRepository extends AbstractEntityRepository<Long,
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ import java.util.UUID;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class ComponentModelRepository extends AbstractEntityRepository<Long, ComponentModel> {
|
public class ComponentModelRepository
|
||||||
|
extends AbstractEntityRepository<Long, ComponentModel> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6358512316472857971L;
|
private static final long serialVersionUID = -6358512316472857971L;
|
||||||
|
|
||||||
|
|
@ -42,6 +43,11 @@ public class ComponentModelRepository extends AbstractEntityRepository<Long, Com
|
||||||
return ComponentModel.class;
|
return ComponentModel.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "componentModelId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final ComponentModel componentModel) {
|
public boolean isNew(final ComponentModel componentModel) {
|
||||||
return componentModel.getComponentModelId() == 0;
|
return componentModel.getComponentModelId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ public class PageModelRepository extends AbstractEntityRepository<Long, PageMode
|
||||||
return PageModel.class;
|
return PageModel.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "pageModelId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final PageModel pageModel) {
|
public boolean isNew(final PageModel pageModel) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ public class GroupRepository extends AbstractEntityRepository<Long, Group> {
|
||||||
return Group.class;
|
return Group.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "partyId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Group entity) {
|
public boolean isNew(final Group entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ public class PartyRepository extends AbstractEntityRepository<Long, Party> {
|
||||||
return Party.class;
|
return Party.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "partyId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Party entity) {
|
public boolean isNew(final Party entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ public class PermissionRepository
|
||||||
return Permission.class;
|
return Permission.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "permissionId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(Permission entity) {
|
public boolean isNew(Permission entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|
@ -51,9 +56,9 @@ public class PermissionRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a {@link Permission} by the privilege, the grantee and the
|
* Finds a {@link Permission} by the privilege, the grantee and the object.
|
||||||
* object. Where the grantee has been granted the given privilege on the
|
* Where the grantee has been granted the given privilege on the given
|
||||||
* given object.
|
* object.
|
||||||
*
|
*
|
||||||
* @param privilege The privilege, beeing granted
|
* @param privilege The privilege, beeing granted
|
||||||
* @param grantee The grantee, having the privilege
|
* @param grantee The grantee, having the privilege
|
||||||
|
|
@ -64,12 +69,14 @@ public class PermissionRepository
|
||||||
public Optional<Permission> findByCustomPermId(final String privilege,
|
public Optional<Permission> findByCustomPermId(final String privilege,
|
||||||
final Role grantee,
|
final Role grantee,
|
||||||
final Object object) {
|
final Object object) {
|
||||||
final TypedQuery<Permission> query = getEntityManager().createNamedQuery(
|
final TypedQuery<Permission> query = getEntityManager()
|
||||||
|
.createNamedQuery(
|
||||||
"Permission.findByCustomPermId", Permission.class);
|
"Permission.findByCustomPermId", Permission.class);
|
||||||
query.setParameter("privilege", privilege);
|
query.setParameter("privilege", privilege);
|
||||||
query.setParameter("grantee", grantee);
|
query.setParameter("grantee", grantee);
|
||||||
if (object != null)
|
if (object != null) {
|
||||||
query.setParameter("object", object);
|
query.setParameter("object", object);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return Optional.of(query.getSingleResult());
|
return Optional.of(query.getSingleResult());
|
||||||
|
|
@ -77,4 +84,5 @@ public class PermissionRepository
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@ public class RoleRepository extends AbstractEntityRepository<Long, Role> {
|
||||||
return Role.class;
|
return Role.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "roleId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Role entity) {
|
public boolean isNew(final Role entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,11 @@ public class UserRepository extends AbstractEntityRepository<Long, User> {
|
||||||
return User.class;
|
return User.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "partyId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final User user) {
|
public boolean isNew(final User user) {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,11 @@ public class SiteRepository extends AbstractEntityRepository<Long, Site> {
|
||||||
return Site.class;
|
return Site.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Site site) {
|
public boolean isNew(final Site site) {
|
||||||
return site.getObjectId() == 0;
|
return site.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ public class ApplicationRepository
|
||||||
return CcmApplication.class;
|
return CcmApplication.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final CcmApplication application) {
|
public boolean isNew(final CcmApplication application) {
|
||||||
return application.getObjectId() == 0;
|
return application.getObjectId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,9 @@ import java.util.stream.Collectors;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class AssignableTaskRepository extends AbstractEntityRepository<Long,
|
public class AssignableTaskRepository
|
||||||
AssignableTask> {
|
extends AbstractEntityRepository<Long, AssignableTask> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2657793145163510103L;
|
private static final long serialVersionUID = 2657793145163510103L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -45,6 +46,11 @@ public class AssignableTaskRepository extends AbstractEntityRepository<Long,
|
||||||
return AssignableTask.class;
|
return AssignableTask.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "taskId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final AssignableTask task) {
|
public boolean isNew(final AssignableTask task) {
|
||||||
return task.getTaskId() == 0;
|
return task.getTaskId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,12 @@ import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
* @version created the 9/27/17
|
*
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class TaskCommentRepository extends AbstractEntityRepository<Long,
|
public class TaskCommentRepository
|
||||||
TaskComment> {
|
extends AbstractEntityRepository<Long, TaskComment> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -420902242220205847L;
|
private static final long serialVersionUID = -420902242220205847L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -39,6 +40,11 @@ public class TaskCommentRepository extends AbstractEntityRepository<Long,
|
||||||
return TaskComment.class;
|
return TaskComment.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "commentId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(TaskComment entity) {
|
public boolean isNew(TaskComment entity) {
|
||||||
return entity.getCommentId() == 0;
|
return entity.getCommentId() == 0;
|
||||||
|
|
@ -62,4 +68,5 @@ public class TaskCommentRepository extends AbstractEntityRepository<Long,
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class TaskRepository extends AbstractEntityRepository<Long, Task> {
|
public class TaskRepository extends AbstractEntityRepository<Long, Task> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8366096936911158514L;
|
private static final long serialVersionUID = -8366096936911158514L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,6 +42,11 @@ public class TaskRepository extends AbstractEntityRepository<Long, Task> {
|
||||||
return Task.class;
|
return Task.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "taskId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Task task) {
|
public boolean isNew(final Task task) {
|
||||||
return task.getTaskId() == 0;
|
return task.getTaskId() == 0;
|
||||||
|
|
@ -71,4 +77,5 @@ public class TaskRepository extends AbstractEntityRepository<Long, Task> {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class WorkflowRepository extends AbstractEntityRepository<Long, Workflow> {
|
public class WorkflowRepository extends AbstractEntityRepository<Long, Workflow> {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8811728904958517569L;
|
private static final long serialVersionUID = -8811728904958517569L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,6 +42,11 @@ public class WorkflowRepository extends AbstractEntityRepository<Long, Workflow>
|
||||||
return Workflow.class;
|
return Workflow.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "workflowId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Workflow workflow) {
|
public boolean isNew(final Workflow workflow) {
|
||||||
return workflow.getWorkflowId() == 0;
|
return workflow.getWorkflowId() == 0;
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,8 @@ import javax.persistence.Lob;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Blob;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.docrepo;
|
package org.libreccm.docrepo;
|
||||||
|
|
||||||
|
|
||||||
import org.libreccm.auditing.AbstractAuditedEntityRepository;
|
import org.libreccm.auditing.AbstractAuditedEntityRepository;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
@ -43,6 +42,11 @@ public class BlobObjectRepository extends
|
||||||
return entity.getBlobObjectId();
|
return entity.getBlobObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "blobObjectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<BlobObject> getEntityClass() {
|
public Class<BlobObject> getEntityClass() {
|
||||||
return BlobObject.class;
|
return BlobObject.class;
|
||||||
|
|
@ -55,4 +59,5 @@ public class BlobObjectRepository extends
|
||||||
}
|
}
|
||||||
return entity.getBlobObjectId() == 0;
|
return entity.getBlobObjectId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -34,6 +34,11 @@ public class FileRepository extends AbstractResourceRepository<File> {
|
||||||
classOfT = File.class;
|
classOfT = File.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedQuery<File> getFindByNameQuery() {
|
public TypedQuery<File> getFindByNameQuery() {
|
||||||
return entityManager.createNamedQuery(
|
return entityManager.createNamedQuery(
|
||||||
|
|
@ -57,4 +62,5 @@ public class FileRepository extends AbstractResourceRepository<File> {
|
||||||
return entityManager.createNamedQuery(
|
return entityManager.createNamedQuery(
|
||||||
"DocRepo.findModifiedFileFromUser", File.class);
|
"DocRepo.findModifiedFileFromUser", File.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,11 @@ public class FolderRepository extends AbstractResourceRepository<Folder> {
|
||||||
classOfT = Folder.class;
|
classOfT = Folder.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypedQuery<Folder> getFindByNameQuery() {
|
public TypedQuery<Folder> getFindByNameQuery() {
|
||||||
return entityManager.createNamedQuery(
|
return entityManager.createNamedQuery(
|
||||||
|
|
@ -57,4 +62,5 @@ public class FolderRepository extends AbstractResourceRepository<Folder> {
|
||||||
return entityManager.createNamedQuery(
|
return entityManager.createNamedQuery(
|
||||||
"DocRepo.findModifiedFolderFromUser", Folder.class);
|
"DocRepo.findModifiedFolderFromUser", Folder.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,10 @@ import java.util.stream.Collectors;
|
||||||
* Repository class for retrieving, storing and deleting {@code Repository}s.
|
* Repository class for retrieving, storing and deleting {@code Repository}s.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
||||||
* @version 25/11/2015
|
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class RepositoryRepository extends
|
public class RepositoryRepository
|
||||||
AbstractAuditedEntityRepository<Long, Repository> {
|
extends AbstractAuditedEntityRepository<Long, Repository> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
@ -48,6 +47,11 @@ public class RepositoryRepository extends
|
||||||
return entity.getObjectId();
|
return entity.getObjectId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "objectId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Repository> getEntityClass() {
|
public Class<Repository> getEntityClass() {
|
||||||
return Repository.class;
|
return Repository.class;
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,11 @@ public class ShortcutRepository extends AbstractEntityRepository<Long, Shortcut>
|
||||||
return Shortcut.class;
|
return Shortcut.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
return "shortcutId";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew(final Shortcut entity) {
|
public boolean isNew(final Shortcut entity) {
|
||||||
return entity.getShortcutId() == 0;
|
return entity.getShortcutId() == 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue