diff --git a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/administration-view-templates.jsp b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/administration-view-templates.jsp index 3daf0eab1..e04a86ba5 100644 --- a/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/administration-view-templates.jsp +++ b/mifosng-individual-lending-app/src/main/webapp/WEB-INF/views/administration-view-templates.jsp @@ -246,8 +246,8 @@ {{/if}} - - + + diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficeApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficeApiResource.java index fc65c29a7..43f29b4eb 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficeApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficeApiResource.java @@ -18,7 +18,7 @@ import javax.ws.rs.core.UriInfo; import org.joda.time.LocalDate; import org.mifosng.data.EntityIdentifier; import org.mifosng.data.OfficeData; -import org.mifosng.data.command.OfficeCommand; +import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.api.infrastructure.ApiDataConversionService; import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService; import org.mifosng.platform.organisation.service.OfficeReadPlatformService; @@ -80,10 +80,10 @@ public class OfficeApiResource { @Produces({ MediaType.APPLICATION_JSON }) public Response createOffice(final OfficeCommand command) { - LocalDate openingDate = apiDataConversionService.convertFrom( - command.getOpeningDateFormatted(), "openingDateFormatted", + LocalDate openingLocalDate = apiDataConversionService.convertFrom( + command.getOpeningDate(), "openingDate", command.getDateFormat()); - command.setOpeningDate(openingDate); + command.setOpeningLocalDate(openingLocalDate); Long officeId = this.writePlatformService.createOffice(command); @@ -115,10 +115,10 @@ public class OfficeApiResource { public Response updateOffice(@PathParam("officeId") final Long officeId, final OfficeCommand command) { - LocalDate openingDate = apiDataConversionService.convertFrom( - command.getOpeningDateFormatted(), "openingDateFormatted", + LocalDate openingLocalDate = apiDataConversionService.convertFrom( + command.getOpeningDate(), "openingDate", command.getDateFormat()); - command.setOpeningDate(openingDate); + command.setOpeningLocalDate(openingLocalDate); command.setId(officeId); Long entityId = this.writePlatformService.updateOffice(command); diff --git a/mifosng-data/src/main/java/org/mifosng/data/command/OfficeCommand.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/OfficeCommand.java similarity index 77% rename from mifosng-data/src/main/java/org/mifosng/data/command/OfficeCommand.java rename to mifosng-provider/src/main/java/org/mifosng/platform/api/commands/OfficeCommand.java index 35c16de92..30948048c 100644 --- a/mifosng-data/src/main/java/org/mifosng/data/command/OfficeCommand.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/commands/OfficeCommand.java @@ -1,4 +1,4 @@ -package org.mifosng.data.command; +package org.mifosng.platform.api.commands; import javax.xml.bind.annotation.XmlRootElement; @@ -15,8 +15,8 @@ public class OfficeCommand { private String externalId; private String dateFormat; - private String openingDateFormatted; - private LocalDate openingDate; + private String openingDate; + private LocalDate openingLocalDate; private Long parentId; private Boolean rootOffice = false; @@ -30,7 +30,7 @@ public class OfficeCommand { this.name = officeName; this.externalId = externalId; this.parentId = parentId; - this.openingDate = openingDate; + this.openingLocalDate = openingDate; } public OfficeCommand(final Long id, final String officeName, @@ -40,15 +40,7 @@ public class OfficeCommand { this.name = officeName; this.externalId = externalId; this.parentId = parentId; - this.openingDate = openingDate; - } - - public LocalDate getOpeningDate() { - return this.openingDate; - } - - public void setOpeningDate(final LocalDate openingDate) { - this.openingDate = openingDate; + this.openingLocalDate = openingDate; } public String getName() { @@ -91,14 +83,6 @@ public class OfficeCommand { this.dateFormat = dateFormat; } - public String getOpeningDateFormatted() { - return openingDateFormatted; - } - - public void setOpeningDateFormatted(String openingDateFormatted) { - this.openingDateFormatted = openingDateFormatted; - } - public boolean isRootOffice() { return rootOffice; } @@ -106,4 +90,20 @@ public class OfficeCommand { public void setRootOffice(boolean rootOffice) { this.rootOffice = rootOffice; } + + public String getOpeningDate() { + return openingDate; + } + + public void setOpeningDate(String openingDate) { + this.openingDate = openingDate; + } + + public LocalDate getOpeningLocalDate() { + return openingLocalDate; + } + + public void setOpeningLocalDate(LocalDate openingLocalDate) { + this.openingLocalDate = openingLocalDate; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/domain/Office.java b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/domain/Office.java index 4255e271e..0db44b0f3 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/domain/Office.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/domain/Office.java @@ -17,7 +17,7 @@ import javax.persistence.UniqueConstraint; import org.apache.commons.lang.StringUtils; import org.joda.time.LocalDate; -import org.mifosng.data.command.OfficeCommand; +import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.infrastructure.AbstractAuditableCustom; import org.mifosng.platform.user.domain.AppUser; @@ -115,7 +115,7 @@ public class Office extends AbstractAuditableCustom { } if (command.getOpeningDate() != null) { - this.openingDate = command.getOpeningDate().toDate(); + this.openingDate = command.getOpeningLocalDate().toDate(); } } diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeCommandValidator.java b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeCommandValidator.java index d4ff61c9d..d3002362c 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeCommandValidator.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeCommandValidator.java @@ -4,8 +4,8 @@ import java.util.ArrayList; import java.util.List; import org.mifosng.data.ApiParameterError; -import org.mifosng.data.command.OfficeCommand; import org.mifosng.platform.DataValidatorBuilder; +import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.exceptions.PlatformApiDataValidationException; public class OfficeCommandValidator { @@ -23,7 +23,7 @@ public class OfficeCommandValidator { DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("office"); baseDataValidator.reset().parameter("name").value(command.getName()).notBlank(); - baseDataValidator.reset().parameter("openingDateFormatted").value(command.getOpeningDateFormatted()).notBlank(); + baseDataValidator.reset().parameter("openingDate").value(command.getOpeningDate()).notBlank(); baseDataValidator.reset().parameter("externalId").value(command.getExternalId()).notExceedingLengthOf(100); baseDataValidator.reset().parameter("parentId").value(command.getParentId()).notNull().greaterThanZero(); @@ -39,11 +39,11 @@ public class OfficeCommandValidator { baseDataValidator.reset().parameter("id").value(command.getId()).notNull(); baseDataValidator.reset().parameter("name").value(command.getName()).ignoreIfNull().notBlank(); - baseDataValidator.reset().parameter("openingDateFormatted").value(command.getOpeningDateFormatted()).ignoreIfNull().notBlank(); + baseDataValidator.reset().parameter("openingDate").value(command.getOpeningDate()).ignoreIfNull().notBlank(); baseDataValidator.reset().parameter("externalId").value(command.getExternalId()).ignoreIfNull().notExceedingLengthOf(100); baseDataValidator.reset().parameter("parentId").value(command.getParentId()).ignoreIfNull().notNull().greaterThanZero(); - baseDataValidator.reset().anyOfNotNull(command.getName(), command.getOpeningDateFormatted(), command.getExternalId(), command.getParentId()); + baseDataValidator.reset().anyOfNotNull(command.getName(), command.getOpeningDate(), command.getExternalId(), command.getParentId()); if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformService.java b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformService.java index ef32854ad..c1ed08257 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformService.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformService.java @@ -1,6 +1,6 @@ package org.mifosng.platform.organisation.service; -import org.mifosng.data.command.OfficeCommand; +import org.mifosng.platform.api.commands.OfficeCommand; public interface OfficeWritePlatformService { diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java index b25a20aca..39a9364b0 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/organisation/service/OfficeWritePlatformServiceJpaRepositoryImpl.java @@ -2,7 +2,7 @@ package org.mifosng.platform.organisation.service; import static org.mifosng.platform.Specifications.officesThatMatch; -import org.mifosng.data.command.OfficeCommand; +import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.exceptions.OfficeNotFoundException; import org.mifosng.platform.exceptions.PlatformDataIntegrityException; @@ -47,7 +47,7 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP throw new OfficeNotFoundException(command.getParentId()); } - Office office = Office.createNew(currentUser.getOrganisation(), parent, command.getName(), command.getOpeningDate(), command.getExternalId()); + Office office = Office.createNew(currentUser.getOrganisation(), parent, command.getName(), command.getOpeningLocalDate(), command.getExternalId()); // pre save to generate id for use in office hierarchy this.officeRepository.save(office);