public class OwDBDependentComboboxDataHandler extends Object implements OwDependentComboboxDataHandler
Implements a DB based OwDependentComboboxDataHandler.
Will query data from a DB, and provide the result as OwComboItem.
Allows to configure independent DataSource using own JNDI name, if local Session DB connection should not be used.
<DataSource>JNDI_NAME</DataSource>
Concept of SQL-Query definition is based on standard query for Select- and From-clause
<Query selectAll="false">Select my,fields FROM table</Query>
where the attribute selectAll is controlling if everything should be retrieved
in case dependent fields are empty, and additional dynamic/dependent WHERE Property definitions:
<Property operator="=">ECM_FIELD_ID<Property><Property queryName="DBClumnName" operator="=">ECM_FIELD_ID<Property><Property queryName="DBClumnName">ECM_FIELD_ID<Property><Property queryName="DBClumnName" operator="!%s=?">ECM_FIELD_ID<Property> queryName (space) operator (space) ?
The constructed Query is provided as QueryString for prepared Statement and should not contain value definitions.
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 | Class and Description |
|---|---|
static class |
OwDBDependentComboboxDataHandler.OwWherePropDefinition
POJO containing configuration options,
as simplified data objects.
|
| Modifier and Type | Field and Description |
|---|---|
protected static String |
AT_PROP_OPERATOR |
protected static String |
AT_PROP_QUERY_NAME |
protected static String |
AT_SELECT_ALL |
protected static String |
EL_DATA_SOURCE |
protected static String |
EL_PROPERTY |
protected static String |
EL_QUERY |
| Constructor and Description |
|---|
OwDBDependentComboboxDataHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
createFullQuery(String query,
Map<String,OwDBDependentComboboxDataHandler.OwWherePropDefinition> whereProps)
Create the String which represents the full SQL query to be fired for new results.
|
protected OwXMLUtil |
getConf() |
protected OwAppContext |
getContext() |
List<OwComboItem> |
getData(OwFieldProvider fieldProvider)
Provide Combobox results which should be available as options in UI.
|
List<String> |
getDependentFieldIds()
Return a list of Id's on which fields of the field provider the handler is dependent.
|
protected org.springframework.jdbc.core.JdbcTemplate |
getTemplate() |
void |
init(OwAppContext context,
OwXMLUtil configuration)
Init method called when OwFieldControl is successfully initialized
and attached to context.
|
protected void |
processRequest(String query,
Map<String,OwDBDependentComboboxDataHandler.OwWherePropDefinition> whereProps,
List<OwComboItem> result)
Process the query and add the query-results into the provided results collection,
wrapped as OwComoboItem interface.
|
boolean |
selectAll() |
protected void |
setConf(OwXMLUtil conf) |
protected void |
setTemplate(org.springframework.jdbc.core.JdbcTemplate template) |
protected static final String EL_DATA_SOURCE
protected static final String AT_SELECT_ALL
protected static final String EL_QUERY
protected static final String EL_PROPERTY
protected static final String AT_PROP_QUERY_NAME
protected static final String AT_PROP_OPERATOR
public void init(OwAppContext context, OwXMLUtil configuration) throws OwException
OwDependentComboboxDataHandlerinit in interface OwDependentComboboxDataHandlercontext - OwAppContext where OwFieldControl is attachedconfiguration - OwXMLUtil configuration informationOwExceptionpublic List<OwComboItem> getData(OwFieldProvider fieldProvider) throws OwException
OwDependentComboboxDataHandlergetData in interface OwDependentComboboxDataHandlerfieldProvider - OwFieldProvider current context object who define fieldsOwExceptionprotected void processRequest(String query, Map<String,OwDBDependentComboboxDataHandler.OwWherePropDefinition> whereProps, List<OwComboItem> result) throws OwException
query - String the created querywhereProps - Map of ECM field name and corresponding SQL where definitionresult - List of OwComboItem'sOwExceptionprotected String createFullQuery(String query, Map<String,OwDBDependentComboboxDataHandler.OwWherePropDefinition> whereProps) throws OwException
query - String the base QuerywhereProps - Map of WHERE props to handleOwExceptionprotected OwAppContext getContext()
protected org.springframework.jdbc.core.JdbcTemplate getTemplate()
protected void setTemplate(org.springframework.jdbc.core.JdbcTemplate template)
protected OwXMLUtil getConf()
protected void setConf(OwXMLUtil conf)
public List<String> getDependentFieldIds()
OwDependentComboboxDataHandlergetDependentFieldIds in interface OwDependentComboboxDataHandlerpublic boolean selectAll()
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.