AssetDTOUnitTest and Membership.displayLabel now with memberFrom/Until
This commit is contained in:
@ -22,7 +22,7 @@ public class Asset implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String ENTITY_NAME = "asset";
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
|
||||
@SequenceGenerator(name = "sequenceGenerator")
|
||||
@ -59,6 +59,11 @@ public class Asset implements Serializable {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Asset id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package org.hostsharing.hsadminng.service.dto;
|
||||
|
||||
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
|
||||
import org.hostsharing.hsadminng.service.AssetService;
|
||||
import org.hostsharing.hsadminng.service.CustomerService;
|
||||
import org.hostsharing.hsadminng.service.MembershipService;
|
||||
import org.hostsharing.hsadminng.service.accessfilter.*;
|
||||
import org.springframework.boot.jackson.JsonComponent;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@ -40,13 +40,15 @@ public class AssetDTO implements Serializable, AccessMappings {
|
||||
private BigDecimal amount;
|
||||
|
||||
@Size(max = 160)
|
||||
@AccessFor(init = Role.ADMIN, update = Role.ADMIN, read = Role.ADMIN)
|
||||
@AccessFor(init = Role.ADMIN, update = Role.ADMIN, read = Role.SUPPORTER)
|
||||
private String remark;
|
||||
|
||||
@ParentId(resolver = CustomerService.class)
|
||||
@ParentId(resolver = MembershipService.class)
|
||||
@AccessFor(init = Role.ADMIN, update = Role.ADMIN, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private Long membershipId;
|
||||
|
||||
// TODO: these init/update rights actually mean "ignore", we might want to express this in a better way
|
||||
// background: there is no converter for any display label in DTOs to entity field values anyway
|
||||
@AccessFor(init=Role.ANYBODY, update = Role.ANYBODY, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private String membershipDisplayLabel;
|
||||
|
||||
|
@ -19,8 +19,8 @@ public interface MembershipMapper extends EntityMapper<MembershipDTO, Membership
|
||||
static String displayLabel(final Membership entity) {
|
||||
final Customer customer = entity.getCustomer();
|
||||
return CustomerMapper.displayLabel(customer) + " "
|
||||
+ Objects.toString(entity.getAdmissionDocumentDate(), "") + " - "
|
||||
+ Objects.toString(entity.getCancellationDocumentDate(), "...");
|
||||
+ Objects.toString(entity.getMemberFromDate(), "") + " - "
|
||||
+ Objects.toString(entity.getMemberUntilDate(), "...");
|
||||
}
|
||||
|
||||
@Mapping(source = "customer.id", target = "customerId")
|
||||
|
Reference in New Issue
Block a user