remove unused import warnings.

This commit is contained in:
Keith Woodlock
2013-04-05 22:31:07 +01:00
parent 9011f5568c
commit 87ee45a592
3 changed files with 123 additions and 139 deletions
@@ -2,11 +2,8 @@ package org.mifosplatform.integrationtests.common;
import static com.jayway.restassured.RestAssured.given; import static com.jayway.restassured.RestAssured.given;
import static com.jayway.restassured.path.json.JsonPath.from; 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 static org.junit.Assert.fail;
import org.apache.commons.lang.StringUtils;
import org.apache.http.conn.HttpHostConnectException; import org.apache.http.conn.HttpHostConnectException;
import com.jayway.restassured.RestAssured; import com.jayway.restassured.RestAssured;
@@ -25,175 +25,162 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
@Table(name = "m_portfolio_command_source") @Table(name = "m_portfolio_command_source")
public class CommandSource extends AbstractPersistable<Long> { public class CommandSource extends AbstractPersistable<Long> {
@Column(name = "action_name", nullable = true, length = 100) @Column(name = "action_name", nullable = true, length = 100)
private String actionName; private String actionName;
@Column(name = "entity_name", nullable = true, length = 100) @Column(name = "entity_name", nullable = true, length = 100)
private String entityName; private String entityName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "office_id") @Column(name = "office_id")
private Long officeId; private Long officeId;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "group_id") @Column(name = "group_id")
private Long groupId; private Long groupId;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "client_id") @Column(name = "client_id")
private Long clientId; private Long clientId;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "loan_id") @Column(name = "loan_id")
private Long loanId; private Long loanId;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "savings_account_id") @Column(name = "savings_account_id")
private Long savingsId; private Long savingsId;
@Column(name = "api_get_url", length = 100) @Column(name = "api_get_url", length = 100)
private String resourceGetUrl; private String resourceGetUrl;
@Column(name = "resource_id") @Column(name = "resource_id")
private Long resourceId; private Long resourceId;
@Column(name = "subresource_id") @Column(name = "subresource_id")
private Long subresourceId; private Long subresourceId;
@Column(name = "command_as_json", length = 1000) @Column(name = "command_as_json", length = 1000)
private String commandAsJson; private String commandAsJson;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "maker_id", nullable = false) @JoinColumn(name = "maker_id", nullable = false)
private AppUser maker; private AppUser maker;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "made_on_date", nullable = false) @Column(name = "made_on_date", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date madeOnDate; private Date madeOnDate;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "checker_id", nullable = true) @JoinColumn(name = "checker_id", nullable = true)
private AppUser checker; private AppUser checker;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "checked_on_date", nullable = true) @Column(name = "checked_on_date", nullable = true)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date checkedOnDate; private Date checkedOnDate;
@SuppressWarnings("unused") @Column(name = "processing_result_enum", nullable = false)
@Column(name = "processing_result_enum", nullable = false) private Integer processingResult;
private Integer processingResult;
public static CommandSource fullEntryFrom(final CommandWrapper wrapper, public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) {
final JsonCommand command, final AppUser maker) { return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(),
return new CommandSource(wrapper.actionName(), wrapper.entityName(), command.json(), maker, DateTime.now());
wrapper.getHref(), command.entityId(), command.subentityId(), }
command.json(), maker, DateTime.now());
}
protected CommandSource() { protected CommandSource() {
// //
} }
private CommandSource(final String actionName, final String entityName, private CommandSource(final String actionName, final String entityName, final String href, final Long resourceId,
final String href, final Long resourceId, final Long subresourceId, final Long subresourceId, final String commandSerializedAsJson, final AppUser maker, final DateTime madeOnDateTime) {
final String commandSerializedAsJson, final AppUser maker, this.actionName = actionName;
final DateTime madeOnDateTime) { this.entityName = entityName;
this.actionName = actionName; this.resourceGetUrl = href;
this.entityName = entityName; this.resourceId = resourceId;
this.resourceGetUrl = href; this.subresourceId = subresourceId;
this.resourceId = resourceId; this.commandAsJson = commandSerializedAsJson;
this.subresourceId = subresourceId; this.maker = maker;
this.commandAsJson = commandSerializedAsJson; this.madeOnDate = madeOnDateTime.toDate();
this.maker = maker; this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
this.madeOnDate = madeOnDateTime.toDate(); }
this.processingResult = CommandProcessingResultType.PROCESSED
.getValue();
}
public void markAsChecked(final AppUser checker, public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) {
final DateTime checkedOnDate) { this.checker = checker;
this.checker = checker; this.checkedOnDate = checkedOnDate.toDate();
this.checkedOnDate = checkedOnDate.toDate(); this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
this.processingResult = CommandProcessingResultType.PROCESSED }
.getValue();
}
public void updateResourceId(final Long resourceId) { public void updateResourceId(final Long resourceId) {
this.resourceId = resourceId; this.resourceId = resourceId;
} }
public void updateSubresourceId(final Long subresourceId) { public void updateSubresourceId(final Long subresourceId) {
this.subresourceId = subresourceId; this.subresourceId = subresourceId;
} }
public void updateJsonTo(final String json) { public void updateJsonTo(final String json) {
this.commandAsJson = json; this.commandAsJson = json;
} }
public Long resourceId() { public Long resourceId() {
return this.resourceId; return this.resourceId;
} }
public Long subresourceId() { public Long subresourceId() {
return this.subresourceId; return this.subresourceId;
} }
public boolean hasJson() { public boolean hasJson() {
return StringUtils.isNotBlank(this.commandAsJson); return StringUtils.isNotBlank(this.commandAsJson);
} }
public String json() { public String json() {
return this.commandAsJson; return this.commandAsJson;
} }
public String getActionName() { public String getActionName() {
return this.actionName; return this.actionName;
} }
public String getEntityName() { public String getEntityName() {
return this.entityName; return this.entityName;
} }
public String getPermissionCode() { public String getPermissionCode() {
return this.actionName + "_" + this.entityName; return this.actionName + "_" + this.entityName;
} }
public Long getResourceId() { public Long getResourceId() {
return this.resourceId; return this.resourceId;
} }
public Long getSubresourceId() { public Long getSubresourceId() {
return this.subresourceId; return this.subresourceId;
} }
public void markAsAwaitingApproval() { public void markAsAwaitingApproval() {
this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL this.processingResult = CommandProcessingResultType.AWAITING_APPROVAL.getValue();
.getValue(); }
}
public boolean isMarkedAsAwaitingApproval() { public boolean isMarkedAsAwaitingApproval() {
if (this.processingResult if (this.processingResult.equals(CommandProcessingResultType.AWAITING_APPROVAL.getValue())) return true;
.equals(CommandProcessingResultType.AWAITING_APPROVAL
.getValue()))
return true;
return false; return false;
} }
public void updateForAudit(final Long officeId, final Long groupId, public void updateForAudit(final Long officeId, final Long groupId, final Long clientId, final Long loanId, final Long savingsId) {
final Long clientId, final Long loanId, final Long savingsId) { this.officeId = officeId;
this.officeId = officeId; this.groupId = groupId;
this.groupId = groupId; this.clientId = clientId;
this.clientId = clientId; this.loanId = loanId;
this.loanId = loanId; this.savingsId = savingsId;
this.savingsId = savingsId; }
}
public String getResourceGetUrl() { public String getResourceGetUrl() {
return this.resourceGetUrl; return this.resourceGetUrl;
} }
} }
@@ -468,7 +468,7 @@ public class CommandWrapper {
return this.entityName.equalsIgnoreCase("GROUP"); return this.entityName.equalsIgnoreCase("GROUP");
} }
public boolean isCollectionSheetResource(){ public boolean isCollectionSheetResource() {
return this.entityName.equals("COLLECTIONSHEET"); return this.entityName.equals("COLLECTIONSHEET");
} }