adding @EntityTypeId to *DTO as preparation for UserRoleAssignments

This commit is contained in:
Michael Hoennig 2019-05-08 13:17:26 +02:00
parent 735f672ea1
commit 671d80cc71
11 changed files with 37 additions and 0 deletions

View File

@ -24,6 +24,7 @@ public class Asset implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ENTITY_NAME = "asset"; public static final String ENTITY_NAME = "asset";
public static final String ENTITY_TYPE_ID = "customer.asset";
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")

View File

@ -22,6 +22,8 @@ public class Customer implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ENTITY_TYPE_ID = "customer.Customer";
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator")

View File

@ -23,6 +23,7 @@ public class Membership implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ENTITY_NAME = "membership"; public static final String ENTITY_NAME = "membership";
public static final String ENTITY_TYPE_ID = "customer.Membership";
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")

View File

@ -20,6 +20,8 @@ public class SepaMandate implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ENTITY_TYPE_ID = "customer.SepaMandate";
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator")

View File

@ -23,6 +23,7 @@ public class Share implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final String ENTITY_NAME = "share"; public static final String ENTITY_NAME = "share";
public static final String ENTITY_TYPE_ID = "customer.share";
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")

View File

@ -0,0 +1,20 @@
// Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.accessfilter;
import java.lang.annotation.*;
/**
* Specifies the entityTypeId to be used in UserRoleAssignment.
*/
@Documented
@Target({ ElementType.FIELD, ElementType.TYPE_USE })
@Retention(RetentionPolicy.RUNTIME)
public @interface EntityTypeId {
/**
* The ID of the entity type, max length: 32.
*
* Pattern: "module.Entity", e.g. "customer.Membership"
*/
String value();
}

View File

@ -1,6 +1,7 @@
// Licensed under Apache-2.0 // Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction; import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import org.hostsharing.hsadminng.service.AssetService; import org.hostsharing.hsadminng.service.AssetService;
import org.hostsharing.hsadminng.service.MembershipService; import org.hostsharing.hsadminng.service.MembershipService;
@ -20,6 +21,7 @@ import javax.validation.constraints.Size;
/** /**
* A DTO for the Asset entity. * A DTO for the Asset entity.
*/ */
@EntityTypeId(Asset.ENTITY_TYPE_ID)
public class AssetDTO implements Serializable, AccessMappings { public class AssetDTO implements Serializable, AccessMappings {
@SelfId(resolver = AssetService.class) @SelfId(resolver = AssetService.class)

View File

@ -1,6 +1,7 @@
// Licensed under Apache-2.0 // Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.enumeration.CustomerKind; import org.hostsharing.hsadminng.domain.enumeration.CustomerKind;
import org.hostsharing.hsadminng.domain.enumeration.VatRegion; import org.hostsharing.hsadminng.domain.enumeration.VatRegion;
import org.hostsharing.hsadminng.service.CustomerService; import org.hostsharing.hsadminng.service.CustomerService;
@ -17,6 +18,7 @@ import javax.validation.constraints.*;
/** /**
* A DTO for the Customer entity. * A DTO for the Customer entity.
*/ */
@EntityTypeId(Customer.ENTITY_TYPE_ID)
public class CustomerDTO implements AccessMappings, FluentBuilder<CustomerDTO> { public class CustomerDTO implements AccessMappings, FluentBuilder<CustomerDTO> {
@SelfId(resolver = CustomerService.class) @SelfId(resolver = CustomerService.class)

View File

@ -1,6 +1,7 @@
// Licensed under Apache-2.0 // Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.service.CustomerService; import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.service.MembershipService; import org.hostsharing.hsadminng.service.MembershipService;
import org.hostsharing.hsadminng.service.accessfilter.*; import org.hostsharing.hsadminng.service.accessfilter.*;
@ -17,6 +18,7 @@ import javax.validation.constraints.Size;
/** /**
* A DTO for the Membership entity. * A DTO for the Membership entity.
*/ */
@EntityTypeId(Membership.ENTITY_TYPE_ID)
public class MembershipDTO implements AccessMappings, FluentBuilder<MembershipDTO> { public class MembershipDTO implements AccessMappings, FluentBuilder<MembershipDTO> {
@SelfId(resolver = MembershipService.class) @SelfId(resolver = MembershipService.class)

View File

@ -1,6 +1,7 @@
// Licensed under Apache-2.0 // Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.hostsharing.hsadminng.service.CustomerService; import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.service.SepaMandateService; import org.hostsharing.hsadminng.service.SepaMandateService;
import org.hostsharing.hsadminng.service.accessfilter.*; import org.hostsharing.hsadminng.service.accessfilter.*;
@ -17,6 +18,7 @@ import javax.validation.constraints.Size;
/** /**
* A DTO for the SepaMandate entity. * A DTO for the SepaMandate entity.
*/ */
@EntityTypeId(SepaMandate.ENTITY_TYPE_ID)
public class SepaMandateDTO implements AccessMappings, FluentBuilder<SepaMandateDTO> { public class SepaMandateDTO implements AccessMappings, FluentBuilder<SepaMandateDTO> {
@SelfId(resolver = SepaMandateService.class) @SelfId(resolver = SepaMandateService.class)

View File

@ -1,6 +1,7 @@
// Licensed under Apache-2.0 // Licensed under Apache-2.0
package org.hostsharing.hsadminng.service.dto; package org.hostsharing.hsadminng.service.dto;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction; import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import org.hostsharing.hsadminng.service.MembershipService; import org.hostsharing.hsadminng.service.MembershipService;
import org.hostsharing.hsadminng.service.ShareService; import org.hostsharing.hsadminng.service.ShareService;
@ -19,6 +20,7 @@ import javax.validation.constraints.Size;
/** /**
* A DTO for the Share entity. * A DTO for the Share entity.
*/ */
@EntityTypeId(Share.ENTITY_TYPE_ID)
public class ShareDTO implements Serializable, AccessMappings { public class ShareDTO implements Serializable, AccessMappings {
@SelfId(resolver = ShareService.class) @SelfId(resolver = ShareService.class)