adding AccessMappings SepaMandateDTO with tests + consequences (HOWTO)
This commit is contained in:
@ -64,10 +64,16 @@ public class SepaMandate implements Serializable {
|
||||
private Customer customer;
|
||||
|
||||
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public SepaMandate id(final Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.Optional;
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class SepaMandateService {
|
||||
public class SepaMandateService implements IdToDtoResolver<SepaMandateDTO> {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(SepaMandateService.class);
|
||||
|
||||
|
@ -1,46 +1,64 @@
|
||||
package org.hostsharing.hsadminng.service.dto;
|
||||
|
||||
import org.hostsharing.hsadminng.service.CustomerService;
|
||||
import org.hostsharing.hsadminng.service.SepaMandateService;
|
||||
import org.hostsharing.hsadminng.service.accessfilter.*;
|
||||
import org.springframework.boot.jackson.JsonComponent;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A DTO for the SepaMandate entity.
|
||||
*/
|
||||
public class SepaMandateDTO implements Serializable {
|
||||
public class SepaMandateDTO implements AccessMappings, FluentBuilder<SepaMandateDTO> {
|
||||
|
||||
@SelfId(resolver = SepaMandateService.class)
|
||||
@AccessFor(read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 40)
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private String reference;
|
||||
|
||||
@Size(max = 34)
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private String iban;
|
||||
|
||||
@Size(max = 11)
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private String bic;
|
||||
|
||||
@NotNull
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private LocalDate grantingDocumentDate;
|
||||
|
||||
@AccessFor(init = Role.ADMIN, update = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private LocalDate revokationDocumentDate;
|
||||
|
||||
@NotNull
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private LocalDate validFromDate;
|
||||
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, update = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private LocalDate validUntilDate;
|
||||
|
||||
@AccessFor(init = Role.ADMIN, update = Role.ADMIN, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private LocalDate lastUsedDate;
|
||||
|
||||
@Size(max = 160)
|
||||
@AccessFor(init = Role.ADMIN, update = Role.SUPPORTER, read = Role.SUPPORTER)
|
||||
private String remark;
|
||||
|
||||
|
||||
@ParentId(resolver = CustomerService.class)
|
||||
@AccessFor(init = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT}, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private Long customerId;
|
||||
|
||||
@AccessFor(update = Role.IGNORED, read = {Role.CONTRACTUAL_CONTACT, Role.FINANCIAL_CONTACT})
|
||||
private String customerPrefix;
|
||||
|
||||
public Long getId() {
|
||||
@ -174,7 +192,23 @@ public class SepaMandateDTO implements Serializable {
|
||||
", lastUsedDate='" + getLastUsedDate() + "'" +
|
||||
", remark='" + getRemark() + "'" +
|
||||
", customer=" + getCustomerId() +
|
||||
", customer='" + getCustomerPrefix() + "'" +
|
||||
", customerPrefix='" + getCustomerPrefix() + "'" +
|
||||
"}";
|
||||
}
|
||||
|
||||
@JsonComponent
|
||||
public static class JsonSerializer extends JsonSerializerWithAccessFilter<SepaMandateDTO> {
|
||||
|
||||
public JsonSerializer(final ApplicationContext ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@JsonComponent
|
||||
public static class JsonDeserializer extends JsonDeserializerWithAccessFilter<SepaMandateDTO> {
|
||||
|
||||
public JsonDeserializer(final ApplicationContext ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user