re-importing latest customer.jdl from master branch

This commit is contained in:
Michael Hoennig 2019-04-12 16:46:43 +02:00
parent 1e7b801e22
commit bd5bb859d9
36 changed files with 927 additions and 175 deletions

View File

@ -37,6 +37,7 @@
"relationshipType": "many-to-one",
"otherEntityName": "membership",
"otherEntityRelationshipName": "asset",
"relationshipValidateRules": "required",
"relationshipName": "member",
"otherEntityField": "id"
}

View File

@ -22,20 +22,62 @@
"pattern"
],
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
},
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualAddress",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "contractualSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "billingAddress",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "billingSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "customerContact",
"otherEntityRelationshipName": "customer",
"relationshipName": "role"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
}
],
"changelogDate": "20190403083735",

View File

@ -30,6 +30,7 @@
"relationshipType": "many-to-one",
"otherEntityName": "customer",
"otherEntityRelationshipName": "membership",
"relationshipValidateRules": "required",
"relationshipName": "customer",
"otherEntityField": "prefix"
}

View File

@ -37,6 +37,7 @@
"relationshipType": "many-to-one",
"otherEntityName": "membership",
"otherEntityRelationshipName": "share",
"relationshipValidateRules": "required",
"relationshipName": "member",
"otherEntityField": "id"
}

View File

@ -2,17 +2,16 @@ package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
/**
* A Asset.
*/
@ -44,7 +43,8 @@ public class Asset implements Serializable {
@Column(name = "jhi_comment", length = 160)
private String comment;
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("assets")
private Membership member;

View File

@ -1,15 +1,12 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
/**
* A Customer.
@ -36,10 +33,32 @@ public class Customer implements Serializable {
@Column(name = "prefix", nullable = false, unique = true)
private String prefix;
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@NotNull
@Size(max = 80)
@Column(name = "name", length = 80, nullable = false)
private String name;
@NotNull
@Size(max = 400)
@Column(name = "contractual_address", length = 400, nullable = false)
private String contractualAddress;
@Size(max = 80)
@Column(name = "contractual_salutation", length = 80)
private String contractualSalutation;
@Size(max = 400)
@Column(name = "billing_address", length = 400)
private String billingAddress;
@Size(max = 80)
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@OneToMany(mappedBy = "customer")
private Set<CustomerContact> roles = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
@ -75,29 +94,69 @@ public class Customer implements Serializable {
this.prefix = prefix;
}
public Set<Membership> getMemberships() {
return memberships;
public String getName() {
return name;
}
public Customer memberships(Set<Membership> memberships) {
this.memberships = memberships;
public Customer name(String name) {
this.name = name;
return this;
}
public Customer addMembership(Membership membership) {
this.memberships.add(membership);
membership.setCustomer(this);
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public Customer removeMembership(Membership membership) {
this.memberships.remove(membership);
membership.setCustomer(null);
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public Customer contractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
return this;
}
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public Customer billingAddress(String billingAddress) {
this.billingAddress = billingAddress;
return this;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public Customer billingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
return this;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
public Set<CustomerContact> getRoles() {
@ -124,6 +183,31 @@ public class Customer implements Serializable {
public void setRoles(Set<CustomerContact> customerContacts) {
this.roles = customerContacts;
}
public Set<Membership> getMemberships() {
return memberships;
}
public Customer memberships(Set<Membership> memberships) {
this.memberships = memberships;
return this;
}
public Customer addMembership(Membership membership) {
this.memberships.add(membership);
membership.setCustomer(this);
return this;
}
public Customer removeMembership(Membership membership) {
this.memberships.remove(membership);
membership.setCustomer(null);
return this;
}
public void setMemberships(Set<Membership> memberships) {
this.memberships = memberships;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
@ -152,6 +236,11 @@ public class Customer implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -1,17 +1,15 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
import java.util.Set;
/**
* A Membership.
@ -38,7 +36,8 @@ public class Membership implements Serializable {
private Set<Share> shares = new HashSet<>();
@OneToMany(mappedBy = "member")
private Set<Asset> assets = new HashSet<>();
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("memberships")
private Customer customer;

View File

@ -2,16 +2,15 @@ package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* A Share.
*/
@ -43,7 +42,8 @@ public class Share implements Serializable {
@Column(name = "jhi_comment", length = 160)
private String comment;
@ManyToOne
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("shares")
private Membership member;

View File

@ -1,9 +1,14 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.CustomerContact_;
import org.hostsharing.hsadminng.domain.Customer_;
import org.hostsharing.hsadminng.domain.Membership_;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
@ -12,14 +17,8 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import io.github.jhipster.service.QueryService;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import javax.persistence.criteria.JoinType;
import java.util.List;
/**
* Service for executing complex queries for Customer entities in the database.
@ -95,14 +94,29 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
if (criteria.getName() != null) {
specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name));
}
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getContractualSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation));
}
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
}
if (criteria.getRoleId() != null) {
specification = specification.and(buildSpecification(criteria.getRoleId(),
root -> root.join(Customer_.roles, JoinType.LEFT).get(CustomerContact_.id)));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;
}

View File

@ -1,15 +1,13 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import io.github.jhipster.service.filter.BooleanFilter;
import io.github.jhipster.service.filter.DoubleFilter;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.FloatFilter;
import io.github.jhipster.service.filter.IntegerFilter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
import java.io.Serializable;
import java.util.Objects;
/**
* Criteria class for the Customer entity. This class is used in CustomerResource to
* receive all the possible filtering options from the Http GET request parameters.
@ -28,10 +26,20 @@ public class CustomerCriteria implements Serializable {
private StringFilter prefix;
private LongFilter membershipId;
private StringFilter name;
private StringFilter contractualAddress;
private StringFilter contractualSalutation;
private StringFilter billingAddress;
private StringFilter billingSalutation;
private LongFilter roleId;
private LongFilter membershipId;
public LongFilter getId() {
return id;
}
@ -56,12 +64,44 @@ public class CustomerCriteria implements Serializable {
this.prefix = prefix;
}
public LongFilter getMembershipId() {
return membershipId;
public StringFilter getName() {
return name;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
public void setName(StringFilter name) {
this.name = name;
}
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(StringFilter contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public StringFilter getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
}
public StringFilter getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(StringFilter billingSalutation) {
this.billingSalutation = billingSalutation;
}
public LongFilter getRoleId() {
@ -72,6 +112,14 @@ public class CustomerCriteria implements Serializable {
this.roleId = roleId;
}
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@Override
public boolean equals(Object o) {
@ -86,8 +134,13 @@ public class CustomerCriteria implements Serializable {
Objects.equals(id, that.id) &&
Objects.equals(number, that.number) &&
Objects.equals(prefix, that.prefix) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(roleId, that.roleId);
Objects.equals(name, that.name) &&
Objects.equals(contractualAddress, that.contractualAddress) &&
Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(roleId, that.roleId) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
@ -96,8 +149,13 @@ public class CustomerCriteria implements Serializable {
id,
number,
prefix,
membershipId,
roleId
name,
contractualAddress,
contractualSalutation,
billingAddress,
billingSalutation,
roleId,
membershipId
);
}
@ -107,8 +165,13 @@ public class CustomerCriteria implements Serializable {
(id != null ? "id=" + id + ", " : "") +
(number != null ? "number=" + number + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}

View File

@ -19,6 +19,23 @@ public class CustomerDTO implements Serializable {
@Pattern(regexp = "[a-z][a-z0-9]+")
private String prefix;
@NotNull
@Size(max = 80)
private String name;
@NotNull
@Size(max = 400)
private String contractualAddress;
@Size(max = 80)
private String contractualSalutation;
@Size(max = 400)
private String billingAddress;
@Size(max = 80)
private String billingSalutation;
public Long getId() {
return id;
@ -44,6 +61,46 @@ public class CustomerDTO implements Serializable {
this.prefix = prefix;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -71,6 +128,11 @@ public class CustomerDTO implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -1,9 +1,9 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.mapstruct.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
/**
* Mapper for the entity Customer and its DTO CustomerDTO.
@ -12,8 +12,8 @@ import org.mapstruct.*;
public interface CustomerMapper extends EntityMapper<CustomerDTO, Customer> {
@Mapping(target = "memberships", ignore = true)
@Mapping(target = "roles", ignore = true)
@Mapping(target = "memberships", ignore = true)
Customer toEntity(CustomerDTO customerDTO);
default Customer fromId(Long id) {

View File

@ -6,6 +6,11 @@ paginate all with infinite-scroll
entity Customer {
number Integer required unique min(10000) max(99999),
prefix String required unique pattern(/[a-z][a-z0-9]+/),
name String required maxlength(80),
contractualAddress String required maxlength(400),
contractualSalutation String maxlength(80),
billingAddress String maxlength(400),
billingSalutation String maxlength(80)
}
entity Contact {
@ -14,7 +19,6 @@ entity Contact {
email String required maxlength(80)
}
enum CustomerContactRole {
CONTRACTUAL,
TECHNICAL,
@ -59,13 +63,10 @@ entity Asset {
}
relationship OneToMany {
Customer to Membership{customer(prefix)},
Membership to Share{member},
Membership to Asset{member}
}
relationship ManyToOne {
CustomerContact{contact(email) required} to Contact{role},
CustomerContact{customer(prefix) required} to Customer{role}
Contact{role} to CustomerContact{contact(email) required},
Customer{role} to CustomerContact{customer(prefix) required},
Customer to Membership{customer(prefix) required},
Membership to Share{member required},
Membership to Asset{member required}
}

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -29,6 +27,26 @@
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_prefix" />
</column>
<column name="name" type="varchar(80)">
<constraints nullable="false"/>
</column>
<column name="contractual_address" type="varchar(400)">
<constraints nullable="false"/>
</column>
<column name="contractual_salutation" type="varchar(80)">
<constraints nullable="true"/>
</column>
<column name="billing_address" type="varchar(400)">
<constraints nullable="true"/>
</column>
<column name="billing_salutation" type="varchar(80)">
<constraints nullable="true"/>
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -30,7 +28,7 @@
</column>
<column name="customer_id" type="bigint">
<constraints nullable="true" />
<constraints nullable="false"/>
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -38,7 +36,7 @@
</column>
<column name="member_id" type="bigint">
<constraints nullable="true" />
<constraints nullable="false"/>
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -1,10 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<property name="now" value="now()" dbms="h2"/>
@ -38,7 +36,7 @@
</column>
<column name="member_id" type="bigint">
<constraints nullable="true" />
<constraints nullable="false"/>
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->

View File

@ -71,11 +71,18 @@
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" >
<option [ngValue]="null"></option>
<select class="form-control" id="field_member" name="member" [(ngModel)]="asset.memberId" required>
<option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -13,6 +13,26 @@
<dd>
<span>{{customer.prefix}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.name">Name</span></dt>
<dd>
<span>{{customer.name}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span></dt>
<dd>
<span>{{customer.contractualAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span></dt>
<dd>
<span>{{customer.contractualSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span></dt>
<dd>
<span>{{customer.billingAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span></dt>
<dd>
<span>{{customer.billingSalutation}}</span>
</dd>
</dl>
<button type="submit"

View File

@ -47,6 +47,86 @@
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.name"
for="field_name">Name</label>
<input type="text" class="form-control" name="name" id="field_name"
[(ngModel)]="customer.name" required maxlength="80"/>
<div [hidden]="!(editForm.controls.name?.dirty && editForm.controls.name?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress"
for="field_contractualAddress">Contractual Address</label>
<input type="text" class="form-control" name="contractualAddress" id="field_contractualAddress"
[(ngModel)]="customer.contractualAddress" required maxlength="400"/>
<div
[hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualSalutation"
for="field_contractualSalutation">Contractual Salutation</label>
<input type="text" class="form-control" name="contractualSalutation"
id="field_contractualSalutation"
[(ngModel)]="customer.contractualSalutation" maxlength="80"/>
<div
[hidden]="!(editForm.controls.contractualSalutation?.dirty && editForm.controls.contractualSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualSalutation?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingAddress"
for="field_billingAddress">Billing Address</label>
<input type="text" class="form-control" name="billingAddress" id="field_billingAddress"
[(ngModel)]="customer.billingAddress" maxlength="400"/>
<div
[hidden]="!(editForm.controls.billingAddress?.dirty && editForm.controls.billingAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingAddress?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingSalutation"
for="field_billingSalutation">Billing Salutation</label>
<input type="text" class="form-control" name="billingSalutation" id="field_billingSalutation"
[(ngModel)]="customer.billingSalutation" maxlength="80"/>
<div
[hidden]="!(editForm.controls.billingSalutation?.dirty && editForm.controls.billingSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingSalutation?.errors?.maxlength"
jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
</div>
<div>

View File

@ -17,6 +17,22 @@
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="number"><span jhiTranslate="hsadminNgApp.customer.number">Number</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="prefix"><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="name"><span jhiTranslate="hsadminNgApp.customer.name">Name</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="contractualAddress"><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="contractualSalutation"><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="billingAddress"><span
jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th jhiSortBy="billingSalutation"><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span>
<fa-icon [icon]="'sort'"></fa-icon>
</th>
<th></th>
</tr>
</thead>
@ -25,6 +41,11 @@
<td><a [routerLink]="['/customer', customer.id, 'view' ]">{{customer.id}}</a></td>
<td>{{customer.number}}</td>
<td>{{customer.prefix}}</td>
<td>{{customer.name}}</td>
<td>{{customer.contractualAddress}}</td>
<td>{{customer.contractualSalutation}}</td>
<td>{{customer.billingAddress}}</td>
<td>{{customer.billingSalutation}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"

View File

@ -1,4 +1,4 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
@NgModule({
@ -24,6 +24,22 @@ import { RouterModule } from '@angular/router';
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'membership',
loadChildren: './membership/membership.module#HsadminNgMembershipModule'
},
{
path: 'share',
loadChildren: './share/share.module#HsadminNgShareModule'
},
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'

View File

@ -38,11 +38,19 @@
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.customer" for="field_customer">Customer</label>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId" >
<option [ngValue]="null"></option>
<select class="form-control" id="field_customer" name="customer" [(ngModel)]="membership.customerId"
required>
<option *ngIf="!editForm.value.customer" [ngValue]="null" selected></option>
<option [ngValue]="customerOption.id" *ngFor="let customerOption of customers; trackBy: trackCustomerById">{{customerOption.prefix}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.customer?.dirty && editForm.controls.customer?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.customer?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -67,11 +67,18 @@
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.share.member" for="field_member">Member</label>
<select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" >
<option [ngValue]="null"></option>
<select class="form-control" id="field_member" name="member" [(ngModel)]="share.memberId" required>
<option *ngIf="!editForm.value.member" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.id}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.member?.dirty && editForm.controls.member?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.member?.errors?.required"
jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">

View File

@ -1,12 +1,17 @@
import { IMembership } from 'app/shared/model/membership.model';
import { ICustomerContact } from 'app/shared/model/customer-contact.model';
import { IMembership } from 'app/shared/model/membership.model';
export interface ICustomer {
id?: number;
number?: number;
prefix?: string;
memberships?: IMembership[];
name?: string;
contractualAddress?: string;
contractualSalutation?: string;
billingAddress?: string;
billingSalutation?: string;
roles?: ICustomerContact[];
memberships?: IMembership[];
}
export class Customer implements ICustomer {
@ -14,7 +19,12 @@ export class Customer implements ICustomer {
public id?: number,
public number?: number,
public prefix?: string,
public memberships?: IMembership[],
public roles?: ICustomerContact[]
public name?: string,
public contractualAddress?: string,
public contractualSalutation?: string,
public billingAddress?: string,
public billingSalutation?: string,
public roles?: ICustomerContact[],
public memberships?: IMembership[]
) {}
}

View File

@ -17,8 +17,13 @@
},
"number": "Number",
"prefix": "Prefix",
"membership": "Membership",
"role": "Role"
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation",
"role": "Role",
"membership": "Membership"
}
}
}

View File

@ -17,8 +17,13 @@
},
"number": "Number",
"prefix": "Prefix",
"membership": "Membership",
"role": "Role"
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation",
"role": "Role",
"membership": "Membership"
}
}
}

View File

@ -1,17 +1,15 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
import org.hostsharing.hsadminng.repository.AssetRepository;
import org.hostsharing.hsadminng.service.AssetQueryService;
import org.hostsharing.hsadminng.service.AssetService;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
import org.hostsharing.hsadminng.service.AssetQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -33,14 +31,11 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
/**
* Test class for the AssetResource REST controller.
*
@ -117,6 +112,11 @@ public class AssetResourceIntTest {
.action(DEFAULT_ACTION)
.amount(DEFAULT_AMOUNT)
.comment(DEFAULT_COMMENT);
// Add required entity
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
asset.setMember(membership);
return asset;
}

View File

@ -1,18 +1,15 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.CustomerContact;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.repository.CustomerRepository;
import org.hostsharing.hsadminng.service.CustomerQueryService;
import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.mapper.CustomerMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.CustomerQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -31,10 +28,9 @@ import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ -53,6 +49,21 @@ public class CustomerResourceIntTest {
private static final String DEFAULT_PREFIX = "lzv";
private static final String UPDATED_PREFIX = "zf";
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
@Autowired
private CustomerRepository customerRepository;
@ -105,7 +116,12 @@ public class CustomerResourceIntTest {
public static Customer createEntity(EntityManager em) {
Customer customer = new Customer()
.number(DEFAULT_NUMBER)
.prefix(DEFAULT_PREFIX);
.prefix(DEFAULT_PREFIX)
.name(DEFAULT_NAME)
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
.contractualSalutation(DEFAULT_CONTRACTUAL_SALUTATION)
.billingAddress(DEFAULT_BILLING_ADDRESS)
.billingSalutation(DEFAULT_BILLING_SALUTATION);
return customer;
}
@ -132,6 +148,11 @@ public class CustomerResourceIntTest {
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(DEFAULT_NUMBER);
assertThat(testCustomer.getPrefix()).isEqualTo(DEFAULT_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(DEFAULT_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(DEFAULT_BILLING_SALUTATION);
}
@Test
@ -192,6 +213,44 @@ public class CustomerResourceIntTest {
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkNameIsRequired() throws Exception {
int databaseSizeBeforeTest = customerRepository.findAll().size();
// set the field null
customer.setName(null);
// Create the Customer, which fails.
CustomerDTO customerDTO = customerMapper.toDto(customer);
restCustomerMockMvc.perform(post("/api/customers")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
.andExpect(status().isBadRequest());
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkContractualAddressIsRequired() throws Exception {
int databaseSizeBeforeTest = customerRepository.findAll().size();
// set the field null
customer.setContractualAddress(null);
// Create the Customer, which fails.
CustomerDTO customerDTO = customerMapper.toDto(customer);
restCustomerMockMvc.perform(post("/api/customers")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
.andExpect(status().isBadRequest());
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllCustomers() throws Exception {
@ -204,7 +263,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())));
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION.toString())))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())));
}
@Test
@ -219,7 +283,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(customer.getId().intValue()))
.andExpect(jsonPath("$.number").value(DEFAULT_NUMBER))
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()));
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
.andExpect(jsonPath("$.contractualSalutation").value(DEFAULT_CONTRACTUAL_SALUTATION.toString()))
.andExpect(jsonPath("$.billingAddress").value(DEFAULT_BILLING_ADDRESS.toString()))
.andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()));
}
@Test
@ -329,22 +398,198 @@ public class CustomerResourceIntTest {
@Test
@Transactional
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
public void getAllCustomersByNameIsEqualToSomething() throws Exception {
// Initialize the database
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
customer.addMembership(membership);
customerRepository.saveAndFlush(customer);
Long membershipId = membership.getId();
// Get all the customerList where membership equals to membershipId
defaultCustomerShouldBeFound("membershipId.equals=" + membershipId);
// Get all the customerList where name equals to DEFAULT_NAME
defaultCustomerShouldBeFound("name.equals=" + DEFAULT_NAME);
// Get all the customerList where membership equals to membershipId + 1
defaultCustomerShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
// Get all the customerList where name equals to UPDATED_NAME
defaultCustomerShouldNotBeFound("name.equals=" + UPDATED_NAME);
}
@Test
@Transactional
public void getAllCustomersByNameIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where name in DEFAULT_NAME or UPDATED_NAME
defaultCustomerShouldBeFound("name.in=" + DEFAULT_NAME + "," + UPDATED_NAME);
// Get all the customerList where name equals to UPDATED_NAME
defaultCustomerShouldNotBeFound("name.in=" + UPDATED_NAME);
}
@Test
@Transactional
public void getAllCustomersByNameIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where name is not null
defaultCustomerShouldBeFound("name.specified=true");
// Get all the customerList where name is null
defaultCustomerShouldNotBeFound("name.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress is not null
defaultCustomerShouldBeFound("contractualAddress.specified=true");
// Get all the customerList where contractualAddress is null
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation equals to DEFAULT_CONTRACTUAL_SALUTATION
defaultCustomerShouldBeFound("contractualSalutation.equals=" + DEFAULT_CONTRACTUAL_SALUTATION);
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldNotBeFound("contractualSalutation.equals=" + UPDATED_CONTRACTUAL_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation in DEFAULT_CONTRACTUAL_SALUTATION or UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldBeFound("contractualSalutation.in=" + DEFAULT_CONTRACTUAL_SALUTATION + "," + UPDATED_CONTRACTUAL_SALUTATION);
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldNotBeFound("contractualSalutation.in=" + UPDATED_CONTRACTUAL_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation is not null
defaultCustomerShouldBeFound("contractualSalutation.specified=true");
// Get all the customerList where contractualSalutation is null
defaultCustomerShouldNotBeFound("contractualSalutation.specified=false");
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress is not null
defaultCustomerShouldBeFound("billingAddress.specified=true");
// Get all the customerList where billingAddress is null
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation equals to DEFAULT_BILLING_SALUTATION
defaultCustomerShouldBeFound("billingSalutation.equals=" + DEFAULT_BILLING_SALUTATION);
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
defaultCustomerShouldNotBeFound("billingSalutation.equals=" + UPDATED_BILLING_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation in DEFAULT_BILLING_SALUTATION or UPDATED_BILLING_SALUTATION
defaultCustomerShouldBeFound("billingSalutation.in=" + DEFAULT_BILLING_SALUTATION + "," + UPDATED_BILLING_SALUTATION);
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
defaultCustomerShouldNotBeFound("billingSalutation.in=" + UPDATED_BILLING_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation is not null
defaultCustomerShouldBeFound("billingSalutation.specified=true");
// Get all the customerList where billingSalutation is null
defaultCustomerShouldNotBeFound("billingSalutation.specified=false");
}
@Test
@Transactional
@ -364,6 +609,25 @@ public class CustomerResourceIntTest {
defaultCustomerShouldNotBeFound("roleId.equals=" + (roleId + 1));
}
@Test
@Transactional
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
// Initialize the database
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
customer.addMembership(membership);
customerRepository.saveAndFlush(customer);
Long membershipId = membership.getId();
// Get all the customerList where membership equals to membershipId
defaultCustomerShouldBeFound("membershipId.equals=" + membershipId);
// Get all the customerList where membership equals to membershipId + 1
defaultCustomerShouldNotBeFound("membershipId.equals=" + (membershipId + 1));
}
/**
* Executes the search, and checks that the default entity is returned
*/
@ -373,7 +637,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)));
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION)))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS)))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)));
// Check, that the count call also returns 1
restCustomerMockMvc.perform(get("/api/customers/count?sort=id,desc&" + filter))
@ -422,7 +691,12 @@ public class CustomerResourceIntTest {
em.detach(updatedCustomer);
updatedCustomer
.number(UPDATED_NUMBER)
.prefix(UPDATED_PREFIX);
.prefix(UPDATED_PREFIX)
.name(UPDATED_NAME)
.contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
.contractualSalutation(UPDATED_CONTRACTUAL_SALUTATION)
.billingAddress(UPDATED_BILLING_ADDRESS)
.billingSalutation(UPDATED_BILLING_SALUTATION);
CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer);
restCustomerMockMvc.perform(put("/api/customers")
@ -436,6 +710,11 @@ public class CustomerResourceIntTest {
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(UPDATED_NUMBER);
assertThat(testCustomer.getPrefix()).isEqualTo(UPDATED_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(UPDATED_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(UPDATED_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(UPDATED_BILLING_SALUTATION);
}
@Test

View File

@ -1,19 +1,16 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.repository.MembershipRepository;
import org.hostsharing.hsadminng.service.MembershipQueryService;
import org.hostsharing.hsadminng.service.MembershipService;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.hostsharing.hsadminng.service.mapper.MembershipMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.MembershipCriteria;
import org.hostsharing.hsadminng.service.MembershipQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -34,10 +31,9 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ -109,6 +105,11 @@ public class MembershipResourceIntTest {
Membership membership = new Membership()
.sinceDate(DEFAULT_SINCE_DATE)
.untilDate(DEFAULT_UNTIL_DATE);
// Add required entity
Customer customer = CustomerResourceIntTest.createEntity(em);
em.persist(customer);
em.flush();
membership.setCustomer(customer);
return membership;
}

View File

@ -1,17 +1,15 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.HsadminNgApp;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
import org.hostsharing.hsadminng.repository.ShareRepository;
import org.hostsharing.hsadminng.service.ShareQueryService;
import org.hostsharing.hsadminng.service.ShareService;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.hostsharing.hsadminng.service.mapper.ShareMapper;
import org.hostsharing.hsadminng.web.rest.errors.ExceptionTranslator;
import org.hostsharing.hsadminng.service.dto.ShareCriteria;
import org.hostsharing.hsadminng.service.ShareQueryService;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -32,14 +30,11 @@ import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.hostsharing.hsadminng.web.rest.TestUtil.createFormattingConversionService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* Test class for the ShareResource REST controller.
*
@ -116,6 +111,11 @@ public class ShareResourceIntTest {
.action(DEFAULT_ACTION)
.quantity(DEFAULT_QUANTITY)
.comment(DEFAULT_COMMENT);
// Add required entity
Membership membership = MembershipResourceIntTest.createEntity(em);
em.persist(membership);
em.flush();
share.setMember(membership);
return share;
}

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { AssetUpdateComponent } from 'app/entities/asset/asset-update.component';

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { CustomerUpdateComponent } from 'app/entities/customer/customer-update.component';

View File

@ -1,11 +1,9 @@
/* tslint:disable max-line-length */
import { TestBed, getTestBed } from '@angular/core/testing';
import { getTestBed, TestBed } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { of } from 'rxjs';
import { take, map } from 'rxjs/operators';
import { map, take } from 'rxjs/operators';
import { CustomerService } from 'app/entities/customer/customer.service';
import { ICustomer, Customer } from 'app/shared/model/customer.model';
import { Customer, ICustomer } from 'app/shared/model/customer.model';
describe('Service Tests', () => {
describe('Customer Service', () => {
@ -21,7 +19,7 @@ describe('Service Tests', () => {
service = injector.get(CustomerService);
httpMock = injector.get(HttpTestingController);
elemDefault = new Customer(0, 0, 'AAAAAAA');
elemDefault = new Customer(0, 0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
});
describe('Service methods', async () => {
@ -56,7 +54,12 @@ describe('Service Tests', () => {
const returnedFromService = Object.assign(
{
number: 1,
prefix: 'BBBBBB'
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
},
elemDefault
);
@ -74,7 +77,12 @@ describe('Service Tests', () => {
const returnedFromService = Object.assign(
{
number: 1,
prefix: 'BBBBBB'
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
},
elemDefault
);

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { MembershipUpdateComponent } from 'app/entities/membership/membership-update.component';

View File

@ -1,7 +1,7 @@
/* tslint:disable max-line-length */
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { HttpResponse } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { of } from 'rxjs';
import { HsadminNgTestModule } from '../../../test.module';
import { ShareUpdateComponent } from 'app/entities/share/share-update.component';