galovics commented on code in PR #2664:
URL: https://github.com/apache/fineract/pull/2664#discussion_r994474501
##########
fineract-provider/src/main/java/org/apache/fineract/organisation/office/domain/Office.java:
##########
@@ -64,45 +73,16 @@ public class Office extends AbstractPersistableCustom
implements Serializable {
private String externalId;
public static Office headOffice(final String name, final LocalDate
openingDate, final String externalId) {
- return new Office(null, name, openingDate, externalId);
+ return new
Office().setName(StringUtils.trim(name)).setOpeningDate(openingDate).setExternalId(StringUtils.trim(externalId));
}
public static Office fromJson(final Office parentOffice, final JsonCommand
command) {
final String name = command.stringValueOfParameterNamed("name");
final LocalDate openingDate =
command.localDateValueOfParameterNamed("openingDate");
final String externalId =
command.stringValueOfParameterNamed("externalId");
- return new Office(parentOffice, name, openingDate, externalId);
- }
-
- protected Office() {
- this.openingDate = null;
- this.parent = null;
- this.name = null;
- this.externalId = null;
- }
-
- private Office(final Office parent, final String name, final LocalDate
openingDate, final String externalId) {
- this.parent = parent;
- this.openingDate = openingDate;
- if (parent != null) {
- this.parent.addChild(this);
- }
-
- if (StringUtils.isNotBlank(name)) {
- this.name = name.trim();
- } else {
- this.name = null;
- }
- if (StringUtils.isNotBlank(externalId)) {
- this.externalId = externalId.trim();
- } else {
- this.externalId = null;
- }
- }
-
- private void addChild(final Office office) {
- this.children.add(office);
+ return new
Office().setParent(parentOffice).setName(StringUtils.trim(name)).setOpeningDate(openingDate)
Review Comment:
Where is this from the constructor?
```
this.parent.addChild(this);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]