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 @@ -41,6 +41,7 @@ public class CommandWrapperBuilder {
private Long clientId;
private Long loanId;
private Long savingsId;
private Long centerId;
private String actionName;
private String entityName;
private Long entityId;
Expand Down Expand Up @@ -203,6 +204,11 @@ public CommandWrapperBuilder withClientId(final Long withClientId) {
return this;
}

public CommandWrapperBuilder withCenterId(final Long centerId) {
this.centerId = centerId;
return this;
}

public CommandWrapperBuilder withGroupId(final Long withGroupId) {
this.groupId = withGroupId;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum NoteType {
CLIENT(100, "noteType.client", "clients", "Client note"), //
LOAN(200, "noteType.loan", "loans", "Loan note"), //
LOAN_TRANSACTION(300, "noteType.loan.transaction", "loanTransactions", "Loan transaction note"), //
CENTER(400, "noteType.center", "centers", "Center note"), //
SAVING_ACCOUNT(500, "noteType.saving", "savings", " account note"), //
GROUP(600, "noteType.group", "groups", "Group note"), //
SHARE_ACCOUNT(700, "noteType.shares", "accounts/share", "Share account note"), //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class NotesApiResource {
public static final String LOANTRANSACTIONNOTE = "LOANTRANSACTIONNOTE";
public static final String SAVINGNOTE = "SAVINGNOTE";
public static final String GROUPNOTE = "GROUPNOTE";
public static final String CENTERNOTE = "CENTERNOTE";
public static final String INVALIDNOTE = "INVALIDNOTE";
private static final Set<String> NOTE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("id", "resourceId", "clientId", "groupId", "loanId", "loanTransactionId", "depositAccountId", "savingAccountId",
Expand Down Expand Up @@ -228,7 +229,11 @@ private CommandWrapper getResourceDetails(final NoteType type, final Long resour
resourceNameForPermissions = GROUPNOTE;
resourceDetails.withGroupId(resourceId);
}
default -> resourceNameForPermissions = INVALIDNOTE;
case CENTER -> {
resourceNameForPermissions = CENTERNOTE;
resourceDetails.withCenterId(resourceId);
}
default -> throw new NoteResourceNotSupportedException(type.name());
}
return resourceDetails.withEntityName(resourceNameForPermissions).build();
}
Expand Down