1
0

Revert "adding AccessMappings SepaMandateDTO with tests + consequences (HOWTO)"

This reverts commit 328e809a because I want all changes of this HOWTO in a single commit.

Unfortunately due to the access filter, the SepaMandateIntTest failed with branch coverage, as some branches were not reachable anymore.
This commit is contained in:
Michael Hoennig
2019-04-29 11:23:05 +02:00
parent 328e809a2b
commit 1916347490
7 changed files with 22 additions and 365 deletions

View File

@ -64,16 +64,10 @@ 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;
}

View File

@ -18,7 +18,7 @@ import java.util.Optional;
*/
@Service
@Transactional
public class SepaMandateService implements IdToDtoResolver<SepaMandateDTO> {
public class SepaMandateService {
private final Logger log = LoggerFactory.getLogger(SepaMandateService.class);

View File

@ -1,12 +0,0 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.springframework.stereotype.Service;
@Service
public class SepaMandateValidator {
public void validate(final SepaMandateDTO sepaMandateDTO) {
// TODO: to be implemented
}
}

View File

@ -1,11 +1,5 @@
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;
@ -15,51 +9,38 @@ import java.util.Objects;
/**
* A DTO for the SepaMandate entity.
*/
public class SepaMandateDTO implements Serializable, AccessMappings {
public class SepaMandateDTO implements Serializable {
@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() {
@ -193,23 +174,7 @@ public class SepaMandateDTO implements Serializable, AccessMappings {
", lastUsedDate='" + getLastUsedDate() + "'" +
", remark='" + getRemark() + "'" +
", customer=" + getCustomerId() +
", customerPrefix='" + getCustomerPrefix() + "'" +
", customer='" + 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);
}
}
}