From 5d07e70d59aca01423c6fdb6d8db1ee4839cf1ce Mon Sep 17 00:00:00 2001 From: Keith Woodlock Date: Thu, 19 Jul 2012 15:05:31 +0100 Subject: [PATCH] tidy up of json deserialization for funds,offices and permissions. --- .../platform/api/FundsApiResource.java | 28 ++----- .../platform/api/OfficesApiResource.java | 70 +++++++++------- .../platform/api/PermissionsApiResource.java | 18 ++-- .../platform/api/data/PermissionData.java | 17 +--- .../ApiDataConversionService.java | 12 ++- .../ApiDataConversionServiceImpl.java | 83 +++++++++++++++++-- .../infrastructure/ApiParameterHelper.java | 42 ++++++++++ .../infrastructure/JodaLocalDateAdapter.java | 32 +++++++ .../platform/user/domain/Permission.java | 2 +- .../PermissionReadPlatformServiceImpl.java | 4 +- 10 files changed, 222 insertions(+), 86 deletions(-) create mode 100644 mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiParameterHelper.java create mode 100644 mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/JodaLocalDateAdapter.java diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/FundsApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/FundsApiResource.java index 292c27e38..62603571d 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/FundsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/FundsApiResource.java @@ -1,8 +1,6 @@ package org.mifosng.platform.api; -import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.Set; import javax.ws.rs.Consumes; @@ -14,7 +12,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; @@ -22,6 +19,7 @@ import org.mifosng.platform.api.commands.FundCommand; import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.FundData; import org.mifosng.platform.api.infrastructure.ApiDataConversionService; +import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.fund.service.FundReadPlatformService; import org.mifosng.platform.fund.service.FundWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; @@ -47,23 +45,12 @@ public class FundsApiResource { @Produces({MediaType.APPLICATION_JSON}) public String retrieveFunds(@Context final UriInfo uriInfo) { - MultivaluedMap queryParams = uriInfo.getQueryParameters(); - String commaSerperatedParameters = ""; - if (queryParams.getFirst("fields") != null) { - commaSerperatedParameters = queryParams.getFirst("fields"); - } - - boolean prettyPrint = false; - if (queryParams.getFirst("pretty") != null) { - String prettyPrintValue = queryParams.getFirst("pretty"); - prettyPrint = "true".equalsIgnoreCase(prettyPrintValue); - } - - Set responseParameters = new HashSet(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); + Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); Collection funds = this.readPlatformService.retrieveAllFunds(); - return this.apiDataConversionService.covertFundDataToJson(prettyPrint, responseParameters, funds.toArray(new FundData[funds.size()])); + return this.apiDataConversionService.convertFundDataToJson(prettyPrint, responseParameters, funds.toArray(new FundData[funds.size()])); } @POST @@ -83,10 +70,13 @@ public class FundsApiResource { @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public String retreiveOffice(@PathParam("fundId") final Long fundId, @Context UriInfo uriInfo) { - + + Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); + FundData fund = this.readPlatformService.retrieveFund(fundId); - return this.apiDataConversionService.covertFundDataToJson(fund); + return this.apiDataConversionService.convertFundDataToJson(prettyPrint, responseParameters, fund); } @PUT diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficesApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficesApiResource.java index b7c9fa0fa..c667e372b 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/OfficesApiResource.java @@ -1,6 +1,9 @@ package org.mifosng.platform.api; +import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -9,7 +12,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -19,7 +21,7 @@ import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.OfficeData; import org.mifosng.platform.api.infrastructure.ApiDataConversionService; -import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService; +import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.organisation.service.OfficeReadPlatformService; import org.mifosng.platform.organisation.service.OfficeWritePlatformService; import org.springframework.beans.factory.annotation.Autowired; @@ -31,10 +33,6 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class OfficesApiResource { - private String defaultFieldList = "openingDate"; - private String allowedFieldList = "allowedParents"; - private String filterName = "myFilter"; - @Autowired private OfficeReadPlatformService readPlatformService; @@ -44,33 +42,41 @@ public class OfficesApiResource { @Autowired private ApiDataConversionService apiDataConversionService; - @Autowired - private ApiJSONFormattingService jsonFormattingService; - @GET @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) - public String retrieveOffices(@Context UriInfo uriInfo) { + public String retrieveOffices(@Context final UriInfo uriInfo) { + + Set typicalResponseParameters = new HashSet( + Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", + "hierarchy", "parentId", "parentName")); + + Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); + if (responseParameters.isEmpty()) { + responseParameters.addAll(typicalResponseParameters); + } + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); Collection offices = this.readPlatformService.retrieveAllOffices(); - String selectedFields = ""; - return this.jsonFormattingService.convertRequest(offices, filterName, - allowedFieldList, selectedFields, uriInfo.getQueryParameters()); + + return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, responseParameters, offices.toArray(new OfficeData[offices.size()])); } @GET @Path("template") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) - public String retrieveOfficeTemplate(@Context UriInfo uriInfo) { + public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) { - OfficeData officeData = this.readPlatformService - .retrieveNewOfficeTemplate(); + Set typicalResponseParameters = new HashSet( + Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", + "hierarchy", "parentId", "parentName", "allowedParents")); + + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); - String selectedFields = defaultFieldList + "," + allowedFieldList; - return this.jsonFormattingService.convertRequest(officeData, - filterName, allowedFieldList, selectedFields, - uriInfo.getQueryParameters()); + OfficeData officeData = this.readPlatformService.retrieveNewOfficeTemplate(); + + return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, typicalResponseParameters, officeData); } @POST @@ -89,18 +95,26 @@ public class OfficesApiResource { @Path("{officeId}") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) - public String retreiveOffice(@PathParam("officeId") final Long officeId, - @QueryParam("template") String template, @Context UriInfo uriInfo) { + public String retreiveOffice(@PathParam("officeId") final Long officeId, @Context final UriInfo uriInfo) { + + Set typicalResponseParameters = new HashSet( + Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", + "hierarchy", "parentId", "parentName")); + + Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); + if (responseParameters.isEmpty()) { + responseParameters.addAll(typicalResponseParameters); + } + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); + boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters()); OfficeData office = this.readPlatformService.retrieveOffice(officeId); - if (template != null && template.equalsIgnoreCase("true")) { - office.setAllowedParents(this.readPlatformService - .retrieveAllowedParents(officeId)); + if (template) { + office.setAllowedParents(this.readPlatformService.retrieveAllowedParents(officeId)); + responseParameters.add("allowedParents"); } - String selectedFields = ""; - return this.jsonFormattingService.convertRequest(office, filterName, - allowedFieldList, selectedFields, uriInfo.getQueryParameters()); + return this.apiDataConversionService.convertOfficeDataToJson(prettyPrint, responseParameters, office); } @PUT diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/PermissionsApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/PermissionsApiResource.java index 81c81ca74..4dbf7bf4d 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/PermissionsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/PermissionsApiResource.java @@ -1,6 +1,7 @@ package org.mifosng.platform.api; import java.util.Collection; +import java.util.Set; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -11,7 +12,8 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.UriInfo; import org.mifosng.platform.api.data.PermissionData; -import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService; +import org.mifosng.platform.api.infrastructure.ApiDataConversionService; +import org.mifosng.platform.api.infrastructure.ApiParameterHelper; import org.mifosng.platform.user.service.PermissionReadPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; @@ -21,25 +23,23 @@ import org.springframework.stereotype.Component; @Component @Scope("singleton") public class PermissionsApiResource { - private String allowedFieldList = ""; - private String filterName = "permissionFilter"; @Autowired private PermissionReadPlatformService permissionReadPlatformService; @Autowired - private ApiJSONFormattingService jsonFormattingService; + private ApiDataConversionService apiDataConversionService; @GET @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public String retrieveAllPermissions(@Context final UriInfo uriInfo) { + Set responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); + boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); + Collection permissions = this.permissionReadPlatformService.retrieveAllPermissions(); - - String selectedFields = ""; - return this.jsonFormattingService.convertRequest(permissions, - filterName, allowedFieldList, selectedFields, - uriInfo.getQueryParameters()); + + return this.apiDataConversionService.convertPermissionDataToJson(prettyPrint, responseParameters, permissions.toArray(new PermissionData[permissions.size()])); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/PermissionData.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/PermissionData.java index b869efe16..033300387 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/PermissionData.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/PermissionData.java @@ -2,29 +2,22 @@ package org.mifosng.platform.api.data; import java.io.Serializable; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.map.annotate.JsonFilter; - -@JsonIgnoreProperties({ "orgId", "groupType" }) -@JsonFilter("permissionFilter") public class PermissionData implements Serializable { private Long id; private String name; private String description; private String code; - private int groupType; public PermissionData() { // } - public PermissionData(final Long id, final String name, final String description, final String code, int groupType) { + public PermissionData(final Long id, final String name, final String description, final String code) { this.id = id; this.name = name; this.description = description; this.code = code; - this.groupType = groupType; } @Override @@ -69,12 +62,4 @@ public class PermissionData implements Serializable { public void setCode(final String code) { this.code = code; } - - public int getGroupType() { - return groupType; - } - - public void setGroupType(int groupType) { - this.groupType = groupType; - } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionService.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionService.java index de2aa0067..b39af7861 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionService.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionService.java @@ -16,14 +16,22 @@ import org.mifosng.platform.api.commands.RoleCommand; import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand; import org.mifosng.platform.api.commands.UserCommand; import org.mifosng.platform.api.data.FundData; +import org.mifosng.platform.api.data.OfficeData; +import org.mifosng.platform.api.data.PermissionData; public interface ApiDataConversionService { + + // + String convertPermissionDataToJson(boolean prettyPrint, Set responseParameters, PermissionData... permissions); + // FundCommand convertJsonToFundCommand(Long resourceIdentifier, String json); - String covertFundDataToJson(boolean prettyPrint, Set responseParameters, FundData... funds); + String convertFundDataToJson(boolean prettyPrint, Set responseParameters, FundData... funds); OfficeCommand convertJsonToOfficeCommand(Long resourceIdentifier, String json); + + String convertOfficeDataToJson(boolean prettyPrint, Set responseParameters, OfficeData... offices); RoleCommand convertJsonToRoleCommand(Long resourceIdentifier, String json); @@ -47,6 +55,4 @@ public interface ApiDataConversionService { OrganisationCurrencyCommand convertJsonToOrganisationCurrencyCommand(String jsonRequestBody); NoteCommand convertJsonToNoteCommand(Long resourceIdentifier, Long clientId, String jsonRequestBody); - - } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java index 6f917ac34..883f9e4ad 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java @@ -32,6 +32,8 @@ import org.mifosng.platform.api.commands.SubmitLoanApplicationCommand; import org.mifosng.platform.api.commands.UserCommand; import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.FundData; +import org.mifosng.platform.api.data.OfficeData; +import org.mifosng.platform.api.data.PermissionData; import org.mifosng.platform.api.errorhandling.InvalidJsonException; import org.mifosng.platform.api.errorhandling.UnsupportedParameterException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException; @@ -58,20 +60,85 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { } @Override - public String covertFundDataToJson(final boolean prettyPrint, final Set responseParameters, final FundData... funds) { + public String convertPermissionDataToJson(final boolean prettyPrint, final Set responseParameters, final PermissionData... permissions) { + Set supportedParameters = new HashSet(Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", + "hierarchy", "parentId", "parentName", "allowedParents")); - Set supportedParameters = new HashSet(Arrays.asList("id", "name", "externalId")); + final Set parameterNamesToSkip = new HashSet(); - if (!supportedParameters.containsAll(responseParameters)) { - throw new UnsupportedParameterException(new ArrayList(responseParameters)); + if (!responseParameters.isEmpty()) { + if (!supportedParameters.containsAll(responseParameters)) { + throw new UnsupportedParameterException(new ArrayList(responseParameters)); + } + + parameterNamesToSkip.addAll(supportedParameters); + parameterNamesToSkip.removeAll(responseParameters); } - final Set parameterNamesToSkip = new HashSet(supportedParameters); - parameterNamesToSkip.removeAll(responseParameters); - ExclusionStrategy strategy = new ParameterListExclusionStrategy(parameterNamesToSkip); - Gson gsonDeserializer = new GsonBuilder().addSerializationExclusionStrategy(strategy).create(); + GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy); + builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter()); + if (prettyPrint) { + builder.setPrettyPrinting(); + } + Gson gsonDeserializer = builder.create(); + + return gsonDeserializer.toJson(permissions); + } + + @Override + public String convertOfficeDataToJson(final boolean prettyPrint, final Set responseParameters, final OfficeData... offices) { + + Set supportedParameters = new HashSet(Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", + "hierarchy", "parentId", "parentName", "allowedParents")); + + final Set parameterNamesToSkip = new HashSet(); + + if (!responseParameters.isEmpty()) { + if (!supportedParameters.containsAll(responseParameters)) { + throw new UnsupportedParameterException(new ArrayList(responseParameters)); + } + + parameterNamesToSkip.addAll(supportedParameters); + parameterNamesToSkip.removeAll(responseParameters); + } + + ExclusionStrategy strategy = new ParameterListExclusionStrategy(parameterNamesToSkip); + + GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy); + builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter()); + if (prettyPrint) { + builder.setPrettyPrinting(); + } + Gson gsonDeserializer = builder.create(); + + return gsonDeserializer.toJson(offices); + } + + @Override + public String convertFundDataToJson(final boolean prettyPrint, final Set responseParameters, final FundData... funds) { + + Set supportedParameters = new HashSet(Arrays.asList("id", "name", "externalId")); + + final Set parameterNamesToSkip = new HashSet(); + + if (!responseParameters.isEmpty()) { + if (!supportedParameters.containsAll(responseParameters)) { + throw new UnsupportedParameterException(new ArrayList(responseParameters)); + } + + parameterNamesToSkip.addAll(supportedParameters); + parameterNamesToSkip.removeAll(responseParameters); + } + + ExclusionStrategy strategy = new ParameterListExclusionStrategy(parameterNamesToSkip); + + GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy); + if (prettyPrint) { + builder.setPrettyPrinting(); + } + Gson gsonDeserializer = builder.create(); return gsonDeserializer.toJson(funds); } diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiParameterHelper.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiParameterHelper.java new file mode 100644 index 000000000..cbe093fe9 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiParameterHelper.java @@ -0,0 +1,42 @@ +package org.mifosng.platform.api.infrastructure; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.core.MultivaluedMap; + +import org.apache.commons.lang.StringUtils; + +public class ApiParameterHelper { + + public static Set extractFieldsForResponseIfProvided(final MultivaluedMap queryParams) { + Set fields = new HashSet(); + String commaSerperatedParameters = ""; + if (queryParams.getFirst("fields") != null) { + commaSerperatedParameters = queryParams.getFirst("fields"); + if (StringUtils.isNotBlank(commaSerperatedParameters)) { + fields = new HashSet(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); + } + } + return fields; + } + + public static boolean prettyPrint(final MultivaluedMap queryParams) { + boolean prettyPrint = false; + if (queryParams.getFirst("pretty") != null) { + String prettyPrintValue = queryParams.getFirst("pretty"); + prettyPrint = "true".equalsIgnoreCase(prettyPrintValue); + } + return prettyPrint; + } + + public static boolean template(final MultivaluedMap queryParams) { + boolean template = false; + if (queryParams.getFirst("template") != null) { + String prettyPrintValue = queryParams.getFirst("template"); + template = "true".equalsIgnoreCase(prettyPrintValue); + } + return template; + } +} diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/JodaLocalDateAdapter.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/JodaLocalDateAdapter.java new file mode 100644 index 000000000..bf51a82b2 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/JodaLocalDateAdapter.java @@ -0,0 +1,32 @@ +package org.mifosng.platform.api.infrastructure; + +import java.lang.reflect.Type; + +import org.joda.time.LocalDate; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; + +/** + * Serializer for joda time {@link LocalDate} that returns date in array format to match previous jackson functionality. + */ +public class JodaLocalDateAdapter implements JsonSerializer { + + @Override + public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) { + + JsonArray array = null; + if (src != null) { + array = new JsonArray(); + array.add(new JsonPrimitive(src.getYearOfEra())); + array.add(new JsonPrimitive(src.getMonthOfYear())); + array.add(new JsonPrimitive(src.getDayOfMonth())); + } + + return array; + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/user/domain/Permission.java b/mifosng-provider/src/main/java/org/mifosng/platform/user/domain/Permission.java index 212dce673..eee79bab1 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/user/domain/Permission.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/user/domain/Permission.java @@ -49,6 +49,6 @@ public class Permission extends AbstractPersistable { } public PermissionData toData() { - return new PermissionData(this.getId(), this.defaultName, this.defaultDescription, this.code, this.permissionGroup.ordinal()); + return new PermissionData(this.getId(), this.defaultName, this.defaultDescription, this.code); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/user/service/PermissionReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/user/service/PermissionReadPlatformServiceImpl.java index 2adf02175..dcbb194db 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/user/service/PermissionReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/user/service/PermissionReadPlatformServiceImpl.java @@ -45,9 +45,9 @@ public class PermissionReadPlatformServiceImpl implements PermissionReadPlatform String name = rs.getString("name"); String description = rs.getString("description"); String code = rs.getString("code"); - Integer groupType = JdbcSupport.getInteger(rs, "groupType"); +// Integer groupType = JdbcSupport.getInteger(rs, "groupType"); - return new PermissionData(id, name, description, code, groupType); + return new PermissionData(id, name, description, code); } public String schema() {