Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_APPROVALUNDO;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_APPROVE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_APPROVE_DIVIDEND;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_ASSIGNROLE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_ASSIGNSTAFF;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_ASSOCIATECLIENTS;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_ASSOCIATEGROUPS;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_ATTACH;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_BLOCK;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_BLOCKCREDIT;
Expand Down Expand Up @@ -67,8 +64,6 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DEPOSIT;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DETACH;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISABLE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISASSOCIATECLIENTS;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISASSOCIATEGROUPS;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISBURSALLASTUNDO;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISBURSALUNDO;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_DISBURSE;
Expand Down Expand Up @@ -117,11 +112,8 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_REVERSETRANSACTION;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_SALE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_SAVE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_SAVECOLLECTIONSHEET;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_SETFRAUD;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_SETTLECASHFROMCASHIER;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_TRANSFERCLIENTS;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UNASSIGNROLE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UNASSIGNSTAFF;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UNBLOCK;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UNBLOCKCREDIT;
Expand All @@ -140,7 +132,6 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATECASHIERALLOCATION;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATEDELINQUENCY;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATELOANOFFICER;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATEROLE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATERUNNINGBALANCE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATESAVINGSACCOUNT;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ACTION_UPDATESAVINGSOFFICER;
Expand All @@ -159,7 +150,6 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_ASSET_OWNER_TRANSACTION;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_BATCH_BUSINESS_STEP;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_CALENDAR;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_CENTER;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_CHARGE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_CLIENT;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_CLIENTIDENTIFIER;
Expand Down Expand Up @@ -193,7 +183,6 @@
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GLACCOUNT;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GLCLOSURE;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GLIMLOAN;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GROUP;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GSIMACCOUNT;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_GUARANTOR;
import static org.apache.fineract.commands.domain.CommandWrapperConstants.ENTITY_HOLIDAY;
Expand Down Expand Up @@ -2271,110 +2260,13 @@ public CommandWrapperBuilder deleteCalendar(final String supportedEntityType, fi
return this;
}

public CommandWrapperBuilder createGroup() {
this.actionName = ACTION_CREATE;
this.entityName = ENTITY_GROUP;
this.href = "/groups/template";
return this;
}

public CommandWrapperBuilder updateGroup(final Long groupId) {
this.actionName = ACTION_UPDATE;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId;
return this;
}

public CommandWrapperBuilder activateGroup(final Long groupId) {
this.actionName = ACTION_ACTIVATE;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=activate";
return this;
}

public CommandWrapperBuilder saveGroupCollectionSheet(final Long groupId) {
this.actionName = ACTION_SAVECOLLECTIONSHEET;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=saveCollectionSheet";
return this;
}

public CommandWrapperBuilder saveIndividualCollectionSheet() {
this.actionName = ACTION_SAVE;
this.entityName = ENTITY_COLLECTIONSHEET;
this.href = "/collectionsheet?command=saveCollectionSheet";
return this;
}

public CommandWrapperBuilder deleteGroup(final Long groupId) {
this.actionName = ACTION_DELETE;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId;
return this;
}

public CommandWrapperBuilder associateClientsToGroup(final Long groupId) {
this.actionName = ACTION_ASSOCIATECLIENTS;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=associateClients";
return this;
}

public CommandWrapperBuilder disassociateClientsFromGroup(final Long groupId) {
this.actionName = ACTION_DISASSOCIATECLIENTS;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=disassociateClients";
return this;
}

public CommandWrapperBuilder transferClientsBetweenGroups(final Long sourceGroupId) {
this.actionName = ACTION_TRANSFERCLIENTS;
this.entityName = ENTITY_GROUP;
this.entityId = sourceGroupId;
this.groupId = sourceGroupId;
this.href = "/groups/" + sourceGroupId + "?command=transferClients";
return this;
}

public CommandWrapperBuilder unassignGroupStaff(final Long groupId) {
this.actionName = ACTION_UNASSIGNSTAFF;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId;
return this;
}

public CommandWrapperBuilder assignGroupStaff(final Long groupId) {
this.actionName = ACTION_ASSIGNSTAFF;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=assignStaff";
return this;
}

public CommandWrapperBuilder closeGroup(final Long groupId) {
this.actionName = ACTION_CLOSE;
this.entityName = ENTITY_GROUP;
this.entityId = groupId;
this.groupId = groupId;
this.href = "/groups/" + groupId + "?command=close";
return this;
}

public CommandWrapperBuilder createCollateral(final Long loanId) {
this.actionName = ACTION_CREATE;
this.entityName = ENTITY_COLLATERAL;
Expand Down Expand Up @@ -2437,74 +2329,6 @@ public CommandWrapperBuilder addClientCollateralProduct(final Long clientId) {
return this;
}

public CommandWrapperBuilder createCenter() {
this.actionName = ACTION_CREATE;
this.entityName = ENTITY_CENTER;
this.href = "/centers/template";
return this;
}

public CommandWrapperBuilder updateCenter(final Long centerId) {
this.actionName = ACTION_UPDATE;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.href = "/centers/" + centerId;
return this;
}

public CommandWrapperBuilder deleteCenter(final Long centerId) {
this.actionName = ACTION_DELETE;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.href = "/centers/" + centerId;
return this;
}

public CommandWrapperBuilder activateCenter(final Long centerId) {
this.actionName = ACTION_ACTIVATE;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.groupId = centerId;
this.href = "/centers/" + centerId + "?command=activate";
return this;
}

public CommandWrapperBuilder saveCenterCollectionSheet(final Long centerId) {
this.actionName = ACTION_SAVECOLLECTIONSHEET;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.groupId = centerId;
this.href = "/centers/" + centerId + "?command=saveCollectionSheet";
return this;
}

public CommandWrapperBuilder closeCenter(final Long centerId) {
this.actionName = ACTION_CLOSE;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.groupId = centerId;
this.href = "/centers/" + centerId + "?command=close";
return this;
}

public CommandWrapperBuilder associateGroupsToCenter(final Long centerId) {
this.actionName = ACTION_ASSOCIATEGROUPS;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.groupId = centerId;
this.href = "/groups/" + centerId + "?command=associateGroups";
return this;
}

public CommandWrapperBuilder disassociateGroupsFromCenter(final Long centerId) {
this.actionName = ACTION_DISASSOCIATEGROUPS;
this.entityName = ENTITY_CENTER;
this.entityId = centerId;
this.groupId = centerId;
this.href = "/groups/" + centerId + "?command=disassociateGroups";
return this;
}

public CommandWrapperBuilder createAccountingRule() {
this.actionName = ACTION_CREATE;
this.entityName = ENTITY_ACCOUNTINGRULE;
Expand Down Expand Up @@ -2561,33 +2385,6 @@ public CommandWrapperBuilder deleteHoliday(final Long holidayId) {
return this;
}

public CommandWrapperBuilder assignRole(final Long groupId) {
this.actionName = ACTION_ASSIGNROLE;
this.entityName = ENTITY_GROUP;
this.groupId = groupId;
this.entityId = null;
this.href = "/groups/" + groupId + "?command=assignRole";
return this;
}

public CommandWrapperBuilder unassignRole(final Long groupId, final Long roleId) {
this.actionName = ACTION_UNASSIGNROLE;
this.entityName = ENTITY_GROUP;
this.groupId = groupId;
this.entityId = roleId;
this.href = "/groups/" + groupId + "?command=unassignRole";
return this;
}

public CommandWrapperBuilder updateRole(final Long groupId, final Long roleId) {
this.actionName = ACTION_UPDATEROLE;
this.entityName = ENTITY_GROUP;
this.groupId = groupId;
this.entityId = roleId;
this.href = "/groups/" + groupId + "?command=updateRole";
return this;
}

public CommandWrapperBuilder unassignClientStaff(final Long clientId) {
this.actionName = ACTION_UNASSIGNSTAFF;
this.entityName = ENTITY_CLIENT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import lombok.Getter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
Expand All @@ -35,6 +36,7 @@
/**
* Immutable data object representing groups.
*/
@Getter
public final class CenterData implements Serializable {

private final Long id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.codes.domain.CodeValue;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
Expand Down Expand Up @@ -281,67 +278,6 @@
return GroupingTypeStatus.fromInt(this.status).isPending();
}

public Map<String, Object> update(final JsonCommand command) {
final Map<String, Object> actualChanges = new LinkedHashMap<>(9);

if (command.isChangeInIntegerParameterNamed(GroupingTypesApiConstants.statusParamName, this.status)) {
final Integer newValue = command.integerValueOfParameterNamed(GroupingTypesApiConstants.statusParamName);
actualChanges.put(GroupingTypesApiConstants.statusParamName, GroupingTypeEnumerations.status(newValue));
this.status = GroupingTypeStatus.fromInt(newValue).getValue();
}

if (command.isChangeInStringParameterNamed(GroupingTypesApiConstants.externalIdParamName, this.externalId)) {
final String newValue = command.stringValueOfParameterNamed(GroupingTypesApiConstants.externalIdParamName);
actualChanges.put(GroupingTypesApiConstants.externalIdParamName, newValue);
this.externalId = StringUtils.defaultIfEmpty(newValue, null);
}

if (command.isChangeInLongParameterNamed(GroupingTypesApiConstants.officeIdParamName, this.office.getId())) {
final Long newValue = command.longValueOfParameterNamed(GroupingTypesApiConstants.officeIdParamName);
actualChanges.put(GroupingTypesApiConstants.officeIdParamName, newValue);
}

if (command.isChangeInLongParameterNamed(GroupingTypesApiConstants.staffIdParamName, staffId())) {
final Long newValue = command.longValueOfParameterNamed(GroupingTypesApiConstants.staffIdParamName);
actualChanges.put(GroupingTypesApiConstants.staffIdParamName, newValue);
}

if (command.isChangeInStringParameterNamed(GroupingTypesApiConstants.nameParamName, this.name)) {
final String newValue = command.stringValueOfParameterNamed(GroupingTypesApiConstants.nameParamName);
actualChanges.put(GroupingTypesApiConstants.nameParamName, newValue);
this.name = StringUtils.defaultIfEmpty(newValue, null);
}

final String dateFormatAsInput = command.dateFormat();
final String localeAsInput = command.locale();

if (command.isChangeInLocalDateParameterNamed(GroupingTypesApiConstants.activationDateParamName, getActivationDate())) {
final String valueAsInput = command.stringValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
actualChanges.put(GroupingTypesApiConstants.activationDateParamName, valueAsInput);
actualChanges.put(GroupingTypesApiConstants.dateFormatParamName, dateFormatAsInput);
actualChanges.put(GroupingTypesApiConstants.localeParamName, localeAsInput);

this.activationDate = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
}

if (command.isChangeInStringParameterNamed(GroupingTypesApiConstants.accountNoParamName, this.accountNumber)) {
final String newValue = command.stringValueOfParameterNamed(GroupingTypesApiConstants.accountNoParamName);
actualChanges.put(GroupingTypesApiConstants.accountNoParamName, newValue);
this.accountNumber = StringUtils.defaultIfEmpty(newValue, null);
}

if (command.isChangeInLocalDateParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName, getSubmittedOnDate())) {
final String valueAsInput = command.stringValueOfParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName);
actualChanges.put(GroupingTypesApiConstants.submittedOnDateParamName, valueAsInput);
actualChanges.put(GroupingTypesApiConstants.dateFormatParamName, dateFormatAsInput);
actualChanges.put(GroupingTypesApiConstants.localeParamName, localeAsInput);

this.submittedOnDate = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.submittedOnDateParamName);
}

return actualChanges;
}

public List<String> associateClients(final Set<Client> clientMembersSet) {
final List<String> differences = new ArrayList<>();
for (final Client client : clientMembersSet) {
Expand Down Expand Up @@ -401,7 +337,7 @@
return this.office.getId();
}

private Long staffId() {

Check failure on line 340 in fineract-core/src/main/java/org/apache/fineract/portfolio/group/domain/Group.java

View workflow job for this annotation

GitHub Actions / build-core / build-core

[UnusedMethod] Method 'staffId' is never used.
Long staffId = null;
if (this.staff != null) {
staffId = this.staff.getId();
Expand Down
Loading
Loading