Skip to content

Commit

Permalink
not-found and already-exists exceptions better handled in the rest layer
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Dec 19, 2014
1 parent 4e7a785 commit f6912c4
Show file tree
Hide file tree
Showing 16 changed files with 430 additions and 548 deletions.
Expand Up @@ -21,8 +21,6 @@
import io.apiman.manager.api.beans.idm.UserBean;
import io.apiman.manager.api.beans.search.SearchCriteriaBean;
import io.apiman.manager.api.beans.search.SearchResultsBean;
import io.apiman.manager.api.core.exceptions.AlreadyExistsException;
import io.apiman.manager.api.core.exceptions.DoesNotExistException;
import io.apiman.manager.api.core.exceptions.StorageException;

import java.util.Set;
Expand All @@ -45,25 +43,22 @@ public interface IIdmStorage {
* Creates a user in the IDM system.
* @param user
* @throws StorageException
* @throws AlreadyExistsException
*/
public void createUser(UserBean user) throws StorageException, AlreadyExistsException;
public void createUser(UserBean user) throws StorageException;

/**
* Gets a user by id.
* @param userId
* @throws StorageException
* @throws DoesNotExistException
*/
public UserBean getUser(String userId) throws StorageException, DoesNotExistException;
public UserBean getUser(String userId) throws StorageException;

/**
* Updates the personal information about a user.
* @param user
* @throws StorageException
* @throws DoesNotExistException
*/
public void updateUser(UserBean user) throws StorageException, DoesNotExistException;
public void updateUser(UserBean user) throws StorageException;

/**
* Returns a list of users that match the given search criteria.
Expand All @@ -78,34 +73,30 @@ public interface IIdmStorage {
* memberhip in those roles will grant.
* @param role
* @throws StorageException
* @throws AlreadyExistsException
*/
public void createRole(RoleBean role) throws StorageException, AlreadyExistsException;
public void createRole(RoleBean role) throws StorageException;

/**
* Gets a role by id.
* @param roleId
* @throws StorageException
* @throws DoesNotExistException
*/
public RoleBean getRole(String roleId) throws StorageException, DoesNotExistException;
public RoleBean getRole(String roleId) throws StorageException;

/**
* Updates a single role (typically with new permissions).
* @param role
* @throws StorageException
* @throws AlreadyExistsException
*/
public void updateRole(RoleBean role) throws StorageException, DoesNotExistException;
public void updateRole(RoleBean role) throws StorageException;

/**
* Deletes a role from the system. This would also remove all memberships in
* that role. This should be done very infrequently!
* @param role
* @throws StorageException
* @throws DoesNotExistException
*/
public void deleteRole(RoleBean role) throws StorageException, DoesNotExistException;
public void deleteRole(RoleBean role) throws StorageException;

/**
* Returns a list of users that match the given search criteria.
Expand All @@ -118,19 +109,17 @@ public interface IIdmStorage {
* Grants membership into a role for a user.
* @param membership
* @throws StorageException
* @throws AlreadyExistsException
*/
public void createMembership(RoleMembershipBean membership) throws StorageException, AlreadyExistsException;
public void createMembership(RoleMembershipBean membership) throws StorageException;

/**
* Deletes a single membership.
* @param userId
* @param roleId
* @param organizationId
* @throws StorageException
* @throws DoesNotExistException
*/
public void deleteMembership(String userId, String roleId, String organizationId) throws StorageException, DoesNotExistException;
public void deleteMembership(String userId, String roleId, String organizationId) throws StorageException;

/**
* Deletes all role memberships for a user in a given organization.
Expand Down
Expand Up @@ -28,8 +28,6 @@
import io.apiman.manager.api.beans.policies.PolicyDefinitionBean;
import io.apiman.manager.api.beans.services.ServiceBean;
import io.apiman.manager.api.beans.services.ServiceVersionBean;
import io.apiman.manager.api.core.exceptions.AlreadyExistsException;
import io.apiman.manager.api.core.exceptions.DoesNotExistException;
import io.apiman.manager.api.core.exceptions.StorageException;

/**
Expand All @@ -51,69 +49,69 @@ public interface IStorage {
* Various creation methods. These are called by the REST layer to create stuff.
*/

public void createOrganization(OrganizationBean organization) throws StorageException, AlreadyExistsException;
public void createApplication(ApplicationBean application) throws StorageException, AlreadyExistsException;
public void createApplicationVersion(ApplicationVersionBean version) throws StorageException, AlreadyExistsException;
public void createContract(ContractBean contract) throws StorageException, AlreadyExistsException;
public void createService(ServiceBean service) throws StorageException, AlreadyExistsException;
public void createServiceVersion(ServiceVersionBean version) throws StorageException, AlreadyExistsException;
public void createPlan(PlanBean plan) throws StorageException, AlreadyExistsException;
public void createPlanVersion(PlanVersionBean version) throws StorageException, AlreadyExistsException;
public void createPolicy(PolicyBean policy) throws StorageException, AlreadyExistsException;
public void createGateway(GatewayBean gateway) throws StorageException, AlreadyExistsException;
public void createPolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException, AlreadyExistsException;
public void createRole(RoleBean role) throws StorageException, AlreadyExistsException;
public void createOrganization(OrganizationBean organization) throws StorageException;
public void createApplication(ApplicationBean application) throws StorageException;
public void createApplicationVersion(ApplicationVersionBean version) throws StorageException;
public void createContract(ContractBean contract) throws StorageException;
public void createService(ServiceBean service) throws StorageException;
public void createServiceVersion(ServiceVersionBean version) throws StorageException;
public void createPlan(PlanBean plan) throws StorageException;
public void createPlanVersion(PlanVersionBean version) throws StorageException;
public void createPolicy(PolicyBean policy) throws StorageException;
public void createGateway(GatewayBean gateway) throws StorageException;
public void createPolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException;
public void createRole(RoleBean role) throws StorageException;
public void createAuditEntry(AuditEntryBean entry) throws StorageException;

/*
* Various update methods. These are called by the REST layer to update stuff.
*/

public void updateOrganization(OrganizationBean organization) throws StorageException, DoesNotExistException;
public void updateApplication(ApplicationBean application) throws StorageException, DoesNotExistException;
public void updateApplicationVersion(ApplicationVersionBean version) throws StorageException, DoesNotExistException;
public void updateContract(ContractBean contract) throws StorageException, DoesNotExistException;
public void updateService(ServiceBean service) throws StorageException, DoesNotExistException;
public void updateServiceVersion(ServiceVersionBean version) throws StorageException, DoesNotExistException;
public void updatePlan(PlanBean plan) throws StorageException, DoesNotExistException;
public void updatePlanVersion(PlanVersionBean version) throws StorageException, DoesNotExistException;
public void updatePolicy(PolicyBean policy) throws StorageException, DoesNotExistException;
public void updateGateway(GatewayBean gateway) throws StorageException, DoesNotExistException;
public void updatePolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException, DoesNotExistException;
public void updateRole(RoleBean role) throws StorageException, DoesNotExistException;
public void updateOrganization(OrganizationBean organization) throws StorageException;
public void updateApplication(ApplicationBean application) throws StorageException;
public void updateApplicationVersion(ApplicationVersionBean version) throws StorageException;
public void updateContract(ContractBean contract) throws StorageException;
public void updateService(ServiceBean service) throws StorageException;
public void updateServiceVersion(ServiceVersionBean version) throws StorageException;
public void updatePlan(PlanBean plan) throws StorageException;
public void updatePlanVersion(PlanVersionBean version) throws StorageException;
public void updatePolicy(PolicyBean policy) throws StorageException;
public void updateGateway(GatewayBean gateway) throws StorageException;
public void updatePolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException;
public void updateRole(RoleBean role) throws StorageException;

/*
* Various delete methods. These are called by the REST layer to delete stuff.
*/

public void deleteOrganization(OrganizationBean organization) throws StorageException, DoesNotExistException;
public void deleteApplication(ApplicationBean application) throws StorageException, DoesNotExistException;
public void deleteApplicationVersion(ApplicationVersionBean version) throws StorageException, DoesNotExistException;
public void deleteContract(ContractBean contract) throws StorageException, DoesNotExistException;
public void deleteService(ServiceBean service) throws StorageException, DoesNotExistException;
public void deleteServiceVersion(ServiceVersionBean version) throws StorageException, DoesNotExistException;
public void deletePlan(PlanBean plan) throws StorageException, DoesNotExistException;
public void deletePlanVersion(PlanVersionBean version) throws StorageException, DoesNotExistException;
public void deletePolicy(PolicyBean policy) throws StorageException, DoesNotExistException;
public void deleteGateway(GatewayBean gateway) throws StorageException, DoesNotExistException;
public void deletePolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException, DoesNotExistException;
public void deleteRole(RoleBean role) throws StorageException, DoesNotExistException;
public void deleteOrganization(OrganizationBean organization) throws StorageException;
public void deleteApplication(ApplicationBean application) throws StorageException;
public void deleteApplicationVersion(ApplicationVersionBean version) throws StorageException;
public void deleteContract(ContractBean contract) throws StorageException;
public void deleteService(ServiceBean service) throws StorageException;
public void deleteServiceVersion(ServiceVersionBean version) throws StorageException;
public void deletePlan(PlanBean plan) throws StorageException;
public void deletePlanVersion(PlanVersionBean version) throws StorageException;
public void deletePolicy(PolicyBean policy) throws StorageException;
public void deleteGateway(GatewayBean gateway) throws StorageException;
public void deletePolicyDefinition(PolicyDefinitionBean policyDef) throws StorageException;
public void deleteRole(RoleBean role) throws StorageException;

/*
* Various get methods. These are called by the REST layer to get stuff.
*/

public OrganizationBean getOrganization(String id) throws StorageException, DoesNotExistException;
public ApplicationBean getApplication(String organizationId, String id) throws StorageException, DoesNotExistException;
public ApplicationVersionBean getApplicationVersion(String organizationId, String applicationId, String version) throws StorageException, DoesNotExistException;
public ContractBean getContract(Long id) throws StorageException, DoesNotExistException;
public ServiceBean getService(String organizationId, String id) throws StorageException, DoesNotExistException;
public ServiceVersionBean getServiceVersion(String organizationId, String serviceId, String version) throws StorageException, DoesNotExistException;
public PlanBean getPlan(String organizationId, String id) throws StorageException, DoesNotExistException;
public PlanVersionBean getPlanVersion(String organizationId, String planId, String version) throws StorageException, DoesNotExistException;
public PolicyBean getPolicy(Long id) throws StorageException, DoesNotExistException;
public GatewayBean getGateway(String id) throws StorageException, DoesNotExistException;
public PolicyDefinitionBean getPolicyDefinition(String id) throws StorageException, DoesNotExistException;
public RoleBean getRole(String id) throws StorageException, DoesNotExistException;
public OrganizationBean getOrganization(String id) throws StorageException;
public ApplicationBean getApplication(String organizationId, String id) throws StorageException;
public ApplicationVersionBean getApplicationVersion(String organizationId, String applicationId, String version) throws StorageException;
public ContractBean getContract(Long id) throws StorageException;
public ServiceBean getService(String organizationId, String id) throws StorageException;
public ServiceVersionBean getServiceVersion(String organizationId, String serviceId, String version) throws StorageException;
public PlanBean getPlan(String organizationId, String id) throws StorageException;
public PlanVersionBean getPlanVersion(String organizationId, String planId, String version) throws StorageException;
public PolicyBean getPolicy(Long id) throws StorageException;
public GatewayBean getGateway(String id) throws StorageException;
public PolicyDefinitionBean getPolicyDefinition(String id) throws StorageException;
public RoleBean getRole(String id) throws StorageException;

}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f6912c4

Please sign in to comment.