ccc.domain
Class GroupEntity

java.lang.Object
  extended by ccc.domain.Entity
      extended by ccc.domain.Principal
          extended by ccc.domain.GroupEntity
All Implemented Interfaces:
Jsonable, java.io.Serializable

public class GroupEntity
extends Principal

A security group.

Author:
Civic Computing Ltd.
See Also:
Serialized Form

Constructor Summary
protected GroupEntity()
          Constructor: for persistence only.
  GroupEntity(java.lang.String name, java.lang.String... permissions)
          Constructor.
 
Method Summary
 Group createDto()
          Create a DTO for this group.
 java.util.Set<java.lang.String> getPermissions()
          Accessor.
 boolean hasPermission(java.lang.String permission)
          Query - determine whether this group has the specified permission.
 boolean includes(UserEntity user)
          Check if the specified user is included by this principal.
static java.util.List<Group> map(java.util.Collection<GroupEntity> groups)
          Map a list of groups to a list of group DTOs.
 void setPermissions(java.util.Set<java.lang.String> permissions)
          Mutator.
 
Methods inherited from class ccc.domain.Principal
getName, setName
 
Methods inherited from class ccc.domain.Entity
equals, getId, getVersion, hashCode, setId, toJson, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupEntity

protected GroupEntity()
Constructor: for persistence only.


GroupEntity

public GroupEntity(java.lang.String name,
                   java.lang.String... permissions)
Constructor.

Parameters:
name - The group's name.
permissions - The group's permissions.
Method Detail

getPermissions

public final java.util.Set<java.lang.String> getPermissions()
Accessor.

Returns:
Returns the permissions.

setPermissions

public final void setPermissions(java.util.Set<java.lang.String> permissions)
Mutator.

Parameters:
permissions - The permissions to set.

hasPermission

public boolean hasPermission(java.lang.String permission)
Query - determine whether this group has the specified permission.

Parameters:
permission - The permission name.
Returns:
True if the group has this permission; false otherwise.

createDto

public Group createDto()
Create a DTO for this group.

Returns:
A DTO representing this group.

map

public static java.util.List<Group> map(java.util.Collection<GroupEntity> groups)
Map a list of groups to a list of group DTOs.

Parameters:
groups - The groups to map.
Returns:
The corresponding DTOs.

includes

public boolean includes(UserEntity user)
Check if the specified user is included by this principal.

Specified by:
includes in class Principal
Parameters:
user - The user to check.
Returns:
True if the user is included; false otherwise.


Copyright © 2010. All Rights Reserved.