Refactor CRUD API of Tenant services to be consistent with retuning null and 
throwing checked exceptions
--------------------------------------------------------------------------------------------------------

                 Key: AMDATU-208
                 URL: http://jira.amdatu.org/jira/browse/AMDATU-208
             Project: Amdatu
          Issue Type: Task
          Components: Amdatu Core - Tenant
    Affects Versions: 0.1.0
            Reporter: Ivo Ladage - van Doorn
            Assignee: Bram de Kruijff
             Fix For: 0.1.0


The current CRUD API of the (combined) TenantManagementService and 
TenantStorageProvider uses the following inconsistent approach:

create(id)  -> returns null if an entity with that id already exists
update(id) -> creates a new entity if it didn't exist yet
delete(id)  -> throws checked exception if it doesn't exist
get(id)       ->  returns null if it doesn't exist

I believe this is not consistent and not correct. IMHO this is how a typical 
CRUD API should look like:

create(id)  -> throws checked AlreadyExistsException if an entity with that id 
already exists
update(id) -> throws checked NotFoundException if an entity with that id does 
not exist
delete(id)  -> throws checked NotFoundException if an entity with that id does 
not exist
get(id)       -> returns null OR throws checked NotFoundException if it doesn't 
exist (either of the two seems ok to me) 


-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to