Package de.businesscode.bcdui.binding
Class StandardBindingSet
- java.lang.Object
-
- de.businesscode.bcdui.binding.StandardBindingSet
-
- All Implemented Interfaces:
BindingSet
,java.io.Serializable
,java.lang.Cloneable
public class StandardBindingSet extends java.lang.Object implements BindingSet
A BindingSet is a mapping from names to BindingItems. It is read from a static XML file by the Bindings class usually from WEB-INF/bindings That file must satisfy the Schema bindings.xsd.- See Also:
Bindings
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.businesscode.bcdui.binding.BindingSet
BindingSet.SECURITY_OPS
-
-
Field Summary
-
Fields inherited from interface de.businesscode.bcdui.binding.BindingSet
DEFAULT_DATABASE_SOURCENAME
-
-
Constructor Summary
Constructors Constructor Description StandardBindingSet(StandardBindingSet bs)
StandardBindingSet(java.lang.String name)
StandardBindingSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRelation(Relation p_relation)
adds a new relation into ArrayListvoid
addWrqModifier(java.lang.String className)
void
assurePermissionDefined(BindingSet.SECURITY_OPS operation)
we check here if the application has set up the subjectSettings.void
assurePermitted(BindingSet.SECURITY_OPS operation)
check if given operation is permitted according to permissions set on subject in scopeBindingItem
get(java.lang.String key)
Gets a BindingItem by its unique name and throws an Exception if it is not present.java.util.Collection<BindingItem>
get(java.util.Collection<java.lang.String> keys)
Get binding items by ids.BindingItem
getBindingItemFromRelation(Relation pRelation, java.lang.String itemName)
Method getBindingItemFromRelationjava.util.Collection<java.lang.String>
getBindingItemNames()
getBindingItemNamesjava.util.Collection<BindingItem>
getBindingItems()
java.lang.String
getJdbcResourceName()
Gets the database name the table of the BindingSet is located in.BindingItem[]
getKeyBindingItems()
Retrieves the list of key BindingItems for this binding set which may contain no entries.java.lang.String
getName()
Gets the unique name of the BindingSet.java.util.ArrayList<Relation>
getRelations()
java.util.Set<StandardBindingSet>
getResolvedBindingSets()
List of use StandardBindingSetsSecurity
getSecurity()
SQLStatementWithParams
getSQLStatementWithParams()
Returns a table expression and if it is a complex one (subselect with where for example) it may come with variables to be bound as host variablesSQLStatementWithParams
getSubjectFilterExpression(WrqInfo wrqInfo, java.lang.String wrqAlias, java.lang.String sqlAlias)
Generate the part of the where clause that is reflecting the bnd:BindingSet/bnd:SubjectSettings/bnd:SubjectFiltersSubjectFilters
getSubjectFilters()
Gets theSubjectFilters
definition for this BindingSet which may be null.java.lang.String
getTableReference()
Returns a table reference.java.lang.String
getTableReference(java.lang.String tableAlias)
java.lang.String
getTableReference(java.util.Collection<java.lang.String> reqBRefs, java.lang.String tableAlias)
WriteProcessing
getWriteProcessing()
java.util.List<java.lang.Class<? extends Modifier>>
getWrqModifiers()
A list of Wrq modifier classes to be applied on all requests for this BindingSet before generating the SQL This is completely transparent to the caller, the answer Wrs does show the original WrsRequestboolean
hasCustomItem()
boolean
hasItem(java.lang.String id)
tells if this binding-set contains an itemboolean
hasKeyBindingItems()
Tests if the BindingSet hat key BindingItems.boolean
hasSubjectFilters()
Tells if the binding set has subject filters.boolean
isAllowSelectAllColumns()
isAllowSelectAllColumnsboolean
isBackendCanBypassSubjectFilter()
isBackendCanBypassSubjectFiltervoid
putItem(BindingItem item)
putItemvoid
setAllowSelectAllColumns(boolean allowSelectAllColumns)
void
setBackendCanBypassSubjectFilter(boolean backendCanBypassSubjectFilter)
void
setDbSourceName(java.lang.String dbSourceName)
setDbSourceNamevoid
setHasCustomItem(boolean hasCustomItem)
void
setSecurity(Security security)
void
setSubjectFilters(SubjectFilters subjectFilters)
sets theSubjectFilters
void
setTableName(java.lang.String tableName)
setTableName
-
-
-
Constructor Detail
-
StandardBindingSet
public StandardBindingSet(java.lang.String name)
StandardBindingSet- Parameters:
name
-
-
StandardBindingSet
public StandardBindingSet(StandardBindingSet bs)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:BindingSet
Gets the unique name of the BindingSet.- Specified by:
getName
in interfaceBindingSet
- Returns:
- The unique BindingSet name.
- See Also:
BindingSet.getName()
-
getTableReference
public java.lang.String getTableReference(java.lang.String tableAlias)
- See Also:
BindingSet.getTableReference()
-
getTableReference
public java.lang.String getTableReference(java.util.Collection<java.lang.String> reqBRefs, java.lang.String tableAlias) throws BindingException
- Throws:
BindingException
- See Also:
BindingSet.getTableReference()
-
setTableName
public void setTableName(java.lang.String tableName)
setTableName- Parameters:
tableName
-
-
setSubjectFilters
public void setSubjectFilters(SubjectFilters subjectFilters)
sets theSubjectFilters
- Parameters:
subjectFilters
-
-
getSubjectFilterExpression
public SQLStatementWithParams getSubjectFilterExpression(WrqInfo wrqInfo, java.lang.String wrqAlias, java.lang.String sqlAlias) throws BindingException
Generate the part of the where clause that is reflecting the bnd:BindingSet/bnd:SubjectSettings/bnd:SubjectFilters- Parameters:
wrqInfo
-wrqAlias
-sqlAlias
-- Returns:
- Throws:
BindingException
-
putItem
public void putItem(BindingItem item)
putItem- Parameters:
item
-
-
hasSubjectFilters
public boolean hasSubjectFilters()
Description copied from interface:BindingSet
Tells if the binding set has subject filters.- Specified by:
hasSubjectFilters
in interfaceBindingSet
- Returns:
- True, if there is at least one SubjectFilter inside this BindingSet.
- See Also:
BindingSet.hasSubjectFilters()
-
getSubjectFilters
public SubjectFilters getSubjectFilters()
Description copied from interface:BindingSet
Gets theSubjectFilters
definition for this BindingSet which may be null.- Specified by:
getSubjectFilters
in interfaceBindingSet
- Returns:
SubjectFilters
for given BindingSet or null
-
getJdbcResourceName
public java.lang.String getJdbcResourceName()
Description copied from interface:BindingSet
Gets the database name the table of the BindingSet is located in.- Specified by:
getJdbcResourceName
in interfaceBindingSet
- Returns:
- The dbSourceName attribute of the BindingSet.
- See Also:
BindingSet.getJdbcResourceName()
-
setDbSourceName
public void setDbSourceName(java.lang.String dbSourceName)
setDbSourceName- Parameters:
dbSourceName
-
-
isBackendCanBypassSubjectFilter
public boolean isBackendCanBypassSubjectFilter()
Description copied from interface:BindingSet
isBackendCanBypassSubjectFilter- Specified by:
isBackendCanBypassSubjectFilter
in interfaceBindingSet
- Returns:
- true if it is allowed for the backend to bypass SubjectFilters
- See Also:
BindingSet.isBackendCanBypassSubjectFilter()
-
setBackendCanBypassSubjectFilter
public void setBackendCanBypassSubjectFilter(boolean backendCanBypassSubjectFilter)
- Parameters:
allowSelectAllColumns
- the allowSelectAllColumns to set
-
isAllowSelectAllColumns
public boolean isAllowSelectAllColumns()
Description copied from interface:BindingSet
isAllowSelectAllColumns- Specified by:
isAllowSelectAllColumns
in interfaceBindingSet
- Returns:
- true if it is allowed to select all columns from this BindingSet.
- See Also:
BindingSet.isAllowSelectAllColumns()
-
setAllowSelectAllColumns
public void setAllowSelectAllColumns(boolean allowSelectAllColumns)
- Parameters:
allowSelectAllColumns
- the allowSelectAllColumns to set
-
get
public BindingItem get(java.lang.String key) throws BindingNotFoundException
Description copied from interface:BindingSet
Gets a BindingItem by its unique name and throws an Exception if it is not present.- Specified by:
get
in interfaceBindingSet
- Parameters:
key
- The name of the BindingItem.- Returns:
- A BindingItem with the specified name.
- Throws:
BindingNotFoundException
- If there is no BindingItem with the denoted name.- See Also:
BindingSet.get(java.lang.String)
-
hasItem
public boolean hasItem(java.lang.String id)
Description copied from interface:BindingSet
tells if this binding-set contains an item- Specified by:
hasItem
in interfaceBindingSet
- Returns:
-
get
public java.util.Collection<BindingItem> get(java.util.Collection<java.lang.String> keys) throws BindingNotFoundException
Description copied from interface:BindingSet
Get binding items by ids.- Specified by:
get
in interfaceBindingSet
- Throws:
BindingNotFoundException
- See Also:
BindingSet.get(java.util.Collection)
-
getBindingItemFromRelation
public BindingItem getBindingItemFromRelation(Relation pRelation, java.lang.String itemName) throws BindingException
Description copied from interface:BindingSet
Method getBindingItemFromRelation- Specified by:
getBindingItemFromRelation
in interfaceBindingSet
- Parameters:
pRelation
-itemName
-- Returns:
- null if not found
- Throws:
BindingException
-
hasKeyBindingItems
public boolean hasKeyBindingItems()
Description copied from interface:BindingSet
Tests if the BindingSet hat key BindingItems.- Specified by:
hasKeyBindingItems
in interfaceBindingSet
- Returns:
- True, if there is a BindingItem which is declared as key item.
- See Also:
BindingSet.hasKeyBindingItems()
-
getKeyBindingItems
public BindingItem[] getKeyBindingItems()
Description copied from interface:BindingSet
Retrieves the list of key BindingItems for this binding set which may contain no entries.- Specified by:
getKeyBindingItems
in interfaceBindingSet
- Returns:
- An array of the BindingItems with the isKey attribute set to "true".
- See Also:
BindingSet.getKeyBindingItems()
-
addRelation
public void addRelation(Relation p_relation)
Description copied from interface:BindingSet
adds a new relation into ArrayList- Specified by:
addRelation
in interfaceBindingSet
- See Also:
BindingSet.addRelation(de.businesscode.bcdui.binding.rel.Relation)
-
getRelations
public java.util.ArrayList<Relation> getRelations()
- Specified by:
getRelations
in interfaceBindingSet
- See Also:
BindingSet.getRelations()
-
getBindingItems
public java.util.Collection<BindingItem> getBindingItems()
-
getBindingItemNames
public java.util.Collection<java.lang.String> getBindingItemNames()
Description copied from interface:BindingSet
getBindingItemNames- Specified by:
getBindingItemNames
in interfaceBindingSet
- Returns:
- names of all items defined in the bindingSet
- See Also:
BindingSet.getBindingItemNames()
-
getWriteProcessing
public WriteProcessing getWriteProcessing()
- Specified by:
getWriteProcessing
in interfaceBindingSet
- See Also:
BindingSet.getWriteProcessing()
-
setSecurity
public void setSecurity(Security security)
-
getSecurity
public Security getSecurity()
- Specified by:
getSecurity
in interfaceBindingSet
- Returns:
- security context to this binding, may be NULL if no security configured
-
hasCustomItem
public boolean hasCustomItem()
- Specified by:
hasCustomItem
in interfaceBindingSet
- Returns:
- TRUE if contains at least one custom element from
StandardNamespaceContext.CUST_NAMESPACE
-
setHasCustomItem
public void setHasCustomItem(boolean hasCustomItem)
- Parameters:
hasCustomItem
- the hasCustomItem to set
-
addWrqModifier
public void addWrqModifier(java.lang.String className) throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
-
getWrqModifiers
public java.util.List<java.lang.Class<? extends Modifier>> getWrqModifiers()
Description copied from interface:BindingSet
A list of Wrq modifier classes to be applied on all requests for this BindingSet before generating the SQL This is completely transparent to the caller, the answer Wrs does show the original WrsRequest- Specified by:
getWrqModifiers
in interfaceBindingSet
- Returns:
-
assurePermissionDefined
public void assurePermissionDefined(BindingSet.SECURITY_OPS operation) throws SecurityMissingForBindingException
Description copied from interface:BindingSet
we check here if the application has set up the subjectSettings. In case it is set up, the binding-set HAS TO define the Security context for given operation otherwise we throwSecurityMissingException
- Specified by:
assurePermissionDefined
in interfaceBindingSet
- Parameters:
operation
- - to assure the permission is defined for- Throws:
SecurityMissingForBindingException
-
assurePermitted
public void assurePermitted(BindingSet.SECURITY_OPS operation) throws SecurityException
Description copied from interface:BindingSet
check if given operation is permitted according to permissions set on subject in scope- Specified by:
assurePermitted
in interfaceBindingSet
- Parameters:
operation
- - to assure permission for- Throws:
SecurityException
-
getTableReference
public java.lang.String getTableReference()
Description copied from interface:BindingSet
Returns a table reference. Can be a plain table name (with alias) or a join of tables- Specified by:
getTableReference
in interfaceBindingSet
- Returns:
-
getSQLStatementWithParams
public SQLStatementWithParams getSQLStatementWithParams()
Description copied from interface:BindingSet
Returns a table expression and if it is a complex one (subselect with where for example) it may come with variables to be bound as host variables- Specified by:
getSQLStatementWithParams
in interfaceBindingSet
- Returns:
-
getResolvedBindingSets
public java.util.Set<StandardBindingSet> getResolvedBindingSets()
List of use StandardBindingSets- Specified by:
getResolvedBindingSets
in interfaceBindingSet
- Returns:
-
-