FormBuilder
Initializer um Konstruktor erweitert, der es ermöglicht, die Konfiguration als Parameter zu übergeben, anstatt sie mittels enterprise.init und LegacyInitializer einzulesen. Kommentar in NewAction hinzugefügt git-svn-id: https://svn.libreccm.org/ccm/trunk@364 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
93d082caa6
commit
fd50e1630a
|
|
@ -40,38 +40,55 @@ import com.arsdigita.formbuilder.PersistentComponent;
|
||||||
* @author <a href="mailto:berrange@redhat.com">Daniel Berrange</a>
|
* @author <a href="mailto:berrange@redhat.com">Daniel Berrange</a>
|
||||||
* @version $Revision: #10 $ $Date: 2004/08/16 $
|
* @version $Revision: #10 $ $Date: 2004/08/16 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Initializer extends BaseInitializer {
|
public class Initializer extends BaseInitializer {
|
||||||
|
|
||||||
public static String WIDGET_TYPES = "widgetTypes";
|
public static String WIDGET_TYPES = "widgetTypes";
|
||||||
public static String PROCESS_LISTENER_TYPES = "processListenerTypes";
|
public static String PROCESS_LISTENER_TYPES = "processListenerTypes";
|
||||||
public static String DATA_QUERIES = "dataQueries";
|
public static String DATA_QUERIES = "dataQueries";
|
||||||
|
|
||||||
private Configuration m_conf = new Configuration();
|
private Configuration m_conf = new Configuration();
|
||||||
|
|
||||||
public Initializer() throws InitializationException {
|
public Initializer() throws InitializationException {
|
||||||
m_conf.initParameter
|
m_conf.initParameter(WIDGET_TYPES,
|
||||||
(WIDGET_TYPES,
|
|
||||||
"The persistent widget types",
|
"The persistent widget types",
|
||||||
List.class);
|
List.class);
|
||||||
m_conf.initParameter
|
m_conf.initParameter(PROCESS_LISTENER_TYPES,
|
||||||
(PROCESS_LISTENER_TYPES,
|
|
||||||
"The persistent process listener types",
|
"The persistent process listener types",
|
||||||
List.class);
|
List.class);
|
||||||
m_conf.initParameter
|
m_conf.initParameter(DATA_QUERIES,
|
||||||
(DATA_QUERIES,
|
|
||||||
"The queries for the data driven select box",
|
"The queries for the data driven select box",
|
||||||
List.class);
|
List.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quasimodo: BEGIN */
|
||||||
|
/**
|
||||||
|
* Initializer
|
||||||
|
*
|
||||||
|
* A new Initializer, which doesn't use the Configuration and the enterprise
|
||||||
|
* init. This initializer can be called during DomainInitEvents, so it is
|
||||||
|
* ready for the new Initializer framework. Configuration will be read from
|
||||||
|
* parameters (for now - maybe there's wil be a better way in the future).
|
||||||
|
*
|
||||||
|
* @throws InitializationException
|
||||||
|
*/
|
||||||
|
public Initializer(List widgets, List processListeners, List dataQueries) throws InitializationException {
|
||||||
|
TransactionContext txn = SessionManager.getSession().getTransactionContext();
|
||||||
|
txn.beginTxn();
|
||||||
|
|
||||||
|
// Load widgets, processListeners and dataQueries from parameters
|
||||||
|
loadMetaObjects(widgets, PersistentComponent.class);
|
||||||
|
loadMetaObjects(processListeners, PersistentProcessListener.class);
|
||||||
|
loadDataQueries(dataQueries);
|
||||||
|
|
||||||
|
txn.commitTxn();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configuration object used by this initializer.
|
* Returns the configuration object used by this initializer.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
public Configuration getConfiguration() {
|
public Configuration getConfiguration() {
|
||||||
return m_conf;
|
return m_conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on startup. Note. As you can not find a call
|
* Called on startup. Note. As you can not find a call
|
||||||
* to this method in enterprise.ini, this method
|
* to this method in enterprise.ini, this method
|
||||||
|
|
@ -82,35 +99,27 @@ public class Initializer extends BaseInitializer {
|
||||||
* present in enterprise.ini
|
* present in enterprise.ini
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
protected void doStartup() {
|
protected void doStartup() {
|
||||||
|
|
||||||
TransactionContext txn = SessionManager.getSession()
|
TransactionContext txn = SessionManager.getSession().getTransactionContext();
|
||||||
.getTransactionContext();
|
|
||||||
txn.beginTxn();
|
txn.beginTxn();
|
||||||
|
|
||||||
List widgets = (List) m_conf.getParameter(WIDGET_TYPES);
|
List widgets = (List) m_conf.getParameter(WIDGET_TYPES);
|
||||||
if (widgets != null)
|
|
||||||
loadMetaObjects(widgets, PersistentComponent.class);
|
loadMetaObjects(widgets, PersistentComponent.class);
|
||||||
|
|
||||||
List listeners = (List) m_conf.getParameter(PROCESS_LISTENER_TYPES);
|
List listeners = (List) m_conf.getParameter(PROCESS_LISTENER_TYPES);
|
||||||
if (listeners != null)
|
|
||||||
loadMetaObjects(listeners, PersistentProcessListener.class);
|
loadMetaObjects(listeners, PersistentProcessListener.class);
|
||||||
|
|
||||||
List queries = (List) m_conf.getParameter(DATA_QUERIES);
|
List queries = (List) m_conf.getParameter(DATA_QUERIES);
|
||||||
if (queries != null)
|
|
||||||
loadDataQueries(queries);
|
loadDataQueries(queries);
|
||||||
|
|
||||||
txn.commitTxn();
|
txn.commitTxn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on shutdown. It's probably not a good idea to depend on this
|
* Called on shutdown. It's probably not a good idea to depend on this
|
||||||
* being called.
|
* being called.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
protected void doShutdown() {
|
protected void doShutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,10 +137,12 @@ public class Initializer extends BaseInitializer {
|
||||||
return objectType;
|
return objectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadMetaObjects(List objects,
|
protected void loadMetaObjects(List objects, Class type)
|
||||||
Class type)
|
|
||||||
throws InitializationException {
|
throws InitializationException {
|
||||||
|
|
||||||
|
// If the objects list is not null, load the object list into the database
|
||||||
|
if (objects != null) {
|
||||||
|
|
||||||
// XXX we don't yet delete types which are no longer in the list
|
// XXX we don't yet delete types which are no longer in the list
|
||||||
Iterator objects_i = objects.iterator();
|
Iterator objects_i = objects.iterator();
|
||||||
while (objects_i.hasNext()) {
|
while (objects_i.hasNext()) {
|
||||||
|
|
@ -176,9 +187,14 @@ public class Initializer extends BaseInitializer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void loadDataQueries(List objects)
|
protected void loadDataQueries(List objects)
|
||||||
throws InitializationException {
|
throws InitializationException {
|
||||||
|
|
||||||
|
// If the objects list is not null, load the object list into the database
|
||||||
|
if (objects != null) {
|
||||||
|
|
||||||
// XXX we don't yet delete types which are no longer in the list
|
// XXX we don't yet delete types which are no longer in the list
|
||||||
Iterator objects_i = objects.iterator();
|
Iterator objects_i = objects.iterator();
|
||||||
while (objects_i.hasNext()) {
|
while (objects_i.hasNext()) {
|
||||||
|
|
@ -205,5 +221,5 @@ public class Initializer extends BaseInitializer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,10 @@ public class NewAction extends Form {
|
||||||
m_selection.getStateParameter());
|
m_selection.getStateParameter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the PersistenProcessListener from database using the preselected
|
||||||
|
* object by application. The preselection is made in enterprise.init
|
||||||
|
*/
|
||||||
protected void loadComponents(String app) {
|
protected void loadComponents(String app) {
|
||||||
try {
|
try {
|
||||||
MetaObjectCollection objects = MetaObject.getWidgets(app,
|
MetaObjectCollection objects = MetaObject.getWidgets(app,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue