Erster Schritt beim Umbau von docmgr.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1533 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-05 19:04:11 +00:00
parent 8a19a65917
commit 0eb2cad432
11 changed files with 131 additions and 35 deletions

View File

@ -15,5 +15,6 @@
<data class="com.arsdigita.cms.docmgr.DocumentLoader"/> <data class="com.arsdigita.cms.docmgr.DocumentLoader"/>
<data class="com.arsdigita.cms.docmgr.DocLinkLoader"/> <data class="com.arsdigita.cms.docmgr.DocLinkLoader"/>
<data class="com.arsdigita.cms.docmgr.DocFolderLoader"/> <data class="com.arsdigita.cms.docmgr.DocFolderLoader"/>
<data class="com.arsdigita.cms.docmgr.Loader"/>
</scripts> </scripts>
</load> </load>

View File

@ -18,13 +18,15 @@
*/ */
package com.arsdigita.cms.docmgr; package com.arsdigita.cms.docmgr;
import com.arsdigita.docrepo.ui.RecentUpdatedDocsPortlet; import com.arsdigita.cms.docmgr.ui.CategoryDocsNavigatorPortlet;
// import com.arsdigita.mimetypes.*; import com.arsdigita.cms.docmgr.ui.LegacyCategoryDocsNavigatorPortlet;
import com.arsdigita.cms.docmgr.ui.RecentUpdatedDocsPortlet;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.kernel.ACSObjectInstantiator; import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.KernelExcursion; import com.arsdigita.kernel.KernelExcursion;
import com.arsdigita.loader.PackageLoader; import com.arsdigita.loader.PackageLoader;
// import com.arsdigita.mimetypes.*;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.portal.PortletType; import com.arsdigita.portal.PortletType;
import com.arsdigita.portal.apportlet.AppPortletSetup; import com.arsdigita.portal.apportlet.AppPortletSetup;
@ -34,6 +36,33 @@ import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
// ///////////////////////////////////////////////////////////////////////////
// Project: Migrate to new style legacy free type of application.
//
// Step 1: Copy from Initializer all data base / applicationtype
// related code to LOADER and use Loader for data loading.
//
// Step 2: Remove usage of ApplicationSetup and switch to legacy
// compativle AppType xxx = new AppType.create(......)
// Move setInstantiator back to Initializer as required.
//
// Step 3: Move to legacy free app type
// (a) modify new App.Tpye.....
// (b) create AppServlet from Dispatcher
//
//
// TESTS:
// (a) Try to instantiate an instance of each type and check the UI
// produced by the dispatcher / servlet
// (b) Instantiate the porlets and try to reproduce the behaviour
// (probably reproduce the error showing up originally)
//
//
// ///////////////////////////////////////////////////////////////////////////
/** /**
* CMS Document Manager (DocMgr) Loader * CMS Document Manager (DocMgr) Loader
* *
@ -61,7 +90,18 @@ public class Loader extends PackageLoader {
loadDocRepositoryApplicationType(); //former setupDocs loadDocRepositoryApplicationType(); //former setupDocs
setupDocRepositoryPortlet(null); //former setupDocManagerPortlet setupDocRepositoryPortlet(null); //former setupDocManagerPortlet
setupDefaultDocRepository(); ApplicationType categoryBrowseDocsAppType = setupCategoryBrowsing();
setupCategoryDocsPortlet(categoryBrowseDocsAppType);
ApplicationType legacyCategoryBrowseDocsAppType =
setupLegacyCategoryBrowsing();
setupLegacyCategoryDocsPortlet(legacyCategoryBrowseDocsAppType);
// de-activate search for now
//SearchUtils.setSearcher
// (new com.arsdigita.cms.docmgr.search.IntermediaSearcher());
setupDefaultDocRepository(); //new here!
} }
}.run(); }.run();
@ -76,6 +116,7 @@ public class Loader extends PackageLoader {
// //////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////
/** /**
* COPY & PASTE, has to be adopted !!
* Creates a document repository application type, the domain class of the * Creates a document repository application type, the domain class of the
* document repository (docrepo) package, as a legacy-compatible type of * document repository (docrepo) package, as a legacy-compatible type of
* application. * application.
@ -85,6 +126,7 @@ public class Loader extends PackageLoader {
* *
* TODO: migrate to a new style, legacy free application type. * TODO: migrate to a new style, legacy free application type.
*/ */
// formerly setupDocs()
private ApplicationType loadDocRepositoryApplicationType() { private ApplicationType loadDocRepositoryApplicationType() {
ApplicationSetup setup = new ApplicationSetup(s_log); ApplicationSetup setup = new ApplicationSetup(s_log);
@ -124,7 +166,8 @@ public class Loader extends PackageLoader {
private ApplicationType setupCategoryBrowsing() { private ApplicationType setupCategoryBrowsing() {
ApplicationSetup setup = new ApplicationSetup(s_log); ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(DocumentCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE); setup.setApplicationObjectType(DocumentCategoryBrowserApplication
.BASE_DATA_OBJECT_TYPE);
setup.setKey("cmsdocs-categories"); setup.setKey("cmsdocs-categories");
setup.setTitle("Browse Documents Application"); setup.setTitle("Browse Documents Application");
setup.setSingleton(true); setup.setSingleton(true);
@ -142,7 +185,8 @@ public class Loader extends PackageLoader {
} }
private ApplicationType setupLegacyCategoryBrowsing() { private ApplicationType setupLegacyCategoryBrowsing() {
ApplicationSetup setup = new ApplicationSetup(s_log); ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(LegacyCategoryBrowserApplication.BASE_DATA_OBJECT_TYPE); setup.setApplicationObjectType(LegacyCategoryBrowserApplication
.BASE_DATA_OBJECT_TYPE);
setup.setKey("cmsdocs-categories-legacy"); setup.setKey("cmsdocs-categories-legacy");
setup.setTitle("Taxonomy Browser"); setup.setTitle("Taxonomy Browser");
setup.setSingleton(true); setup.setSingleton(true);
@ -171,13 +215,16 @@ public class Loader extends PackageLoader {
// try { // try {
// SiteNode sn = SiteNode.getSiteNode("/administration", false); // SiteNode sn = SiteNode.getSiteNode("/administration", false);
// if (!"administration".equals(sn.getName())) { // if (!"administration".equals(sn.getName())) {
Repository repo = Repository.create( Repository repo = Repository
"repository", "Default Document Repository", null); .create( "docrepo",
"Default DocumentMgr Repository",
null);
repo.save(); repo.save();
// } // }
// } catch (DataObjectNotFoundException e) { // } catch (DataObjectNotFoundException e) {
// Assert.fail(e.getMessage()); // Assert.fail(e.getMessage());
// } // }
} }
@ -195,6 +242,7 @@ public class Loader extends PackageLoader {
* Instances (Portlets) are created by user interface or programmatically * Instances (Portlets) are created by user interface or programmatically
* by configuration. * by configuration.
*/ */
//former setupDocManagerPortlet
private void setupDocRepositoryPortlet(ApplicationType provider) { private void setupDocRepositoryPortlet(ApplicationType provider) {
// Create the document repository portlet // Create the document repository portlet
@ -218,5 +266,49 @@ public class Loader extends PackageLoader {
} }
private void setupCategoryDocsPortlet(ApplicationType provider) {
// Create the document manager portlet
AppPortletSetup setup = new AppPortletSetup(s_log);
setup.setPortletObjectType(CategoryDocsNavigatorPortlet
.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Document Category Navigator");
setup.setDescription("Browse documents by category.");
setup.setProfile(PortletType.WIDE_PROFILE);
setup.setProviderApplicationType(provider);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new CategoryDocsNavigatorPortlet(dataObject);
}
});
setup.run();
}
private void setupLegacyCategoryDocsPortlet(ApplicationType provider) {
// Create the document manager portlet
AppPortletSetup setup = new AppPortletSetup(s_log);
setup.setPortletObjectType(LegacyCategoryDocsNavigatorPortlet
.BASE_DATA_OBJECT_TYPE);
setup.setTitle("Taxonomy Browser");
setup.setDescription("Browse documents by category.");
setup.setProfile(PortletType.WIDE_PROFILE);
setup.setProviderApplicationType(provider);
setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) {
return new LegacyCategoryDocsNavigatorPortlet(dataObject);
}
});
setup.run();
}
} }

View File

@ -80,7 +80,9 @@ public class Initializer extends CompoundInitializer {
@Override @Override
public void init(DomainInitEvent e) { public void init(DomainInitEvent e) {
s_log.debug("Document (CCM) Manager is initializing using .init(DomainInitEvent e)"); s_log.debug("Document (CCM) Manager is Domain initializing ... ");
setupDomainFactory();
startup(); startup();
} }
@ -90,7 +92,7 @@ public class Initializer extends CompoundInitializer {
public void startup() { public void startup() {
s_log.warn("Document Manager is initializing."); s_log.warn("Document Manager is initializing.");
setupDomainFactory(); // setupDomainFactory();
TransactionContext txn = SessionManager.getSession() TransactionContext txn = SessionManager.getSession()
.getTransactionContext(); .getTransactionContext();
@ -148,6 +150,7 @@ public class Initializer extends CompoundInitializer {
setup.setProfile(PortletType.WIDE_PROFILE); setup.setProfile(PortletType.WIDE_PROFILE);
setup.setProviderApplicationType(provider); setup.setProviderApplicationType(provider);
setup.setInstantiator(new ACSObjectInstantiator() { setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) { protected DomainObject doNewInstance(DataObject dataObject) {
return new RecentUpdatedDocsPortlet(dataObject); return new RecentUpdatedDocsPortlet(dataObject);
} }
@ -169,6 +172,7 @@ public class Initializer extends CompoundInitializer {
// deprecated and removed. New StylesheetResolver is pattern based. // deprecated and removed. New StylesheetResolver is pattern based.
//setup.setStylesheet("/packages/cms-docmgr/xsl/docs.xsl"); //setup.setStylesheet("/packages/cms-docmgr/xsl/docs.xsl");
setup.setInstantiator(new ACSObjectInstantiator() { setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new DocumentCategoryBrowserApplication(dataObject); return new DocumentCategoryBrowserApplication(dataObject);
} }
@ -189,6 +193,7 @@ public class Initializer extends CompoundInitializer {
// deprecated and removed. New StylesheetResolver is pattern based. // deprecated and removed. New StylesheetResolver is pattern based.
//setup.setStylesheet("/packages/cms-docmgr/xsl/docs.xsl"); //setup.setStylesheet("/packages/cms-docmgr/xsl/docs.xsl");
setup.setInstantiator(new ACSObjectInstantiator() { setup.setInstantiator(new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new LegacyCategoryBrowserApplication(dataObject); return new LegacyCategoryBrowserApplication(dataObject);
} }
@ -207,6 +212,7 @@ public class Initializer extends CompoundInitializer {
setup.setProfile(PortletType.WIDE_PROFILE); setup.setProfile(PortletType.WIDE_PROFILE);
setup.setProviderApplicationType(provider); setup.setProviderApplicationType(provider);
setup.setInstantiator(new ACSObjectInstantiator() { setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) { protected DomainObject doNewInstance(DataObject dataObject) {
return new CategoryDocsNavigatorPortlet(dataObject); return new CategoryDocsNavigatorPortlet(dataObject);
} }
@ -225,6 +231,7 @@ public class Initializer extends CompoundInitializer {
setup.setProfile(PortletType.WIDE_PROFILE); setup.setProfile(PortletType.WIDE_PROFILE);
setup.setProviderApplicationType(provider); setup.setProviderApplicationType(provider);
setup.setInstantiator(new ACSObjectInstantiator() { setup.setInstantiator(new ACSObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject dataObject) { protected DomainObject doNewInstance(DataObject dataObject) {
return new LegacyCategoryDocsNavigatorPortlet(dataObject); return new LegacyCategoryDocsNavigatorPortlet(dataObject);
} }
@ -240,6 +247,7 @@ public class Initializer extends CompoundInitializer {
private void setupDomainFactory() { private void setupDomainFactory() {
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
Document.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() { Document.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new Document(dataObject); return new Document(dataObject);
} }
@ -247,6 +255,7 @@ public class Initializer extends CompoundInitializer {
); );
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
DocFolder.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() { DocFolder.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) { public DomainObject doNewInstance(DataObject dataObject) {
return new DocFolder(dataObject); return new DocFolder(dataObject);
} }

View File

@ -30,7 +30,7 @@ import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter; // import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.docmgr.util.GlobalizationUtil; import com.arsdigita.cms.docmgr.util.GlobalizationUtil;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.permissions.PermissionDescriptor; import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -369,9 +369,13 @@ public class DocmgrBasePage extends Page implements DMConstants {
Assert.exists(app, Application.class); Assert.exists(app, Application.class);
Application parent = app.getParentApplication(); Application parent = app.getParentApplication();
if (parent != null ) { // it's me
link.setChild(new Label(parent.getTitle())); link.setChild(new Label(parent.getTitle()));
link.setTarget(parent.getPath()); link.setTarget(parent.getPath());
} else { // it's me (the following 4 lines
link.setChild(new Label("/"));
link.setTarget(com.arsdigita.web.URL.root().toString());
}
} }
} }

View File

@ -359,6 +359,7 @@ class DocrepoBasePage extends Page {
} }
protected class CurrentApplicationLabelPrinter implements PrintListener { protected class CurrentApplicationLabelPrinter implements PrintListener {
public CurrentApplicationLabelPrinter() { public CurrentApplicationLabelPrinter() {
// Empty // Empty
} }

View File

@ -68,12 +68,14 @@ public class Converter extends HttpServlet
public Converter() { } public Converter() { }
@Override
public void init() throws ServletException public void init() throws ServletException
{ {
transformerFactory = TransformerFactory.newInstance(); transformerFactory = TransformerFactory.newInstance();
} }
//Setup FOP //Setup FOP
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException throws ServletException, IOException
{ {

View File

@ -27,13 +27,9 @@ import com.arsdigita.runtime.CompoundInitializer;
/** /**
* Initializes the formbuilder pdf generator * Initializes the formbuilder pdf generator
* @version $Id: //ps/apps/london/atoz/dev/src/com/arsdigita/london/atoz/Initializer.java#6 $ * @version $Id: Initializer.java#6 $
*/ */
public class Initializer extends CompoundInitializer { public class Initializer extends CompoundInitializer {
public final static String versionId =
"$Id: //ps/apps/london/atoz/dev/src/com/arsdigita/london/atoz/Initializer.java#6 $" +
"$Author: mbooth $" +
"$DateTime: 2004/04/23 13:04:49 $";
public Initializer() { public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL(); final String url = RuntimeConfig.getConfig().getJDBCURL();

View File

@ -31,13 +31,9 @@ import org.apache.log4j.Logger;
* Loader. * Loader.
* *
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: //apps/forum/dev/src/com/arsdigita/forum/Loader.java#7 $ * @version $Id: Loader.java#7 $
*/ */
public class Loader extends PackageLoader { public class Loader extends PackageLoader {
public final static String versionId =
"$Id: //apps/forum/dev/src/com/arsdigita/forum/Loader.java#7 $" +
"$Author: dennis $" +
"$DateTime: 2004/08/17 23:26:27 $";
private static final Logger s_log = Logger.getLogger(Loader.class); private static final Logger s_log = Logger.getLogger(Loader.class);

View File

@ -21,7 +21,6 @@ package com.arsdigita.formbuilder.pdf;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.StringParameter; import com.arsdigita.util.parameter.StringParameter;
import org.apache.log4j.Logger;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -29,21 +28,17 @@ import org.apache.log4j.Logger;
* A set of configuration parameters for the formbuilder PDF action. * A set of configuration parameters for the formbuilder PDF action.
* *
* @author Matthew Booth <mbooth@redhat.com> * @author Matthew Booth <mbooth@redhat.com>
* @version $Id: ForumConfig.java 285 2005-02-22 00:29:02Z sskracic $ * @version $Id: PDFConfig.java 285 2005-02-22 00:29:02Z sskracic $
*/ */
public class PDFConfig extends AbstractConfig { public class PDFConfig extends AbstractConfig {
public final static String versionId =
"$Id: ForumConfig.java 285 2005-02-22 00:29:02Z sskracic $" +
"$Author: sskracic $" +
"$DateTime: 2004/08/17 23:26:27 $";
private Parameter m_xslFile;
private static final Logger s_log = Logger.getLogger(PDFConfig.class); private static final Logger s_log = Logger.getLogger(PDFConfig.class);
private static final PDFConfig s_config = new PDFConfig(); private static final PDFConfig s_config = new PDFConfig();
private Parameter m_xslFile;
static { static {
s_log.debug("Static initalizer starting..."); s_log.debug("Static initalizer starting...");
try { try {