net.sf.sail.webapp.service.workgroup.impl
Class WorkgroupServiceImpl

java.lang.Object
  extended by net.sf.sail.webapp.service.workgroup.impl.WorkgroupServiceImpl
All Implemented Interfaces:
WorkgroupService
Direct Known Subclasses:
WISEWorkgroupServiceImpl

public class WorkgroupServiceImpl
extends Object
implements WorkgroupService

Version:
$Id$
Author:
Cynick Young

Field Summary
protected  AclService<Workgroup> aclService
           
protected  GroupDao<Group> groupDao
           
protected  OfferingService offeringService
           
protected  SdsWorkgroupDao sdsWorkgroupDao
           
protected  UserService userService
           
protected  WorkgroupDao<Workgroup> workgroupDao
           
 
Constructor Summary
WorkgroupServiceImpl()
           
 
Method Summary
 void addMembers(Workgroup workgroup, Set<User> membersToAdd)
          Adds members to an already-existing workgroup.
 List<Workgroup> createPreviewWorkgroupForOfferingIfNecessary(Offering offering, List<Workgroup> workgroupList, User user, String previewWorkgroupName)
          Given a list of workgroups for a particular offering, if the list is empty (i.e.
protected  SdsWorkgroup createSdsWorkgroup(String name, Set<User> members, Offering offering)
          Creates and returns a SdsWorkgroup given parameters
protected  Workgroup createWorkgroup(Set<User> members, Offering offering, SdsWorkgroup sdsWorkgroup)
          Creates and returns a Workgroup given parameters
 Workgroup createWorkgroup(String name, Set<User> members, Offering offering)
          Creates a new SdsWorkgroup on the SDS as well as a Workgroup object in the local data store, and then associates that workgroup to an offering.
 Workgroup getPreviewWorkgroupForRooloOffering(Offering previewOffering, User previewUser)
          Creates a workgroup for a preview offering.
 Workgroup getWorkgroupForPreviewOffering(Offering previewOffering, User previewUser)
          Given a PreviewOffering, returns a workgroup that is used to preview it If a workgroup has not been created yet, a new workgroup is created with a default preview user
 List<Workgroup> getWorkgroupList()
          Gets a List of workgroups available.
 List<Workgroup> getWorkgroupListByOfferingAndUser(Offering offering, User user)
          Gets a List of workgroups for a given offering with the specified user as a member of that workgroup.
 List<Workgroup> getWorkgroupsForUser(User user)
          Given a User, returns all of the workgroups that the user is in
 void removeMembers(Workgroup workgroup, Set<User> membersToRemove)
          Removes members from an already-existing workgroup.
 Workgroup retrieveById(Long workgroupId)
          Retrieves the Workgroup domain object using unique workgroupId
 void setAclService(AclService<Workgroup> aclService)
           
 void setGroupDao(GroupDao<Group> groupDao)
           
 void setOfferingService(OfferingService offeringService)
           
 void setSdsWorkgroupDao(SdsWorkgroupDao sdsWorkgroupDao)
           
 void setUserService(UserService userService)
           
 void setWorkgroupDao(WorkgroupDao<Workgroup> workgroupDao)
           
 Workgroup updateWorkgroupMembership(ChangeWorkgroupParameters params)
          Updates the Workgroups by modifying its members
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sdsWorkgroupDao

protected SdsWorkgroupDao sdsWorkgroupDao

workgroupDao

protected WorkgroupDao<Workgroup> workgroupDao

groupDao

protected GroupDao<Group> groupDao

offeringService

protected OfferingService offeringService

aclService

protected AclService<Workgroup> aclService

userService

protected UserService userService
Constructor Detail

WorkgroupServiceImpl

public WorkgroupServiceImpl()
Method Detail

setAclService

public void setAclService(AclService<Workgroup> aclService)
Parameters:
aclService - the aclService to set

setSdsWorkgroupDao

public void setSdsWorkgroupDao(SdsWorkgroupDao sdsWorkgroupDao)
Parameters:
sdsWorkgroupDao - the sdsWorkgroupDao to set

setWorkgroupDao

public void setWorkgroupDao(WorkgroupDao<Workgroup> workgroupDao)
Parameters:
workgroupDao - the workgroupDao to set

createWorkgroup

@Transactional(rollbackFor=HttpStatusCodeException.class)
public Workgroup createWorkgroup(String name,
                                                                            Set<User> members,
                                                                            Offering offering)
Description copied from interface: WorkgroupService
Creates a new SdsWorkgroup on the SDS as well as a Workgroup object in the local data store, and then associates that workgroup to an offering. A side effect is that the workgroup id is set to the value that the SDS assigns to the new workgroup.

Specified by:
createWorkgroup in interface WorkgroupService
Parameters:
name - String name of the workgroup you want to create
offering - The offering to associate the workgroup to
Returns:
a Workgroup that is created.
See Also:
net.sf.sail.webapp.service.workgroup.WorkgroupService#createWorkgroup(net.sf.sail.webapp.domain.Workgroup, net.sf.sail.webapp.domain.Offering)

createWorkgroup

protected Workgroup createWorkgroup(Set<User> members,
                                    Offering offering,
                                    SdsWorkgroup sdsWorkgroup)
Creates and returns a Workgroup given parameters

Parameters:
members - Set of users in this SdsWorkgroup
offering - which Offering this workgroup belongs in
sdsWorkgroup - SdsWorkgroupReturns:
created Workgroup

createSdsWorkgroup

protected SdsWorkgroup createSdsWorkgroup(String name,
                                          Set<User> members,
                                          Offering offering)
Creates and returns a SdsWorkgroup given parameters

Parameters:
name - what this SdsWorkgroup is called
members - Set of users in this SdsWorkgroup
offering - which Offering this workgroup belongs in
Returns:
created SdsWorkgroup

getWorkgroupList

@Transactional(readOnly=true)
public List<Workgroup> getWorkgroupList()
Description copied from interface: WorkgroupService
Gets a List of workgroups available.

Specified by:
getWorkgroupList in interface WorkgroupService
Returns:
a Workgroup List.
See Also:
net.sf.sail.webapp.service.workgroup.WorkgroupService#getWorkgroupIterator()

getWorkgroupListByOfferingAndUser

@Transactional(readOnly=true)
public List<Workgroup> getWorkgroupListByOfferingAndUser(Offering offering,
                                                                       User user)
Description copied from interface: WorkgroupService
Gets a List of workgroups for a given offering with the specified user as a member of that workgroup.

Specified by:
getWorkgroupListByOfferingAndUser in interface WorkgroupService
Parameters:
offering - for the workgroup
user - that is a member of the workgroup
Returns:
See Also:
WorkgroupService.getWorkgroupListByOfferingAndUser(net.sf.sail.webapp.domain.Offering, net.sf.sail.webapp.domain.User)

getWorkgroupsForUser

@Transactional(readOnly=true)
public List<Workgroup> getWorkgroupsForUser(User user)
Description copied from interface: WorkgroupService
Given a User, returns all of the workgroups that the user is in

Specified by:
getWorkgroupsForUser in interface WorkgroupService
Parameters:
user - the User to search for
Returns:
a list of workgroups that the specified user is in.
See Also:
WorkgroupService.getWorkgroupsForUser(net.sf.sail.webapp.domain.User)

createPreviewWorkgroupForOfferingIfNecessary

@Transactional(rollbackFor=HttpStatusCodeException.class)
public List<Workgroup> createPreviewWorkgroupForOfferingIfNecessary(Offering offering,
                                                                                                               List<Workgroup> workgroupList,
                                                                                                               User user,
                                                                                                               String previewWorkgroupName)
Description copied from interface: WorkgroupService
Given a list of workgroups for a particular offering, if the list is empty (i.e. there are no workgroups), then create a default "preview" workgroup with just the user in it. If there exists workgroups already, then do nothing.

Specified by:
createPreviewWorkgroupForOfferingIfNecessary in interface WorkgroupService
Parameters:
offering - the given offering associated with the workgroups
workgroupList - List of workgroups belonging to the given offering
user - the User that should be put into the preview workgroup
previewWorkgroupName - String that specifies the default preview workgroup name
Returns:
See Also:
net.sf.sail.webapp.service.workgroup.WorkgroupService#createPreviewWorkgroupForOfferingIfNecessary(net.sf.sail.webapp.domain.Offering, java.util.List, net.sf.sail.webapp.domain.User)

getWorkgroupForPreviewOffering

@Transactional(rollbackFor=HttpStatusCodeException.class)
public Workgroup getWorkgroupForPreviewOffering(Offering previewOffering,
                                                                                           User previewUser)
Description copied from interface: WorkgroupService
Given a PreviewOffering, returns a workgroup that is used to preview it If a workgroup has not been created yet, a new workgroup is created with a default preview user

Specified by:
getWorkgroupForPreviewOffering in interface WorkgroupService
Returns:
workgroup
See Also:
net.sf.sail.webapp.service.workgroup.WorkgroupService#getWorkgroupForPreviewOffering(net.sf.sail.webapp.domain.Offering)

getPreviewWorkgroupForRooloOffering

@Transactional(rollbackFor=HttpStatusCodeException.class)
public Workgroup getPreviewWorkgroupForRooloOffering(Offering previewOffering,
                                                                                                User previewUser)
Description copied from interface: WorkgroupService
Creates a workgroup for a preview offering.

Specified by:
getPreviewWorkgroupForRooloOffering in interface WorkgroupService
Returns:
Workgroup
See Also:
WorkgroupService.getPreviewWorkgroupForRooloOffering(net.sf.sail.webapp.domain.Offering, net.sf.sail.webapp.domain.User)

addMembers

@Transactional
public void addMembers(Workgroup workgroup,
                                     Set<User> membersToAdd)
Description copied from interface: WorkgroupService
Adds members to an already-existing workgroup. If a member is already in the group, do not add again. Also update the workgroup name.

Specified by:
addMembers in interface WorkgroupService
Parameters:
workgroup - an existing Workgroup that the members will be added to
membersToAdd - Set of users to add to the group
See Also:
WorkgroupService.addMembers(net.sf.sail.webapp.domain.Workgroup, java.util.Set)

removeMembers

@Transactional
public void removeMembers(Workgroup workgroup,
                                        Set<User> membersToRemove)
Description copied from interface: WorkgroupService
Removes members from an already-existing workgroup. Also update the workgroup name.

Specified by:
removeMembers in interface WorkgroupService
Parameters:
workgroup - an existing Workgroup that the members will be removed from
membersToRemove - Set of users to remove from the group
See Also:
WorkgroupService.removeMembers(Workgroup, Set)

updateWorkgroupMembership

@Transactional
public Workgroup updateWorkgroupMembership(ChangeWorkgroupParameters params)
                                    throws Exception
Description copied from interface: WorkgroupService
Updates the Workgroups by modifying its members

Specified by:
updateWorkgroupMembership in interface WorkgroupService
Throws:
Exception
See Also:
net.sf.sail.webapp.service.workgroup.WorkgroupService#updateWorkgroupMembership(net.sf.sail.webapp.domain.User, net.sf.sail.webapp.domain.Workgroup, net.sf.sail.webapp.domain.Workgroup)

retrieveById

public Workgroup retrieveById(Long workgroupId)
                       throws ObjectNotFoundException
Description copied from interface: WorkgroupService
Retrieves the Workgroup domain object using unique workgroupId

Specified by:
retrieveById in interface WorkgroupService
Parameters:
workgroupId - Long workgroupId to use for lookup
Returns:
Workgroup the Workgroup object with the workgroupId
Throws:
ObjectNotFoundException
See Also:
WorkgroupService.retrieveById(Long)

setOfferingService

public void setOfferingService(OfferingService offeringService)
Parameters:
offeringService - the offeringService to set

setGroupDao

public void setGroupDao(GroupDao<Group> groupDao)
Parameters:
groupDao - the groupDao to set

setUserService

public void setUserService(UserService userService)
Parameters:
userService - the userService to set


Copyright © 2012. All Rights Reserved.