org.eclipse.emf.emfstore.internal.server.core
Class AdminEmfStoreImpl

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.server.core.AbstractEmfstoreInterface
      extended by org.eclipse.emf.emfstore.internal.server.core.AdminEmfStoreImpl
All Implemented Interfaces:
AdminEmfStore, EMFStoreInterface

public class AdminEmfStoreImpl
extends AbstractEmfstoreInterface
implements AdminEmfStore

Implementation of AdminEmfStore interface.

Author:
wesendon

Constructor Summary
AdminEmfStoreImpl(ACDAOFacade daoFacade, ServerSpace serverSpace, AuthorizationControl authorizationControl)
          Default constructor.
 
Method Summary
 void addInitialParticipant(SessionId sessionId, ProjectId projectId, ACOrgUnitId participantId, org.eclipse.emf.ecore.EClass roleClass)
          Adds an organization unit to a project.
 void addMember(SessionId sessionId, ACOrgUnitId group, ACOrgUnitId member)
          Adds an orgUnit to a group.
 void addParticipant(SessionId sessionId, ProjectId projectId, ACOrgUnitId participantId, org.eclipse.emf.ecore.EClass roleClass)
          Adds an organization unit to a project.
 void assignRole(SessionId sessionId, ACOrgUnitId orgUnitId, org.eclipse.emf.ecore.EClass roleClass)
          Assigns a role for an orgUnit without a project.
 void changeOrgUnit(SessionId sessionId, ACOrgUnitId orgUnitId, String name, String description)
          Changes the orgUnit's name and description.
 void changeRole(SessionId sessionId, ProjectId projectId, ACOrgUnitId orgUnitId, org.eclipse.emf.ecore.EClass roleClass)
          Changes the role for an orgUnit in a specified project.
 void changeUser(SessionId sessionId, ACOrgUnitId userId, String name, String password)
          Changes the name and password of an ACUser.
 ACOrgUnitId createGroup(SessionId sessionId, String name)
          Creates a group on the server.
 ACOrgUnitId createUser(SessionId sessionId, String name)
          Creates a user on the server.
 void deleteGroup(SessionId sessionId, ACOrgUnitId groupId)
          Deletes a group on the server.
 void deleteUser(SessionId sessionId, ACOrgUnitId userId)
          Deletes a user from the server.
 List<ACGroup> getGroups(SessionId sessionId)
          Returns all groups on the server.
 List<ACGroup> getGroups(SessionId sessionId, ACOrgUnitId orgUnitId)
          Returns a list of all groups in which the specified user is member of.
 List<ACOrgUnit> getMembers(SessionId sessionId, ACOrgUnitId groupId)
          Returns all members from a group.
 ACOrgUnit getOrgUnit(SessionId sessionId, ACOrgUnitId orgUnitId)
          Returns an orgUnit with the specified orgUnitId.
 List<ACOrgUnit> getOrgUnits(SessionId sessionId)
          Returns all orgUnits on the server.
 List<ACOrgUnit> getParticipants(SessionId sessionId, ProjectId projectId)
          Returns all orgUnits which are attached to the given project.
 List<ProjectInfo> getProjectInfos(SessionId sessionId)
          Returns a list of available project.
 Role getRole(SessionId sessionId, ProjectId projectId, ACOrgUnitId orgUnitId)
          Returns an orgUnit's role for a specified project.
 List<ACUser> getUsers(SessionId sessionId)
          Returns all users on the server.
 void removeGroup(SessionId sessionId, ACOrgUnitId user, ACOrgUnitId group)
          Removes a user from a group.
 void removeMember(SessionId sessionId, ACOrgUnitId group, ACOrgUnitId member)
          Removes a orgUnit from a group.
 void removeParticipant(SessionId sessionId, ProjectId projectId, ACOrgUnitId participantId)
          Removes an orgUnits from a project.
 
Methods inherited from class org.eclipse.emf.emfstore.internal.server.core.AbstractEmfstoreInterface
runCommand
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdminEmfStoreImpl

public AdminEmfStoreImpl(ACDAOFacade daoFacade,
                         ServerSpace serverSpace,
                         AuthorizationControl authorizationControl)
                  throws FatalESException
Default constructor.

Parameters:
daoFacade - provider facade for access control related DAOs
serverSpace - the server space
authorizationControl - the authorization control
Throws:
FatalESException - in case of failure
Method Detail

getGroups

public List<ACGroup> getGroups(SessionId sessionId)
                        throws ESException
Returns all groups on the server.

Specified by:
getGroups in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
Returns:
list of groups
Throws:
ESException - if any error in the EmfStore occurs

getGroups

public List<ACGroup> getGroups(SessionId sessionId,
                               ACOrgUnitId orgUnitId)
                        throws ESException
Returns a list of all groups in which the specified user is member of.

Specified by:
getGroups in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
orgUnitId - the users orgUnitId
Returns:
a list of groups
Throws:
ESException - if any error in the EmfStore occurs

createGroup

public ACOrgUnitId createGroup(SessionId sessionId,
                               String name)
                        throws ESException
Creates a group on the server.

Specified by:
createGroup in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
name - the name for the group
Returns:
ACOrgUnitId
Throws:
ESException - if any error in the EmfStore occurs

removeGroup

public void removeGroup(SessionId sessionId,
                        ACOrgUnitId user,
                        ACOrgUnitId group)
                 throws ESException
Removes a user from a group.

Specified by:
removeGroup in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
user - the user's orgUnitId
group - the group's orgUnitId
Throws:
ESException - if any error in the EmfStore occurs

deleteGroup

public void deleteGroup(SessionId sessionId,
                        ACOrgUnitId groupId)
                 throws ESException
Deletes a group on the server.

Specified by:
deleteGroup in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
groupId - orgUnitId of the group
Throws:
ESException - if any error in the EmfStore occurs

getMembers

public List<ACOrgUnit> getMembers(SessionId sessionId,
                                  ACOrgUnitId groupId)
                           throws ESException
Returns all members from a group.

Specified by:
getMembers in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
groupId - the group's orgUnitId
Returns:
a list of orgUnits
Throws:
ESException - if any error in the EmfStore occurs.

addMember

public void addMember(SessionId sessionId,
                      ACOrgUnitId group,
                      ACOrgUnitId member)
               throws ESException
Adds an orgUnit to a group.

Specified by:
addMember in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
group - the group's orgUnitId
member - the members orgUnitId
Throws:
ESException - if any error in the EmfStore occurs

removeMember

public void removeMember(SessionId sessionId,
                         ACOrgUnitId group,
                         ACOrgUnitId member)
                  throws ESException
Removes a orgUnit from a group.

Specified by:
removeMember in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
group - the group's orgUnitId
member - the members orgUnitId
Throws:
ESException - if any error in the EmfStore occurs

getParticipants

public List<ACOrgUnit> getParticipants(SessionId sessionId,
                                       ProjectId projectId)
                                throws ESException
Returns all orgUnits which are attached to the given project.

Specified by:
getParticipants in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
projectId - project's id
Returns:
a list of orgUnits
Throws:
ESException - if any error in the EmfStore occurs

addParticipant

public void addParticipant(SessionId sessionId,
                           ProjectId projectId,
                           ACOrgUnitId participantId,
                           org.eclipse.emf.ecore.EClass roleClass)
                    throws ESException
Adds an organization unit to a project.

Specified by:
addParticipant in interface AdminEmfStore
Parameters:
sessionId - the SessionId for authentication
projectId - the ProjectId of the project
participantId - the ACOrgUnitId of the participant
roleClass - the role to be assigned to the participant
Throws:
ESException - if any error in the EmfStore occurs

addInitialParticipant

public void addInitialParticipant(SessionId sessionId,
                                  ProjectId projectId,
                                  ACOrgUnitId participantId,
                                  org.eclipse.emf.ecore.EClass roleClass)
                           throws ESException
Adds an organization unit to a project.

Specified by:
addInitialParticipant in interface AdminEmfStore
Parameters:
sessionId - the SessionId for authentication
projectId - the ProjectId of the project
participantId - the ACOrgUnitId of the participant
roleClass - the role to be assigned to the participant
Throws:
ESException - if any error in the EmfStore occurs

removeParticipant

public void removeParticipant(SessionId sessionId,
                              ProjectId projectId,
                              ACOrgUnitId participantId)
                       throws ESException
Removes an orgUnits from a project.

Specified by:
removeParticipant in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
projectId - the project's id
participantId - the orgUnit's id
Throws:
ESException - if any error in the EmfStore occurs

getRole

public Role getRole(SessionId sessionId,
                    ProjectId projectId,
                    ACOrgUnitId orgUnitId)
             throws ESException
Returns an orgUnit's role for a specified project.

Specified by:
getRole in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
projectId - the project's id
orgUnitId - the orgUnit's id
Returns:
a role the user's role
Throws:
ESException - if any error in the EmfStore occurs

changeRole

public void changeRole(SessionId sessionId,
                       ProjectId projectId,
                       ACOrgUnitId orgUnitId,
                       org.eclipse.emf.ecore.EClass roleClass)
                throws ESException
Changes the role for an orgUnit in a specified project.

Specified by:
changeRole in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
projectId - the project's id
orgUnitId - the orgUnit
roleClass - new role for orgUnit
Throws:
ESException - if any error in the EmfStore occurs.

assignRole

public void assignRole(SessionId sessionId,
                       ACOrgUnitId orgUnitId,
                       org.eclipse.emf.ecore.EClass roleClass)
                throws ESException
Assigns a role for an orgUnit without a project.

Specified by:
assignRole in interface AdminEmfStore
Parameters:
sessionId - the SessionId for authentication
orgUnitId - the ID of an organizational unit
roleClass - the role to be assigned
Throws:
ESException - if an exceptions occurs on the server or on transport

getUsers

public List<ACUser> getUsers(SessionId sessionId)
                      throws ESException
Returns all users on the server.

Specified by:
getUsers in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
Returns:
list of user
Throws:
ESException - if any error in the EmfStore occurs

getOrgUnits

public List<ACOrgUnit> getOrgUnits(SessionId sessionId)
                            throws ESException
Returns all orgUnits on the server.

Specified by:
getOrgUnits in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
Returns:
list of orgUnits
Throws:
ESException - if any error in the EmfStore occurs

getProjectInfos

public List<ProjectInfo> getProjectInfos(SessionId sessionId)
                                  throws ESException
Returns a list of available project.

Specified by:
getProjectInfos in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
Returns:
list of project infos
Throws:
ESException - if any error in the EmfStore occurs

createUser

public ACOrgUnitId createUser(SessionId sessionId,
                              String name)
                       throws ESException
Creates a user on the server.

Specified by:
createUser in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
name - the user's name
Returns:
ACOrgUnitId the ACOrgUnitId of the created user
Throws:
ESException - if any error occurred while creating the user

deleteUser

public void deleteUser(SessionId sessionId,
                       ACOrgUnitId userId)
                throws ESException
Deletes a user from the server.

Specified by:
deleteUser in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
userId - the user's orgUnitId
Throws:
ESException - if any error in the EmfStore occurs

changeOrgUnit

public void changeOrgUnit(SessionId sessionId,
                          ACOrgUnitId orgUnitId,
                          String name,
                          String description)
                   throws ESException
Changes the orgUnit's name and description.

Specified by:
changeOrgUnit in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication.
orgUnitId - the orgUnitId
name - the new name
description - the new description
Throws:
ESException - if any error in the EmfStore occurs

changeUser

public void changeUser(SessionId sessionId,
                       ACOrgUnitId userId,
                       String name,
                       String password)
                throws ESException
Changes the name and password of an ACUser.

Specified by:
changeUser in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication.
userId - the ID of the user
name - the new name
password - the new password
Throws:
ESException - if any error in the EmfStore occurs
See Also:
AdminEmfStore.changeUser(org.eclipse.emf.emfstore.internal.server.model.SessionId, org.eclipse.emf.emfstore.internal.server.model.accesscontrol.ACOrgUnitId, java.lang.String, java.lang.String)

getOrgUnit

public ACOrgUnit getOrgUnit(SessionId sessionId,
                            ACOrgUnitId orgUnitId)
                     throws ESException
Returns an orgUnit with the specified orgUnitId.

Specified by:
getOrgUnit in interface AdminEmfStore
Parameters:
sessionId - the session id for authentication
orgUnitId - the orgUnitId
Returns:
an orgUnit
Throws:
ESException - if any error in the EmfStore occurs


Copyright © 2015. All Rights Reserved.