Skip to content

Commit 23c67f7

Browse files
authored
FINERACT-2288: New command processing - Staff (#5653)
1 parent 9dad940 commit 23c67f7

77 files changed

Lines changed: 1303 additions & 1277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,6 @@ public CommandWrapperBuilder withGroupId(final Long withGroupId) {
206206
return this;
207207
}
208208

209-
public CommandWrapperBuilder withEntityName(final String withEntityName) {
210-
this.entityName = withEntityName;
211-
return this;
212-
}
213-
214209
public CommandWrapperBuilder withSubEntityId(final Long withSubEntityId) {
215210
this.subentityId = withSubEntityId;
216211
return this;
@@ -332,22 +327,6 @@ public CommandWrapperBuilder deleteOfficeTransaction(final Long transactionId) {
332327
return this;
333328
}
334329

335-
public CommandWrapperBuilder createStaff() {
336-
this.actionName = "CREATE";
337-
this.entityName = "STAFF";
338-
this.entityId = null;
339-
this.href = "/staff/template";
340-
return this;
341-
}
342-
343-
public CommandWrapperBuilder updateStaff(final Long staffId) {
344-
this.actionName = "UPDATE";
345-
this.entityName = "STAFF";
346-
this.entityId = staffId;
347-
this.href = "/staff/" + staffId;
348-
return this;
349-
}
350-
351330
public CommandWrapperBuilder createGuarantor(final Long loanId) {
352331
this.actionName = "CREATE";
353332
this.entityName = "GUARANTOR";
@@ -1454,14 +1433,6 @@ public CommandWrapperBuilder defineOpeningBalanceForJournalEntry() {
14541433
return this;
14551434
}
14561435

1457-
public CommandWrapperBuilder updateOpeningBalanceForJournalEntry() {
1458-
this.actionName = "UPDATEOPENINGBALANCE";
1459-
this.entityName = "JOURNALENTRY";
1460-
this.entityId = null;
1461-
this.href = "/journalentries/update";
1462-
return this;
1463-
}
1464-
14651436
public CommandWrapperBuilder createSavingProduct() {
14661437
this.actionName = "CREATE";
14671438
this.entityName = "SAVINGSPRODUCT";
@@ -1848,57 +1819,6 @@ public CommandWrapperBuilder deleteRecurringDepositProduct(final Long productId)
18481819
return this;
18491820
}
18501821

1851-
public CommandWrapperBuilder createInterestRateChart() {
1852-
this.actionName = "CREATE";
1853-
this.entityName = "INTERESTRATECHART";
1854-
this.entityId = null;
1855-
this.href = "/interestratechart/template";
1856-
return this;
1857-
}
1858-
1859-
public CommandWrapperBuilder updateInterestRateChart(final Long interestRateChartId) {
1860-
this.actionName = "UPDATE";
1861-
this.entityName = "INTERESTRATECHART";
1862-
this.entityId = interestRateChartId;
1863-
this.href = "/interestratechart/" + interestRateChartId;
1864-
return this;
1865-
}
1866-
1867-
public CommandWrapperBuilder deleteInterestRateChart(final Long interestRateChartId) {
1868-
this.actionName = "DELETE";
1869-
this.entityName = "INTERESTRATECHART";
1870-
this.entityId = interestRateChartId;
1871-
this.href = "/interestratechart/" + interestRateChartId;
1872-
return this;
1873-
}
1874-
1875-
public CommandWrapperBuilder createInterestRateChartSlab(final Long chartId) {
1876-
this.actionName = "CREATE";
1877-
this.entityName = "CHARTSLAB";
1878-
this.entityId = null;
1879-
this.subentityId = chartId; // refer to chart id
1880-
this.href = "/interestratechart/" + chartId + "/chartdetails/template";
1881-
return this;
1882-
}
1883-
1884-
public CommandWrapperBuilder updateInterestRateChartSlab(final Long chartId, final Long chartSlabId) {
1885-
this.actionName = "UPDATE";
1886-
this.entityName = "CHARTSLAB";
1887-
this.entityId = chartSlabId;
1888-
this.subentityId = chartId;// refers parent chart
1889-
this.href = "/interestratechart/" + chartId + "/chartdetails/" + chartSlabId;
1890-
return this;
1891-
}
1892-
1893-
public CommandWrapperBuilder deleteInterestRateChartSlab(final Long chartId, final Long chartSlabId) {
1894-
this.actionName = "DELETE";
1895-
this.entityName = "CHARTSLAB";
1896-
this.entityId = chartSlabId;
1897-
this.subentityId = chartId;// refers parent chart
1898-
this.href = "/interestratechart/" + chartId + "/chartdetails/" + chartSlabId;
1899-
return this;
1900-
}
1901-
19021822
public CommandWrapperBuilder createCalendar(final CommandWrapper resourceDetails, final String supportedEntityType,
19031823
final Long supportedEntityId) {
19041824
this.actionName = "CREATE";
@@ -2109,14 +2029,6 @@ public CommandWrapperBuilder addClientCollateralProduct(final Long clientId) {
21092029
return this;
21102030
}
21112031

2112-
public CommandWrapperBuilder updateCollectionSheet(final Long groupId) {
2113-
this.actionName = "UPDATE";
2114-
this.entityName = "COLLECTIONSHEET";
2115-
this.entityId = groupId;
2116-
this.href = "/groups/" + groupId + "/collectionsheet";
2117-
return this;
2118-
}
2119-
21202032
public CommandWrapperBuilder createCenter() {
21212033
this.actionName = "CREATE";
21222034
this.entityName = "CENTER";
@@ -2756,15 +2668,6 @@ public CommandWrapperBuilder unassignSavingsOfficer(final Long accountId) {
27562668
return this;
27572669
}
27582670

2759-
public CommandWrapperBuilder savingsInterestPostingAsOnDate(final Long accountId) {
2760-
this.actionName = "POSTINTERESTASONDATE";
2761-
this.entityName = "SAVINGSACCOUNT";
2762-
this.savingsId = accountId;
2763-
this.entityId = null;
2764-
this.href = "/savingsaccounts/" + accountId + "?command=postInterestAsOn";
2765-
return this;
2766-
}
2767-
27682671
public CommandWrapperBuilder createLoanRescheduleRequest(final String entityName) {
27692672
this.actionName = "CREATE";
27702673
this.entityName = entityName;
@@ -3402,24 +3305,6 @@ public CommandWrapperBuilder unblockSavingsAccount(final Long accountId) {
34023305
return this;
34033306
}
34043307

3405-
public CommandWrapperBuilder disableAdHoc(Long adHocId) {
3406-
this.actionName = "DISABLE";
3407-
this.entityName = "ADHOC";
3408-
this.entityId = adHocId;
3409-
this.href = "/adhoc/" + adHocId + "/disbale";
3410-
this.json = "{}";
3411-
return this;
3412-
}
3413-
3414-
public CommandWrapperBuilder enableAdHoc(Long adHocId) {
3415-
this.actionName = "ENABLE";
3416-
this.entityName = "ADHOC";
3417-
this.entityId = adHocId;
3418-
this.href = "/adhoc/" + adHocId + "/enable";
3419-
this.json = "{}";
3420-
return this;
3421-
}
3422-
34233308
public CommandWrapperBuilder createAdHoc() {
34243309
this.actionName = "CREATE";
34253310
this.entityName = "ADHOC";

fineract-core/src/main/java/org/apache/fineract/organisation/staff/data/StaffData.java

Lines changed: 23 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -22,127 +22,35 @@
2222
import java.io.Serializable;
2323
import java.time.LocalDate;
2424
import java.util.Collection;
25-
import lombok.Getter;
25+
import lombok.AllArgsConstructor;
26+
import lombok.Builder;
27+
import lombok.Data;
28+
import lombok.NoArgsConstructor;
2629
import org.apache.fineract.organisation.office.data.OfficeData;
2730

28-
/**
29-
* Immutable data object representing staff data.
30-
*/
31-
@Getter
31+
@Builder
32+
@Data
33+
@NoArgsConstructor
34+
@AllArgsConstructor
3235
public final class StaffData implements Serializable {
3336

3437
@Serial
3538
private static final long serialVersionUID = 1L;
3639

37-
private final Long id;
38-
private final String externalId;
39-
private final String firstname;
40-
private final String lastname;
41-
private final String displayName;
42-
private final String mobileNo;
43-
private final Long officeId;
44-
private final String officeName;
45-
private final Boolean isLoanOfficer;
46-
private final Boolean isActive;
47-
private final LocalDate joiningDate;
48-
49-
// import fields
50-
private transient Integer rowIndex;
51-
private String dateFormat;
40+
private Long id;
41+
private String externalId;
42+
private String firstname;
43+
private String lastname;
44+
private String displayName;
45+
private String mobileNo;
46+
private Long officeId;
47+
private String officeName;
48+
private Boolean isLoanOfficer;
49+
private Boolean isActive;
50+
private LocalDate joiningDate;
51+
private Integer rowIndex;
52+
@Builder.Default
53+
private String dateFormat = "dd MMMM yyyy";
5254
private String locale;
53-
54-
public static StaffData importInstance(String externalId, String firstname, String lastname, String mobileNo, Long officeId,
55-
Boolean isLoanOfficer, Boolean isActive, LocalDate joinedOnDate, Integer rowIndex, String locale, String dateFormat) {
56-
return new StaffData(externalId, firstname, lastname, mobileNo, officeId, isLoanOfficer, isActive, joinedOnDate, rowIndex, locale,
57-
dateFormat);
58-
59-
}
60-
61-
private StaffData(String externalId, String firstname, String lastname, String mobileNo, Long officeId, Boolean isLoanOfficer,
62-
Boolean isActive, LocalDate joiningDate, Integer rowIndex, String locale, String dateFormat) {
63-
64-
this.externalId = externalId;
65-
this.firstname = firstname;
66-
this.lastname = lastname;
67-
this.mobileNo = mobileNo;
68-
this.officeId = officeId;
69-
this.isLoanOfficer = isLoanOfficer;
70-
this.isActive = isActive;
71-
this.joiningDate = joiningDate;
72-
this.rowIndex = rowIndex;
73-
this.dateFormat = dateFormat;
74-
this.locale = locale;
75-
this.allowedOffices = null;
76-
this.id = null;
77-
this.officeName = null;
78-
this.displayName = null;
79-
}
80-
81-
public Integer getRowIndex() {
82-
return rowIndex;
83-
}
84-
85-
@SuppressWarnings("unused")
86-
private final Collection<OfficeData> allowedOffices;
87-
88-
public static StaffData templateData(final StaffData staff, final Collection<OfficeData> allowedOffices) {
89-
return new StaffData(staff.id, staff.firstname, staff.lastname, staff.displayName, staff.officeId, staff.officeName,
90-
staff.isLoanOfficer, staff.externalId, staff.mobileNo, allowedOffices, staff.isActive, staff.joiningDate);
91-
}
92-
93-
public static StaffData lookup(final Long id, final String displayName) {
94-
return new StaffData(id, null, null, displayName, null, null, null, null, null, null, null, null);
95-
}
96-
97-
public static StaffData instance(final Long id, final String firstname, final String lastname, final String displayName,
98-
final Long officeId, final String officeName, final Boolean isLoanOfficer, final String externalId, final String mobileNo,
99-
final boolean isActive, final LocalDate joiningDate) {
100-
return new StaffData(id, firstname, lastname, displayName, officeId, officeName, isLoanOfficer, externalId, mobileNo, null,
101-
isActive, joiningDate);
102-
}
103-
104-
private StaffData(final Long id, final String firstname, final String lastname, final String displayName, final Long officeId,
105-
final String officeName, final Boolean isLoanOfficer, final String externalId, final String mobileNo,
106-
final Collection<OfficeData> allowedOffices, final Boolean isActive, final LocalDate joiningDate) {
107-
this.id = id;
108-
this.firstname = firstname;
109-
this.lastname = lastname;
110-
this.displayName = displayName;
111-
this.officeName = officeName;
112-
this.isLoanOfficer = isLoanOfficer;
113-
this.externalId = externalId;
114-
this.officeId = officeId;
115-
this.mobileNo = mobileNo;
116-
this.allowedOffices = allowedOffices;
117-
this.isActive = isActive;
118-
this.joiningDate = joiningDate;
119-
}
120-
121-
public Long getId() {
122-
return this.id;
123-
}
124-
125-
public String getDisplayName() {
126-
return this.displayName;
127-
}
128-
129-
public String getFirstname() {
130-
return this.firstname;
131-
}
132-
133-
public String getLastname() {
134-
return this.lastname;
135-
}
136-
137-
public String getOfficeName() {
138-
return this.officeName;
139-
}
140-
141-
public LocalDate getJoiningDate() {
142-
return this.joiningDate;
143-
}
144-
145-
public Long getOfficeId() {
146-
return this.officeId;
147-
}
55+
private Collection<OfficeData> allowedOffices;
14856
}

0 commit comments

Comments
 (0)