diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java index ca74c2e2e..fff8c5410 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java @@ -2,11 +2,8 @@ package org.mifosplatform.integrationtests.common; import static com.jayway.restassured.RestAssured.given; import static com.jayway.restassured.path.json.JsonPath.from; -import static org.junit.Assert.assertThat; -import static org.hamcrest.Matchers.*; import static org.junit.Assert.fail; -import org.apache.commons.lang.StringUtils; import org.apache.http.conn.HttpHostConnectException; import com.jayway.restassured.RestAssured; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java index 093db0a7a..15256020e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandSource.java @@ -25,175 +25,162 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_portfolio_command_source") public class CommandSource extends AbstractPersistable { - @Column(name = "action_name", nullable = true, length = 100) - private String actionName; + @Column(name = "action_name", nullable = true, length = 100) + private String actionName; - @Column(name = "entity_name", nullable = true, length = 100) - private String entityName; + @Column(name = "entity_name", nullable = true, length = 100) + private String entityName; - @SuppressWarnings("unused") - @Column(name = "office_id") - private Long officeId; + @SuppressWarnings("unused") + @Column(name = "office_id") + private Long officeId; - @SuppressWarnings("unused") - @Column(name = "group_id") - private Long groupId; + @SuppressWarnings("unused") + @Column(name = "group_id") + private Long groupId; - @SuppressWarnings("unused") - @Column(name = "client_id") - private Long clientId; + @SuppressWarnings("unused") + @Column(name = "client_id") + private Long clientId; - @SuppressWarnings("unused") - @Column(name = "loan_id") - private Long loanId; + @SuppressWarnings("unused") + @Column(name = "loan_id") + private Long loanId; - @SuppressWarnings("unused") - @Column(name = "savings_account_id") - private Long savingsId; + @SuppressWarnings("unused") + @Column(name = "savings_account_id") + private Long savingsId; - @Column(name = "api_get_url", length = 100) - private String resourceGetUrl; + @Column(name = "api_get_url", length = 100) + private String resourceGetUrl; - @Column(name = "resource_id") - private Long resourceId; + @Column(name = "resource_id") + private Long resourceId; - @Column(name = "subresource_id") - private Long subresourceId; + @Column(name = "subresource_id") + private Long subresourceId; - @Column(name = "command_as_json", length = 1000) - private String commandAsJson; + @Column(name = "command_as_json", length = 1000) + private String commandAsJson; - @SuppressWarnings("unused") - @ManyToOne - @JoinColumn(name = "maker_id", nullable = false) - private AppUser maker; + @SuppressWarnings("unused") + @ManyToOne + @JoinColumn(name = "maker_id", nullable = false) + private AppUser maker; - @SuppressWarnings("unused") - @Column(name = "made_on_date", nullable = false) - @Temporal(TemporalType.TIMESTAMP) - private Date madeOnDate; + @SuppressWarnings("unused") + @Column(name = "made_on_date", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date madeOnDate; - @SuppressWarnings("unused") - @ManyToOne - @JoinColumn(name = "checker_id", nullable = true) - private AppUser checker; + @SuppressWarnings("unused") + @ManyToOne + @JoinColumn(name = "checker_id", nullable = true) + private AppUser checker; - @SuppressWarnings("unused") - @Column(name = "checked_on_date", nullable = true) - @Temporal(TemporalType.TIMESTAMP) - private Date checkedOnDate; + @SuppressWarnings("unused") + @Column(name = "checked_on_date", nullable = true) + @Temporal(TemporalType.TIMESTAMP) + private Date checkedOnDate; - @SuppressWarnings("unused") - @Column(name = "processing_result_enum", nullable = false) - private Integer processingResult; + @Column(name = "processing_result_enum", nullable = false) + private Integer processingResult; - public static CommandSource fullEntryFrom(final CommandWrapper wrapper, - final JsonCommand command, final AppUser maker) { - return new CommandSource(wrapper.actionName(), wrapper.entityName(), - wrapper.getHref(), command.entityId(), command.subentityId(), - command.json(), maker, DateTime.now()); - } + public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) { + return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(), + command.json(), maker, DateTime.now()); + } - protected CommandSource() { - // - } + protected CommandSource() { + // + } - private CommandSource(final String actionName, final String entityName, - final String href, final Long resourceId, final Long subresourceId, - final String commandSerializedAsJson, final AppUser maker, - final DateTime madeOnDateTime) { - this.actionName = actionName; - this.entityName = entityName; - this.resourceGetUrl = href; - this.resourceId = resourceId; - this.subresourceId = subresourceId; - this.commandAsJson = commandSerializedAsJson; - this.maker = maker; - this.madeOnDate = madeOnDateTime.toDate(); - this.processingResult = CommandProcessingResultType.PROCESSED - .getValue(); - } + private CommandSource(final String actionName, final String entityName, final String href, final Long resourceId, + final Long subresourceId, final String commandSerializedAsJson, final AppUser maker, final DateTime madeOnDateTime) { + this.actionName = actionName; + this.entityName = entityName; + this.resourceGetUrl = href; + this.resourceId = resourceId; + this.subresourceId = subresourceId; + this.commandAsJson = commandSerializedAsJson; + this.maker = maker; + this.madeOnDate = madeOnDateTime.toDate(); + this.processingResult = CommandProcessingResultType.PROCESSED.getValue(); + } - public void markAsChecked(final AppUser checker, - final DateTime checkedOnDate) { - this.checker = checker; - this.checkedOnDate = checkedOnDate.toDate(); - this.processingResult = CommandProcessingResultType.PROCESSED - .getValue(); - } + public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) { + this.checker = checker; + this.checkedOnDate = checkedOnDate.toDate(); + this.processingResult = CommandProcessingResultType.PROCESSED.getValue(); + } - public void updateResourceId(final Long resourceId) { - this.resourceId = resourceId; - } + public void updateResourceId(final Long resourceId) { + this.resourceId = resourceId; + } - public void updateSubresourceId(final Long subresourceId) { - this.subresourceId = subresourceId; - } + public void updateSubresourceId(final Long subresourceId) { + this.subresourceId = subresourceId; + } - public void updateJsonTo(final String json) { - this.commandAsJson = json; - } + public void updateJsonTo(final String json) { + this.commandAsJson = json; + } - public Long resourceId() { - return this.resourceId; - } + public Long resourceId() { + return this.resourceId; + } - public Long subresourceId() { - return this.subresourceId; - } + public Long subresourceId() { + return this.subresourceId; + } - public boolean hasJson() { - return StringUtils.isNotBlank(this.commandAsJson); - } + public boolean hasJson() { + return StringUtils.isNotBlank(this.commandAsJson); + } - public String json() { - return this.commandAsJson; - } + public String json() { + return this.commandAsJson; + } - public String getActionName() { - return this.actionName; - } + public String getActionName() { + return this.actionName; + } - public String getEntityName() { - return this.entityName; - } + public String getEntityName() { + return this.entityName; + } - public String getPermissionCode() { - return this.actionName + "_" + this.entityName; - } + public String getPermissionCode() { + return this.actionName + "_" + this.entityName; + } - public Long getResourceId() { - return this.resourceId; - } + public Long getResourceId() { + return this.resourceId; + } - public Long getSubresourceId() { - return this.subresourceId; - } + public Long getSubresourceId() { + return this.subresourceId; + } - public void markAsAwaitingApproval() { - this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL - .getValue(); - } + public void markAsAwaitingApproval() { + this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL.getValue(); + } - public boolean isMarkedAsAwaitingApproval() { - if (this.processingResult - .equals(CommandProcessingResultType.AWAITING_APPROVAL - .getValue())) - return true; + public boolean isMarkedAsAwaitingApproval() { + if (this.processingResult.equals(CommandProcessingResultType.AWAITING_APPROVAL.getValue())) return true; - return false; - } + return false; + } - public void updateForAudit(final Long officeId, final Long groupId, - final Long clientId, final Long loanId, final Long savingsId) { - this.officeId = officeId; - this.groupId = groupId; - this.clientId = clientId; - this.loanId = loanId; - this.savingsId = savingsId; - } + public void updateForAudit(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) { + this.officeId = officeId; + this.groupId = groupId; + this.clientId = clientId; + this.loanId = loanId; + this.savingsId = savingsId; + } - public String getResourceGetUrl() { - return this.resourceGetUrl; - } + public String getResourceGetUrl() { + return this.resourceGetUrl; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java index 658ee7503..b03c6451b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/domain/CommandWrapper.java @@ -468,7 +468,7 @@ public class CommandWrapper { return this.entityName.equalsIgnoreCase("GROUP"); } - public boolean isCollectionSheetResource(){ + public boolean isCollectionSheetResource() { return this.entityName.equals("COLLECTIONSHEET"); }