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>
|
||||
* @version $Revision: #10 $ $Date: 2004/08/16 $
|
||||
*/
|
||||
|
||||
public class Initializer extends BaseInitializer {
|
||||
|
||||
public static String WIDGET_TYPES = "widgetTypes";
|
||||
public static String PROCESS_LISTENER_TYPES = "processListenerTypes";
|
||||
public static String DATA_QUERIES = "dataQueries";
|
||||
|
||||
private Configuration m_conf = new Configuration();
|
||||
|
||||
public Initializer() throws InitializationException {
|
||||
m_conf.initParameter
|
||||
(WIDGET_TYPES,
|
||||
m_conf.initParameter(WIDGET_TYPES,
|
||||
"The persistent widget types",
|
||||
List.class);
|
||||
m_conf.initParameter
|
||||
(PROCESS_LISTENER_TYPES,
|
||||
m_conf.initParameter(PROCESS_LISTENER_TYPES,
|
||||
"The persistent process listener types",
|
||||
List.class);
|
||||
m_conf.initParameter
|
||||
(DATA_QUERIES,
|
||||
m_conf.initParameter(DATA_QUERIES,
|
||||
"The queries for the data driven select box",
|
||||
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.
|
||||
**/
|
||||
|
||||
public Configuration getConfiguration() {
|
||||
return m_conf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called on startup. Note. As you can not find a call
|
||||
* to this method in enterprise.ini, this method
|
||||
|
|
@ -82,35 +99,27 @@ public class Initializer extends BaseInitializer {
|
|||
* present in enterprise.ini
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
protected void doStartup() {
|
||||
|
||||
TransactionContext txn = SessionManager.getSession()
|
||||
.getTransactionContext();
|
||||
TransactionContext txn = SessionManager.getSession().getTransactionContext();
|
||||
txn.beginTxn();
|
||||
|
||||
List widgets = (List) m_conf.getParameter(WIDGET_TYPES);
|
||||
if (widgets != null)
|
||||
loadMetaObjects(widgets, PersistentComponent.class);
|
||||
|
||||
List listeners = (List) m_conf.getParameter(PROCESS_LISTENER_TYPES);
|
||||
if (listeners != null)
|
||||
loadMetaObjects(listeners, PersistentProcessListener.class);
|
||||
|
||||
List queries = (List) m_conf.getParameter(DATA_QUERIES);
|
||||
if (queries != null)
|
||||
loadDataQueries(queries);
|
||||
|
||||
txn.commitTxn();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called on shutdown. It's probably not a good idea to depend on this
|
||||
* being called.
|
||||
**/
|
||||
|
||||
protected void doShutdown() {
|
||||
}
|
||||
|
||||
|
|
@ -128,10 +137,12 @@ public class Initializer extends BaseInitializer {
|
|||
return objectType;
|
||||
}
|
||||
|
||||
protected void loadMetaObjects(List objects,
|
||||
Class type)
|
||||
protected void loadMetaObjects(List objects, Class type)
|
||||
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
|
||||
Iterator objects_i = objects.iterator();
|
||||
while (objects_i.hasNext()) {
|
||||
|
|
@ -176,9 +187,14 @@ public class Initializer extends BaseInitializer {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadDataQueries(List objects)
|
||||
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
|
||||
Iterator objects_i = objects.iterator();
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the PersistenProcessListener from database using the preselected
|
||||
* object by application. The preselection is made in enterprise.init
|
||||
*/
|
||||
protected void loadComponents(String app) {
|
||||
try {
|
||||
MetaObjectCollection objects = MetaObject.getWidgets(app,
|
||||
|
|
|
|||
Loading…
Reference in New Issue