Refactoring

This commit is contained in:
Nicolas Héron 2018-09-14 15:24:06 +02:00
commit 6515138a1b
7 changed files with 28 additions and 61 deletions

View file

@ -9,5 +9,8 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.4.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.4.0" level="project" />
</component> </component>
</module> </module>

View file

@ -1,55 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.training.leisure.swimmingpool;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* Date: 12/09/14
* Time: 11:57
* To change this template use File | Settings | File Templates.
*/
public class BaseElement {
private List<CalculatedAttribute> calculatedAttributeList = new ArrayList<>();
public BaseElement() {
}
public List<CalculatedAttribute> getCalculatedAttributeList() {
return calculatedAttributeList;
}
public void setCalculatedAttributeList(List<CalculatedAttribute> calculatedAttributeList) {
this.calculatedAttributeList = calculatedAttributeList;
}
public void addCalculatedElement(CalculatedAttribute calculatedAttribute) {
this.calculatedAttributeList.add(calculatedAttribute);
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("BaseElement{");
sb.append("calculatedAttributeList=").append(calculatedAttributeList);
sb.append('}');
return sb.toString();
}
}

View file

@ -33,7 +33,7 @@ public class CalculatedAttribute {
private BigDecimal bigDecimalValue; private BigDecimal bigDecimalValue;
private Integer integerValue; private Integer integerValue;
@JsonIgnore @JsonIgnore
private BaseElement father; private Person father;
public CalculatedAttribute() { public CalculatedAttribute() {
} }
@ -86,11 +86,11 @@ public class CalculatedAttribute {
this.integerValue = integerValue; this.integerValue = integerValue;
} }
public BaseElement getFather() { public Person getFather() {
return father; return father;
} }
public void setFather(BaseElement father) { public void setFather(Person father) {
this.father = father; this.father = father;
} }

View file

@ -18,7 +18,7 @@ package org.training.leisure.swimmingpool;
import java.util.Date; import java.util.Date;
public class Period extends BaseElement { public class Period {
private Date desidedStartDate; private Date desidedStartDate;
private String seasonType; private String seasonType;

View file

@ -20,7 +20,7 @@ import java.util.List;
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
public class Person extends BaseElement { public class Person {
private String name; private String name;
private String surname; private String surname;
private String gender; private String gender;
@ -28,6 +28,7 @@ public class Person extends BaseElement {
private List<Price> priceList = new ArrayList<>(); private List<Price> priceList = new ArrayList<>();
private double age; private double age;
private BigDecimal standardPrice; private BigDecimal standardPrice;
private List<CalculatedAttribute> calculatedAttributeList = new ArrayList<>();
public Person() { public Person() {
@ -93,6 +94,13 @@ public class Person extends BaseElement {
this.standardPrice = standardPrice; this.standardPrice = standardPrice;
} }
public List<CalculatedAttribute> getCalculatedAttributeList() {
return calculatedAttributeList;
}
public void setCalculatedAttributeList(List<CalculatedAttribute> calculatedAttributeList) {
this.calculatedAttributeList = calculatedAttributeList;
}
@Override @Override
public String toString() { public String toString() {

View file

@ -26,6 +26,9 @@ public class Price {
private String priceType; private String priceType;
@JsonIgnore @JsonIgnore
private Person person; private Person person;
@JsonIgnore
private Quote quote;
public Price() { public Price() {
} }
@ -61,6 +64,14 @@ public class Price {
this.person = person; this.person = person;
} }
public Quote getQuote() {
return quote;
}
public void setQuote(Quote quote) {
this.quote = quote;
}
@Override @Override
public String toString() { public String toString() {
final StringBuffer sb = new StringBuffer("Price{"); final StringBuffer sb = new StringBuffer("Price{");

View file

@ -21,7 +21,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
@XmlRootElement @XmlRootElement
public class Quote extends BaseElement { public class Quote {
private Date quoteDate; private Date quoteDate;
private Date validUntil; private Date validUntil;
private Period period; private Period period;