move commands and validators into their own package for useradmin area.

This commit is contained in:
Keith Woodlock
2012-11-27 01:27:59 +00:00
parent 72881c740b
commit d997add560
24 changed files with 44 additions and 44 deletions
@@ -13,13 +13,13 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.PermissionsCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.infrastructure.api.ApiParameterHelper; import org.mifosng.platform.infrastructure.api.ApiParameterHelper;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.infrastructure.user.api.data.PermissionUsageData; import org.mifosplatform.infrastructure.user.api.data.PermissionUsageData;
import org.mifosplatform.infrastructure.user.command.PermissionsCommand;
import org.mifosplatform.infrastructure.user.service.PermissionReadPlatformService; import org.mifosplatform.infrastructure.user.service.PermissionReadPlatformService;
import org.mifosplatform.infrastructure.user.service.PermissionWritePlatformService; import org.mifosplatform.infrastructure.user.service.PermissionWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -17,8 +17,6 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.api.data.EntityIdentifier; import org.mifosng.platform.api.data.EntityIdentifier;
import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioApiJsonSerializerService;
import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService; import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService;
@@ -30,6 +28,8 @@ import org.mifosplatform.commands.service.PortfolioCommandsReadPlatformService;
import org.mifosplatform.infrastructure.user.api.data.PermissionUsageData; import org.mifosplatform.infrastructure.user.api.data.PermissionUsageData;
import org.mifosplatform.infrastructure.user.api.data.RoleData; import org.mifosplatform.infrastructure.user.api.data.RoleData;
import org.mifosplatform.infrastructure.user.api.data.RolePermissionsData; import org.mifosplatform.infrastructure.user.api.data.RolePermissionsData;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.service.PermissionReadPlatformService; import org.mifosplatform.infrastructure.user.service.PermissionReadPlatformService;
import org.mifosplatform.infrastructure.user.service.RoleReadPlatformService; import org.mifosplatform.infrastructure.user.service.RoleReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -24,14 +24,14 @@ import org.mifosng.platform.api.commands.LoanTransactionCommand;
import org.mifosng.platform.api.commands.NoteCommand; import org.mifosng.platform.api.commands.NoteCommand;
import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.api.commands.OfficeCommand;
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand; import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
import org.mifosng.platform.api.commands.PermissionsCommand;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.api.commands.SavingAccountCommand; import org.mifosng.platform.api.commands.SavingAccountCommand;
import org.mifosng.platform.api.commands.SavingProductCommand; import org.mifosng.platform.api.commands.SavingProductCommand;
import org.mifosng.platform.api.commands.StaffCommand; import org.mifosng.platform.api.commands.StaffCommand;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.ClientData; import org.mifosng.platform.api.data.ClientData;
import org.mifosplatform.infrastructure.user.command.PermissionsCommand;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.command.UserCommand;
public interface PortfolioApiDataConversionService { public interface PortfolioApiDataConversionService {
@@ -41,19 +41,19 @@ import org.mifosng.platform.api.commands.LoanTransactionCommand;
import org.mifosng.platform.api.commands.NoteCommand; import org.mifosng.platform.api.commands.NoteCommand;
import org.mifosng.platform.api.commands.OfficeCommand; import org.mifosng.platform.api.commands.OfficeCommand;
import org.mifosng.platform.api.commands.OrganisationCurrencyCommand; import org.mifosng.platform.api.commands.OrganisationCurrencyCommand;
import org.mifosng.platform.api.commands.PermissionsCommand;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.api.commands.SavingAccountCommand; import org.mifosng.platform.api.commands.SavingAccountCommand;
import org.mifosng.platform.api.commands.SavingProductCommand; import org.mifosng.platform.api.commands.SavingProductCommand;
import org.mifosng.platform.api.commands.StaffCommand; import org.mifosng.platform.api.commands.StaffCommand;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.api.data.ClientData; import org.mifosng.platform.api.data.ClientData;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
import org.mifosng.platform.infrastructure.api.JsonParserHelper; import org.mifosng.platform.infrastructure.api.JsonParserHelper;
import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException; import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException;
import org.mifosng.platform.infrastructure.errorhandling.UnsupportedParameterException; import org.mifosng.platform.infrastructure.errorhandling.UnsupportedParameterException;
import org.mifosplatform.infrastructure.user.command.PermissionsCommand;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.number.NumberFormatter; import org.springframework.format.number.NumberFormatter;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -4,11 +4,11 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.infrastructure.api.JsonParserHelper; import org.mifosng.platform.infrastructure.api.JsonParserHelper;
import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException; import org.mifosng.platform.infrastructure.errorhandling.InvalidJsonException;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.google.gson.Gson; import com.google.gson.Gson;
@@ -1,8 +1,8 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.api.infrastructure;
import org.mifosng.platform.api.commands.RoleCommand; import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosng.platform.api.commands.UserCommand; import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand; import org.mifosplatform.infrastructure.user.command.UserCommand;
/** /**
* Service for de-serializing JSON for a command into the platforms internal * Service for de-serializing JSON for a command into the platforms internal
@@ -1,8 +1,8 @@
package org.mifosng.platform.api.infrastructure; package org.mifosng.platform.api.infrastructure;
import org.mifosng.platform.api.commands.RoleCommand; import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosng.platform.api.commands.UserCommand; import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand; import org.mifosplatform.infrastructure.user.command.UserCommand;
/** /**
* Service for serializing commands into another format. * Service for serializing commands into another format.
@@ -2,10 +2,10 @@ package org.mifosng.platform.api.infrastructure;
import java.util.HashSet; import java.util.HashSet;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.infrastructure.api.GoogleGsonSerializerHelper; import org.mifosng.platform.infrastructure.api.GoogleGsonSerializerHelper;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -4,8 +4,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService; import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService;
import org.mifosng.platform.api.infrastructure.PortfolioCommandSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioCommandSerializerService;
@@ -14,6 +12,8 @@ import org.mifosng.platform.infrastructure.errorhandling.UnsupportedCommandExcep
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.commands.domain.CommandSource; import org.mifosplatform.commands.domain.CommandSource;
import org.mifosplatform.commands.service.ChangeDetectionService; import org.mifosplatform.commands.service.ChangeDetectionService;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.domain.AppUser; import org.mifosplatform.infrastructure.user.domain.AppUser;
import org.mifosplatform.infrastructure.user.service.RoleWritePlatformService; import org.mifosplatform.infrastructure.user.service.RoleWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService; import org.mifosng.platform.api.infrastructure.PortfolioApiDataConversionService;
import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService; import org.mifosng.platform.api.infrastructure.PortfolioCommandDeserializerService;
import org.mifosng.platform.api.infrastructure.PortfolioCommandSerializerService; import org.mifosng.platform.api.infrastructure.PortfolioCommandSerializerService;
@@ -12,6 +11,7 @@ import org.mifosng.platform.client.service.RollbackTransactionAsCommandIsNotAppr
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.commands.domain.CommandSource; import org.mifosplatform.commands.domain.CommandSource;
import org.mifosplatform.commands.service.ChangeDetectionService; import org.mifosplatform.commands.service.ChangeDetectionService;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.mifosplatform.infrastructure.user.domain.AppUser; import org.mifosplatform.infrastructure.user.domain.AppUser;
import org.mifosplatform.infrastructure.user.service.AppUserWritePlatformService; import org.mifosplatform.infrastructure.user.service.AppUserWritePlatformService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.commands; package org.mifosplatform.infrastructure.user.command;
import java.util.Map; import java.util.Map;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.commands; package org.mifosplatform.infrastructure.user.command;
import java.util.Set; import java.util.Set;
@@ -1,10 +1,9 @@
package org.mifosplatform.infrastructure.user.service; package org.mifosplatform.infrastructure.user.command;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.mifosng.platform.DataValidatorBuilder; import org.mifosng.platform.DataValidatorBuilder;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.commands; package org.mifosplatform.infrastructure.user.command;
import java.util.Map; import java.util.Map;
@@ -1,4 +1,4 @@
package org.mifosng.platform.api.commands; package org.mifosplatform.infrastructure.user.command;
import java.util.Set; import java.util.Set;
@@ -1,10 +1,9 @@
package org.mifosplatform.infrastructure.user.service; package org.mifosplatform.infrastructure.user.command;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.mifosng.platform.DataValidatorBuilder; import org.mifosng.platform.DataValidatorBuilder;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.exceptions.PlatformApiDataValidationException; import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
@@ -16,11 +16,11 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.exceptions.NoAuthorizationException;
import org.mifosng.platform.infrastructure.AbstractAuditableCustom; import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
import org.mifosng.platform.infrastructure.PlatformUser; import org.mifosng.platform.infrastructure.PlatformUser;
import org.mifosng.platform.organisation.domain.Office; import org.mifosng.platform.organisation.domain.Office;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.User;
@@ -12,9 +12,9 @@ import javax.persistence.JoinTable;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.infrastructure.AbstractAuditableCustom; import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
import org.mifosplatform.infrastructure.user.api.data.RoleData; import org.mifosplatform.infrastructure.user.api.data.RoleData;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
@Entity @Entity
@Table(name = "m_role") @Table(name = "m_role")
@@ -1,6 +1,6 @@
package org.mifosplatform.infrastructure.user.service; package org.mifosplatform.infrastructure.user.service;
import org.mifosng.platform.api.commands.UserCommand; import org.mifosplatform.infrastructure.user.command.UserCommand;
public interface AppUserWritePlatformService { public interface AppUserWritePlatformService {
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.mifosng.platform.api.commands.UserCommand;
import org.mifosng.platform.api.data.ApiParameterError; import org.mifosng.platform.api.data.ApiParameterError;
import org.mifosng.platform.client.service.RollbackTransactionAsCommandIsNotApprovedByCheckerException; import org.mifosng.platform.client.service.RollbackTransactionAsCommandIsNotApprovedByCheckerException;
import org.mifosng.platform.exceptions.OfficeNotFoundException; import org.mifosng.platform.exceptions.OfficeNotFoundException;
@@ -21,6 +20,8 @@ import org.mifosng.platform.infrastructure.PlatformUser;
import org.mifosng.platform.organisation.domain.Office; import org.mifosng.platform.organisation.domain.Office;
import org.mifosng.platform.organisation.domain.OfficeRepository; import org.mifosng.platform.organisation.domain.OfficeRepository;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.infrastructure.user.command.UserCommand;
import org.mifosplatform.infrastructure.user.command.UserCommandValidator;
import org.mifosplatform.infrastructure.user.domain.AppUser; import org.mifosplatform.infrastructure.user.domain.AppUser;
import org.mifosplatform.infrastructure.user.domain.AppUserRepository; import org.mifosplatform.infrastructure.user.domain.AppUserRepository;
import org.mifosplatform.infrastructure.user.domain.Permission; import org.mifosplatform.infrastructure.user.domain.Permission;
@@ -1,7 +1,7 @@
package org.mifosplatform.infrastructure.user.service; package org.mifosplatform.infrastructure.user.service;
import org.mifosng.platform.api.commands.PermissionsCommand; import org.mifosplatform.infrastructure.user.command.PermissionsCommand;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
public interface PermissionWritePlatformService { public interface PermissionWritePlatformService {
@@ -3,9 +3,9 @@ package org.mifosplatform.infrastructure.user.service;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import org.mifosng.platform.api.commands.PermissionsCommand;
import org.mifosng.platform.exceptions.PermissionNotFoundException; import org.mifosng.platform.exceptions.PermissionNotFoundException;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.infrastructure.user.command.PermissionsCommand;
import org.mifosplatform.infrastructure.user.domain.Permission; import org.mifosplatform.infrastructure.user.domain.Permission;
import org.mifosplatform.infrastructure.user.domain.PermissionRepository; import org.mifosplatform.infrastructure.user.domain.PermissionRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -1,7 +1,7 @@
package org.mifosplatform.infrastructure.user.service; package org.mifosplatform.infrastructure.user.service;
import org.mifosng.platform.api.commands.RoleCommand; import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand; import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
public interface RoleWritePlatformService { public interface RoleWritePlatformService {
@@ -3,12 +3,13 @@ package org.mifosplatform.infrastructure.user.service;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import org.mifosng.platform.api.commands.RoleCommand;
import org.mifosng.platform.api.commands.RolePermissionCommand;
import org.mifosng.platform.client.service.RollbackTransactionAsCommandIsNotApprovedByCheckerException; import org.mifosng.platform.client.service.RollbackTransactionAsCommandIsNotApprovedByCheckerException;
import org.mifosng.platform.exceptions.PermissionNotFoundException; import org.mifosng.platform.exceptions.PermissionNotFoundException;
import org.mifosng.platform.exceptions.RoleNotFoundException; import org.mifosng.platform.exceptions.RoleNotFoundException;
import org.mifosng.platform.security.PlatformSecurityContext; import org.mifosng.platform.security.PlatformSecurityContext;
import org.mifosplatform.infrastructure.user.command.RoleCommand;
import org.mifosplatform.infrastructure.user.command.RoleCommandValidator;
import org.mifosplatform.infrastructure.user.command.RolePermissionCommand;
import org.mifosplatform.infrastructure.user.domain.Permission; import org.mifosplatform.infrastructure.user.domain.Permission;
import org.mifosplatform.infrastructure.user.domain.PermissionRepository; import org.mifosplatform.infrastructure.user.domain.PermissionRepository;
import org.mifosplatform.infrastructure.user.domain.Role; import org.mifosplatform.infrastructure.user.domain.Role;