Class BasicLookupStrategy
- All Implemented Interfaces:
- LookupStrategy
 NB: This implementation does attempt to provide reasonably optimised lookups - within
 the constraints of a normalised database and standard ANSI SQL features. If you are
 willing to sacrifice either of these constraints (e.g. use a particular database
 feature such as hierarchical queries or materalized views, or reduce normalisation) you
 are likely to achieve better performance. In such situations you will need to provide
 your own custom LookupStrategy. This class does not support subclassing,
 as it is likely to change in future releases and therefore subclassing is unsupported.
 
There are two SQL queries executed, one in the lookupPrimaryKeys method and one in lookupObjectIdentities. These are built from the same select and "order by" clause, using a different where clause in each case. In order to use custom schema or column names, each of these SQL clauses can be customized, but they must be consistent with each other and with the expected result set generated by the default values.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionBasicLookupStrategy(DataSource dataSource, AclCache aclCache, AclAuthorizationStrategy aclAuthorizationStrategy, AuditLogger auditLogger) Constructor accepting mandatory argumentsBasicLookupStrategy(DataSource dataSource, AclCache aclCache, AclAuthorizationStrategy aclAuthorizationStrategy, PermissionGrantingStrategy grantingStrategy) Creates a new instance
- 
Method SummaryModifier and TypeMethodDescriptionprotected SidCreates a particular implementation ofSiddepending on the arguments.final Map<ObjectIdentity,Acl> readAclsById(List<ObjectIdentity> objects, List<Sid> sids) The main method.final voidsetAclClassIdSupported(boolean aclClassIdSupported) final voidsetBatchSize(int batchSize) final voidsetConversionService(org.springframework.core.convert.ConversionService conversionService) final voidsetLookupObjectIdentitiesWhereClause(String lookupObjectIdentitiesWhereClause) The SQL for the where clause used in the lookupObjectIdentities method.final voidsetLookupPrimaryKeysWhereClause(String lookupPrimaryKeysWhereClause) The SQL for the where clause used in the lookupPrimaryKey method.final voidsetObjectIdentityGenerator(ObjectIdentityGenerator objectIdentityGenerator) final voidsetOrderByClause(String orderByClause) The SQL for the "order by" clause used in both queries.final voidsetPermissionFactory(PermissionFactory permissionFactory) Sets thePermissionFactoryinstance which will be used to convert loaded permission data values toPermissions.final voidsetSelectClause(String selectClause) The SQL for the select clause.
- 
Field Details- 
DEFAULT_SELECT_CLAUSE- See Also:
 
- 
DEFAULT_ACL_CLASS_ID_SELECT_CLAUSE- See Also:
 
- 
DEFAULT_ORDER_BY_CLAUSE- See Also:
 
 
- 
- 
Constructor Details- 
BasicLookupStrategypublic BasicLookupStrategy(DataSource dataSource, AclCache aclCache, AclAuthorizationStrategy aclAuthorizationStrategy, AuditLogger auditLogger) Constructor accepting mandatory arguments- Parameters:
- dataSource- to access the database
- aclCache- the cache where fully-loaded elements can be stored
- aclAuthorizationStrategy- authorization strategy (required)
 
- 
BasicLookupStrategypublic BasicLookupStrategy(DataSource dataSource, AclCache aclCache, AclAuthorizationStrategy aclAuthorizationStrategy, PermissionGrantingStrategy grantingStrategy) Creates a new instance- Parameters:
- dataSource- to access the database
- aclCache- the cache where fully-loaded elements can be stored
- aclAuthorizationStrategy- authorization strategy (required)
- grantingStrategy- the PermissionGrantingStrategy
 
 
- 
- 
Method Details- 
readAclsByIdThe main method.WARNING: This implementation completely disregards the "sids" argument! Every item in the cache is expected to contain all SIDs. If you have serious performance needs (e.g. a very large number of SIDs per object identity), you'll probably want to develop a custom LookupStrategyimplementation instead.The implementation works in batch sizes specified by batchSize.- Specified by:
- readAclsByIdin interface- LookupStrategy
- Parameters:
- objects- the identities to lookup (required)
- sids- the SIDs for which identities are required (ignored by this implementation)
- Returns:
- a Map where keys represent the ObjectIdentityof the locatedAcland values are the locatedAcl(never null although some entries may be missing; this method should not throwNotFoundException, as a chain ofLookupStrategys may be used to automatically create entries if required)
 
- 
createSidCreates a particular implementation ofSiddepending on the arguments.- Parameters:
- sid- the name of the sid representing its unique identifier. In typical ACL database schema it's located in table- acl_sidtable,- sidcolumn.
- isPrincipal- whether it's a user or granted authority like role
- Returns:
- the instance of Sid with the sidNameas an identifier
 
- 
setPermissionFactorySets thePermissionFactoryinstance which will be used to convert loaded permission data values toPermissions. ADefaultPermissionFactorywill be used by default.- Parameters:
- permissionFactory-
 
- 
setBatchSizepublic final void setBatchSize(int batchSize) 
- 
setSelectClauseThe SQL for the select clause. If customizing in order to modify column names, schema etc, the other SQL customization fields must also be set to match.- Parameters:
- selectClause- the select clause, which defaults to- DEFAULT_SELECT_CLAUSE.
 
- 
setLookupPrimaryKeysWhereClauseThe SQL for the where clause used in the lookupPrimaryKey method.
- 
setLookupObjectIdentitiesWhereClauseThe SQL for the where clause used in the lookupObjectIdentities method.
- 
setOrderByClauseThe SQL for the "order by" clause used in both queries.
- 
setAclClassIdSupportedpublic final void setAclClassIdSupported(boolean aclClassIdSupported) 
- 
setObjectIdentityGenerator
- 
setConversionServicepublic final void setConversionService(org.springframework.core.convert.ConversionService conversionService) 
 
-