public class OwStandardDBAttributeBagWriteableFactory extends Object
Implements a factory for DB based writable attribute bags.
Retrieve a writable attribute bag with getBag(Name).
The factory has the advantage that all attribute bag data is loaded in one single SQL Query.
Uses the following attribute scheme to access the database e.g.:
(Number) | User (String) | Name (String) | AttributeName (String) | AttributeValue (String) |
1 | OW_SITE_USER | ViewerSize | X | 100 |
2 | OW_SITE_USER | ViewerSize | Y | 100 |
3 | UserName | SelectedClass | Account | 1 |
4 | UserName | SelectedClass | Credit | 1 |
5 | UserName | SelectedClass | Depot | 1 |
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_ATTR_NAME
DB attribute name of the attribute name
|
static String |
ATTRIBUTE_ATTR_VALUE
DB attribute name of the attribute value
|
static String |
ATTRIBUTE_BAGNAME
DB attribute name of the Name
|
static String |
ATTRIBUTE_INDEX
DB attribute name of the User
|
static String |
ATTRIBUTE_USER
DB attribute name of the User
|
static int |
LENGTH_LIMIT_ATTRIBUTE_NAME
length limitation for the attribute name
|
static int |
LENGTH_LIMIT_ATTRIBUTE_VALUE
length limitation for the attribute value
|
static int |
LENGTH_LIMIT_BAG_NAME
length limitation for the bag name
|
static String |
SEQUENCE_NAME
name of the oracle sequence
|
Constructor and Description |
---|
OwStandardDBAttributeBagWriteableFactory(org.springframework.jdbc.core.JdbcTemplate jdbc,
String userID,
OwTableSpec attributeBagTable)
Constructs the attribute bag with the given Database
Use the following attribute scheme:
[Index, User, Name, AttributeName, AttributeValue]
|
OwStandardDBAttributeBagWriteableFactory(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate_p,
String strUser_p,
String strTable_p)
Deprecated.
Will be replaced by
OwStandardDBAttributeBagWriteableFactory(JdbcTemplate, String, OwTableSpec) . |
Modifier and Type | Method and Description |
---|---|
int |
attributecount(String strBagName_p) |
void |
clear(String strBagName_p) |
protected com.wewebu.ow.server.util.OwStandardDBAttributeBagWriteableFactory.OwPreparedStatementCreator |
createStatementCreator()
Create a class which is responsible for prepared statement creation,
and also OwAttribute based SQL creation.
|
Object |
getAttribute(int iIndex_p,
String strBagName_p) |
Object |
getAttribute(String strName_p,
String strBagName_p) |
Collection |
getAttributeNames(String strBagName_p) |
OwAttributeBagWriteable |
getBag(String sBagName_p)
get a specific attribute bag
|
Object |
getSafeAttribute(String strName_p,
Object default_p,
String strBagName_p)
get the attribute with the given name, returns default if not found.
|
protected String |
getTableName()
getter of the configured Table to use.
|
boolean |
hasAttribute(String strName_p,
String strBagName_p) |
void |
init()
Load the tuples from the DB, transform them into a local objects representation and cache them.
|
protected void |
initColumnLimit()
(overridable)
Initializing the limit of the columns,
which will be used later before writing to data base.
|
void |
remove(String strName_p,
String strBagName_p) |
void |
save(String strBagName_p) |
void |
setAttribute(String strName_p,
Object value_p,
String sBagName_p) |
public static final String ATTRIBUTE_INDEX
public static final String ATTRIBUTE_USER
public static final String ATTRIBUTE_BAGNAME
public static final String ATTRIBUTE_ATTR_NAME
public static final String ATTRIBUTE_ATTR_VALUE
public static final String SEQUENCE_NAME
public static final int LENGTH_LIMIT_ATTRIBUTE_NAME
public static final int LENGTH_LIMIT_BAG_NAME
public static final int LENGTH_LIMIT_ATTRIBUTE_VALUE
public OwStandardDBAttributeBagWriteableFactory(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate_p, String strUser_p, String strTable_p) throws OwDataSourceException
OwStandardDBAttributeBagWriteableFactory(JdbcTemplate, String, OwTableSpec)
.jdbcTemplate_p
- The Spring JdbcTemplate to use for the database connectivity.strUser_p
- String optional user name to map the attribute bag to a specific user, can be null.strTable_p
- String table nameOwDataSourceException
public OwStandardDBAttributeBagWriteableFactory(org.springframework.jdbc.core.JdbcTemplate jdbc, String userID, OwTableSpec attributeBagTable) throws OwDataSourceException
jdbc
- The Spring JdbcTemplate to use for the database connectivity.userID
- optional user name to map the attribute bag to a specific user, can be null.attributeBagTable
- the table to be used for storing/reading the data.OwDataSourceException
public void init() throws Exception
Exception
- if cannot retrieve information from DBprotected void initColumnLimit() throws SQLException
SQLException
protected String getTableName()
public void setAttribute(String strName_p, Object value_p, String sBagName_p) throws Exception
Exception
public Object getAttribute(int iIndex_p, String strBagName_p) throws Exception
Exception
public Object getAttribute(String strName_p, String strBagName_p) throws Exception
Exception
public Object getSafeAttribute(String strName_p, Object default_p, String strBagName_p)
public int attributecount(String strBagName_p)
public Collection getAttributeNames(String strBagName_p)
public OwAttributeBagWriteable getBag(String sBagName_p) throws Exception
sBagName_p
- String name that identifies the attribute bagException
public void clear(String strBagName_p)
protected com.wewebu.ow.server.util.OwStandardDBAttributeBagWriteableFactory.OwPreparedStatementCreator createStatementCreator()
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.