Merge branch 'master' into develop

This commit is contained in:
Vishwas Babu A J
2015-08-06 14:01:53 -07:00
4 changed files with 35 additions and 26 deletions
@@ -6,7 +6,6 @@
package org.mifosplatform.accounting.journalentry.handler; package org.mifosplatform.accounting.journalentry.handler;
import org.mifosplatform.accounting.journalentry.service.JournalEntryWritePlatformService; import org.mifosplatform.accounting.journalentry.service.JournalEntryWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler; import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -15,7 +14,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service @Service
@CommandType(entity = "JOURNALENTRY", action = "CREATE")
public class CreateJournalEntryCommandHandler implements NewCommandSourceHandler { public class CreateJournalEntryCommandHandler implements NewCommandSourceHandler {
private final JournalEntryWritePlatformService writePlatformService; private final JournalEntryWritePlatformService writePlatformService;
@@ -6,7 +6,6 @@
package org.mifosplatform.accounting.journalentry.handler; package org.mifosplatform.accounting.journalentry.handler;
import org.mifosplatform.accounting.journalentry.service.JournalEntryWritePlatformService; import org.mifosplatform.accounting.journalentry.service.JournalEntryWritePlatformService;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.handler.NewCommandSourceHandler; import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.CommandProcessingResult; import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
@@ -15,7 +14,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Service @Service
@CommandType(entity = "JOURNALENTRY", action = "REVERSE")
public class ReverseJournalEntryCommandHandler implements NewCommandSourceHandler { public class ReverseJournalEntryCommandHandler implements NewCommandSourceHandler {
private final JournalEntryWritePlatformService writePlatformService; private final JournalEntryWritePlatformService writePlatformService;
@@ -119,6 +119,10 @@ public class CommandWrapper {
return this.actionName.equalsIgnoreCase("CREATE"); return this.actionName.equalsIgnoreCase("CREATE");
} }
public boolean isReverse() {
return this.actionName.equalsIgnoreCase("REVERSE");
}
public boolean isCreateDatatable() { public boolean isCreateDatatable() {
return this.actionName.equalsIgnoreCase("CREATE") && this.href.startsWith("/datatables/") && this.entityId == null; return this.actionName.equalsIgnoreCase("CREATE") && this.href.startsWith("/datatables/") && this.entityId == null;
} }
@@ -184,6 +188,7 @@ public class CommandWrapper {
public Long getSubentityId() { public Long getSubentityId() {
return this.subentityId; return this.subentityId;
} }
public String getTransactionId() { public String getTransactionId() {
return this.transactionId; return this.transactionId;
} }
@@ -212,6 +217,10 @@ public class CommandWrapper {
return this.href.startsWith("/survey/"); return this.href.startsWith("/survey/");
} }
public boolean isJournalEntryResource() {
return this.entityName.equalsIgnoreCase("JOURNALENTRY");
}
public boolean isRegisterSurvey() { public boolean isRegisterSurvey() {
return this.actionName.equalsIgnoreCase("REGISTER"); return this.actionName.equalsIgnoreCase("REGISTER");
} }
@@ -164,7 +164,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else { } else {
throw new UnsupportedCommandException(wrapper.commandName()); throw new UnsupportedCommandException(wrapper.commandName());
} }
} else if (wrapper.isSurveyResource()) { } else if (wrapper.isSurveyResource()) {
if (wrapper.isRegisterSurvey()) { if (wrapper.isRegisterSurvey()) {
handler = this.applicationContext.getBean("registerSurveyCommandHandler", NewCommandSourceHandler.class); handler = this.applicationContext.getBean("registerSurveyCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isFullFilSurvey()) { } else if (wrapper.isFullFilSurvey()) {
@@ -172,7 +172,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else { } else {
throw new UnsupportedCommandException(wrapper.commandName()); throw new UnsupportedCommandException(wrapper.commandName());
} }
} else if (wrapper.isLoanDisburseDetailResource()) { } else if (wrapper.isLoanDisburseDetailResource()) {
if (wrapper.isUpdateDisbursementDate()) { if (wrapper.isUpdateDisbursementDate()) {
handler = this.applicationContext.getBean("updateLoanDisbuseDateCommandHandler", NewCommandSourceHandler.class); handler = this.applicationContext.getBean("updateLoanDisbuseDateCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.addAndDeleteDisbursementDetails()) { } else if (wrapper.addAndDeleteDisbursementDetails()) {
@@ -180,10 +180,14 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
} else { } else {
throw new UnsupportedCommandException(wrapper.commandName()); throw new UnsupportedCommandException(wrapper.commandName());
} }
} } else if (wrapper.isJournalEntryResource()) {
else { if (wrapper.isCreate()) {
handler = this.applicationContext.getBean("createJournalEntryCommandHandler", NewCommandSourceHandler.class);
handler = this.commandHandlerProvider.getHandler(wrapper.entityName(), wrapper.actionName()); } else if (wrapper.isReverse()) {
handler = this.applicationContext.getBean("reverseJournalEntryCommandHandler", NewCommandSourceHandler.class);
}
} else {
handler = this.commandHandlerProvider.getHandler(wrapper.entityName(), wrapper.actionName());
} }
return handler; return handler;