fixing merge issues with MIFOSX-1024

This commit is contained in:
andrew-dzak
2014-05-09 18:00:34 +05:30
committed by Vishwas Babu A J
parent 9472ec236c
commit e2a9d8afbc
6 changed files with 61 additions and 11 deletions
+25 -1
View File
@@ -13001,6 +13001,22 @@ POST https://DomainName/api/v1/makercheckers/{auditId}?command=approve
</code>
<code class="method-request">
POST makercheckers/1?command=approve
Content-Type: application/json
</code>
<code class="method-response">{ "auditId": 1 } </code>
</div>
</div>
<a id="makercheckers_reject" name="makercheckers_approve" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h4>Reject Maker Checker Entry</h4>
</div>
<div class="method-example">
<code class="method-declaration">
PUT https://DomainName/api/v1/makercheckers/{auditId}
</code>
<code class="method-request">
PUT makercheckers/1
Content-Type: application/json
</code>
<code class="method-response">{ "auditId": 1 } </code>
@@ -30534,7 +30550,15 @@ No Request Body:
<td></td>
<td></td>
</tr>
<tr>
<tr>
<td></td>
<td>makercheckers/{auditId}</td>
<td></td>
<td></td>
<td><a href="#makercheckers_reject">Reject Maker Checker Entry</a></td>
<td></td>
</tr>
<tr>
<td><a href="#scheduler_jobs">Scheduler jobs</a></td>
<td>jobs</td>
<td></td>
@@ -10,14 +10,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
@@ -110,13 +103,23 @@ public class MakercheckersApiResource {
CommandProcessingResult result = null;
if (is(commandParam, "approve")) {
result = this.writePlatformService.approveEntry(auditId);
} else {
}else {
throw new UnrecognizedQueryParamException("command", commandParam);
}
return this.toApiJsonSerializerAudit.serialize(result);
}
@PUT
@Path("{auditId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String rejectMakerCheckerEntry(@PathParam("auditId") final Long auditId) {
final Long id = this.writePlatformService.rejectEntry(auditId);
return this.toApiJsonSerializerAudit.serialize(CommandProcessingResult.commandOnlyResult(id));
}
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
}
@@ -132,6 +135,9 @@ public class MakercheckersApiResource {
return this.toApiJsonSerializerAudit.serialize(CommandProcessingResult.commandOnlyResult(id));
}
private String getExtraCriteria(final String actionName, final String entityName, final Long resourceId, final Long makerId,
final String makerDateTimeFrom, final String makerDateTimeTo, final Integer officeId, final Integer groupId,
final Integer clientId, final Integer loanId, final Integer savingsAccountId) {
@@ -111,6 +111,12 @@ public class CommandSource extends AbstractPersistable<Long> {
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
}
public void markAsRejected(final AppUser checker, final DateTime checkedOnDate){
this.checker = checker;
this.checkedOnDate = checkedOnDate.toDate();
this.processingResult = CommandProcessingResultType.REJECTED.getValue();
}
public void updateResourceId(final Long resourceId) {
this.resourceId = resourceId;
}
@@ -14,5 +14,7 @@ public interface PortfolioCommandSourceWritePlatformService {
CommandProcessingResult approveEntry(Long id);
Long rejectEntry(Long id);
Long deleteEntry(Long makerCheckerId);
}
@@ -5,6 +5,7 @@
*/
package org.mifosplatform.commands.service;
import org.joda.time.DateTime;
import org.mifosplatform.commands.domain.CommandSource;
import org.mifosplatform.commands.domain.CommandSourceRepository;
import org.mifosplatform.commands.domain.CommandWrapper;
@@ -16,6 +17,7 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.mifosplatform.infrastructure.jobs.service.SchedulerJobRunnerReadService;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.useradministration.domain.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -127,4 +129,14 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
return this.schedulerJobRunnerReadService.isUpdatesAllowed();
}
@Override
public Long rejectEntry(final Long makerCheckerId) {
final CommandSource commandSourceInput = validateMakerCheckerTransaction(makerCheckerId);
validateIsUpdateAllowed();
final AppUser maker = this.context.authenticatedUser();
commandSourceInput.markAsRejected(maker, DateTime.now());
this.commandSourceRepository.save(commandSourceInput);
return makerCheckerId ;
}
}
@@ -63,7 +63,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
CommandSource commandSourceResult = null;
if (command.commandId() != null) {
commandSourceResult = this.commandSourceRepository.findOne(command.commandId());
commandSourceResult.markAsChecked(maker, DateTime.now());
commandSourceResult.markAsChecked(maker, DateTime.now());
} else {
commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker);
}