Generated

This commit is contained in:
Michael Hierweck 2019-04-18 16:31:39 +02:00
parent c6be30895e
commit fa0ba61de3
171 changed files with 15676 additions and 0 deletions

61
.jhipster/Asset.json Normal file
View File

@ -0,0 +1,61 @@
{
"name": "Asset",
"fields": [
{
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "valueDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "action",
"fieldType": "AssetAction",
"fieldValues": "PAYMENT,HANDOVER,ADOPTION,LOSS,CLEARING,PAYBACK",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "amount",
"fieldType": "BigDecimal",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "membership",
"otherEntityRelationshipName": "asset",
"relationshipValidateRules": "required",
"relationshipName": "membership",
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190418143053",
"entityTableName": "asset",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

102
.jhipster/Customer.json Normal file
View File

@ -0,0 +1,102 @@
{
"name": "Customer",
"fields": [
{
"fieldName": "reference",
"fieldType": "Integer",
"fieldValidateRules": [
"required",
"unique",
"min",
"max"
],
"fieldValidateRulesMin": 10000,
"fieldValidateRulesMax": 99999
},
{
"fieldName": "prefix",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength",
"unique",
"pattern"
],
"fieldValidateRulesMaxlength": 3,
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
},
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualAddress",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "billingSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "billingAddress",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "membership",
"otherEntityRelationshipName": "customer",
"relationshipName": "membership"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "sepaMandate",
"otherEntityRelationshipName": "customer",
"relationshipName": "sepamandate"
}
],
"changelogDate": "20190418143050",
"entityTableName": "customer",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

62
.jhipster/Membership.json Normal file
View File

@ -0,0 +1,62 @@
{
"name": "Membership",
"fields": [
{
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "memberFrom",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "memberUntil",
"fieldType": "LocalDate"
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "one-to-many",
"otherEntityName": "share",
"otherEntityRelationshipName": "membership",
"relationshipName": "share"
},
{
"relationshipType": "one-to-many",
"otherEntityName": "asset",
"otherEntityRelationshipName": "membership",
"relationshipName": "asset"
},
{
"relationshipType": "many-to-one",
"otherEntityName": "customer",
"otherEntityRelationshipName": "membership",
"relationshipValidateRules": "required",
"relationshipName": "customer",
"otherEntityField": "prefix"
}
],
"changelogDate": "20190418143051",
"entityTableName": "membership",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

View File

@ -0,0 +1,84 @@
{
"name": "SepaMandate",
"fields": [
{
"fieldName": "reference",
"fieldType": "String",
"fieldValidateRules": [
"maxlength",
"unique",
"required"
],
"fieldValidateRulesMaxlength": 40
},
{
"fieldName": "iban",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 34
},
{
"fieldName": "bic",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 11
},
{
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "validFrom",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "validUntil",
"fieldType": "LocalDate"
},
{
"fieldName": "lastUsed",
"fieldType": "LocalDate"
},
{
"fieldName": "cancellationDate",
"fieldType": "LocalDate"
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "customer",
"otherEntityRelationshipName": "sepamandate",
"relationshipValidateRules": "required",
"relationshipName": "customer",
"otherEntityField": "prefix"
}
],
"changelogDate": "20190418143054",
"entityTableName": "sepa_mandate",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

61
.jhipster/Share.json Normal file
View File

@ -0,0 +1,61 @@
{
"name": "Share",
"fields": [
{
"fieldName": "documentDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "valueDate",
"fieldType": "LocalDate",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "action",
"fieldType": "ShareAction",
"fieldValues": "SUBSCRIPTION,CANCELLATION",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "quantity",
"fieldType": "Integer",
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "remark",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 160
}
],
"relationships": [
{
"relationshipType": "many-to-one",
"otherEntityName": "membership",
"otherEntityRelationshipName": "share",
"relationshipValidateRules": "required",
"relationshipName": "membership",
"otherEntityField": "documentDate"
}
],
"changelogDate": "20190418143052",
"entityTableName": "share",
"dto": "mapstruct",
"pagination": "infinite-scroll",
"service": "serviceClass",
"jpaMetamodelFiltering": true,
"fluentMethods": true,
"clientRootFolder": "",
"applications": "*"
}

View File

@ -0,0 +1,175 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
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.
*/
@Entity
@Table(name = "asset")
public class Asset implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "value_date", nullable = false)
private LocalDate valueDate;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "action", nullable = false)
private AssetAction action;
@NotNull
@Column(name = "amount", precision = 10, scale = 2, nullable = false)
private BigDecimal amount;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("assets")
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public Asset documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public Asset valueDate(LocalDate valueDate) {
this.valueDate = valueDate;
return this;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public AssetAction getAction() {
return action;
}
public Asset action(AssetAction action) {
this.action = action;
return this;
}
public void setAction(AssetAction action) {
this.action = action;
}
public BigDecimal getAmount() {
return amount;
}
public Asset amount(BigDecimal amount) {
this.amount = amount;
return this;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getRemark() {
return remark;
}
public Asset remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Membership getMembership() {
return membership;
}
public Asset membership(Membership membership) {
this.membership = membership;
return this;
}
public void setMembership(Membership membership) {
this.membership = membership;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Asset asset = (Asset) o;
if (asset.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), asset.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Asset{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", amount=" + getAmount() +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,268 @@
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;
/**
* A Customer.
*/
@Entity
@Table(name = "customer")
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Min(value = 10000)
@Max(value = 99999)
@Column(name = "reference", nullable = false, unique = true)
private Integer reference;
@NotNull
@Size(max = 3)
@Pattern(regexp = "[a-z][a-z0-9]+")
@Column(name = "prefix", length = 3, nullable = false, unique = true)
private String prefix;
@NotNull
@Size(max = 80)
@Column(name = "name", length = 80, nullable = false)
private String name;
@Size(max = 80)
@Column(name = "contractual_salutation", length = 80)
private String contractualSalutation;
@NotNull
@Size(max = 400)
@Column(name = "contractual_address", length = 400, nullable = false)
private String contractualAddress;
@Size(max = 80)
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@Size(max = 400)
@Column(name = "billing_address", length = 400)
private String billingAddress;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@OneToMany(mappedBy = "customer")
private Set<SepaMandate> sepamandates = new HashSet<>();
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getReference() {
return reference;
}
public Customer reference(Integer reference) {
this.reference = reference;
return this;
}
public void setReference(Integer reference) {
this.reference = reference;
}
public String getPrefix() {
return prefix;
}
public Customer prefix(String prefix) {
this.prefix = prefix;
return this;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getName() {
return name;
}
public Customer name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public Customer contractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
return this;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getContractualAddress() {
return contractualAddress;
}
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public Customer billingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
return this;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
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 getRemark() {
return remark;
}
public Customer remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
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;
}
public Set<SepaMandate> getSepamandates() {
return sepamandates;
}
public Customer sepamandates(Set<SepaMandate> sepaMandates) {
this.sepamandates = sepaMandates;
return this;
}
public Customer addSepamandate(SepaMandate sepaMandate) {
this.sepamandates.add(sepaMandate);
sepaMandate.setCustomer(this);
return this;
}
public Customer removeSepamandate(SepaMandate sepaMandate) {
this.sepamandates.remove(sepaMandate);
sepaMandate.setCustomer(null);
return this;
}
public void setSepamandates(Set<SepaMandate> sepaMandates) {
this.sepamandates = sepaMandates;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Customer customer = (Customer) o;
if (customer.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), customer.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Customer{" +
"id=" + getId() +
", reference=" + getReference() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,209 @@
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 java.io.Serializable;
import java.time.LocalDate;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;
/**
* A Membership.
*/
@Entity
@Table(name = "membership")
public class Membership implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "member_from", nullable = false)
private LocalDate memberFrom;
@Column(name = "member_until")
private LocalDate memberUntil;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@OneToMany(mappedBy = "membership")
private Set<Share> shares = new HashSet<>();
@OneToMany(mappedBy = "membership")
private Set<Asset> assets = new HashSet<>();
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("memberships")
private Customer customer;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public Membership documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getMemberFrom() {
return memberFrom;
}
public Membership memberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
return this;
}
public void setMemberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDate getMemberUntil() {
return memberUntil;
}
public Membership memberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
return this;
}
public void setMemberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
}
public String getRemark() {
return remark;
}
public Membership remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Set<Share> getShares() {
return shares;
}
public Membership shares(Set<Share> shares) {
this.shares = shares;
return this;
}
public Membership addShare(Share share) {
this.shares.add(share);
share.setMembership(this);
return this;
}
public Membership removeShare(Share share) {
this.shares.remove(share);
share.setMembership(null);
return this;
}
public void setShares(Set<Share> shares) {
this.shares = shares;
}
public Set<Asset> getAssets() {
return assets;
}
public Membership assets(Set<Asset> assets) {
this.assets = assets;
return this;
}
public Membership addAsset(Asset asset) {
this.assets.add(asset);
asset.setMembership(this);
return this;
}
public Membership removeAsset(Asset asset) {
this.assets.remove(asset);
asset.setMembership(null);
return this;
}
public void setAssets(Set<Asset> assets) {
this.assets = assets;
}
public Customer getCustomer() {
return customer;
}
public Membership customer(Customer customer) {
this.customer = customer;
return this;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Membership membership = (Membership) o;
if (membership.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), membership.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Membership{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", memberFrom='" + getMemberFrom() + "'" +
", memberUntil='" + getMemberUntil() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,241 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
/**
* A SepaMandate.
*/
@Entity
@Table(name = "sepa_mandate")
public class SepaMandate implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Size(max = 40)
@Column(name = "reference", length = 40, nullable = false, unique = true)
private String reference;
@Size(max = 34)
@Column(name = "iban", length = 34)
private String iban;
@Size(max = 11)
@Column(name = "bic", length = 11)
private String bic;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "valid_from", nullable = false)
private LocalDate validFrom;
@Column(name = "valid_until")
private LocalDate validUntil;
@Column(name = "last_used")
private LocalDate lastUsed;
@Column(name = "cancellation_date")
private LocalDate cancellationDate;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("sepamandates")
private Customer customer;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReference() {
return reference;
}
public SepaMandate reference(String reference) {
this.reference = reference;
return this;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getIban() {
return iban;
}
public SepaMandate iban(String iban) {
this.iban = iban;
return this;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBic() {
return bic;
}
public SepaMandate bic(String bic) {
this.bic = bic;
return this;
}
public void setBic(String bic) {
this.bic = bic;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public SepaMandate documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValidFrom() {
return validFrom;
}
public SepaMandate validFrom(LocalDate validFrom) {
this.validFrom = validFrom;
return this;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidUntil() {
return validUntil;
}
public SepaMandate validUntil(LocalDate validUntil) {
this.validUntil = validUntil;
return this;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public SepaMandate lastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
return this;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancellationDate() {
return cancellationDate;
}
public SepaMandate cancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
return this;
}
public void setCancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
}
public String getRemark() {
return remark;
}
public SepaMandate remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Customer getCustomer() {
return customer;
}
public SepaMandate customer(Customer customer) {
this.customer = customer;
return this;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SepaMandate sepaMandate = (SepaMandate) o;
if (sepaMandate.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), sepaMandate.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "SepaMandate{" +
"id=" + getId() +
", reference='" + getReference() + "'" +
", iban='" + getIban() + "'" +
", bic='" + getBic() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validUntil='" + getValidUntil() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancellationDate='" + getCancellationDate() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,174 @@
package org.hostsharing.hsadminng.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* A Share.
*/
@Entity
@Table(name = "share")
public class Share implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Column(name = "document_date", nullable = false)
private LocalDate documentDate;
@NotNull
@Column(name = "value_date", nullable = false)
private LocalDate valueDate;
@NotNull
@Enumerated(EnumType.STRING)
@Column(name = "action", nullable = false)
private ShareAction action;
@NotNull
@Column(name = "quantity", nullable = false)
private Integer quantity;
@Size(max = 160)
@Column(name = "remark", length = 160)
private String remark;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("shares")
private Membership membership;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public Share documentDate(LocalDate documentDate) {
this.documentDate = documentDate;
return this;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public Share valueDate(LocalDate valueDate) {
this.valueDate = valueDate;
return this;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public ShareAction getAction() {
return action;
}
public Share action(ShareAction action) {
this.action = action;
return this;
}
public void setAction(ShareAction action) {
this.action = action;
}
public Integer getQuantity() {
return quantity;
}
public Share quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getRemark() {
return remark;
}
public Share remark(String remark) {
this.remark = remark;
return this;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Membership getMembership() {
return membership;
}
public Share membership(Membership membership) {
this.membership = membership;
return this;
}
public void setMembership(Membership membership) {
this.membership = membership;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Share share = (Share) o;
if (share.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), share.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Share{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", quantity=" + getQuantity() +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,8 @@
package org.hostsharing.hsadminng.domain.enumeration;
/**
* The AssetAction enumeration.
*/
public enum AssetAction {
PAYMENT, HANDOVER, ADOPTION, LOSS, CLEARING, PAYBACK
}

View File

@ -0,0 +1,8 @@
package org.hostsharing.hsadminng.domain.enumeration;
/**
* The ShareAction enumeration.
*/
public enum ShareAction {
SUBSCRIPTION, CANCELLATION
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.Asset;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Asset entity.
*/
@SuppressWarnings("unused")
@Repository
public interface AssetRepository extends JpaRepository<Asset, Long>, JpaSpecificationExecutor<Asset> {
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.Customer;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Customer entity.
*/
@SuppressWarnings("unused")
@Repository
public interface CustomerRepository extends JpaRepository<Customer, Long>, JpaSpecificationExecutor<Customer> {
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.Membership;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Membership entity.
*/
@SuppressWarnings("unused")
@Repository
public interface MembershipRepository extends JpaRepository<Membership, Long>, JpaSpecificationExecutor<Membership> {
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the SepaMandate entity.
*/
@SuppressWarnings("unused")
@Repository
public interface SepaMandateRepository extends JpaRepository<SepaMandate, Long>, JpaSpecificationExecutor<SepaMandate> {
}

View File

@ -0,0 +1,15 @@
package org.hostsharing.hsadminng.repository;
import org.hostsharing.hsadminng.domain.Share;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data repository for the Share entity.
*/
@SuppressWarnings("unused")
@Repository
public interface ShareRepository extends JpaRepository<Share, Long>, JpaSpecificationExecutor<Share> {
}

View File

@ -0,0 +1,114 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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.Asset;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.AssetRepository;
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
/**
* Service for executing complex queries for Asset entities in the database.
* The main input is a {@link AssetCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link AssetDTO} or a {@link Page} of {@link AssetDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class AssetQueryService extends QueryService<Asset> {
private final Logger log = LoggerFactory.getLogger(AssetQueryService.class);
private final AssetRepository assetRepository;
private final AssetMapper assetMapper;
public AssetQueryService(AssetRepository assetRepository, AssetMapper assetMapper) {
this.assetRepository = assetRepository;
this.assetMapper = assetMapper;
}
/**
* Return a {@link List} of {@link AssetDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<AssetDTO> findByCriteria(AssetCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<Asset> specification = createSpecification(criteria);
return assetMapper.toDto(assetRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link AssetDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<AssetDTO> findByCriteria(AssetCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<Asset> specification = createSpecification(criteria);
return assetRepository.findAll(specification, page)
.map(assetMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(AssetCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<Asset> specification = createSpecification(criteria);
return assetRepository.count(specification);
}
/**
* Function to convert AssetCriteria to a {@link Specification}
*/
private Specification<Asset> createSpecification(AssetCriteria criteria) {
Specification<Asset> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Asset_.id));
}
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Asset_.documentDate));
}
if (criteria.getValueDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValueDate(), Asset_.valueDate));
}
if (criteria.getAction() != null) {
specification = specification.and(buildSpecification(criteria.getAction(), Asset_.action));
}
if (criteria.getAmount() != null) {
specification = specification.and(buildRangeSpecification(criteria.getAmount(), Asset_.amount));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Asset_.remark));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Asset_.membership, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.Asset;
import org.hostsharing.hsadminng.repository.AssetRepository;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.mapper.AssetMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing Asset.
*/
@Service
@Transactional
public class AssetService {
private final Logger log = LoggerFactory.getLogger(AssetService.class);
private final AssetRepository assetRepository;
private final AssetMapper assetMapper;
public AssetService(AssetRepository assetRepository, AssetMapper assetMapper) {
this.assetRepository = assetRepository;
this.assetMapper = assetMapper;
}
/**
* Save a asset.
*
* @param assetDTO the entity to save
* @return the persisted entity
*/
public AssetDTO save(AssetDTO assetDTO) {
log.debug("Request to save Asset : {}", assetDTO);
Asset asset = assetMapper.toEntity(assetDTO);
asset = assetRepository.save(asset);
return assetMapper.toDto(asset);
}
/**
* Get all the assets.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<AssetDTO> findAll(Pageable pageable) {
log.debug("Request to get all Assets");
return assetRepository.findAll(pageable)
.map(assetMapper::toDto);
}
/**
* Get one asset by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<AssetDTO> findOne(Long id) {
log.debug("Request to get Asset : {}", id);
return assetRepository.findById(id)
.map(assetMapper::toDto);
}
/**
* Delete the asset by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Asset : {}", id);
assetRepository.deleteById(id);
}
}

View File

@ -0,0 +1,127 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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;
/**
* Service for executing complex queries for Customer entities in the database.
* The main input is a {@link CustomerCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link CustomerDTO} or a {@link Page} of {@link CustomerDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class CustomerQueryService extends QueryService<Customer> {
private final Logger log = LoggerFactory.getLogger(CustomerQueryService.class);
private final CustomerRepository customerRepository;
private final CustomerMapper customerMapper;
public CustomerQueryService(CustomerRepository customerRepository, CustomerMapper customerMapper) {
this.customerRepository = customerRepository;
this.customerMapper = customerMapper;
}
/**
* Return a {@link List} of {@link CustomerDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<CustomerDTO> findByCriteria(CustomerCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<Customer> specification = createSpecification(criteria);
return customerMapper.toDto(customerRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link CustomerDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<CustomerDTO> findByCriteria(CustomerCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<Customer> specification = createSpecification(criteria);
return customerRepository.findAll(specification, page)
.map(customerMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(CustomerCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<Customer> specification = createSpecification(criteria);
return customerRepository.count(specification);
}
/**
* Function to convert CustomerCriteria to a {@link Specification}
*/
private Specification<Customer> createSpecification(CustomerCriteria criteria) {
Specification<Customer> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Customer_.id));
}
if (criteria.getReference() != null) {
specification = specification.and(buildRangeSpecification(criteria.getReference(), Customer_.reference));
}
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
}
if (criteria.getName() != null) {
specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name));
}
if (criteria.getContractualSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation));
}
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
}
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Customer_.remark));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));
}
if (criteria.getSepamandateId() != null) {
specification = specification.and(buildSpecification(criteria.getSepamandateId(),
root -> root.join(Customer_.sepamandates, JoinType.LEFT).get(SepaMandate_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.Customer;
import org.hostsharing.hsadminng.repository.CustomerRepository;
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;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing Customer.
*/
@Service
@Transactional
public class CustomerService {
private final Logger log = LoggerFactory.getLogger(CustomerService.class);
private final CustomerRepository customerRepository;
private final CustomerMapper customerMapper;
public CustomerService(CustomerRepository customerRepository, CustomerMapper customerMapper) {
this.customerRepository = customerRepository;
this.customerMapper = customerMapper;
}
/**
* Save a customer.
*
* @param customerDTO the entity to save
* @return the persisted entity
*/
public CustomerDTO save(CustomerDTO customerDTO) {
log.debug("Request to save Customer : {}", customerDTO);
Customer customer = customerMapper.toEntity(customerDTO);
customer = customerRepository.save(customer);
return customerMapper.toDto(customer);
}
/**
* Get all the customers.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<CustomerDTO> findAll(Pageable pageable) {
log.debug("Request to get all Customers");
return customerRepository.findAll(pageable)
.map(customerMapper::toDto);
}
/**
* Get one customer by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<CustomerDTO> findOne(Long id) {
log.debug("Request to get Customer : {}", id);
return customerRepository.findById(id)
.map(customerMapper::toDto);
}
/**
* Delete the customer by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Customer : {}", id);
customerRepository.deleteById(id);
}
}

View File

@ -0,0 +1,119 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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.Membership;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.MembershipRepository;
import org.hostsharing.hsadminng.service.dto.MembershipCriteria;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.hostsharing.hsadminng.service.mapper.MembershipMapper;
/**
* Service for executing complex queries for Membership entities in the database.
* The main input is a {@link MembershipCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link MembershipDTO} or a {@link Page} of {@link MembershipDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class MembershipQueryService extends QueryService<Membership> {
private final Logger log = LoggerFactory.getLogger(MembershipQueryService.class);
private final MembershipRepository membershipRepository;
private final MembershipMapper membershipMapper;
public MembershipQueryService(MembershipRepository membershipRepository, MembershipMapper membershipMapper) {
this.membershipRepository = membershipRepository;
this.membershipMapper = membershipMapper;
}
/**
* Return a {@link List} of {@link MembershipDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<MembershipDTO> findByCriteria(MembershipCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<Membership> specification = createSpecification(criteria);
return membershipMapper.toDto(membershipRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link MembershipDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<MembershipDTO> findByCriteria(MembershipCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<Membership> specification = createSpecification(criteria);
return membershipRepository.findAll(specification, page)
.map(membershipMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(MembershipCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<Membership> specification = createSpecification(criteria);
return membershipRepository.count(specification);
}
/**
* Function to convert MembershipCriteria to a {@link Specification}
*/
private Specification<Membership> createSpecification(MembershipCriteria criteria) {
Specification<Membership> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Membership_.id));
}
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Membership_.documentDate));
}
if (criteria.getMemberFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getMemberFrom(), Membership_.memberFrom));
}
if (criteria.getMemberUntil() != null) {
specification = specification.and(buildRangeSpecification(criteria.getMemberUntil(), Membership_.memberUntil));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Membership_.remark));
}
if (criteria.getShareId() != null) {
specification = specification.and(buildSpecification(criteria.getShareId(),
root -> root.join(Membership_.shares, JoinType.LEFT).get(Share_.id)));
}
if (criteria.getAssetId() != null) {
specification = specification.and(buildSpecification(criteria.getAssetId(),
root -> root.join(Membership_.assets, JoinType.LEFT).get(Asset_.id)));
}
if (criteria.getCustomerId() != null) {
specification = specification.and(buildSpecification(criteria.getCustomerId(),
root -> root.join(Membership_.customer, JoinType.LEFT).get(Customer_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.Membership;
import org.hostsharing.hsadminng.repository.MembershipRepository;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.hostsharing.hsadminng.service.mapper.MembershipMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing Membership.
*/
@Service
@Transactional
public class MembershipService {
private final Logger log = LoggerFactory.getLogger(MembershipService.class);
private final MembershipRepository membershipRepository;
private final MembershipMapper membershipMapper;
public MembershipService(MembershipRepository membershipRepository, MembershipMapper membershipMapper) {
this.membershipRepository = membershipRepository;
this.membershipMapper = membershipMapper;
}
/**
* Save a membership.
*
* @param membershipDTO the entity to save
* @return the persisted entity
*/
public MembershipDTO save(MembershipDTO membershipDTO) {
log.debug("Request to save Membership : {}", membershipDTO);
Membership membership = membershipMapper.toEntity(membershipDTO);
membership = membershipRepository.save(membership);
return membershipMapper.toDto(membership);
}
/**
* Get all the memberships.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<MembershipDTO> findAll(Pageable pageable) {
log.debug("Request to get all Memberships");
return membershipRepository.findAll(pageable)
.map(membershipMapper::toDto);
}
/**
* Get one membership by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<MembershipDTO> findOne(Long id) {
log.debug("Request to get Membership : {}", id);
return membershipRepository.findById(id)
.map(membershipMapper::toDto);
}
/**
* Delete the membership by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Membership : {}", id);
membershipRepository.deleteById(id);
}
}

View File

@ -0,0 +1,126 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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.SepaMandate;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
/**
* Service for executing complex queries for SepaMandate entities in the database.
* The main input is a {@link SepaMandateCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link SepaMandateDTO} or a {@link Page} of {@link SepaMandateDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class SepaMandateQueryService extends QueryService<SepaMandate> {
private final Logger log = LoggerFactory.getLogger(SepaMandateQueryService.class);
private final SepaMandateRepository sepaMandateRepository;
private final SepaMandateMapper sepaMandateMapper;
public SepaMandateQueryService(SepaMandateRepository sepaMandateRepository, SepaMandateMapper sepaMandateMapper) {
this.sepaMandateRepository = sepaMandateRepository;
this.sepaMandateMapper = sepaMandateMapper;
}
/**
* Return a {@link List} of {@link SepaMandateDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<SepaMandateDTO> findByCriteria(SepaMandateCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateMapper.toDto(sepaMandateRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link SepaMandateDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<SepaMandateDTO> findByCriteria(SepaMandateCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateRepository.findAll(specification, page)
.map(sepaMandateMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(SepaMandateCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<SepaMandate> specification = createSpecification(criteria);
return sepaMandateRepository.count(specification);
}
/**
* Function to convert SepaMandateCriteria to a {@link Specification}
*/
private Specification<SepaMandate> createSpecification(SepaMandateCriteria criteria) {
Specification<SepaMandate> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), SepaMandate_.id));
}
if (criteria.getReference() != null) {
specification = specification.and(buildStringSpecification(criteria.getReference(), SepaMandate_.reference));
}
if (criteria.getIban() != null) {
specification = specification.and(buildStringSpecification(criteria.getIban(), SepaMandate_.iban));
}
if (criteria.getBic() != null) {
specification = specification.and(buildStringSpecification(criteria.getBic(), SepaMandate_.bic));
}
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), SepaMandate_.documentDate));
}
if (criteria.getValidFrom() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidFrom(), SepaMandate_.validFrom));
}
if (criteria.getValidUntil() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValidUntil(), SepaMandate_.validUntil));
}
if (criteria.getLastUsed() != null) {
specification = specification.and(buildRangeSpecification(criteria.getLastUsed(), SepaMandate_.lastUsed));
}
if (criteria.getCancellationDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getCancellationDate(), SepaMandate_.cancellationDate));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), SepaMandate_.remark));
}
if (criteria.getCustomerId() != null) {
specification = specification.and(buildSpecification(criteria.getCustomerId(),
root -> root.join(SepaMandate_.customer, JoinType.LEFT).get(Customer_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.SepaMandate;
import org.hostsharing.hsadminng.repository.SepaMandateRepository;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.mapper.SepaMandateMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing SepaMandate.
*/
@Service
@Transactional
public class SepaMandateService {
private final Logger log = LoggerFactory.getLogger(SepaMandateService.class);
private final SepaMandateRepository sepaMandateRepository;
private final SepaMandateMapper sepaMandateMapper;
public SepaMandateService(SepaMandateRepository sepaMandateRepository, SepaMandateMapper sepaMandateMapper) {
this.sepaMandateRepository = sepaMandateRepository;
this.sepaMandateMapper = sepaMandateMapper;
}
/**
* Save a sepaMandate.
*
* @param sepaMandateDTO the entity to save
* @return the persisted entity
*/
public SepaMandateDTO save(SepaMandateDTO sepaMandateDTO) {
log.debug("Request to save SepaMandate : {}", sepaMandateDTO);
SepaMandate sepaMandate = sepaMandateMapper.toEntity(sepaMandateDTO);
sepaMandate = sepaMandateRepository.save(sepaMandate);
return sepaMandateMapper.toDto(sepaMandate);
}
/**
* Get all the sepaMandates.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<SepaMandateDTO> findAll(Pageable pageable) {
log.debug("Request to get all SepaMandates");
return sepaMandateRepository.findAll(pageable)
.map(sepaMandateMapper::toDto);
}
/**
* Get one sepaMandate by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<SepaMandateDTO> findOne(Long id) {
log.debug("Request to get SepaMandate : {}", id);
return sepaMandateRepository.findById(id)
.map(sepaMandateMapper::toDto);
}
/**
* Delete the sepaMandate by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete SepaMandate : {}", id);
sepaMandateRepository.deleteById(id);
}
}

View File

@ -0,0 +1,114 @@
package org.hostsharing.hsadminng.service;
import java.util.List;
import javax.persistence.criteria.JoinType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
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.Share;
import org.hostsharing.hsadminng.domain.*; // for static metamodels
import org.hostsharing.hsadminng.repository.ShareRepository;
import org.hostsharing.hsadminng.service.dto.ShareCriteria;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.hostsharing.hsadminng.service.mapper.ShareMapper;
/**
* Service for executing complex queries for Share entities in the database.
* The main input is a {@link ShareCriteria} which gets converted to {@link Specification},
* in a way that all the filters must apply.
* It returns a {@link List} of {@link ShareDTO} or a {@link Page} of {@link ShareDTO} which fulfills the criteria.
*/
@Service
@Transactional(readOnly = true)
public class ShareQueryService extends QueryService<Share> {
private final Logger log = LoggerFactory.getLogger(ShareQueryService.class);
private final ShareRepository shareRepository;
private final ShareMapper shareMapper;
public ShareQueryService(ShareRepository shareRepository, ShareMapper shareMapper) {
this.shareRepository = shareRepository;
this.shareMapper = shareMapper;
}
/**
* Return a {@link List} of {@link ShareDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public List<ShareDTO> findByCriteria(ShareCriteria criteria) {
log.debug("find by criteria : {}", criteria);
final Specification<Share> specification = createSpecification(criteria);
return shareMapper.toDto(shareRepository.findAll(specification));
}
/**
* Return a {@link Page} of {@link ShareDTO} which matches the criteria from the database
* @param criteria The object which holds all the filters, which the entities should match.
* @param page The page, which should be returned.
* @return the matching entities.
*/
@Transactional(readOnly = true)
public Page<ShareDTO> findByCriteria(ShareCriteria criteria, Pageable page) {
log.debug("find by criteria : {}, page: {}", criteria, page);
final Specification<Share> specification = createSpecification(criteria);
return shareRepository.findAll(specification, page)
.map(shareMapper::toDto);
}
/**
* Return the number of matching entities in the database
* @param criteria The object which holds all the filters, which the entities should match.
* @return the number of matching entities.
*/
@Transactional(readOnly = true)
public long countByCriteria(ShareCriteria criteria) {
log.debug("count by criteria : {}", criteria);
final Specification<Share> specification = createSpecification(criteria);
return shareRepository.count(specification);
}
/**
* Function to convert ShareCriteria to a {@link Specification}
*/
private Specification<Share> createSpecification(ShareCriteria criteria) {
Specification<Share> specification = Specification.where(null);
if (criteria != null) {
if (criteria.getId() != null) {
specification = specification.and(buildSpecification(criteria.getId(), Share_.id));
}
if (criteria.getDocumentDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getDocumentDate(), Share_.documentDate));
}
if (criteria.getValueDate() != null) {
specification = specification.and(buildRangeSpecification(criteria.getValueDate(), Share_.valueDate));
}
if (criteria.getAction() != null) {
specification = specification.and(buildSpecification(criteria.getAction(), Share_.action));
}
if (criteria.getQuantity() != null) {
specification = specification.and(buildRangeSpecification(criteria.getQuantity(), Share_.quantity));
}
if (criteria.getRemark() != null) {
specification = specification.and(buildStringSpecification(criteria.getRemark(), Share_.remark));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Share_.membership, JoinType.LEFT).get(Membership_.id)));
}
}
return specification;
}
}

View File

@ -0,0 +1,84 @@
package org.hostsharing.hsadminng.service;
import org.hostsharing.hsadminng.domain.Share;
import org.hostsharing.hsadminng.repository.ShareRepository;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.hostsharing.hsadminng.service.mapper.ShareMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing Share.
*/
@Service
@Transactional
public class ShareService {
private final Logger log = LoggerFactory.getLogger(ShareService.class);
private final ShareRepository shareRepository;
private final ShareMapper shareMapper;
public ShareService(ShareRepository shareRepository, ShareMapper shareMapper) {
this.shareRepository = shareRepository;
this.shareMapper = shareMapper;
}
/**
* Save a share.
*
* @param shareDTO the entity to save
* @return the persisted entity
*/
public ShareDTO save(ShareDTO shareDTO) {
log.debug("Request to save Share : {}", shareDTO);
Share share = shareMapper.toEntity(shareDTO);
share = shareRepository.save(share);
return shareMapper.toDto(share);
}
/**
* Get all the shares.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<ShareDTO> findAll(Pageable pageable) {
log.debug("Request to get all Shares");
return shareRepository.findAll(pageable)
.map(shareMapper::toDto);
}
/**
* Get one share by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public Optional<ShareDTO> findOne(Long id) {
log.debug("Request to get Share : {}", id);
return shareRepository.findById(id)
.map(shareMapper::toDto);
}
/**
* Delete the share by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Share : {}", id);
shareRepository.deleteById(id);
}
}

View File

@ -0,0 +1,149 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
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 io.github.jhipster.service.filter.BigDecimalFilter;
import io.github.jhipster.service.filter.LocalDateFilter;
/**
* Criteria class for the Asset entity. This class is used in AssetResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /assets?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class AssetCriteria implements Serializable {
/**
* Class for filtering AssetAction
*/
public static class AssetActionFilter extends Filter<AssetAction> {
}
private static final long serialVersionUID = 1L;
private LongFilter id;
private LocalDateFilter documentDate;
private LocalDateFilter valueDate;
private AssetActionFilter action;
private BigDecimalFilter amount;
private StringFilter remark;
private LongFilter membershipId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValueDate() {
return valueDate;
}
public void setValueDate(LocalDateFilter valueDate) {
this.valueDate = valueDate;
}
public AssetActionFilter getAction() {
return action;
}
public void setAction(AssetActionFilter action) {
this.action = action;
}
public BigDecimalFilter getAmount() {
return amount;
}
public void setAmount(BigDecimalFilter amount) {
this.amount = amount;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final AssetCriteria that = (AssetCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(valueDate, that.valueDate) &&
Objects.equals(action, that.action) &&
Objects.equals(amount, that.amount) &&
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
documentDate,
valueDate,
action,
amount,
remark,
membershipId
);
}
@Override
public String toString() {
return "AssetCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(valueDate != null ? "valueDate=" + valueDate + ", " : "") +
(action != null ? "action=" + action + ", " : "") +
(amount != null ? "amount=" + amount + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,134 @@
package org.hostsharing.hsadminng.service.dto;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.AssetAction;
/**
* A DTO for the Asset entity.
*/
public class AssetDTO implements Serializable {
private Long id;
@NotNull
private LocalDate documentDate;
@NotNull
private LocalDate valueDate;
@NotNull
private AssetAction action;
@NotNull
private BigDecimal amount;
@Size(max = 160)
private String remark;
private Long membershipId;
private String membershipDocumentDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public AssetAction getAction() {
return action;
}
public void setAction(AssetAction action) {
this.action = action;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getMembershipId() {
return membershipId;
}
public void setMembershipId(Long membershipId) {
this.membershipId = membershipId;
}
public String getMembershipDocumentDate() {
return membershipDocumentDate;
}
public void setMembershipDocumentDate(String membershipDocumentDate) {
this.membershipDocumentDate = membershipDocumentDate;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AssetDTO assetDTO = (AssetDTO) o;
if (assetDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), assetDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "AssetDTO{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", amount=" + getAmount() +
", remark='" + getRemark() + "'" +
", membership=" + getMembershipId() +
", membership='" + getMembershipDocumentDate() + "'" +
"}";
}
}

View File

@ -0,0 +1,193 @@
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;
/**
* 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.
* For example the following could be a valid requests:
* <code> /customers?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class CustomerCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private IntegerFilter reference;
private StringFilter prefix;
private StringFilter name;
private StringFilter contractualSalutation;
private StringFilter contractualAddress;
private StringFilter billingSalutation;
private StringFilter billingAddress;
private StringFilter remark;
private LongFilter membershipId;
private LongFilter sepamandateId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public IntegerFilter getReference() {
return reference;
}
public void setReference(IntegerFilter reference) {
this.reference = reference;
}
public StringFilter getPrefix() {
return prefix;
}
public void setPrefix(StringFilter prefix) {
this.prefix = prefix;
}
public StringFilter getName() {
return name;
}
public void setName(StringFilter name) {
this.name = name;
}
public StringFilter getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(StringFilter contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(StringFilter billingSalutation) {
this.billingSalutation = billingSalutation;
}
public StringFilter getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
public LongFilter getSepamandateId() {
return sepamandateId;
}
public void setSepamandateId(LongFilter sepamandateId) {
this.sepamandateId = sepamandateId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final CustomerCriteria that = (CustomerCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(reference, that.reference) &&
Objects.equals(prefix, that.prefix) &&
Objects.equals(name, that.name) &&
Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(contractualAddress, that.contractualAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(sepamandateId, that.sepamandateId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
reference,
prefix,
name,
contractualSalutation,
contractualAddress,
billingSalutation,
billingAddress,
remark,
membershipId,
sepamandateId
);
}
@Override
public String toString() {
return "CustomerCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(reference != null ? "reference=" + reference + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(sepamandateId != null ? "sepamandateId=" + sepamandateId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,151 @@
package org.hostsharing.hsadminng.service.dto;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the Customer entity.
*/
public class CustomerDTO implements Serializable {
private Long id;
@NotNull
@Min(value = 10000)
@Max(value = 99999)
private Integer reference;
@NotNull
@Size(max = 3)
@Pattern(regexp = "[a-z][a-z0-9]+")
private String prefix;
@NotNull
@Size(max = 80)
private String name;
@Size(max = 80)
private String contractualSalutation;
@NotNull
@Size(max = 400)
private String contractualAddress;
@Size(max = 80)
private String billingSalutation;
@Size(max = 400)
private String billingAddress;
@Size(max = 160)
private String remark;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getReference() {
return reference;
}
public void setReference(Integer reference) {
this.reference = reference;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CustomerDTO customerDTO = (CustomerDTO) o;
if (customerDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), customerDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "CustomerDTO{" +
"id=" + getId() +
", reference=" + getReference() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", remark='" + getRemark() + "'" +
"}";
}
}

View File

@ -0,0 +1,155 @@
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 io.github.jhipster.service.filter.LocalDateFilter;
/**
* Criteria class for the Membership entity. This class is used in MembershipResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /memberships?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class MembershipCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private LocalDateFilter documentDate;
private LocalDateFilter memberFrom;
private LocalDateFilter memberUntil;
private StringFilter remark;
private LongFilter shareId;
private LongFilter assetId;
private LongFilter customerId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getMemberFrom() {
return memberFrom;
}
public void setMemberFrom(LocalDateFilter memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDateFilter getMemberUntil() {
return memberUntil;
}
public void setMemberUntil(LocalDateFilter memberUntil) {
this.memberUntil = memberUntil;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getShareId() {
return shareId;
}
public void setShareId(LongFilter shareId) {
this.shareId = shareId;
}
public LongFilter getAssetId() {
return assetId;
}
public void setAssetId(LongFilter assetId) {
this.assetId = assetId;
}
public LongFilter getCustomerId() {
return customerId;
}
public void setCustomerId(LongFilter customerId) {
this.customerId = customerId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final MembershipCriteria that = (MembershipCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(memberFrom, that.memberFrom) &&
Objects.equals(memberUntil, that.memberUntil) &&
Objects.equals(remark, that.remark) &&
Objects.equals(shareId, that.shareId) &&
Objects.equals(assetId, that.assetId) &&
Objects.equals(customerId, that.customerId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
documentDate,
memberFrom,
memberUntil,
remark,
shareId,
assetId,
customerId
);
}
@Override
public String toString() {
return "MembershipCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(memberFrom != null ? "memberFrom=" + memberFrom + ", " : "") +
(memberUntil != null ? "memberUntil=" + memberUntil + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(shareId != null ? "shareId=" + shareId + ", " : "") +
(assetId != null ? "assetId=" + assetId + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,119 @@
package org.hostsharing.hsadminng.service.dto;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the Membership entity.
*/
public class MembershipDTO implements Serializable {
private Long id;
@NotNull
private LocalDate documentDate;
@NotNull
private LocalDate memberFrom;
private LocalDate memberUntil;
@Size(max = 160)
private String remark;
private Long customerId;
private String customerPrefix;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getMemberFrom() {
return memberFrom;
}
public void setMemberFrom(LocalDate memberFrom) {
this.memberFrom = memberFrom;
}
public LocalDate getMemberUntil() {
return memberUntil;
}
public void setMemberUntil(LocalDate memberUntil) {
this.memberUntil = memberUntil;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getCustomerPrefix() {
return customerPrefix;
}
public void setCustomerPrefix(String customerPrefix) {
this.customerPrefix = customerPrefix;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MembershipDTO membershipDTO = (MembershipDTO) o;
if (membershipDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), membershipDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "MembershipDTO{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", memberFrom='" + getMemberFrom() + "'" +
", memberUntil='" + getMemberUntil() + "'" +
", remark='" + getRemark() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";
}
}

View File

@ -0,0 +1,194 @@
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 io.github.jhipster.service.filter.LocalDateFilter;
/**
* Criteria class for the SepaMandate entity. This class is used in SepaMandateResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /sepa-mandates?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class SepaMandateCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private LongFilter id;
private StringFilter reference;
private StringFilter iban;
private StringFilter bic;
private LocalDateFilter documentDate;
private LocalDateFilter validFrom;
private LocalDateFilter validUntil;
private LocalDateFilter lastUsed;
private LocalDateFilter cancellationDate;
private StringFilter remark;
private LongFilter customerId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public StringFilter getReference() {
return reference;
}
public void setReference(StringFilter reference) {
this.reference = reference;
}
public StringFilter getIban() {
return iban;
}
public void setIban(StringFilter iban) {
this.iban = iban;
}
public StringFilter getBic() {
return bic;
}
public void setBic(StringFilter bic) {
this.bic = bic;
}
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDateFilter validFrom) {
this.validFrom = validFrom;
}
public LocalDateFilter getValidUntil() {
return validUntil;
}
public void setValidUntil(LocalDateFilter validUntil) {
this.validUntil = validUntil;
}
public LocalDateFilter getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDateFilter lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDateFilter getCancellationDate() {
return cancellationDate;
}
public void setCancellationDate(LocalDateFilter cancellationDate) {
this.cancellationDate = cancellationDate;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getCustomerId() {
return customerId;
}
public void setCustomerId(LongFilter customerId) {
this.customerId = customerId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final SepaMandateCriteria that = (SepaMandateCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(reference, that.reference) &&
Objects.equals(iban, that.iban) &&
Objects.equals(bic, that.bic) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(validFrom, that.validFrom) &&
Objects.equals(validUntil, that.validUntil) &&
Objects.equals(lastUsed, that.lastUsed) &&
Objects.equals(cancellationDate, that.cancellationDate) &&
Objects.equals(remark, that.remark) &&
Objects.equals(customerId, that.customerId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
reference,
iban,
bic,
documentDate,
validFrom,
validUntil,
lastUsed,
cancellationDate,
remark,
customerId
);
}
@Override
public String toString() {
return "SepaMandateCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(reference != null ? "reference=" + reference + ", " : "") +
(iban != null ? "iban=" + iban + ", " : "") +
(bic != null ? "bic=" + bic + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(validFrom != null ? "validFrom=" + validFrom + ", " : "") +
(validUntil != null ? "validUntil=" + validUntil + ", " : "") +
(lastUsed != null ? "lastUsed=" + lastUsed + ", " : "") +
(cancellationDate != null ? "cancellationDate=" + cancellationDate + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(customerId != null ? "customerId=" + customerId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,178 @@
package org.hostsharing.hsadminng.service.dto;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A DTO for the SepaMandate entity.
*/
public class SepaMandateDTO implements Serializable {
private Long id;
@NotNull
@Size(max = 40)
private String reference;
@Size(max = 34)
private String iban;
@Size(max = 11)
private String bic;
@NotNull
private LocalDate documentDate;
@NotNull
private LocalDate validFrom;
private LocalDate validUntil;
private LocalDate lastUsed;
private LocalDate cancellationDate;
@Size(max = 160)
private String remark;
private Long customerId;
private String customerPrefix;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBic() {
return bic;
}
public void setBic(String bic) {
this.bic = bic;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValidFrom() {
return validFrom;
}
public void setValidFrom(LocalDate validFrom) {
this.validFrom = validFrom;
}
public LocalDate getValidUntil() {
return validUntil;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public LocalDate getLastUsed() {
return lastUsed;
}
public void setLastUsed(LocalDate lastUsed) {
this.lastUsed = lastUsed;
}
public LocalDate getCancellationDate() {
return cancellationDate;
}
public void setCancellationDate(LocalDate cancellationDate) {
this.cancellationDate = cancellationDate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public String getCustomerPrefix() {
return customerPrefix;
}
public void setCustomerPrefix(String customerPrefix) {
this.customerPrefix = customerPrefix;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SepaMandateDTO sepaMandateDTO = (SepaMandateDTO) o;
if (sepaMandateDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), sepaMandateDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "SepaMandateDTO{" +
"id=" + getId() +
", reference='" + getReference() + "'" +
", iban='" + getIban() + "'" +
", bic='" + getBic() + "'" +
", documentDate='" + getDocumentDate() + "'" +
", validFrom='" + getValidFrom() + "'" +
", validUntil='" + getValidUntil() + "'" +
", lastUsed='" + getLastUsed() + "'" +
", cancellationDate='" + getCancellationDate() + "'" +
", remark='" + getRemark() + "'" +
", customer=" + getCustomerId() +
", customer='" + getCustomerPrefix() + "'" +
"}";
}
}

View File

@ -0,0 +1,148 @@
package org.hostsharing.hsadminng.service.dto;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
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 io.github.jhipster.service.filter.LocalDateFilter;
/**
* Criteria class for the Share entity. This class is used in ShareResource to
* receive all the possible filtering options from the Http GET request parameters.
* For example the following could be a valid requests:
* <code> /shares?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code>
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class ShareCriteria implements Serializable {
/**
* Class for filtering ShareAction
*/
public static class ShareActionFilter extends Filter<ShareAction> {
}
private static final long serialVersionUID = 1L;
private LongFilter id;
private LocalDateFilter documentDate;
private LocalDateFilter valueDate;
private ShareActionFilter action;
private IntegerFilter quantity;
private StringFilter remark;
private LongFilter membershipId;
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public LocalDateFilter getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDateFilter documentDate) {
this.documentDate = documentDate;
}
public LocalDateFilter getValueDate() {
return valueDate;
}
public void setValueDate(LocalDateFilter valueDate) {
this.valueDate = valueDate;
}
public ShareActionFilter getAction() {
return action;
}
public void setAction(ShareActionFilter action) {
this.action = action;
}
public IntegerFilter getQuantity() {
return quantity;
}
public void setQuantity(IntegerFilter quantity) {
this.quantity = quantity;
}
public StringFilter getRemark() {
return remark;
}
public void setRemark(StringFilter remark) {
this.remark = remark;
}
public LongFilter getMembershipId() {
return membershipId;
}
public void setMembershipId(LongFilter membershipId) {
this.membershipId = membershipId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ShareCriteria that = (ShareCriteria) o;
return
Objects.equals(id, that.id) &&
Objects.equals(documentDate, that.documentDate) &&
Objects.equals(valueDate, that.valueDate) &&
Objects.equals(action, that.action) &&
Objects.equals(quantity, that.quantity) &&
Objects.equals(remark, that.remark) &&
Objects.equals(membershipId, that.membershipId);
}
@Override
public int hashCode() {
return Objects.hash(
id,
documentDate,
valueDate,
action,
quantity,
remark,
membershipId
);
}
@Override
public String toString() {
return "ShareCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(documentDate != null ? "documentDate=" + documentDate + ", " : "") +
(valueDate != null ? "valueDate=" + valueDate + ", " : "") +
(action != null ? "action=" + action + ", " : "") +
(quantity != null ? "quantity=" + quantity + ", " : "") +
(remark != null ? "remark=" + remark + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
"}";
}
}

View File

@ -0,0 +1,133 @@
package org.hostsharing.hsadminng.service.dto;
import java.time.LocalDate;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
import org.hostsharing.hsadminng.domain.enumeration.ShareAction;
/**
* A DTO for the Share entity.
*/
public class ShareDTO implements Serializable {
private Long id;
@NotNull
private LocalDate documentDate;
@NotNull
private LocalDate valueDate;
@NotNull
private ShareAction action;
@NotNull
private Integer quantity;
@Size(max = 160)
private String remark;
private Long membershipId;
private String membershipDocumentDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDocumentDate() {
return documentDate;
}
public void setDocumentDate(LocalDate documentDate) {
this.documentDate = documentDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public ShareAction getAction() {
return action;
}
public void setAction(ShareAction action) {
this.action = action;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Long getMembershipId() {
return membershipId;
}
public void setMembershipId(Long membershipId) {
this.membershipId = membershipId;
}
public String getMembershipDocumentDate() {
return membershipDocumentDate;
}
public void setMembershipDocumentDate(String membershipDocumentDate) {
this.membershipDocumentDate = membershipDocumentDate;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ShareDTO shareDTO = (ShareDTO) o;
if (shareDTO.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), shareDTO.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "ShareDTO{" +
"id=" + getId() +
", documentDate='" + getDocumentDate() + "'" +
", valueDate='" + getValueDate() + "'" +
", action='" + getAction() + "'" +
", quantity=" + getQuantity() +
", remark='" + getRemark() + "'" +
", membership=" + getMembershipId() +
", membership='" + getMembershipDocumentDate() + "'" +
"}";
}
}

View File

@ -0,0 +1,29 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Asset and its DTO AssetDTO.
*/
@Mapper(componentModel = "spring", uses = {MembershipMapper.class})
public interface AssetMapper extends EntityMapper<AssetDTO, Asset> {
@Mapping(source = "membership.id", target = "membershipId")
@Mapping(source = "membership.documentDate", target = "membershipDocumentDate")
AssetDTO toDto(Asset asset);
@Mapping(source = "membershipId", target = "membership")
Asset toEntity(AssetDTO assetDTO);
default Asset fromId(Long id) {
if (id == null) {
return null;
}
Asset asset = new Asset();
asset.setId(id);
return asset;
}
}

View File

@ -0,0 +1,27 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Customer and its DTO CustomerDTO.
*/
@Mapper(componentModel = "spring", uses = {})
public interface CustomerMapper extends EntityMapper<CustomerDTO, Customer> {
@Mapping(target = "memberships", ignore = true)
@Mapping(target = "sepamandates", ignore = true)
Customer toEntity(CustomerDTO customerDTO);
default Customer fromId(Long id) {
if (id == null) {
return null;
}
Customer customer = new Customer();
customer.setId(id);
return customer;
}
}

View File

@ -0,0 +1,21 @@
package org.hostsharing.hsadminng.service.mapper;
import java.util.List;
/**
* Contract for a generic dto to entity mapper.
*
* @param <D> - DTO type parameter.
* @param <E> - Entity type parameter.
*/
public interface EntityMapper <D, E> {
E toEntity(D dto);
D toDto(E entity);
List <E> toEntity(List<D> dtoList);
List <D> toDto(List<E> entityList);
}

View File

@ -0,0 +1,31 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Membership and its DTO MembershipDTO.
*/
@Mapper(componentModel = "spring", uses = {CustomerMapper.class})
public interface MembershipMapper extends EntityMapper<MembershipDTO, Membership> {
@Mapping(source = "customer.id", target = "customerId")
@Mapping(source = "customer.prefix", target = "customerPrefix")
MembershipDTO toDto(Membership membership);
@Mapping(target = "shares", ignore = true)
@Mapping(target = "assets", ignore = true)
@Mapping(source = "customerId", target = "customer")
Membership toEntity(MembershipDTO membershipDTO);
default Membership fromId(Long id) {
if (id == null) {
return null;
}
Membership membership = new Membership();
membership.setId(id);
return membership;
}
}

View File

@ -0,0 +1,29 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.mapstruct.*;
/**
* Mapper for the entity SepaMandate and its DTO SepaMandateDTO.
*/
@Mapper(componentModel = "spring", uses = {CustomerMapper.class})
public interface SepaMandateMapper extends EntityMapper<SepaMandateDTO, SepaMandate> {
@Mapping(source = "customer.id", target = "customerId")
@Mapping(source = "customer.prefix", target = "customerPrefix")
SepaMandateDTO toDto(SepaMandate sepaMandate);
@Mapping(source = "customerId", target = "customer")
SepaMandate toEntity(SepaMandateDTO sepaMandateDTO);
default SepaMandate fromId(Long id) {
if (id == null) {
return null;
}
SepaMandate sepaMandate = new SepaMandate();
sepaMandate.setId(id);
return sepaMandate;
}
}

View File

@ -0,0 +1,29 @@
package org.hostsharing.hsadminng.service.mapper;
import org.hostsharing.hsadminng.domain.*;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.mapstruct.*;
/**
* Mapper for the entity Share and its DTO ShareDTO.
*/
@Mapper(componentModel = "spring", uses = {MembershipMapper.class})
public interface ShareMapper extends EntityMapper<ShareDTO, Share> {
@Mapping(source = "membership.id", target = "membershipId")
@Mapping(source = "membership.documentDate", target = "membershipDocumentDate")
ShareDTO toDto(Share share);
@Mapping(source = "membershipId", target = "membership")
Share toEntity(ShareDTO shareDTO);
default Share fromId(Long id) {
if (id == null) {
return null;
}
Share share = new Share();
share.setId(id);
return share;
}
}

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.AssetService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.AssetDTO;
import org.hostsharing.hsadminng.service.dto.AssetCriteria;
import org.hostsharing.hsadminng.service.AssetQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Asset.
*/
@RestController
@RequestMapping("/api")
public class AssetResource {
private final Logger log = LoggerFactory.getLogger(AssetResource.class);
private static final String ENTITY_NAME = "asset";
private final AssetService assetService;
private final AssetQueryService assetQueryService;
public AssetResource(AssetService assetService, AssetQueryService assetQueryService) {
this.assetService = assetService;
this.assetQueryService = assetQueryService;
}
/**
* POST /assets : Create a new asset.
*
* @param assetDTO the assetDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new assetDTO, or with status 400 (Bad Request) if the asset has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/assets")
public ResponseEntity<AssetDTO> createAsset(@Valid @RequestBody AssetDTO assetDTO) throws URISyntaxException {
log.debug("REST request to save Asset : {}", assetDTO);
if (assetDTO.getId() != null) {
throw new BadRequestAlertException("A new asset cannot already have an ID", ENTITY_NAME, "idexists");
}
AssetDTO result = assetService.save(assetDTO);
return ResponseEntity.created(new URI("/api/assets/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /assets : Updates an existing asset.
*
* @param assetDTO the assetDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated assetDTO,
* or with status 400 (Bad Request) if the assetDTO is not valid,
* or with status 500 (Internal Server Error) if the assetDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/assets")
public ResponseEntity<AssetDTO> updateAsset(@Valid @RequestBody AssetDTO assetDTO) throws URISyntaxException {
log.debug("REST request to update Asset : {}", assetDTO);
if (assetDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
AssetDTO result = assetService.save(assetDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, assetDTO.getId().toString()))
.body(result);
}
/**
* GET /assets : get all the assets.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of assets in body
*/
@GetMapping("/assets")
public ResponseEntity<List<AssetDTO>> getAllAssets(AssetCriteria criteria, Pageable pageable) {
log.debug("REST request to get Assets by criteria: {}", criteria);
Page<AssetDTO> page = assetQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/assets");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /assets/count : count all the assets.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/assets/count")
public ResponseEntity<Long> countAssets(AssetCriteria criteria) {
log.debug("REST request to count Assets by criteria: {}", criteria);
return ResponseEntity.ok().body(assetQueryService.countByCriteria(criteria));
}
/**
* GET /assets/:id : get the "id" asset.
*
* @param id the id of the assetDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the assetDTO, or with status 404 (Not Found)
*/
@GetMapping("/assets/{id}")
public ResponseEntity<AssetDTO> getAsset(@PathVariable Long id) {
log.debug("REST request to get Asset : {}", id);
Optional<AssetDTO> assetDTO = assetService.findOne(id);
return ResponseUtil.wrapOrNotFound(assetDTO);
}
/**
* DELETE /assets/:id : delete the "id" asset.
*
* @param id the id of the assetDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/assets/{id}")
public ResponseEntity<Void> deleteAsset(@PathVariable Long id) {
log.debug("REST request to delete Asset : {}", id);
assetService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.CustomerService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.CustomerDTO;
import org.hostsharing.hsadminng.service.dto.CustomerCriteria;
import org.hostsharing.hsadminng.service.CustomerQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Customer.
*/
@RestController
@RequestMapping("/api")
public class CustomerResource {
private final Logger log = LoggerFactory.getLogger(CustomerResource.class);
private static final String ENTITY_NAME = "customer";
private final CustomerService customerService;
private final CustomerQueryService customerQueryService;
public CustomerResource(CustomerService customerService, CustomerQueryService customerQueryService) {
this.customerService = customerService;
this.customerQueryService = customerQueryService;
}
/**
* POST /customers : Create a new customer.
*
* @param customerDTO the customerDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new customerDTO, or with status 400 (Bad Request) if the customer has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/customers")
public ResponseEntity<CustomerDTO> createCustomer(@Valid @RequestBody CustomerDTO customerDTO) throws URISyntaxException {
log.debug("REST request to save Customer : {}", customerDTO);
if (customerDTO.getId() != null) {
throw new BadRequestAlertException("A new customer cannot already have an ID", ENTITY_NAME, "idexists");
}
CustomerDTO result = customerService.save(customerDTO);
return ResponseEntity.created(new URI("/api/customers/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /customers : Updates an existing customer.
*
* @param customerDTO the customerDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated customerDTO,
* or with status 400 (Bad Request) if the customerDTO is not valid,
* or with status 500 (Internal Server Error) if the customerDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/customers")
public ResponseEntity<CustomerDTO> updateCustomer(@Valid @RequestBody CustomerDTO customerDTO) throws URISyntaxException {
log.debug("REST request to update Customer : {}", customerDTO);
if (customerDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
CustomerDTO result = customerService.save(customerDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, customerDTO.getId().toString()))
.body(result);
}
/**
* GET /customers : get all the customers.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of customers in body
*/
@GetMapping("/customers")
public ResponseEntity<List<CustomerDTO>> getAllCustomers(CustomerCriteria criteria, Pageable pageable) {
log.debug("REST request to get Customers by criteria: {}", criteria);
Page<CustomerDTO> page = customerQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/customers");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /customers/count : count all the customers.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/customers/count")
public ResponseEntity<Long> countCustomers(CustomerCriteria criteria) {
log.debug("REST request to count Customers by criteria: {}", criteria);
return ResponseEntity.ok().body(customerQueryService.countByCriteria(criteria));
}
/**
* GET /customers/:id : get the "id" customer.
*
* @param id the id of the customerDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the customerDTO, or with status 404 (Not Found)
*/
@GetMapping("/customers/{id}")
public ResponseEntity<CustomerDTO> getCustomer(@PathVariable Long id) {
log.debug("REST request to get Customer : {}", id);
Optional<CustomerDTO> customerDTO = customerService.findOne(id);
return ResponseUtil.wrapOrNotFound(customerDTO);
}
/**
* DELETE /customers/:id : delete the "id" customer.
*
* @param id the id of the customerDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/customers/{id}")
public ResponseEntity<Void> deleteCustomer(@PathVariable Long id) {
log.debug("REST request to delete Customer : {}", id);
customerService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.MembershipService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.MembershipDTO;
import org.hostsharing.hsadminng.service.dto.MembershipCriteria;
import org.hostsharing.hsadminng.service.MembershipQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Membership.
*/
@RestController
@RequestMapping("/api")
public class MembershipResource {
private final Logger log = LoggerFactory.getLogger(MembershipResource.class);
private static final String ENTITY_NAME = "membership";
private final MembershipService membershipService;
private final MembershipQueryService membershipQueryService;
public MembershipResource(MembershipService membershipService, MembershipQueryService membershipQueryService) {
this.membershipService = membershipService;
this.membershipQueryService = membershipQueryService;
}
/**
* POST /memberships : Create a new membership.
*
* @param membershipDTO the membershipDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new membershipDTO, or with status 400 (Bad Request) if the membership has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/memberships")
public ResponseEntity<MembershipDTO> createMembership(@Valid @RequestBody MembershipDTO membershipDTO) throws URISyntaxException {
log.debug("REST request to save Membership : {}", membershipDTO);
if (membershipDTO.getId() != null) {
throw new BadRequestAlertException("A new membership cannot already have an ID", ENTITY_NAME, "idexists");
}
MembershipDTO result = membershipService.save(membershipDTO);
return ResponseEntity.created(new URI("/api/memberships/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /memberships : Updates an existing membership.
*
* @param membershipDTO the membershipDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated membershipDTO,
* or with status 400 (Bad Request) if the membershipDTO is not valid,
* or with status 500 (Internal Server Error) if the membershipDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/memberships")
public ResponseEntity<MembershipDTO> updateMembership(@Valid @RequestBody MembershipDTO membershipDTO) throws URISyntaxException {
log.debug("REST request to update Membership : {}", membershipDTO);
if (membershipDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
MembershipDTO result = membershipService.save(membershipDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, membershipDTO.getId().toString()))
.body(result);
}
/**
* GET /memberships : get all the memberships.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of memberships in body
*/
@GetMapping("/memberships")
public ResponseEntity<List<MembershipDTO>> getAllMemberships(MembershipCriteria criteria, Pageable pageable) {
log.debug("REST request to get Memberships by criteria: {}", criteria);
Page<MembershipDTO> page = membershipQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/memberships");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /memberships/count : count all the memberships.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/memberships/count")
public ResponseEntity<Long> countMemberships(MembershipCriteria criteria) {
log.debug("REST request to count Memberships by criteria: {}", criteria);
return ResponseEntity.ok().body(membershipQueryService.countByCriteria(criteria));
}
/**
* GET /memberships/:id : get the "id" membership.
*
* @param id the id of the membershipDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the membershipDTO, or with status 404 (Not Found)
*/
@GetMapping("/memberships/{id}")
public ResponseEntity<MembershipDTO> getMembership(@PathVariable Long id) {
log.debug("REST request to get Membership : {}", id);
Optional<MembershipDTO> membershipDTO = membershipService.findOne(id);
return ResponseUtil.wrapOrNotFound(membershipDTO);
}
/**
* DELETE /memberships/:id : delete the "id" membership.
*
* @param id the id of the membershipDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/memberships/{id}")
public ResponseEntity<Void> deleteMembership(@PathVariable Long id) {
log.debug("REST request to delete Membership : {}", id);
membershipService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.SepaMandateService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.SepaMandateDTO;
import org.hostsharing.hsadminng.service.dto.SepaMandateCriteria;
import org.hostsharing.hsadminng.service.SepaMandateQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing SepaMandate.
*/
@RestController
@RequestMapping("/api")
public class SepaMandateResource {
private final Logger log = LoggerFactory.getLogger(SepaMandateResource.class);
private static final String ENTITY_NAME = "sepaMandate";
private final SepaMandateService sepaMandateService;
private final SepaMandateQueryService sepaMandateQueryService;
public SepaMandateResource(SepaMandateService sepaMandateService, SepaMandateQueryService sepaMandateQueryService) {
this.sepaMandateService = sepaMandateService;
this.sepaMandateQueryService = sepaMandateQueryService;
}
/**
* POST /sepa-mandates : Create a new sepaMandate.
*
* @param sepaMandateDTO the sepaMandateDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new sepaMandateDTO, or with status 400 (Bad Request) if the sepaMandate has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/sepa-mandates")
public ResponseEntity<SepaMandateDTO> createSepaMandate(@Valid @RequestBody SepaMandateDTO sepaMandateDTO) throws URISyntaxException {
log.debug("REST request to save SepaMandate : {}", sepaMandateDTO);
if (sepaMandateDTO.getId() != null) {
throw new BadRequestAlertException("A new sepaMandate cannot already have an ID", ENTITY_NAME, "idexists");
}
SepaMandateDTO result = sepaMandateService.save(sepaMandateDTO);
return ResponseEntity.created(new URI("/api/sepa-mandates/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /sepa-mandates : Updates an existing sepaMandate.
*
* @param sepaMandateDTO the sepaMandateDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated sepaMandateDTO,
* or with status 400 (Bad Request) if the sepaMandateDTO is not valid,
* or with status 500 (Internal Server Error) if the sepaMandateDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/sepa-mandates")
public ResponseEntity<SepaMandateDTO> updateSepaMandate(@Valid @RequestBody SepaMandateDTO sepaMandateDTO) throws URISyntaxException {
log.debug("REST request to update SepaMandate : {}", sepaMandateDTO);
if (sepaMandateDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
SepaMandateDTO result = sepaMandateService.save(sepaMandateDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, sepaMandateDTO.getId().toString()))
.body(result);
}
/**
* GET /sepa-mandates : get all the sepaMandates.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of sepaMandates in body
*/
@GetMapping("/sepa-mandates")
public ResponseEntity<List<SepaMandateDTO>> getAllSepaMandates(SepaMandateCriteria criteria, Pageable pageable) {
log.debug("REST request to get SepaMandates by criteria: {}", criteria);
Page<SepaMandateDTO> page = sepaMandateQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/sepa-mandates");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /sepa-mandates/count : count all the sepaMandates.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/sepa-mandates/count")
public ResponseEntity<Long> countSepaMandates(SepaMandateCriteria criteria) {
log.debug("REST request to count SepaMandates by criteria: {}", criteria);
return ResponseEntity.ok().body(sepaMandateQueryService.countByCriteria(criteria));
}
/**
* GET /sepa-mandates/:id : get the "id" sepaMandate.
*
* @param id the id of the sepaMandateDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the sepaMandateDTO, or with status 404 (Not Found)
*/
@GetMapping("/sepa-mandates/{id}")
public ResponseEntity<SepaMandateDTO> getSepaMandate(@PathVariable Long id) {
log.debug("REST request to get SepaMandate : {}", id);
Optional<SepaMandateDTO> sepaMandateDTO = sepaMandateService.findOne(id);
return ResponseUtil.wrapOrNotFound(sepaMandateDTO);
}
/**
* DELETE /sepa-mandates/:id : delete the "id" sepaMandate.
*
* @param id the id of the sepaMandateDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/sepa-mandates/{id}")
public ResponseEntity<Void> deleteSepaMandate(@PathVariable Long id) {
log.debug("REST request to delete SepaMandate : {}", id);
sepaMandateService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -0,0 +1,138 @@
package org.hostsharing.hsadminng.web.rest;
import org.hostsharing.hsadminng.service.ShareService;
import org.hostsharing.hsadminng.web.rest.errors.BadRequestAlertException;
import org.hostsharing.hsadminng.web.rest.util.HeaderUtil;
import org.hostsharing.hsadminng.web.rest.util.PaginationUtil;
import org.hostsharing.hsadminng.service.dto.ShareDTO;
import org.hostsharing.hsadminng.service.dto.ShareCriteria;
import org.hostsharing.hsadminng.service.ShareQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing Share.
*/
@RestController
@RequestMapping("/api")
public class ShareResource {
private final Logger log = LoggerFactory.getLogger(ShareResource.class);
private static final String ENTITY_NAME = "share";
private final ShareService shareService;
private final ShareQueryService shareQueryService;
public ShareResource(ShareService shareService, ShareQueryService shareQueryService) {
this.shareService = shareService;
this.shareQueryService = shareQueryService;
}
/**
* POST /shares : Create a new share.
*
* @param shareDTO the shareDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new shareDTO, or with status 400 (Bad Request) if the share has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/shares")
public ResponseEntity<ShareDTO> createShare(@Valid @RequestBody ShareDTO shareDTO) throws URISyntaxException {
log.debug("REST request to save Share : {}", shareDTO);
if (shareDTO.getId() != null) {
throw new BadRequestAlertException("A new share cannot already have an ID", ENTITY_NAME, "idexists");
}
ShareDTO result = shareService.save(shareDTO);
return ResponseEntity.created(new URI("/api/shares/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /shares : Updates an existing share.
*
* @param shareDTO the shareDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated shareDTO,
* or with status 400 (Bad Request) if the shareDTO is not valid,
* or with status 500 (Internal Server Error) if the shareDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/shares")
public ResponseEntity<ShareDTO> updateShare(@Valid @RequestBody ShareDTO shareDTO) throws URISyntaxException {
log.debug("REST request to update Share : {}", shareDTO);
if (shareDTO.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
ShareDTO result = shareService.save(shareDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, shareDTO.getId().toString()))
.body(result);
}
/**
* GET /shares : get all the shares.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of shares in body
*/
@GetMapping("/shares")
public ResponseEntity<List<ShareDTO>> getAllShares(ShareCriteria criteria, Pageable pageable) {
log.debug("REST request to get Shares by criteria: {}", criteria);
Page<ShareDTO> page = shareQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/shares");
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
/**
* GET /shares/count : count all the shares.
*
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the count in body
*/
@GetMapping("/shares/count")
public ResponseEntity<Long> countShares(ShareCriteria criteria) {
log.debug("REST request to count Shares by criteria: {}", criteria);
return ResponseEntity.ok().body(shareQueryService.countByCriteria(criteria));
}
/**
* GET /shares/:id : get the "id" share.
*
* @param id the id of the shareDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the shareDTO, or with status 404 (Not Found)
*/
@GetMapping("/shares/{id}")
public ResponseEntity<ShareDTO> getShare(@PathVariable Long id) {
log.debug("REST request to get Share : {}", id);
Optional<ShareDTO> shareDTO = shareService.findOne(id);
return ResponseUtil.wrapOrNotFound(shareDTO);
}
/**
* DELETE /shares/:id : delete the "id" share.
*
* @param id the id of the shareDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/shares/{id}")
public ResponseEntity<Void> deleteShare(@PathVariable Long id) {
log.debug("REST request to delete Share : {}", id);
shareService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}

View File

@ -0,0 +1,61 @@
<?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">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Customer.
-->
<changeSet id="20190418143050-1" author="jhipster">
<createTable tableName="customer">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="reference" type="integer">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_reference" />
</column>
<column name="prefix" type="varchar(3)">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_prefix" />
</column>
<column name="name" type="varchar(80)">
<constraints nullable="false" />
</column>
<column name="contractual_salutation" type="varchar(80)">
<constraints nullable="true" />
</column>
<column name="contractual_address" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="billing_salutation" type="varchar(80)">
<constraints nullable="true" />
</column>
<column name="billing_address" type="varchar(400)">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,49 @@
<?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">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Membership.
-->
<changeSet id="20190418143051-1" author="jhipster">
<createTable tableName="membership">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="member_from" type="date">
<constraints nullable="false" />
</column>
<column name="member_until" type="date">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="customer_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<!--
Added the constraints for entity Membership.
-->
<changeSet id="20190418143051-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="membership"
constraintName="fk_membership_customer_id"
referencedColumnNames="id"
referencedTableName="customer"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,53 @@
<?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">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Share.
-->
<changeSet id="20190418143052-1" author="jhipster">
<createTable tableName="share">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="value_date" type="date">
<constraints nullable="false" />
</column>
<column name="action" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="quantity" type="integer">
<constraints nullable="false" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="membership_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<!--
Added the constraints for entity Share.
-->
<changeSet id="20190418143052-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="share"
constraintName="fk_share_membership_id"
referencedColumnNames="id"
referencedTableName="membership"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,53 @@
<?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">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity Asset.
-->
<changeSet id="20190418143053-1" author="jhipster">
<createTable tableName="asset">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="value_date" type="date">
<constraints nullable="false" />
</column>
<column name="action" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="amount" type="decimal(10,2)">
<constraints nullable="false" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="membership_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<!--
Added the constraints for entity Asset.
-->
<changeSet id="20190418143053-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="asset"
constraintName="fk_asset_membership_id"
referencedColumnNames="id"
referencedTableName="membership"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,69 @@
<?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">
<property name="now" value="now()" dbms="h2"/>
<property name="now" value="current_timestamp" dbms="postgresql"/>
<property name="floatType" value="float4" dbms="postgresql, h2"/>
<property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
<!--
Added the entity SepaMandate.
-->
<changeSet id="20190418143054-1" author="jhipster">
<createTable tableName="sepa_mandate">
<column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="reference" type="varchar(40)">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_sepa_mandate_reference" />
</column>
<column name="iban" type="varchar(34)">
<constraints nullable="true" />
</column>
<column name="bic" type="varchar(11)">
<constraints nullable="true" />
</column>
<column name="document_date" type="date">
<constraints nullable="false" />
</column>
<column name="valid_from" type="date">
<constraints nullable="false" />
</column>
<column name="valid_until" type="date">
<constraints nullable="true" />
</column>
<column name="last_used" type="date">
<constraints nullable="true" />
</column>
<column name="cancellation_date" type="date">
<constraints nullable="true" />
</column>
<column name="remark" type="varchar(160)">
<constraints nullable="true" />
</column>
<column name="customer_id" type="bigint">
<constraints nullable="false" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>
</changeSet>
<!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
</databaseChangeLog>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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">
<!--
Added the constraints for entity SepaMandate.
-->
<changeSet id="20190418143054-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="sepa_mandate"
constraintName="fk_sepa_mandate_customer_id"
referencedColumnNames="id"
referencedTableName="customer"/>
</changeSet>
</databaseChangeLog>

View File

@ -5,6 +5,15 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143050_added_entity_Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143051_added_entity_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143052_added_entity_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143053_added_entity_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143054_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<include file="config/liquibase/changelog/20190418143051_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143052_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143053_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190418143054_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
</databaseChangeLog>

View File

@ -0,0 +1,19 @@
<form name="deleteForm" (ngSubmit)="confirmDelete(asset.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-asset-heading" jhiTranslate="hsadminNgApp.asset.delete.question" [translateValues]="{id: asset.id}">Are you sure you want to delete this Asset?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-asset" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,65 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { IAsset } from 'app/shared/model/asset.model';
import { AssetService } from './asset.service';
@Component({
selector: 'jhi-asset-delete-dialog',
templateUrl: './asset-delete-dialog.component.html'
})
export class AssetDeleteDialogComponent {
asset: IAsset;
constructor(protected assetService: AssetService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.assetService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'assetListModification',
content: 'Deleted an asset'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-asset-delete-popup',
template: ''
})
export class AssetDeletePopupComponent implements OnInit, OnDestroy {
protected ngbModalRef: NgbModalRef;
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ asset }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(AssetDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
this.ngbModalRef.componentInstance.asset = asset;
this.ngbModalRef.result.then(
result => {
this.router.navigate(['/asset', { outlets: { popup: null } }]);
this.ngbModalRef = null;
},
reason => {
this.router.navigate(['/asset', { outlets: { popup: null } }]);
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}

View File

@ -0,0 +1,49 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="asset">
<h2><span jhiTranslate="hsadminNgApp.asset.detail.title">Asset</span> {{asset.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.asset.documentDate">Document Date</span></dt>
<dd>
<span>{{asset.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.valueDate">Value Date</span></dt>
<dd>
<span>{{asset.valueDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.action">Action</span></dt>
<dd>
<span jhiTranslate="{{'hsadminNgApp.AssetAction.' + asset.action}}">{{asset.action}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.amount">Amount</span></dt>
<dd>
<span>{{asset.amount}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.remark">Remark</span></dt>
<dd>
<span>{{asset.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.asset.membership">Membership</span></dt>
<dd>
<div *ngIf="asset.membershipId">
<a [routerLink]="['/membership', asset.membershipId, 'view']">{{asset.membershipDocumentDate}}</a>
</div>
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/asset', asset.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IAsset } from 'app/shared/model/asset.model';
@Component({
selector: 'jhi-asset-detail',
templateUrl: './asset-detail.component.html'
})
export class AssetDetailComponent implements OnInit {
asset: IAsset;
constructor(protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ asset }) => {
this.asset = asset;
});
}
previousState() {
window.history.back();
}
}

View File

@ -0,0 +1,112 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2 id="jhi-asset-heading" jhiTranslate="hsadminNgApp.asset.home.createOrEditLabel">Create or edit a Asset</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!asset.id">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
[(ngModel)]="asset.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="asset.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.valueDate" for="field_valueDate">Value Date</label>
<div class="input-group">
<input id="field_valueDate" type="text" class="form-control" name="valueDate" ngbDatepicker #valueDateDp="ngbDatepicker" [(ngModel)]="asset.valueDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="valueDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.valueDate?.dirty && editForm.controls.valueDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.valueDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.action" for="field_action">Action</label>
<select class="form-control" name="action" [(ngModel)]="asset.action" id="field_action" required>
<option value="PAYMENT">{{'hsadminNgApp.AssetAction.PAYMENT' | translate}}</option>
<option value="HANDOVER">{{'hsadminNgApp.AssetAction.HANDOVER' | translate}}</option>
<option value="ADOPTION">{{'hsadminNgApp.AssetAction.ADOPTION' | translate}}</option>
<option value="LOSS">{{'hsadminNgApp.AssetAction.LOSS' | translate}}</option>
<option value="CLEARING">{{'hsadminNgApp.AssetAction.CLEARING' | translate}}</option>
<option value="PAYBACK">{{'hsadminNgApp.AssetAction.PAYBACK' | translate}}</option>
</select>
<div [hidden]="!(editForm.controls.action?.dirty && editForm.controls.action?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.action?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.amount" for="field_amount">Amount</label>
<input type="number" class="form-control" name="amount" id="field_amount"
[(ngModel)]="asset.amount" required/>
<div [hidden]="!(editForm.controls.amount?.dirty && editForm.controls.amount?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.amount?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.amount?.errors?.number" jhiTranslate="entity.validation.number">
This field should be a number.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="asset.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.asset.membership" for="field_membership">Membership</label>
<select class="form-control" id="field_membership" name="membership" [(ngModel)]="asset.membershipId" required>
<option *ngIf="!editForm.value.membership" [ngValue]="null" selected></option>
<option [ngValue]="membershipOption.id" *ngFor="let membershipOption of memberships; trackBy: trackMembershipById">{{membershipOption.documentDate}}</option>
</select>
</div>
<div [hidden]="!(editForm.controls.membership?.dirty && editForm.controls.membership?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.membership?.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()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
<fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,79 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import * as moment from 'moment';
import { JhiAlertService } from 'ng-jhipster';
import { IAsset } from 'app/shared/model/asset.model';
import { AssetService } from './asset.service';
import { IMembership } from 'app/shared/model/membership.model';
import { MembershipService } from 'app/entities/membership';
@Component({
selector: 'jhi-asset-update',
templateUrl: './asset-update.component.html'
})
export class AssetUpdateComponent implements OnInit {
asset: IAsset;
isSaving: boolean;
memberships: IMembership[];
documentDateDp: any;
valueDateDp: any;
constructor(
protected jhiAlertService: JhiAlertService,
protected assetService: AssetService,
protected membershipService: MembershipService,
protected activatedRoute: ActivatedRoute
) {}
ngOnInit() {
this.isSaving = false;
this.activatedRoute.data.subscribe(({ asset }) => {
this.asset = asset;
});
this.membershipService
.query()
.pipe(
filter((mayBeOk: HttpResponse<IMembership[]>) => mayBeOk.ok),
map((response: HttpResponse<IMembership[]>) => response.body)
)
.subscribe((res: IMembership[]) => (this.memberships = res), (res: HttpErrorResponse) => this.onError(res.message));
}
previousState() {
window.history.back();
}
save() {
this.isSaving = true;
if (this.asset.id !== undefined) {
this.subscribeToSaveResponse(this.assetService.update(this.asset));
} else {
this.subscribeToSaveResponse(this.assetService.create(this.asset));
}
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IAsset>>) {
result.subscribe((res: HttpResponse<IAsset>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
}
protected onSaveSuccess() {
this.isSaving = false;
this.previousState();
}
protected onSaveError() {
this.isSaving = false;
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
trackMembershipById(index: number, item: IMembership) {
return item.id;
}
}

View File

@ -0,0 +1,68 @@
<div>
<h2 id="page-heading">
<span jhiTranslate="hsadminNgApp.asset.home.title">Assets</span>
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-asset" [routerLink]="['/asset/new']">
<fa-icon [icon]="'plus'"></fa-icon>
<span jhiTranslate="hsadminNgApp.asset.home.createLabel">
Create new Asset
</span>
</button>
</h2>
<jhi-alert></jhi-alert>
<br/>
<div class="table-responsive" *ngIf="assets">
<table class="table table-striped">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.asset.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="valueDate"><span jhiTranslate="hsadminNgApp.asset.valueDate">Value Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="action"><span jhiTranslate="hsadminNgApp.asset.action">Action</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="amount"><span jhiTranslate="hsadminNgApp.asset.amount">Amount</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.asset.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="membershipDocumentDate"><span jhiTranslate="hsadminNgApp.asset.membership">Membership</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let asset of assets ;trackBy: trackId">
<td><a [routerLink]="['/asset', asset.id, 'view' ]">{{asset.id}}</a></td>
<td>{{asset.documentDate | date:'mediumDate'}}</td>
<td>{{asset.valueDate | date:'mediumDate'}}</td>
<td jhiTranslate="{{'hsadminNgApp.AssetAction.' + asset.action}}">{{asset.action}}</td>
<td>{{asset.amount}}</td>
<td>{{asset.remark}}</td>
<td>
<div *ngIf="asset.membershipId">
<a [routerLink]="['../membership', asset.membershipId , 'view' ]" >{{asset.membershipDocumentDate}}</a>
</div>
</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
[routerLink]="['/asset', asset.id, 'view' ]"
class="btn btn-info btn-sm">
<fa-icon [icon]="'eye'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button type="submit"
[routerLink]="['/asset', asset.id, 'edit']"
class="btn btn-primary btn-sm">
<fa-icon [icon]="'pencil-alt'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit"
[routerLink]="['/', 'asset', { outlets: { popup: asset.id + '/delete'} }]"
replaceUrl="true"
queryParamsHandling="merge"
class="btn btn-danger btn-sm">
<fa-icon [icon]="'times'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,108 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
import { IAsset } from 'app/shared/model/asset.model';
import { AccountService } from 'app/core';
import { ITEMS_PER_PAGE } from 'app/shared';
import { AssetService } from './asset.service';
@Component({
selector: 'jhi-asset',
templateUrl: './asset.component.html'
})
export class AssetComponent implements OnInit, OnDestroy {
assets: IAsset[];
currentAccount: any;
eventSubscriber: Subscription;
itemsPerPage: number;
links: any;
page: any;
predicate: any;
reverse: any;
totalItems: number;
constructor(
protected assetService: AssetService,
protected jhiAlertService: JhiAlertService,
protected eventManager: JhiEventManager,
protected parseLinks: JhiParseLinks,
protected accountService: AccountService
) {
this.assets = [];
this.itemsPerPage = ITEMS_PER_PAGE;
this.page = 0;
this.links = {
last: 0
};
this.predicate = 'id';
this.reverse = true;
}
loadAll() {
this.assetService
.query({
page: this.page,
size: this.itemsPerPage,
sort: this.sort()
})
.subscribe(
(res: HttpResponse<IAsset[]>) => this.paginateAssets(res.body, res.headers),
(res: HttpErrorResponse) => this.onError(res.message)
);
}
reset() {
this.page = 0;
this.assets = [];
this.loadAll();
}
loadPage(page) {
this.page = page;
this.loadAll();
}
ngOnInit() {
this.loadAll();
this.accountService.identity().then(account => {
this.currentAccount = account;
});
this.registerChangeInAssets();
}
ngOnDestroy() {
this.eventManager.destroy(this.eventSubscriber);
}
trackId(index: number, item: IAsset) {
return item.id;
}
registerChangeInAssets() {
this.eventSubscriber = this.eventManager.subscribe('assetListModification', response => this.reset());
}
sort() {
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
if (this.predicate !== 'id') {
result.push('id');
}
return result;
}
protected paginateAssets(data: IAsset[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
for (let i = 0; i < data.length; i++) {
this.assets.push(data[i]);
}
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
}

View File

@ -0,0 +1,34 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
import { JhiLanguageService } from 'ng-jhipster';
import { JhiLanguageHelper } from 'app/core';
import { HsadminNgSharedModule } from 'app/shared';
import {
AssetComponent,
AssetDetailComponent,
AssetUpdateComponent,
AssetDeletePopupComponent,
AssetDeleteDialogComponent,
assetRoute,
assetPopupRoute
} from './';
const ENTITY_STATES = [...assetRoute, ...assetPopupRoute];
@NgModule({
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
declarations: [AssetComponent, AssetDetailComponent, AssetUpdateComponent, AssetDeleteDialogComponent, AssetDeletePopupComponent],
entryComponents: [AssetComponent, AssetUpdateComponent, AssetDeleteDialogComponent, AssetDeletePopupComponent],
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HsadminNgAssetModule {
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
this.languageHelper.language.subscribe((languageKey: string) => {
if (languageKey !== undefined) {
this.languageService.changeLanguage(languageKey);
}
});
}
}

View File

@ -0,0 +1,93 @@
import { Injectable } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
import { UserRouteAccessService } from 'app/core';
import { Observable, of } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { Asset } from 'app/shared/model/asset.model';
import { AssetService } from './asset.service';
import { AssetComponent } from './asset.component';
import { AssetDetailComponent } from './asset-detail.component';
import { AssetUpdateComponent } from './asset-update.component';
import { AssetDeletePopupComponent } from './asset-delete-dialog.component';
import { IAsset } from 'app/shared/model/asset.model';
@Injectable({ providedIn: 'root' })
export class AssetResolve implements Resolve<IAsset> {
constructor(private service: AssetService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IAsset> {
const id = route.params['id'] ? route.params['id'] : null;
if (id) {
return this.service.find(id).pipe(
filter((response: HttpResponse<Asset>) => response.ok),
map((asset: HttpResponse<Asset>) => asset.body)
);
}
return of(new Asset());
}
}
export const assetRoute: Routes = [
{
path: '',
component: AssetComponent,
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.asset.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/view',
component: AssetDetailComponent,
resolve: {
asset: AssetResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.asset.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: 'new',
component: AssetUpdateComponent,
resolve: {
asset: AssetResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.asset.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/edit',
component: AssetUpdateComponent,
resolve: {
asset: AssetResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.asset.home.title'
},
canActivate: [UserRouteAccessService]
}
];
export const assetPopupRoute: Routes = [
{
path: ':id/delete',
component: AssetDeletePopupComponent,
resolve: {
asset: AssetResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.asset.home.title'
},
canActivate: [UserRouteAccessService],
outlet: 'popup'
}
];

View File

@ -0,0 +1,77 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as moment from 'moment';
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
import { map } from 'rxjs/operators';
import { SERVER_API_URL } from 'app/app.constants';
import { createRequestOption } from 'app/shared';
import { IAsset } from 'app/shared/model/asset.model';
type EntityResponseType = HttpResponse<IAsset>;
type EntityArrayResponseType = HttpResponse<IAsset[]>;
@Injectable({ providedIn: 'root' })
export class AssetService {
public resourceUrl = SERVER_API_URL + 'api/assets';
constructor(protected http: HttpClient) {}
create(asset: IAsset): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(asset);
return this.http
.post<IAsset>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
update(asset: IAsset): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(asset);
return this.http
.put<IAsset>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
find(id: number): Observable<EntityResponseType> {
return this.http
.get<IAsset>(`${this.resourceUrl}/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
query(req?: any): Observable<EntityArrayResponseType> {
const options = createRequestOption(req);
return this.http
.get<IAsset[]>(this.resourceUrl, { params: options, observe: 'response' })
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
}
delete(id: number): Observable<HttpResponse<any>> {
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
}
protected convertDateFromClient(asset: IAsset): IAsset {
const copy: IAsset = Object.assign({}, asset, {
documentDate: asset.documentDate != null && asset.documentDate.isValid() ? asset.documentDate.format(DATE_FORMAT) : null,
valueDate: asset.valueDate != null && asset.valueDate.isValid() ? asset.valueDate.format(DATE_FORMAT) : null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.valueDate = res.body.valueDate != null ? moment(res.body.valueDate) : null;
}
return res;
}
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((asset: IAsset) => {
asset.documentDate = asset.documentDate != null ? moment(asset.documentDate) : null;
asset.valueDate = asset.valueDate != null ? moment(asset.valueDate) : null;
});
}
return res;
}
}

View File

@ -0,0 +1,6 @@
export * from './asset.service';
export * from './asset-update.component';
export * from './asset-delete-dialog.component';
export * from './asset-detail.component';
export * from './asset.component';
export * from './asset.route';

View File

@ -0,0 +1,19 @@
<form name="deleteForm" (ngSubmit)="confirmDelete(customer.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-customer-heading" jhiTranslate="hsadminNgApp.customer.delete.question" [translateValues]="{id: customer.id}">Are you sure you want to delete this Customer?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-customer" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,65 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { ICustomer } from 'app/shared/model/customer.model';
import { CustomerService } from './customer.service';
@Component({
selector: 'jhi-customer-delete-dialog',
templateUrl: './customer-delete-dialog.component.html'
})
export class CustomerDeleteDialogComponent {
customer: ICustomer;
constructor(protected customerService: CustomerService, public activeModal: NgbActiveModal, protected eventManager: JhiEventManager) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.customerService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'customerListModification',
content: 'Deleted an customer'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-customer-delete-popup',
template: ''
})
export class CustomerDeletePopupComponent implements OnInit, OnDestroy {
protected ngbModalRef: NgbModalRef;
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ customer }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(CustomerDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
this.ngbModalRef.componentInstance.customer = customer;
this.ngbModalRef.result.then(
result => {
this.router.navigate(['/customer', { outlets: { popup: null } }]);
this.ngbModalRef = null;
},
reason => {
this.router.navigate(['/customer', { outlets: { popup: null } }]);
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}

View File

@ -0,0 +1,55 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="customer">
<h2><span jhiTranslate="hsadminNgApp.customer.detail.title">Customer</span> {{customer.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.customer.reference">Reference</span></dt>
<dd>
<span>{{customer.reference}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span></dt>
<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.contractualSalutation">Contractual Salutation</span></dt>
<dd>
<span>{{customer.contractualSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span></dt>
<dd>
<span>{{customer.contractualAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span></dt>
<dd>
<span>{{customer.billingSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span></dt>
<dd>
<span>{{customer.billingAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.remark">Remark</span></dt>
<dd>
<span>{{customer.remark}}</span>
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/customer', customer.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ICustomer } from 'app/shared/model/customer.model';
@Component({
selector: 'jhi-customer-detail',
templateUrl: './customer-detail.component.html'
})
export class CustomerDetailComponent implements OnInit {
customer: ICustomer;
constructor(protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ customer }) => {
this.customer = customer;
});
}
previousState() {
window.history.back();
}
}

View File

@ -0,0 +1,140 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2 id="jhi-customer-heading" jhiTranslate="hsadminNgApp.customer.home.createOrEditLabel">Create or edit a Customer</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!customer.id">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
[(ngModel)]="customer.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.reference" for="field_reference">Reference</label>
<input type="number" class="form-control" name="reference" id="field_reference"
[(ngModel)]="customer.reference" required min="10000" jhiMin="10000" max="99999" jhiMax="99999"/>
<div [hidden]="!(editForm.controls.reference?.dirty && editForm.controls.reference?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.min" jhiTranslate="entity.validation.min" [translateValues]="{ min: 10000 }">
This field should be at least 10000.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.max" jhiTranslate="entity.validation.max" [translateValues]="{ max: 99999 }">
This field cannot be more than 99999.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.reference?.errors?.number" jhiTranslate="entity.validation.number">
This field should be a number.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.prefix" for="field_prefix">Prefix</label>
<input type="text" class="form-control" name="prefix" id="field_prefix"
[(ngModel)]="customer.prefix" required maxlength="3" pattern="[a-z][a-z0-9]+"/>
<div [hidden]="!(editForm.controls.prefix?.dirty && editForm.controls.prefix?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 3 }">
This field cannot be longer than 3 characters.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.prefix?.errors?.pattern" jhiTranslate="entity.validation.pattern" [translateValues]="{ pattern: 'Prefix' }">
This field should follow pattern for "Prefix".
</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.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.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.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 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.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="customer.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
</div>
<div>
<button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
<fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,51 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { ICustomer } from 'app/shared/model/customer.model';
import { CustomerService } from './customer.service';
@Component({
selector: 'jhi-customer-update',
templateUrl: './customer-update.component.html'
})
export class CustomerUpdateComponent implements OnInit {
customer: ICustomer;
isSaving: boolean;
constructor(protected customerService: CustomerService, protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.isSaving = false;
this.activatedRoute.data.subscribe(({ customer }) => {
this.customer = customer;
});
}
previousState() {
window.history.back();
}
save() {
this.isSaving = true;
if (this.customer.id !== undefined) {
this.subscribeToSaveResponse(this.customerService.update(this.customer));
} else {
this.subscribeToSaveResponse(this.customerService.create(this.customer));
}
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<ICustomer>>) {
result.subscribe((res: HttpResponse<ICustomer>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
}
protected onSaveSuccess() {
this.isSaving = false;
this.previousState();
}
protected onSaveError() {
this.isSaving = false;
}
}

View File

@ -0,0 +1,68 @@
<div>
<h2 id="page-heading">
<span jhiTranslate="hsadminNgApp.customer.home.title">Customers</span>
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-customer" [routerLink]="['/customer/new']">
<fa-icon [icon]="'plus'"></fa-icon>
<span jhiTranslate="hsadminNgApp.customer.home.createLabel">
Create new Customer
</span>
</button>
</h2>
<jhi-alert></jhi-alert>
<br/>
<div class="table-responsive" *ngIf="customers">
<table class="table table-striped">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="reference"><span jhiTranslate="hsadminNgApp.customer.reference">Reference</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="contractualSalutation"><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</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="billingSalutation"><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing 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="remark"><span jhiTranslate="hsadminNgApp.customer.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let customer of customers ;trackBy: trackId">
<td><a [routerLink]="['/customer', customer.id, 'view' ]">{{customer.id}}</a></td>
<td>{{customer.reference}}</td>
<td>{{customer.prefix}}</td>
<td>{{customer.name}}</td>
<td>{{customer.contractualSalutation}}</td>
<td>{{customer.contractualAddress}}</td>
<td>{{customer.billingSalutation}}</td>
<td>{{customer.billingAddress}}</td>
<td>{{customer.remark}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
[routerLink]="['/customer', customer.id, 'view' ]"
class="btn btn-info btn-sm">
<fa-icon [icon]="'eye'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button type="submit"
[routerLink]="['/customer', customer.id, 'edit']"
class="btn btn-primary btn-sm">
<fa-icon [icon]="'pencil-alt'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit"
[routerLink]="['/', 'customer', { outlets: { popup: customer.id + '/delete'} }]"
replaceUrl="true"
queryParamsHandling="merge"
class="btn btn-danger btn-sm">
<fa-icon [icon]="'times'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,108 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
import { ICustomer } from 'app/shared/model/customer.model';
import { AccountService } from 'app/core';
import { ITEMS_PER_PAGE } from 'app/shared';
import { CustomerService } from './customer.service';
@Component({
selector: 'jhi-customer',
templateUrl: './customer.component.html'
})
export class CustomerComponent implements OnInit, OnDestroy {
customers: ICustomer[];
currentAccount: any;
eventSubscriber: Subscription;
itemsPerPage: number;
links: any;
page: any;
predicate: any;
reverse: any;
totalItems: number;
constructor(
protected customerService: CustomerService,
protected jhiAlertService: JhiAlertService,
protected eventManager: JhiEventManager,
protected parseLinks: JhiParseLinks,
protected accountService: AccountService
) {
this.customers = [];
this.itemsPerPage = ITEMS_PER_PAGE;
this.page = 0;
this.links = {
last: 0
};
this.predicate = 'id';
this.reverse = true;
}
loadAll() {
this.customerService
.query({
page: this.page,
size: this.itemsPerPage,
sort: this.sort()
})
.subscribe(
(res: HttpResponse<ICustomer[]>) => this.paginateCustomers(res.body, res.headers),
(res: HttpErrorResponse) => this.onError(res.message)
);
}
reset() {
this.page = 0;
this.customers = [];
this.loadAll();
}
loadPage(page) {
this.page = page;
this.loadAll();
}
ngOnInit() {
this.loadAll();
this.accountService.identity().then(account => {
this.currentAccount = account;
});
this.registerChangeInCustomers();
}
ngOnDestroy() {
this.eventManager.destroy(this.eventSubscriber);
}
trackId(index: number, item: ICustomer) {
return item.id;
}
registerChangeInCustomers() {
this.eventSubscriber = this.eventManager.subscribe('customerListModification', response => this.reset());
}
sort() {
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
if (this.predicate !== 'id') {
result.push('id');
}
return result;
}
protected paginateCustomers(data: ICustomer[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
for (let i = 0; i < data.length; i++) {
this.customers.push(data[i]);
}
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
}

View File

@ -0,0 +1,40 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
import { JhiLanguageService } from 'ng-jhipster';
import { JhiLanguageHelper } from 'app/core';
import { HsadminNgSharedModule } from 'app/shared';
import {
CustomerComponent,
CustomerDetailComponent,
CustomerUpdateComponent,
CustomerDeletePopupComponent,
CustomerDeleteDialogComponent,
customerRoute,
customerPopupRoute
} from './';
const ENTITY_STATES = [...customerRoute, ...customerPopupRoute];
@NgModule({
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
declarations: [
CustomerComponent,
CustomerDetailComponent,
CustomerUpdateComponent,
CustomerDeleteDialogComponent,
CustomerDeletePopupComponent
],
entryComponents: [CustomerComponent, CustomerUpdateComponent, CustomerDeleteDialogComponent, CustomerDeletePopupComponent],
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HsadminNgCustomerModule {
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
this.languageHelper.language.subscribe((languageKey: string) => {
if (languageKey !== undefined) {
this.languageService.changeLanguage(languageKey);
}
});
}
}

View File

@ -0,0 +1,93 @@
import { Injectable } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
import { UserRouteAccessService } from 'app/core';
import { Observable, of } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { Customer } from 'app/shared/model/customer.model';
import { CustomerService } from './customer.service';
import { CustomerComponent } from './customer.component';
import { CustomerDetailComponent } from './customer-detail.component';
import { CustomerUpdateComponent } from './customer-update.component';
import { CustomerDeletePopupComponent } from './customer-delete-dialog.component';
import { ICustomer } from 'app/shared/model/customer.model';
@Injectable({ providedIn: 'root' })
export class CustomerResolve implements Resolve<ICustomer> {
constructor(private service: CustomerService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ICustomer> {
const id = route.params['id'] ? route.params['id'] : null;
if (id) {
return this.service.find(id).pipe(
filter((response: HttpResponse<Customer>) => response.ok),
map((customer: HttpResponse<Customer>) => customer.body)
);
}
return of(new Customer());
}
}
export const customerRoute: Routes = [
{
path: '',
component: CustomerComponent,
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.customer.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/view',
component: CustomerDetailComponent,
resolve: {
customer: CustomerResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.customer.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: 'new',
component: CustomerUpdateComponent,
resolve: {
customer: CustomerResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.customer.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/edit',
component: CustomerUpdateComponent,
resolve: {
customer: CustomerResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.customer.home.title'
},
canActivate: [UserRouteAccessService]
}
];
export const customerPopupRoute: Routes = [
{
path: ':id/delete',
component: CustomerDeletePopupComponent,
resolve: {
customer: CustomerResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.customer.home.title'
},
canActivate: [UserRouteAccessService],
outlet: 'popup'
}
];

View File

@ -0,0 +1,38 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { SERVER_API_URL } from 'app/app.constants';
import { createRequestOption } from 'app/shared';
import { ICustomer } from 'app/shared/model/customer.model';
type EntityResponseType = HttpResponse<ICustomer>;
type EntityArrayResponseType = HttpResponse<ICustomer[]>;
@Injectable({ providedIn: 'root' })
export class CustomerService {
public resourceUrl = SERVER_API_URL + 'api/customers';
constructor(protected http: HttpClient) {}
create(customer: ICustomer): Observable<EntityResponseType> {
return this.http.post<ICustomer>(this.resourceUrl, customer, { observe: 'response' });
}
update(customer: ICustomer): Observable<EntityResponseType> {
return this.http.put<ICustomer>(this.resourceUrl, customer, { observe: 'response' });
}
find(id: number): Observable<EntityResponseType> {
return this.http.get<ICustomer>(`${this.resourceUrl}/${id}`, { observe: 'response' });
}
query(req?: any): Observable<EntityArrayResponseType> {
const options = createRequestOption(req);
return this.http.get<ICustomer[]>(this.resourceUrl, { params: options, observe: 'response' });
}
delete(id: number): Observable<HttpResponse<any>> {
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
}
}

View File

@ -0,0 +1,6 @@
export * from './customer.service';
export * from './customer-update.component';
export * from './customer-delete-dialog.component';
export * from './customer-detail.component';
export * from './customer.component';
export * from './customer.route';

View File

@ -4,6 +4,26 @@ import { RouterModule } from '@angular/router';
@NgModule({
imports: [
RouterModule.forChild([
{
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'
},
{
path: 'sepa-mandate',
loadChildren: './sepa-mandate/sepa-mandate.module#HsadminNgSepaMandateModule'
}
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
])
],

View File

@ -0,0 +1,6 @@
export * from './membership.service';
export * from './membership-update.component';
export * from './membership-delete-dialog.component';
export * from './membership-detail.component';
export * from './membership.component';
export * from './membership.route';

View File

@ -0,0 +1,19 @@
<form name="deleteForm" (ngSubmit)="confirmDelete(membership.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-membership-heading" jhiTranslate="hsadminNgApp.membership.delete.question" [translateValues]="{id: membership.id}">Are you sure you want to delete this Membership?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-membership" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,69 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { IMembership } from 'app/shared/model/membership.model';
import { MembershipService } from './membership.service';
@Component({
selector: 'jhi-membership-delete-dialog',
templateUrl: './membership-delete-dialog.component.html'
})
export class MembershipDeleteDialogComponent {
membership: IMembership;
constructor(
protected membershipService: MembershipService,
public activeModal: NgbActiveModal,
protected eventManager: JhiEventManager
) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.membershipService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'membershipListModification',
content: 'Deleted an membership'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-membership-delete-popup',
template: ''
})
export class MembershipDeletePopupComponent implements OnInit, OnDestroy {
protected ngbModalRef: NgbModalRef;
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ membership }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(MembershipDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
this.ngbModalRef.componentInstance.membership = membership;
this.ngbModalRef.result.then(
result => {
this.router.navigate(['/membership', { outlets: { popup: null } }]);
this.ngbModalRef = null;
},
reason => {
this.router.navigate(['/membership', { outlets: { popup: null } }]);
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}

View File

@ -0,0 +1,45 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="membership">
<h2><span jhiTranslate="hsadminNgApp.membership.detail.title">Membership</span> {{membership.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.membership.documentDate">Document Date</span></dt>
<dd>
<span>{{membership.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.memberFrom">Member From</span></dt>
<dd>
<span>{{membership.memberFrom}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.memberUntil">Member Until</span></dt>
<dd>
<span>{{membership.memberUntil}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.remark">Remark</span></dt>
<dd>
<span>{{membership.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.membership.customer">Customer</span></dt>
<dd>
<div *ngIf="membership.customerId">
<a [routerLink]="['/customer', membership.customerId, 'view']">{{membership.customerPrefix}}</a>
</div>
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/membership', membership.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IMembership } from 'app/shared/model/membership.model';
@Component({
selector: 'jhi-membership-detail',
templateUrl: './membership-detail.component.html'
})
export class MembershipDetailComponent implements OnInit {
membership: IMembership;
constructor(protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ membership }) => {
this.membership = membership;
});
}
previousState() {
window.history.back();
}
}

View File

@ -0,0 +1,90 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
<h2 id="jhi-membership-heading" jhiTranslate="hsadminNgApp.membership.home.createOrEditLabel">Create or edit a Membership</h2>
<div>
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!membership.id">
<label for="id" jhiTranslate="global.field.id">ID</label>
<input type="text" class="form-control" id="id" name="id"
[(ngModel)]="membership.id" readonly />
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.documentDate" for="field_documentDate">Document Date</label>
<div class="input-group">
<input id="field_documentDate" type="text" class="form-control" name="documentDate" ngbDatepicker #documentDateDp="ngbDatepicker" [(ngModel)]="membership.documentDate"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="documentDateDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.documentDate?.dirty && editForm.controls.documentDate?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.documentDate?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.memberFrom" for="field_memberFrom">Member From</label>
<div class="input-group">
<input id="field_memberFrom" type="text" class="form-control" name="memberFrom" ngbDatepicker #memberFromDp="ngbDatepicker" [(ngModel)]="membership.memberFrom"
required/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="memberFromDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
<div [hidden]="!(editForm.controls.memberFrom?.dirty && editForm.controls.memberFrom?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.memberFrom?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.memberUntil" for="field_memberUntil">Member Until</label>
<div class="input-group">
<input id="field_memberUntil" type="text" class="form-control" name="memberUntil" ngbDatepicker #memberUntilDp="ngbDatepicker" [(ngModel)]="membership.memberUntil"
/>
<span class="input-group-append">
<button type="button" class="btn btn-secondary" (click)="memberUntilDp.toggle()"><fa-icon [icon]="'calendar-alt'"></fa-icon></button>
</span>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.membership.remark" for="field_remark">Remark</label>
<input type="text" class="form-control" name="remark" id="field_remark"
[(ngModel)]="membership.remark" maxlength="160"/>
<div [hidden]="!(editForm.controls.remark?.dirty && editForm.controls.remark?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.remark?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 160 }">
This field cannot be longer than 160 characters.
</small>
</div>
</div>
<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" 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()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
<fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,80 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import * as moment from 'moment';
import { JhiAlertService } from 'ng-jhipster';
import { IMembership } from 'app/shared/model/membership.model';
import { MembershipService } from './membership.service';
import { ICustomer } from 'app/shared/model/customer.model';
import { CustomerService } from 'app/entities/customer';
@Component({
selector: 'jhi-membership-update',
templateUrl: './membership-update.component.html'
})
export class MembershipUpdateComponent implements OnInit {
membership: IMembership;
isSaving: boolean;
customers: ICustomer[];
documentDateDp: any;
memberFromDp: any;
memberUntilDp: any;
constructor(
protected jhiAlertService: JhiAlertService,
protected membershipService: MembershipService,
protected customerService: CustomerService,
protected activatedRoute: ActivatedRoute
) {}
ngOnInit() {
this.isSaving = false;
this.activatedRoute.data.subscribe(({ membership }) => {
this.membership = membership;
});
this.customerService
.query()
.pipe(
filter((mayBeOk: HttpResponse<ICustomer[]>) => mayBeOk.ok),
map((response: HttpResponse<ICustomer[]>) => response.body)
)
.subscribe((res: ICustomer[]) => (this.customers = res), (res: HttpErrorResponse) => this.onError(res.message));
}
previousState() {
window.history.back();
}
save() {
this.isSaving = true;
if (this.membership.id !== undefined) {
this.subscribeToSaveResponse(this.membershipService.update(this.membership));
} else {
this.subscribeToSaveResponse(this.membershipService.create(this.membership));
}
}
protected subscribeToSaveResponse(result: Observable<HttpResponse<IMembership>>) {
result.subscribe((res: HttpResponse<IMembership>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
}
protected onSaveSuccess() {
this.isSaving = false;
this.previousState();
}
protected onSaveError() {
this.isSaving = false;
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
trackCustomerById(index: number, item: ICustomer) {
return item.id;
}
}

View File

@ -0,0 +1,66 @@
<div>
<h2 id="page-heading">
<span jhiTranslate="hsadminNgApp.membership.home.title">Memberships</span>
<button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-membership" [routerLink]="['/membership/new']">
<fa-icon [icon]="'plus'"></fa-icon>
<span jhiTranslate="hsadminNgApp.membership.home.createLabel">
Create new Membership
</span>
</button>
</h2>
<jhi-alert></jhi-alert>
<br/>
<div class="table-responsive" *ngIf="memberships">
<table class="table table-striped">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="reset.bind(this)">
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="documentDate"><span jhiTranslate="hsadminNgApp.membership.documentDate">Document Date</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberFrom"><span jhiTranslate="hsadminNgApp.membership.memberFrom">Member From</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="memberUntil"><span jhiTranslate="hsadminNgApp.membership.memberUntil">Member Until</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="remark"><span jhiTranslate="hsadminNgApp.membership.remark">Remark</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="customerPrefix"><span jhiTranslate="hsadminNgApp.membership.customer">Customer</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
</thead>
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
<tr *ngFor="let membership of memberships ;trackBy: trackId">
<td><a [routerLink]="['/membership', membership.id, 'view' ]">{{membership.id}}</a></td>
<td>{{membership.documentDate | date:'mediumDate'}}</td>
<td>{{membership.memberFrom | date:'mediumDate'}}</td>
<td>{{membership.memberUntil | date:'mediumDate'}}</td>
<td>{{membership.remark}}</td>
<td>
<div *ngIf="membership.customerId">
<a [routerLink]="['../customer', membership.customerId , 'view' ]" >{{membership.customerPrefix}}</a>
</div>
</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"
[routerLink]="['/membership', membership.id, 'view' ]"
class="btn btn-info btn-sm">
<fa-icon [icon]="'eye'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button type="submit"
[routerLink]="['/membership', membership.id, 'edit']"
class="btn btn-primary btn-sm">
<fa-icon [icon]="'pencil-alt'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit"
[routerLink]="['/', 'membership', { outlets: { popup: membership.id + '/delete'} }]"
replaceUrl="true"
queryParamsHandling="merge"
class="btn btn-danger btn-sm">
<fa-icon [icon]="'times'"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,108 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpErrorResponse, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Subscription } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { JhiEventManager, JhiParseLinks, JhiAlertService } from 'ng-jhipster';
import { IMembership } from 'app/shared/model/membership.model';
import { AccountService } from 'app/core';
import { ITEMS_PER_PAGE } from 'app/shared';
import { MembershipService } from './membership.service';
@Component({
selector: 'jhi-membership',
templateUrl: './membership.component.html'
})
export class MembershipComponent implements OnInit, OnDestroy {
memberships: IMembership[];
currentAccount: any;
eventSubscriber: Subscription;
itemsPerPage: number;
links: any;
page: any;
predicate: any;
reverse: any;
totalItems: number;
constructor(
protected membershipService: MembershipService,
protected jhiAlertService: JhiAlertService,
protected eventManager: JhiEventManager,
protected parseLinks: JhiParseLinks,
protected accountService: AccountService
) {
this.memberships = [];
this.itemsPerPage = ITEMS_PER_PAGE;
this.page = 0;
this.links = {
last: 0
};
this.predicate = 'id';
this.reverse = true;
}
loadAll() {
this.membershipService
.query({
page: this.page,
size: this.itemsPerPage,
sort: this.sort()
})
.subscribe(
(res: HttpResponse<IMembership[]>) => this.paginateMemberships(res.body, res.headers),
(res: HttpErrorResponse) => this.onError(res.message)
);
}
reset() {
this.page = 0;
this.memberships = [];
this.loadAll();
}
loadPage(page) {
this.page = page;
this.loadAll();
}
ngOnInit() {
this.loadAll();
this.accountService.identity().then(account => {
this.currentAccount = account;
});
this.registerChangeInMemberships();
}
ngOnDestroy() {
this.eventManager.destroy(this.eventSubscriber);
}
trackId(index: number, item: IMembership) {
return item.id;
}
registerChangeInMemberships() {
this.eventSubscriber = this.eventManager.subscribe('membershipListModification', response => this.reset());
}
sort() {
const result = [this.predicate + ',' + (this.reverse ? 'asc' : 'desc')];
if (this.predicate !== 'id') {
result.push('id');
}
return result;
}
protected paginateMemberships(data: IMembership[], headers: HttpHeaders) {
this.links = this.parseLinks.parse(headers.get('link'));
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
for (let i = 0; i < data.length; i++) {
this.memberships.push(data[i]);
}
}
protected onError(errorMessage: string) {
this.jhiAlertService.error(errorMessage, null, null);
}
}

View File

@ -0,0 +1,40 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
import { JhiLanguageService } from 'ng-jhipster';
import { JhiLanguageHelper } from 'app/core';
import { HsadminNgSharedModule } from 'app/shared';
import {
MembershipComponent,
MembershipDetailComponent,
MembershipUpdateComponent,
MembershipDeletePopupComponent,
MembershipDeleteDialogComponent,
membershipRoute,
membershipPopupRoute
} from './';
const ENTITY_STATES = [...membershipRoute, ...membershipPopupRoute];
@NgModule({
imports: [HsadminNgSharedModule, RouterModule.forChild(ENTITY_STATES)],
declarations: [
MembershipComponent,
MembershipDetailComponent,
MembershipUpdateComponent,
MembershipDeleteDialogComponent,
MembershipDeletePopupComponent
],
entryComponents: [MembershipComponent, MembershipUpdateComponent, MembershipDeleteDialogComponent, MembershipDeletePopupComponent],
providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HsadminNgMembershipModule {
constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
this.languageHelper.language.subscribe((languageKey: string) => {
if (languageKey !== undefined) {
this.languageService.changeLanguage(languageKey);
}
});
}
}

View File

@ -0,0 +1,93 @@
import { Injectable } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
import { UserRouteAccessService } from 'app/core';
import { Observable, of } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { Membership } from 'app/shared/model/membership.model';
import { MembershipService } from './membership.service';
import { MembershipComponent } from './membership.component';
import { MembershipDetailComponent } from './membership-detail.component';
import { MembershipUpdateComponent } from './membership-update.component';
import { MembershipDeletePopupComponent } from './membership-delete-dialog.component';
import { IMembership } from 'app/shared/model/membership.model';
@Injectable({ providedIn: 'root' })
export class MembershipResolve implements Resolve<IMembership> {
constructor(private service: MembershipService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<IMembership> {
const id = route.params['id'] ? route.params['id'] : null;
if (id) {
return this.service.find(id).pipe(
filter((response: HttpResponse<Membership>) => response.ok),
map((membership: HttpResponse<Membership>) => membership.body)
);
}
return of(new Membership());
}
}
export const membershipRoute: Routes = [
{
path: '',
component: MembershipComponent,
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.membership.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/view',
component: MembershipDetailComponent,
resolve: {
membership: MembershipResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.membership.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: 'new',
component: MembershipUpdateComponent,
resolve: {
membership: MembershipResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.membership.home.title'
},
canActivate: [UserRouteAccessService]
},
{
path: ':id/edit',
component: MembershipUpdateComponent,
resolve: {
membership: MembershipResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.membership.home.title'
},
canActivate: [UserRouteAccessService]
}
];
export const membershipPopupRoute: Routes = [
{
path: ':id/delete',
component: MembershipDeletePopupComponent,
resolve: {
membership: MembershipResolve
},
data: {
authorities: ['ROLE_USER'],
pageTitle: 'hsadminNgApp.membership.home.title'
},
canActivate: [UserRouteAccessService],
outlet: 'popup'
}
];

View File

@ -0,0 +1,82 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import * as moment from 'moment';
import { DATE_FORMAT } from 'app/shared/constants/input.constants';
import { map } from 'rxjs/operators';
import { SERVER_API_URL } from 'app/app.constants';
import { createRequestOption } from 'app/shared';
import { IMembership } from 'app/shared/model/membership.model';
type EntityResponseType = HttpResponse<IMembership>;
type EntityArrayResponseType = HttpResponse<IMembership[]>;
@Injectable({ providedIn: 'root' })
export class MembershipService {
public resourceUrl = SERVER_API_URL + 'api/memberships';
constructor(protected http: HttpClient) {}
create(membership: IMembership): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(membership);
return this.http
.post<IMembership>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
update(membership: IMembership): Observable<EntityResponseType> {
const copy = this.convertDateFromClient(membership);
return this.http
.put<IMembership>(this.resourceUrl, copy, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
find(id: number): Observable<EntityResponseType> {
return this.http
.get<IMembership>(`${this.resourceUrl}/${id}`, { observe: 'response' })
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
}
query(req?: any): Observable<EntityArrayResponseType> {
const options = createRequestOption(req);
return this.http
.get<IMembership[]>(this.resourceUrl, { params: options, observe: 'response' })
.pipe(map((res: EntityArrayResponseType) => this.convertDateArrayFromServer(res)));
}
delete(id: number): Observable<HttpResponse<any>> {
return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
}
protected convertDateFromClient(membership: IMembership): IMembership {
const copy: IMembership = Object.assign({}, membership, {
documentDate:
membership.documentDate != null && membership.documentDate.isValid() ? membership.documentDate.format(DATE_FORMAT) : null,
memberFrom: membership.memberFrom != null && membership.memberFrom.isValid() ? membership.memberFrom.format(DATE_FORMAT) : null,
memberUntil:
membership.memberUntil != null && membership.memberUntil.isValid() ? membership.memberUntil.format(DATE_FORMAT) : null
});
return copy;
}
protected convertDateFromServer(res: EntityResponseType): EntityResponseType {
if (res.body) {
res.body.documentDate = res.body.documentDate != null ? moment(res.body.documentDate) : null;
res.body.memberFrom = res.body.memberFrom != null ? moment(res.body.memberFrom) : null;
res.body.memberUntil = res.body.memberUntil != null ? moment(res.body.memberUntil) : null;
}
return res;
}
protected convertDateArrayFromServer(res: EntityArrayResponseType): EntityArrayResponseType {
if (res.body) {
res.body.forEach((membership: IMembership) => {
membership.documentDate = membership.documentDate != null ? moment(membership.documentDate) : null;
membership.memberFrom = membership.memberFrom != null ? moment(membership.memberFrom) : null;
membership.memberUntil = membership.memberUntil != null ? moment(membership.memberUntil) : null;
});
}
return res;
}
}

View File

@ -0,0 +1,6 @@
export * from './sepa-mandate.service';
export * from './sepa-mandate-update.component';
export * from './sepa-mandate-delete-dialog.component';
export * from './sepa-mandate-detail.component';
export * from './sepa-mandate.component';
export * from './sepa-mandate.route';

View File

@ -0,0 +1,19 @@
<form name="deleteForm" (ngSubmit)="confirmDelete(sepaMandate.id)">
<div class="modal-header">
<h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"
(click)="clear()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p id="jhi-delete-sepaMandate-heading" jhiTranslate="hsadminNgApp.sepaMandate.delete.question" [translateValues]="{id: sepaMandate.id}">Are you sure you want to delete this Sepa Mandate?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
<fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-sepaMandate" type="submit" class="btn btn-danger">
<fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,72 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
import { SepaMandateService } from './sepa-mandate.service';
@Component({
selector: 'jhi-sepa-mandate-delete-dialog',
templateUrl: './sepa-mandate-delete-dialog.component.html'
})
export class SepaMandateDeleteDialogComponent {
sepaMandate: ISepaMandate;
constructor(
protected sepaMandateService: SepaMandateService,
public activeModal: NgbActiveModal,
protected eventManager: JhiEventManager
) {}
clear() {
this.activeModal.dismiss('cancel');
}
confirmDelete(id: number) {
this.sepaMandateService.delete(id).subscribe(response => {
this.eventManager.broadcast({
name: 'sepaMandateListModification',
content: 'Deleted an sepaMandate'
});
this.activeModal.dismiss(true);
});
}
}
@Component({
selector: 'jhi-sepa-mandate-delete-popup',
template: ''
})
export class SepaMandateDeletePopupComponent implements OnInit, OnDestroy {
protected ngbModalRef: NgbModalRef;
constructor(protected activatedRoute: ActivatedRoute, protected router: Router, protected modalService: NgbModal) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ sepaMandate }) => {
setTimeout(() => {
this.ngbModalRef = this.modalService.open(SepaMandateDeleteDialogComponent as Component, {
size: 'lg',
backdrop: 'static'
});
this.ngbModalRef.componentInstance.sepaMandate = sepaMandate;
this.ngbModalRef.result.then(
result => {
this.router.navigate(['/sepa-mandate', { outlets: { popup: null } }]);
this.ngbModalRef = null;
},
reason => {
this.router.navigate(['/sepa-mandate', { outlets: { popup: null } }]);
this.ngbModalRef = null;
}
);
}, 0);
});
}
ngOnDestroy() {
this.ngbModalRef = null;
}
}

View File

@ -0,0 +1,65 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="sepaMandate">
<h2><span jhiTranslate="hsadminNgApp.sepaMandate.detail.title">Sepa Mandate</span> {{sepaMandate.id}}</h2>
<hr>
<jhi-alert-error></jhi-alert-error>
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.reference">Reference</span></dt>
<dd>
<span>{{sepaMandate.reference}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.iban">Iban</span></dt>
<dd>
<span>{{sepaMandate.iban}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.bic">Bic</span></dt>
<dd>
<span>{{sepaMandate.bic}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.documentDate">Document Date</span></dt>
<dd>
<span>{{sepaMandate.documentDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.validFrom">Valid From</span></dt>
<dd>
<span>{{sepaMandate.validFrom}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.validUntil">Valid Until</span></dt>
<dd>
<span>{{sepaMandate.validUntil}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.lastUsed">Last Used</span></dt>
<dd>
<span>{{sepaMandate.lastUsed}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.cancellationDate">Cancellation Date</span></dt>
<dd>
<span>{{sepaMandate.cancellationDate}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.remark">Remark</span></dt>
<dd>
<span>{{sepaMandate.remark}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.sepaMandate.customer">Customer</span></dt>
<dd>
<div *ngIf="sepaMandate.customerId">
<a [routerLink]="['/customer', sepaMandate.customerId, 'view']">{{sepaMandate.customerPrefix}}</a>
</div>
</dd>
</dl>
<button type="submit"
(click)="previousState()"
class="btn btn-info">
<fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
</button>
<button type="button"
[routerLink]="['/sepa-mandate', sepaMandate.id, 'edit']"
class="btn btn-primary">
<fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ISepaMandate } from 'app/shared/model/sepa-mandate.model';
@Component({
selector: 'jhi-sepa-mandate-detail',
templateUrl: './sepa-mandate-detail.component.html'
})
export class SepaMandateDetailComponent implements OnInit {
sepaMandate: ISepaMandate;
constructor(protected activatedRoute: ActivatedRoute) {}
ngOnInit() {
this.activatedRoute.data.subscribe(({ sepaMandate }) => {
this.sepaMandate = sepaMandate;
});
}
previousState() {
window.history.back();
}
}

Some files were not shown because too many files have changed in this diff Show More