public class StateRelationshipComposite<U extends AppUser,BDO extends DataObject,X extends StateRelationshipComposite> extends Composite<BDO,X> implements AccessRoleProvider<U,BDO>
SessionServices have
a corresponding relationship with the target.
This is used in AND combination with other relationships to allow the other relationship to
be activated on a per-target basis.
The class can be sub-classed to include multiple instances for different fields as it
registers under its actual class.| Modifier and Type | Class and Description |
|---|---|
class |
StateRelationshipComposite.Filter |
class |
StateRelationshipComposite.PersonFilter<U extends AppUser> |
| Modifier | Constructor and Description |
|---|---|
protected |
StateRelationshipComposite(DataObjectFactory<BDO> fac,
java.lang.String field) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRelationships(java.util.Set<java.lang.String> roles)
Add known roles to a set.
|
java.util.Map<java.lang.String,Selector> |
addSelectors(java.util.Map<java.lang.String,Selector> selectors)
Get a Map of selectors to use for forms of this type.
|
java.util.Map<java.lang.String,java.lang.String> |
addTranslations(java.util.Map<java.lang.String,java.lang.String> translations)
return a default set of translation between field names and text labels.
|
protected boolean |
getDefault() |
protected java.lang.Class<? super X> |
getType()
Returns the type the composite should be registered under.
|
BaseFilter<BDO> |
hasRelationFilter(java.lang.String role,
U u)
Get a
BaseFilter corresponding to target objects where the given user has
the specified relation. |
TableSpecification |
modifyDefaultTableSpecification(TableSpecification spec,
java.lang.String table)
Modify the
TableSpecification of the target factory. |
BaseFilter<U> |
personInRelationFilter(SessionService<U> sess,
java.lang.String role,
BDO target)
Get a
BaseFilter for AppUsers that are in the specified relationship with
the target object. |
boolean |
providesRelationship(java.lang.String role)
Does this class provide the named relationship.
|
addDefaults, addFieldHelp, addOptional, addSuppress, customiseForm, customiseUpdateForm, getContext, getFactory, getLogger, getRecord, getRepository, postUpdate, preRegister, release, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddFieldConstraints, addFormFieldsprotected StateRelationshipComposite(DataObjectFactory<BDO> fac, java.lang.String field)
fac - protected java.lang.Class<? super X> getType()
CompositegetType in class Composite<BDO extends DataObject,X extends StateRelationshipComposite>public BaseFilter<BDO> hasRelationFilter(java.lang.String role, U u)
AccessRoleProviderBaseFilter corresponding to target objects where the given user has
the specified relation.
If the method returns null then the role is not recognised by the provider.
A non-null result means the role is recognised but does not imply
that any target will match. The relation with a specific target object can be tested using
DataObjectFactory.matches(BaseFilter, DataObject)
This method should not be called directly only via a call to SessionService.getRelationshipRoleFilter(DataObjectFactory, String)
to allow the SessionService to combine and customise access rules.hasRelationFilter in interface AccessRoleProvider<U extends AppUser,BDO extends DataObject>BaseFilter or nullpublic TableSpecification modifyDefaultTableSpecification(TableSpecification spec, java.lang.String table)
TableStructureContributerTableSpecification of the target factory.modifyDefaultTableSpecification in interface TableStructureContributer<BDO extends DataObject>modifyDefaultTableSpecification in class Composite<BDO extends DataObject,X extends StateRelationshipComposite>protected boolean getDefault()
public java.util.Map<java.lang.String,java.lang.String> addTranslations(java.util.Map<java.lang.String,java.lang.String> translations)
TableStructureContributeraddTranslations in interface TableStructureContributer<BDO extends DataObject>addTranslations in class Composite<BDO extends DataObject,X extends StateRelationshipComposite>Mappublic java.util.Map<java.lang.String,Selector> addSelectors(java.util.Map<java.lang.String,Selector> selectors)
TableStructureContributeraddSelectors in interface TableStructureContributer<BDO extends DataObject>addSelectors in class Composite<BDO extends DataObject,X extends StateRelationshipComposite>Map of modified selectors/inputspublic BaseFilter<U> personInRelationFilter(SessionService<U> sess, java.lang.String role, BDO target)
AccessRoleProviderBaseFilter for AppUsers that are in the specified relationship with
the target object.
This is the inverse of #hasRelationFilter(SessionService, String) used to generate a list
of AppUser with the relation. It can always be implemented (inefficiently) by creating an AcceptFilter
that uses AccessRoleProvider.hasRelationFilter(String, AppUser) to check each person in turn but though it is usually possible to find some SQLFilter
to narrow the selection first even if a full SQL implementation is not possible.
If the target is null it should generate a filter for any user in relation with targets
selected by DataObjectFactory.getDefaultRelationshipFilter(). If this is not possible
it should return null;personInRelationFilter in interface AccessRoleProvider<U extends AppUser,BDO extends DataObject>BaseFilter or nullpublic boolean providesRelationship(java.lang.String role)
AccessRoleProviderprovidesRelationship in interface AccessRoleProvider<U extends AppUser,BDO extends DataObject>public void addRelationships(java.util.Set<java.lang.String> roles)
AccessRoleProvideraddRelationships in interface AccessRoleProvider<U extends AppUser,BDO extends DataObject>