Complex and big update:
- removed dependencies from ~/sitenode/SiteNodeRequestContext - refactored ContentCenterServlet to use clean new style application code - removed dispatcher base code from ContentCenter main page - refactored root index.jsp to check for logged in user and redirect tu user page - added permission check to ContentCenterServlet and removed content-center redirect.jsp - removed old package dependen admin / sitemap application - added various documentation and improved formatting git-svn-id: https://svn.libreccm.org/ccm/trunk@2047 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2d011e2f62
commit
6bc125dbca
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
Version 6.6.8
|
||||
- Remove Dependency from SiteNodeRequestContext
|
||||
(Starting with removal of SNRC in core web.BaseApplicationServlet)
|
||||
- Refactored content-center from dispatcher mechanism to bebop page
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-cms"
|
||||
prettyName="Red Hat CCM Content Management System"
|
||||
version="6.6.7"
|
||||
version="6.6.8"
|
||||
release="1"
|
||||
webapp="ROOT">
|
||||
<ccm:dependencies>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ model com.arsdigita.cms;
|
|||
import com.arsdigita.kernel.*;
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
object type Workspace extends Application {
|
||||
object type ContentCenter extends Application {
|
||||
// nothing to persist yet
|
||||
// reference key (cms_workspace.workspace_id);
|
||||
// reference key (cms_contentcenter.contentcenter_id);
|
||||
}
|
||||
|
|
@ -21,10 +21,7 @@ package com.arsdigita.cms;
|
|||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationCollection;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
|
@ -35,15 +32,16 @@ import org.apache.log4j.Logger;
|
|||
* Application domain class for the CMS module user entry page (content-center)
|
||||
*
|
||||
* @author pb
|
||||
* @version $Id: Workspace.java $
|
||||
* @version $Id: ContentCenter.java $
|
||||
*/
|
||||
public class Workspace extends Application {
|
||||
public class ContentCenter extends Application {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log = Logger.getLogger(ContentSection.class);
|
||||
|
||||
// pdl stuff (constants)
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.Workspace";
|
||||
"com.arsdigita.cms.ContentCenter";
|
||||
|
||||
// general constants
|
||||
public static final String PACKAGE_KEY = "content-center";
|
||||
|
|
@ -57,7 +55,7 @@ public class Workspace extends Application {
|
|||
* @param oid the OID of the workspace (content-center)
|
||||
* @throws DataObjectNotFoundException
|
||||
*/
|
||||
public Workspace(OID oid) throws DataObjectNotFoundException {
|
||||
public ContentCenter(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
|
|
@ -68,14 +66,14 @@ public class Workspace extends Application {
|
|||
* @param id The <code>id</code> for the retrieved
|
||||
* <code>DataObject</code>.
|
||||
*/
|
||||
public Workspace(BigDecimal key) throws DataObjectNotFoundException {
|
||||
public ContentCenter(BigDecimal key) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a repository from the underlying data object.
|
||||
*/
|
||||
public Workspace(DataObject dataObject) {
|
||||
public ContentCenter(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
}
|
||||
|
||||
|
|
@ -92,12 +90,12 @@ public class Workspace extends Application {
|
|||
/**
|
||||
* This is called when the application is created.
|
||||
*/
|
||||
public static Workspace create(String urlName,
|
||||
String title,
|
||||
Application parent) {
|
||||
public static ContentCenter create(String urlName,
|
||||
String title,
|
||||
Application parent) {
|
||||
|
||||
Workspace app =
|
||||
(Workspace) Application.createApplication
|
||||
ContentCenter app =
|
||||
(ContentCenter) Application.createApplication
|
||||
(BASE_DATA_OBJECT_TYPE, urlName, title, parent);
|
||||
|
||||
app.save();
|
||||
|
|
@ -105,39 +103,32 @@ public class Workspace extends Application {
|
|||
return app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the Workspace application. There must not more
|
||||
* than one instance exist. May return null.
|
||||
*/
|
||||
public static Application getInstance() {
|
||||
ApplicationType workspaceType = ApplicationType.
|
||||
retrieveApplicationTypeForApplication(BASE_DATA_OBJECT_TYPE);
|
||||
if ( workspaceType == null ) { return null; }
|
||||
|
||||
ApplicationCollection apps = Application.retrieveAllApplications();
|
||||
apps.addEqualsFilter("resourceType.id", workspaceType.getID());
|
||||
if ( !apps.next() ) { return null; }
|
||||
|
||||
Application result = apps.getApplication();
|
||||
apps.close();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the location (URL) of the CMS Workspace. There must not more than
|
||||
* one instance exist.
|
||||
* Fetch the URL of the CMS ContentCenter.
|
||||
*
|
||||
* @return The URL of the CMS Workspace (currently including trailing slash)
|
||||
* Currently only one Content Center application installed is allowed!
|
||||
* Therefore we simply may return the URL used to load and initialise the
|
||||
* Content Center.
|
||||
*
|
||||
* @return The URL of the CMS ContentCenter (currently including trailing slash)
|
||||
*/
|
||||
public static String getURL() {
|
||||
|
||||
Application app = Workspace.getInstance();
|
||||
if (app == null) {
|
||||
return null;
|
||||
} else {
|
||||
String url = (String) app.getPrimaryURL();
|
||||
return url;
|
||||
}
|
||||
// quick 'nd dirty!
|
||||
return "/"+PACKAGE_KEY;
|
||||
|
||||
// Doesn't work as expected
|
||||
// see c.ad.ui.login.UserInfo for a working (hopefully) example.
|
||||
// ApplicationCollection apps = Application
|
||||
// .retrieveAllApplications(BASE_DATA_OBJECT_TYPE);
|
||||
// if (apps.next()) {
|
||||
// // Note: Currently only one Content Center application is allowed!
|
||||
// s_log.error("Instance of ContentCenter found!");
|
||||
// return apps.getPrimaryURL();
|
||||
// } else {
|
||||
// s_log.error("No instance of ContentCenter could be found!");
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -19,28 +19,31 @@
|
|||
|
||||
package com.arsdigita.cms;
|
||||
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.cms.dispatcher.ResourceHandler;
|
||||
import com.arsdigita.cms.dispatcher.SimpleCache;
|
||||
import com.arsdigita.cms.ui.contentcenter.MainPage;
|
||||
import com.arsdigita.developersupport.DeveloperSupport;
|
||||
import com.arsdigita.dispatcher.AccessDeniedException;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.kernel.security.Util;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.ui.login.LoginHelper;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationFileResolver;
|
||||
import com.arsdigita.web.BaseApplicationServlet;
|
||||
import com.arsdigita.web.*;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.web.Web;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -48,38 +51,45 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* CMS Workspace (content-center) application servlet serves all request made
|
||||
* within the Content Center application.
|
||||
* CMS ContentCenter (content-center) application servlet serves all request
|
||||
* made within the Content Center application.
|
||||
*
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
* @version $Id: WorkspaceServlet.java 2161 2011-02-02 00:16:13Z pboy $
|
||||
* @version $Id: ContentCenterServlet.java 2161 2011-02-02 00:16:13Z pboy $
|
||||
*/
|
||||
public class WorkspaceServlet extends BaseApplicationServlet {
|
||||
public class ContentCenterServlet extends BaseApplicationServlet {
|
||||
|
||||
/**Error logging */
|
||||
/** Logger instance for debugging */
|
||||
private static Logger s_log = Logger
|
||||
.getLogger(WorkspaceServlet.class.getName());
|
||||
.getLogger(ContentCenterServlet.class.getName());
|
||||
|
||||
/** The path of the file that maps resources. */
|
||||
// DEPRECATED STUFF follows. Should be no longer used, deleted in future!
|
||||
/** The path of the file that maps resources. */
|
||||
public final static String DEFAULT_MAP_FILE =
|
||||
"/WEB-INF/resources/content-center-old-map.xml";
|
||||
|
||||
/** Mapping between a relative URL and the class name of a ResourceHandler.*/
|
||||
private static HashMap s_pageClasses = WorkspaceSetup.getURLToClassMap();
|
||||
private static HashMap s_pageURLs = WorkspaceSetup.getClassToURLMap();
|
||||
private static HashMap s_pageClasses = ContentCenterSetup.getURLToClassMap();
|
||||
private static HashMap s_pageURLs = ContentCenterSetup.getClassToURLMap();
|
||||
|
||||
/**
|
||||
* Instantiated ResourceHandlers cache. This allows for lazy loading.
|
||||
*/
|
||||
/** Instantiated ResourceHandlers cache. This allows for lazy loading. */
|
||||
private static SimpleCache s_pages = new SimpleCache();
|
||||
|
||||
// private Dispatcher m_notFoundHandler;
|
||||
private ArrayList m_trailingSlashList = new ArrayList();
|
||||
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
|
||||
/** URL (pathinfo) -> Page object mapping. Based on it (and the http
|
||||
* request url) the doService method to selects a page to display */
|
||||
private final Map m_pages = new HashMap();
|
||||
|
||||
|
||||
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
|
||||
// handled by the this servlet directly.
|
||||
/** Path to directory containg ccm-cms template files */
|
||||
private String m_templatePath;
|
||||
|
||||
/** Resolvers to find templages (JSP) and other stuff stored in file system.*/
|
||||
/** Resolvers to find templates (JSP) and other stuff stored in file system.*/
|
||||
private ApplicationFileResolver m_resolver;
|
||||
|
||||
|
||||
|
|
@ -92,9 +102,22 @@ public class WorkspaceServlet extends BaseApplicationServlet {
|
|||
if (s_log.isDebugEnabled()) {
|
||||
s_log.info("starting doInit method");
|
||||
}
|
||||
// DEPRECATED STUFF for servlet internally process pages, maybe required
|
||||
// for JSP extension.
|
||||
m_trailingSlashList = new ArrayList();
|
||||
requireTrailingSlash("");
|
||||
|
||||
// NEW STUFF here used to process the pages in this servlet
|
||||
// Addresses previously noted in WEB-INF/resources/content-center-map.xml
|
||||
// Obviously not required.
|
||||
addPage("/", new MainPage()); // index page at address ~/ds
|
||||
// addPage("/index/", new MainPage());
|
||||
// addPage("/ItemSearchPage/", new CCItemSearchPage());
|
||||
// addPage("/SearchResultRedirector/", new CCSearchResultRedirector());
|
||||
|
||||
|
||||
// STUFF to use for JSP extension, i.e. jsp's to try for URLs which are not
|
||||
// handled by the this servlet directly.
|
||||
/** Set Template base path for JSP's */
|
||||
// ToDo: Make it configurable by an appropriate config registry entry!
|
||||
// m_templatePath = CMS.getConfig().getTemplateRoot();
|
||||
|
|
@ -111,7 +134,7 @@ public class WorkspaceServlet extends BaseApplicationServlet {
|
|||
|
||||
/**
|
||||
* Implements the (abstract) doService method of BaseApplicationServlet to
|
||||
* create the Workspace page.
|
||||
* create the ContentCenter page.
|
||||
*
|
||||
* @see com.arsdigita.web.BaseApplicationServlet#doService
|
||||
* (HttpServletRequest, HttpServletResponse, Application)
|
||||
|
|
@ -126,31 +149,75 @@ public class WorkspaceServlet extends BaseApplicationServlet {
|
|||
}
|
||||
DeveloperSupport.startStage("ContentCenterServlet.doService");
|
||||
|
||||
Workspace workspace = (Workspace) app;
|
||||
ContentCenter workspace = (ContentCenter) app;
|
||||
|
||||
/*
|
||||
* Check user and privilegies
|
||||
*/
|
||||
if (Web.getContext().getUser() == null) { // user not logged in
|
||||
throw new LoginSignal(sreq); // send to login page
|
||||
}
|
||||
// Check whether logged in user has access to at least one content section
|
||||
ContentSectionCollection sections = ContentSection.getAllSections();
|
||||
boolean hasAccess = false;
|
||||
while (sections.next()) {
|
||||
ContentSection section = sections.getContentSection();
|
||||
SecurityManager sm = new SecurityManager(section);
|
||||
if (sm.canAccess(sreq, SecurityManager.ADMIN_PAGES)) {
|
||||
hasAccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sections.close();
|
||||
if (!hasAccess) { // user has no access privilege
|
||||
throw new AccessDeniedException(
|
||||
"User is not entitled to access any content section");
|
||||
// throw new LoginSignal(sreq); // send to login page
|
||||
}
|
||||
|
||||
|
||||
|
||||
RequestContext ctx = DispatcherHelper.getRequestContext();
|
||||
String url = ctx.getRemainingURLPart(); // here SiteNodeRequestContext
|
||||
String originalUrl = ctx.getOriginalURL();
|
||||
|
||||
String requestUri = sreq.getRequestURI();
|
||||
|
||||
// New way to tetch the page
|
||||
String pathInfo = sreq.getPathInfo();
|
||||
Assert.exists(pathInfo, "String pathInfo");
|
||||
if (pathInfo.length() > 1 && pathInfo.endsWith("/")) {
|
||||
/* NOTE: ServletAPI specifies, pathInfo may be empty or will
|
||||
* start with a '/' character. It currently carries a
|
||||
* trailing '/' if a "virtual" page, i.e. not a real jsp, but
|
||||
* result of a servlet mapping. But Application requires url
|
||||
* NOT to end with a trailing '/' for legacy free applications. */
|
||||
pathInfo = pathInfo.substring(0, pathInfo.length()-1);
|
||||
}
|
||||
|
||||
// An empty remaining URL or a URL which doesn't end in trailing slash:
|
||||
// probably want to redirect.
|
||||
// Probably DEPRECATED with new access method or only relevant for jsp
|
||||
// extension
|
||||
if ( m_trailingSlashList.contains(url) && !originalUrl.endsWith("/") ) {
|
||||
DispatcherHelper.sendRedirect(sresp, originalUrl + "/");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check user access.
|
||||
// checkUserAccess(sreq, sresp);
|
||||
|
||||
ResourceHandler page = getResource(url);
|
||||
// ResourceHandler page = getResource(url);
|
||||
final Page page = (Page) m_pages.get(pathInfo);
|
||||
if ( page != null ) {
|
||||
|
||||
// Check user access.
|
||||
checkUserAccess(sreq, sresp);
|
||||
// Serve the page.
|
||||
page.init();
|
||||
page.dispatch(sreq, sresp, ctx);
|
||||
final Document doc = page.buildDocument(sreq, sresp);
|
||||
PresentationManager pm = Templating.getPresentationManager();
|
||||
pm.servePage(doc, sreq, sresp);
|
||||
// page.init();
|
||||
// page.dispatch(sreq, sresp, ctx);
|
||||
|
||||
} else {
|
||||
// Fall back on the JSP application dispatcher.
|
||||
// NOTE: The JSP must ensure the proper authentication and
|
||||
|
|
@ -178,8 +245,28 @@ public class WorkspaceServlet extends BaseApplicationServlet {
|
|||
if (s_log.isDebugEnabled()) {
|
||||
s_log.info("doService method completed");
|
||||
}
|
||||
} // END doService()
|
||||
|
||||
|
||||
/**
|
||||
* Adds one pair of Url - Page to the internal hash map, used as a cache.
|
||||
*
|
||||
* @param pathInfo url stub for a page to display
|
||||
* @param page Page object to display
|
||||
*/
|
||||
private void addPage(final String pathInfo, final Page page) {
|
||||
|
||||
Assert.exists(pathInfo, String.class);
|
||||
Assert.exists(page, Page.class);
|
||||
// Current Implementation requires pathInfo to start with a leading '/'
|
||||
// SUN Servlet API specifies: "PathInfo *may be empty* or will start
|
||||
// with a '/' character."
|
||||
Assert.isTrue(pathInfo.startsWith("/"), "path starts not with '/'");
|
||||
|
||||
m_pages.put(pathInfo, page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Service Method returns the URL stub for the class name,
|
||||
* can return null if not mapped
|
||||
|
|
@ -45,9 +45,9 @@ import org.xml.sax.SAXException;
|
|||
* @author Peter Boy <pboy@barkhof.uni-bremen.,de>
|
||||
* @version $Id: $
|
||||
*/
|
||||
public final class WorkspaceSetup {
|
||||
public final class ContentCenterSetup {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(WorkspaceSetup.class);
|
||||
private static Logger s_log = Logger.getLogger(ContentCenterSetup.class);
|
||||
|
||||
/** URL to access the CMS Workspace, by default content-center */
|
||||
final String m_workspaceURL;
|
||||
|
|
@ -69,7 +69,7 @@ public final class WorkspaceSetup {
|
|||
* @param workspaceURL
|
||||
* @param contentCenterMap
|
||||
*/
|
||||
public WorkspaceSetup( String workspaceURL,
|
||||
public ContentCenterSetup( String workspaceURL,
|
||||
String contentCenterMap) {
|
||||
|
||||
m_workspaceURL = workspaceURL;
|
||||
|
|
@ -78,7 +78,7 @@ import org.apache.log4j.Logger;
|
|||
* In a process of refactoring from legacy compatible to legacy free applications.
|
||||
* TODO:
|
||||
* - replace url check using RequestContext which resolves to SiteNodeRequest
|
||||
* implementation
|
||||
* implementation (due to SiteNodeRequest used in BaseApplicationServlet).
|
||||
* - Refactor content item UI bebop ApplicationPage or PageFactory instead of
|
||||
* legacy infected sitenode / package dispatchers.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -108,7 +108,10 @@ public class Initializer extends CompoundInitializer {
|
|||
s_log.debug("CMS.Initializer.(Constructor) invoked");
|
||||
|
||||
add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf",
|
||||
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
||||
new NameFilter(DbHelper
|
||||
.getDatabaseSuffix(database),
|
||||
"pdl")))
|
||||
);
|
||||
|
||||
add(new com.arsdigita.cms.contentsection.Initializer());
|
||||
add(new com.arsdigita.cms.publishToFile.Initializer());
|
||||
|
|
@ -127,12 +130,12 @@ public class Initializer extends CompoundInitializer {
|
|||
s_log.debug("CMS.Initializer.init(DomainInitEvent) invoked");
|
||||
super.init(e);
|
||||
|
||||
/* Register object instantiator for Workspace (Content Center) */
|
||||
e.getFactory().registerInstantiator(Workspace.BASE_DATA_OBJECT_TYPE,
|
||||
/* Register object instantiator for ContentCenter (Content Center) */
|
||||
e.getFactory().registerInstantiator(ContentCenter.BASE_DATA_OBJECT_TYPE,
|
||||
new ACSObjectInstantiator() {
|
||||
@Override
|
||||
public DomainObject doNewInstance(DataObject dobj) {
|
||||
return new Workspace(dobj);
|
||||
return new ContentCenter(dobj);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -203,10 +206,10 @@ public class Initializer extends CompoundInitializer {
|
|||
// cg - register Task Retrieval engine
|
||||
Engine.registerEngine(CMSEngine.CMS_ENGINE_TYPE, new CMSEngine());
|
||||
|
||||
// Setup Workspace tab to URL mapping
|
||||
// Setup ContentCenter tab to URL mapping
|
||||
final String workspaceURL = CMS.WORKSPACE_PACKAGE_KEY;
|
||||
final String contentCenterMap = s_conf.getContentCenterMap();
|
||||
WorkspaceSetup workspaceSetup = new WorkspaceSetup(workspaceURL,
|
||||
ContentCenterSetup workspaceSetup = new ContentCenterSetup(workspaceURL,
|
||||
contentCenterMap);
|
||||
workspaceSetup.run();
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,10 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* <p>This class also optionally initializes user-defined content types. </p>
|
||||
* <p>Additional user-defined content sections can be loaded and initilized
|
||||
* using the recurring
|
||||
* <pre>initializer</pre> at any startup.
|
||||
* using the recurring <pre>initializer</pre> at any startup.
|
||||
*
|
||||
* <p>The tasks to perform are:</p> <ol> <li>create CMS package
|
||||
* type(content-section)</li> <li>create Workspace package type and
|
||||
* type(content-section)</li> <li>create ContentCenter package type and
|
||||
* instance</li> <li>create CMS Service package type and instance</li>
|
||||
* <li>create CMS package (content-section) instance</li> </ol>
|
||||
*
|
||||
|
|
@ -134,9 +133,9 @@ public class Loader extends PackageLoader {
|
|||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
|
||||
// Step 1) Setup the CMS Workspace
|
||||
ApplicationType appType = loadWorkspaceApplicationType();
|
||||
setupDefaultWorkspaceApplicationInstance(appType);
|
||||
// Step 1) Setup the CMS ContentCenter
|
||||
ApplicationType appType = loadContentCenterApplicationType();
|
||||
setupDefaultContentCenterApplicationInstance(appType);
|
||||
|
||||
// Step 2) Setup the CMS global services
|
||||
appType = loadServiceApplicationType();
|
||||
|
|
@ -168,14 +167,14 @@ public class Loader extends PackageLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the Workspace subpackage (content-center) into the database.
|
||||
* Loads the ContentCenter subpackage (content-center) into the database.
|
||||
*
|
||||
* It is made public to be able to invoke it from the update script (e.g.
|
||||
* 6.6.1-6.6.2). We need separate steps for loading and instantiating
|
||||
* because update skript requires.
|
||||
*/
|
||||
public static ApplicationType loadWorkspaceApplicationType() {
|
||||
s_log.debug("Creating CMS Workspace...");
|
||||
public static ApplicationType loadContentCenterApplicationType() {
|
||||
s_log.debug("Creating CMS ContentCenter...");
|
||||
|
||||
/*
|
||||
* Create new type legacy free application type NOTE: The wording in the
|
||||
|
|
@ -185,18 +184,18 @@ public class Loader extends PackageLoader {
|
|||
* words and illegal characters with an hyphen and converted to lower
|
||||
* case. "Content Center" will become "content-center".
|
||||
*/
|
||||
ApplicationType type = new ApplicationType(Workspace.INSTANCE_NAME,
|
||||
Workspace.BASE_DATA_OBJECT_TYPE);
|
||||
ApplicationType type = new ApplicationType(ContentCenter.INSTANCE_NAME,
|
||||
ContentCenter.BASE_DATA_OBJECT_TYPE);
|
||||
|
||||
type.setDescription("The content center workspace for content creators.");
|
||||
type.save();
|
||||
|
||||
s_log.debug("CMS Workspace type created.");
|
||||
s_log.debug("CMS ContentCenter type created.");
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the Workspace subpackage (content-center) (in the database).
|
||||
* Instantiates the ContentCenter subpackage (content-center) (in the database).
|
||||
*
|
||||
* It is made public to be able to invoke it from the update script (e.g.
|
||||
* 6.6.1-6.6.2). We need separate steps for loading and instantiating
|
||||
|
|
@ -204,25 +203,26 @@ public class Loader extends PackageLoader {
|
|||
*
|
||||
* @param workspaceType
|
||||
*/
|
||||
public static void setupDefaultWorkspaceApplicationInstance(
|
||||
ApplicationType workspaceType) {
|
||||
public static void setupDefaultContentCenterApplicationInstance(
|
||||
ApplicationType appType) {
|
||||
|
||||
// create application instance
|
||||
// Whether a legacy compatible or a legacy free application is
|
||||
// created depends on the type of ApplicationType above. No need to
|
||||
// modify anything here in the migration process
|
||||
// old-style package key used as url fragment where to install the instance
|
||||
s_log.debug("Creating CMS Workspace instance ...");
|
||||
Workspace app = (Workspace) Application.createApplication(
|
||||
Workspace.BASE_DATA_OBJECT_TYPE, // type
|
||||
Workspace.PACKAGE_KEY, // url fragment
|
||||
Workspace.INSTANCE_NAME, // title
|
||||
s_log.debug("Creating CMS ContentCenter instance ...");
|
||||
ContentCenter app = (ContentCenter) Application.createApplication(
|
||||
ContentCenter.BASE_DATA_OBJECT_TYPE, // type
|
||||
ContentCenter.PACKAGE_KEY, // url fragment
|
||||
ContentCenter.INSTANCE_NAME, // title
|
||||
null); // parent
|
||||
app.setDescription("The default CMS workspace instance.");
|
||||
app.setDescription("The default CMS ContentCenter instance.");
|
||||
app.save();
|
||||
|
||||
s_log.debug("CMS Workspace instance " + Workspace.PACKAGE_KEY + " created.");
|
||||
s_log.debug("Done loading CMS Workspace.");
|
||||
s_log.debug("CMS ContentCenter instance " + ContentCenter.PACKAGE_KEY
|
||||
+ " created.");
|
||||
s_log.debug("Done loading CMS ContentCenter.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -319,15 +319,17 @@ public class Loader extends PackageLoader {
|
|||
ContentSectionConfig conf = new ContentSectionConfig();
|
||||
conf.load();
|
||||
|
||||
ContentSectionSetup.setupContentSectionAppInstance(sectionName,
|
||||
conf.getDefaultRoles(),
|
||||
conf.getDefaultWorkflows(),
|
||||
s_conf.isPubliclyViewable(),
|
||||
s_conf.getItemResolverClass(),
|
||||
s_conf.getTemplateResolverClass(),
|
||||
m_content_type_list,
|
||||
s_conf.getUseSectionCategories(),
|
||||
s_conf.getCategoryFileList());
|
||||
ContentSectionSetup.setupContentSectionAppInstance(
|
||||
sectionName,
|
||||
conf.getDefaultRoles(),
|
||||
conf.getDefaultWorkflows(),
|
||||
s_conf.isPubliclyViewable(),
|
||||
s_conf.getItemResolverClass(),
|
||||
s_conf.getTemplateResolverClass(),
|
||||
m_content_type_list,
|
||||
s_conf.getUseSectionCategories(),
|
||||
s_conf.getCategoryFileList()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import com.arsdigita.cms.workflow.CMSEngine;
|
|||
import com.arsdigita.cms.workflow.CMSTask;
|
||||
import com.arsdigita.cms.workflow.CMSTaskType;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
|
|
@ -185,7 +184,7 @@ public class SecurityManager implements Security, SecurityConstants {
|
|||
|
||||
public boolean canAccess(HttpServletRequest request, String action,
|
||||
ContentItem item) {
|
||||
User user = KernelHelper.getCurrentUser(request);
|
||||
User user = (User)Kernel.getContext().getParty();
|
||||
boolean canAccess = canAccess(user, action, item);
|
||||
if (!canAccess) {
|
||||
canAccess = LocalRequestPassword.validLocalRequest(request);
|
||||
|
|
@ -498,7 +497,7 @@ public class SecurityManager implements Security, SecurityConstants {
|
|||
HttpServletResponse response)
|
||||
throws IOException, ServletException {
|
||||
|
||||
if (KernelHelper.getCurrentUser(request) != null) { return; }
|
||||
if (Kernel.getContext().getParty() != null) { return; }
|
||||
String url = com.arsdigita.kernel.security.Util
|
||||
.getSecurityHelper().getLoginURL(request)
|
||||
+ "?" + LoginHelper.RETURN_URL_PARAM_NAME
|
||||
|
|
|
|||
|
|
@ -23,15 +23,10 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.publishToFile.LocalRequestPassword;
|
||||
import com.arsdigita.developersupport.DeveloperSupport;
|
||||
import com.arsdigita.dispatcher.ChainedDispatcher;
|
||||
import com.arsdigita.dispatcher.Dispatcher;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.JSPApplicationDispatcher;
|
||||
import com.arsdigita.dispatcher.RedirectException;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.dispatcher.*;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.ACSObjectCache;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.KernelContext;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
|
|
@ -366,7 +361,7 @@ public class CMSDispatcher implements Dispatcher, ChainedDispatcher {
|
|||
RequestContext actx)
|
||||
throws ServletException, AccessDeniedException {
|
||||
|
||||
User user = KernelHelper.getCurrentUser(request);
|
||||
User user = KernelContext.getUser();
|
||||
|
||||
ContentSection section = getContentSection(request);
|
||||
SecurityManager sm = getSecurityManager(section);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import com.arsdigita.dispatcher.RequestContext;
|
|||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
// import com.arsdigita.kernel.KernelContext;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
|
|
@ -116,7 +116,8 @@ public class CMSPage extends Page implements ResourceHandler {
|
|||
* Builds the page.
|
||||
*/
|
||||
protected void buildPage() {
|
||||
// Set the class attribute.
|
||||
// Set the class attribute value. May be overwritten by child class
|
||||
// to hold a more specific value
|
||||
setClassAttr(PAGE_CLASS);
|
||||
|
||||
// Global XML params.
|
||||
|
|
@ -126,6 +127,8 @@ public class CMSPage extends Page implements ResourceHandler {
|
|||
|
||||
// MP: This is a hack to so that the XML params work with the newer
|
||||
// version of Xalan.
|
||||
// Sets attribute in SimpleComponent, attributes of the same name will
|
||||
// be overweritten.
|
||||
setAttribute(ASSETS, Utilities.getGlobalAssetsURL());
|
||||
|
||||
// Make sure the error display gets rendered.
|
||||
|
|
@ -193,7 +196,7 @@ public class CMSPage extends Page implements ResourceHandler {
|
|||
* On the other hand, if deprecated, implementing ResourceHandler
|
||||
* may not be required
|
||||
*/
|
||||
public ContentSection getContentSection(HttpServletRequest request) {
|
||||
public ContentSection getContentSection(HttpServletRequest request) {
|
||||
// Resets all content sections associations.
|
||||
// return ContentSectionDispatcher.getContentSection(request);
|
||||
return ContentSectionServlet.getContentSection(request);
|
||||
|
|
@ -327,22 +330,29 @@ public class CMSPage extends Page implements ResourceHandler {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites bebop.Page#generateXMLHelper to add the name of the user
|
||||
* logged in to the page (displayed as part of the header).
|
||||
* @param ps
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Element generateXMLHelper(PageState ps, Document parent) {
|
||||
Element page = super.generateXMLHelper(ps,parent);
|
||||
User user = getCurrentUser(ps);
|
||||
if ( user != null ) {
|
||||
page.addAttribute("name",user.getDisplayName());
|
||||
}
|
||||
User user = (User) Kernel.getContext().getParty();
|
||||
if ( user != null ) {
|
||||
page.addAttribute("name",user.getDisplayName());
|
||||
}
|
||||
|
||||
return page;
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use Kernel.getContext().getParty() if possible and
|
||||
* Web.getContext().getUser() if necessary.
|
||||
*/
|
||||
public static User getCurrentUser(PageState state) {
|
||||
return KernelHelper.getCurrentUser(state.getRequest());
|
||||
}
|
||||
// /**
|
||||
// * @deprecated Use Kernel.getContext().getParty() if possible and
|
||||
// * Web.getContext().getUser() if necessary.
|
||||
// */
|
||||
// public static User getCurrentUser(PageState state) {
|
||||
// return (User) Kernel.getContext().getParty();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@ import com.arsdigita.dispatcher.RequestContext;
|
|||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelContext;
|
||||
import com.arsdigita.kernel.KernelRequestContext;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
// import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
|
|
@ -64,7 +65,8 @@ public class ContentSectionDispatcher implements Dispatcher {
|
|||
RequestContext context)
|
||||
throws IOException, ServletException {
|
||||
|
||||
setContentSection(request, (SiteNodeRequestContext) context);
|
||||
// setContentSection(request, (SiteNodeRequestContext) context);
|
||||
setContentSection(request, (KernelRequestContext) context);
|
||||
dispatcherChain.dispatch(request, response, context);
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +100,8 @@ public class ContentSectionDispatcher implements Dispatcher {
|
|||
* @return The current Content Section
|
||||
*/
|
||||
private void setContentSection(HttpServletRequest request,
|
||||
SiteNodeRequestContext actx)
|
||||
// SiteNodeRequestContext actx)
|
||||
KernelRequestContext actx)
|
||||
throws ServletException {
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.cms.ContentBundle;
|
|||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.util.LanguageUtil;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
|
|
@ -246,7 +246,7 @@ public class MultilingualItemResolver extends AbstractItemResolver implements It
|
|||
|
||||
// Determine if we are under the admin UI.
|
||||
|
||||
if (url.startsWith(ADMIN_PREFIX) || url.startsWith(Workspace.getURL())) {
|
||||
if (url.startsWith(ADMIN_PREFIX) || url.startsWith(ContentCenter.getURL())) {
|
||||
return ContentItem.DRAFT;
|
||||
} else {
|
||||
return ContentItem.LIVE;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
|
|
@ -81,7 +81,7 @@ public abstract class ResourceHandlerImpl implements ResourceHandler {
|
|||
HttpServletResponse response,
|
||||
RequestContext actx,
|
||||
ContentItem item) {
|
||||
User user = KernelHelper.getCurrentUser(request);
|
||||
User user = (User)Kernel.getContext().getParty();
|
||||
|
||||
PrivilegeDescriptor view = PrivilegeDescriptor.get
|
||||
(SecurityManager.CMS_READ_ITEM);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.cms.CMS;
|
|||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
|
|
@ -64,7 +64,7 @@ public class SimpleItemResolver extends AbstractItemResolver implements ItemReso
|
|||
Logger.getLogger(SimpleItemResolver.class.getName());
|
||||
|
||||
private static final String ADMIN_PREFIX = "admin";
|
||||
private static final String WORKSPACE_PREFIX = Workspace.getURL();
|
||||
private static final String WORKSPACE_PREFIX = ContentCenter.getURL();
|
||||
|
||||
private static MasterPage s_masterP = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.ImageAsset;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.Service;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.WorkspaceServlet;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.ContentCenterServlet;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelContext;
|
||||
|
|
@ -62,13 +62,13 @@ public class Utilities {
|
|||
public static final Logger LOG = Logger.getLogger(Utilities.class);
|
||||
|
||||
/**
|
||||
* Fetch the location of the CMS Workspace package.
|
||||
* @return The URL of the CMS Workspace package
|
||||
* @deprecated use Workspace.getURL() instead
|
||||
* Fetch the location of the CMS ContentCenter package.
|
||||
* @return The URL of the CMS ContentCenter package
|
||||
* @deprecated use ContentCenter.getURL() instead
|
||||
*/
|
||||
public static String getWorkspaceURL() {
|
||||
|
||||
return Workspace.getURL();
|
||||
return ContentCenter.getURL();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -271,8 +271,8 @@ public class Utilities {
|
|||
// OLD APPROACH: used in conjunction with CMSDispatcher. This
|
||||
// shouldn't do any harm even if CMSDispatcher is not being used.
|
||||
CMSDispatcher.releaseResource(section, "admin/item");
|
||||
WorkspaceServlet.releaseResource("");
|
||||
WorkspaceServlet.releaseResource("index");
|
||||
ContentCenterServlet.releaseResource("");
|
||||
ContentCenterServlet.releaseResource("index");
|
||||
refreshAdminUI(state);
|
||||
|
||||
// NEW APPROACH: used in conjunction with
|
||||
|
|
@ -296,8 +296,8 @@ public class Utilities {
|
|||
CMSDispatcher.releaseResource(section, "admin");
|
||||
CMSDispatcher.releaseResource(section, "admin/index");
|
||||
CMSDispatcher.releaseResource(section, "");
|
||||
WorkspaceServlet.releaseResource("");
|
||||
WorkspaceServlet.releaseResource("index");
|
||||
ContentCenterServlet.releaseResource("");
|
||||
ContentCenterServlet.releaseResource("index");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,11 +31,9 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.ContentSectionServlet;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.developersupport.DeveloperSupport;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
|
|
@ -55,6 +53,16 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Currently under development as a replacement for CMSPage without the
|
||||
// dispatcher mechanism but a new application style "pure" bebop page
|
||||
// served by an application servlet.
|
||||
//
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* <p>A <tt>CMSPage</tt> is a Bebop {@link com.arsdigita.bebop.Page}
|
||||
* implementation of the {@link com.arsdigita.cms.dispatcher.ResourceHandler}
|
||||
|
|
@ -329,20 +337,15 @@ public class CMSApplicationPage extends Page {
|
|||
|
||||
@Override
|
||||
protected Element generateXMLHelper(PageState ps, Document parent) {
|
||||
|
||||
Element page = super.generateXMLHelper(ps,parent);
|
||||
User user = getCurrentUser(ps);
|
||||
if ( user != null ) {
|
||||
page.addAttribute("name",user.getDisplayName());
|
||||
}
|
||||
|
||||
return page;
|
||||
User user = (User) Kernel.getContext().getParty();
|
||||
if ( user != null ) {
|
||||
page.addAttribute("name",user.getDisplayName());
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use Kernel.getContext().getParty() if possible and
|
||||
* Web.getContext().getUser() if necessary.
|
||||
*/
|
||||
public static User getCurrentUser(PageState state) {
|
||||
return KernelHelper.getCurrentUser(state.getRequest());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,29 +20,26 @@ package com.arsdigita.cms.ui;
|
|||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.ui.workspace.TasksPanel;
|
||||
import com.arsdigita.cms.ui.contentcenter.TasksPanel;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
import com.arsdigita.ui.DebugPanel;
|
||||
|
||||
|
||||
/**
|
||||
* <p>The Content Center page.</p>
|
||||
* <p>The Content Center main page (index page). </p>
|
||||
*
|
||||
* This class uses the dispatcher based page creation mechanism.
|
||||
*
|
||||
* @author Jack Chung (flattop@arsdigita.com)
|
||||
* @author Michael Pih (pihman@arsdigita.com)
|
||||
|
|
@ -66,6 +63,9 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
|
|||
* Construct a new CMSPageWorkspacePage
|
||||
*/
|
||||
public CMSPageWorkspacePage() { // Constructor Page
|
||||
|
||||
/* specifically invokes PresentationManager / PageTransformer to create
|
||||
* a page instantiation. */
|
||||
super(new Label( GlobalizationUtil.globalize
|
||||
("cms.ui.content_center")),
|
||||
new SimpleContainer());
|
||||
|
|
@ -74,16 +74,16 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
|
|||
|
||||
BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE);
|
||||
addGlobalStateParam(typeId);
|
||||
m_typeSel = new ACSObjectSelectionModel
|
||||
(ContentType.class.getName(), ContentType.BASE_DATA_OBJECT_TYPE, typeId);
|
||||
m_typeSel = new ACSObjectSelectionModel(ContentType.class.getName(),
|
||||
ContentType.BASE_DATA_OBJECT_TYPE,
|
||||
typeId);
|
||||
|
||||
BigDecimalParameter sectionId = new BigDecimalParameter
|
||||
(CONTENT_SECTION);
|
||||
BigDecimalParameter sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(sectionId);
|
||||
m_sectionSel = new ACSObjectSelectionModel
|
||||
(ContentSection.class.getName(),
|
||||
ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
sectionId);
|
||||
(ContentSection.class.getName(),
|
||||
ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
sectionId);
|
||||
|
||||
add( new WorkspaceContextBar() );
|
||||
add( new GlobalNavigation() );
|
||||
|
|
@ -101,7 +101,7 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
|
|||
/**
|
||||
* Creates, and then caches, the Tasks pane. Overriding this
|
||||
* method to return null will prevent this tab from appearing.
|
||||
**/
|
||||
*/
|
||||
protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel,
|
||||
ACSObjectSelectionModel sectionModel) {
|
||||
if (m_tasks == null) {
|
||||
|
|
@ -122,7 +122,7 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
|
|||
return m_search;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private SimpleContainer makeHeader() {
|
||||
PrintListener l = new PrintListener() {
|
||||
public void prepare(PrintEvent event) {
|
||||
|
|
@ -145,21 +145,22 @@ public class CMSPageWorkspacePage extends CMSPage implements ActionListener {
|
|||
return sc;
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Created the TabbedPane to use for this page. Sets the class
|
||||
* attribute for this tabbed pane. The default implementation uses a
|
||||
* {@link com.arsdigita.bebop.TabbedPane} and sets the class
|
||||
* Created the TabbedPane to use for this page.
|
||||
*
|
||||
* This is the "index" page, displayed at the base address (content-center
|
||||
* by default).
|
||||
*
|
||||
* Sets the class attribute for this tabbed pane. The default implementation
|
||||
* uses a {@link com.arsdigita.bebop.TabbedPane} and sets the class
|
||||
* attribute to "CMS Admin." This implementation also adds tasks,
|
||||
* content sections, and search panes.
|
||||
*
|
||||
*<p>
|
||||
*
|
||||
* Developers can override this method to add only the tabs they
|
||||
* want, or to add additional tabs after the default CMS tabs are
|
||||
* added.
|
||||
**/
|
||||
* Developers can override this method to add only the tabs they want,
|
||||
* or to add additional tabs after the default CMS tabs are added.
|
||||
*/
|
||||
protected TabbedPane createTabbedPane() {
|
||||
TabbedPane pane = new TabbedPane();
|
||||
pane.setClassAttr(XSL_CLASS);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.PageLocations;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ public class ContentItemNavbar extends CMSContainer {
|
|||
ContentType type = item.getContentType();
|
||||
|
||||
final String url = URL.there(state.getRequest(),
|
||||
Workspace.getURL()).toString();
|
||||
ContentCenter.getURL()).toString();
|
||||
|
||||
element.addAttribute("workspaceURL", url);
|
||||
element.addAttribute("sectionName", section.getName());
|
||||
|
|
|
|||
|
|
@ -47,8 +47,13 @@ class ContentSectionContextBar extends WorkspaceContextBar {
|
|||
private static final Logger s_log = Logger.getLogger
|
||||
(ContentSectionContextBar.class);
|
||||
|
||||
@Override
|
||||
protected List entries(final PageState state) {
|
||||
|
||||
/* Include breadcrumb entries already set by content-center (i.e. the
|
||||
* URL of the content center itself */
|
||||
final List entries = super.entries(state);
|
||||
|
||||
final ContentSection section = CMS.getContext().getContentSection();
|
||||
final Stack folderEntryStack = new Stack();
|
||||
String currentFolderLabel = null;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import com.arsdigita.bebop.Link;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
|
@ -45,7 +45,7 @@ public class ContentSectionNavbar extends CMSContainer {
|
|||
setClassAttr("section");
|
||||
|
||||
String wsUrl = UI.getWorkspaceURL();
|
||||
String csUrl = Workspace.getURL();
|
||||
String csUrl = ContentCenter.getURL();
|
||||
|
||||
m_navbar = new DimensionalNavbar();
|
||||
m_navbar.setAlign(DimensionalNavbar.LEFT);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
|||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.ObjectPermissionCollection;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
|
|
@ -344,7 +344,7 @@ public class FlatItemList extends SegmentedPanel
|
|||
|
||||
m_editFolderAction.setVisible(state, editItem);
|
||||
|
||||
User user = KernelHelper.getCurrentUser(state.getRequest());
|
||||
User user = (User) Kernel.getContext().getParty();
|
||||
PermissionDescriptor perm =
|
||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||
folder,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package com.arsdigita.cms.ui;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
|
@ -35,7 +35,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: GlobalNavigation.java 1942 2009-05-29 07:53:23Z terry $
|
||||
*/
|
||||
class GlobalNavigation extends SimpleComponent {
|
||||
// Made public (instead of unspecified, resulting in protected) in 6.6.8
|
||||
public class GlobalNavigation extends SimpleComponent {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(GlobalNavigation.class);
|
||||
|
|
@ -45,13 +46,21 @@ class GlobalNavigation extends SimpleComponent {
|
|||
private final String m_signOutPath;
|
||||
private final String m_helpPath;
|
||||
|
||||
GlobalNavigation() {
|
||||
m_centerPath = Workspace.getURL();
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GlobalNavigation() {
|
||||
m_centerPath = ContentCenter.getURL();
|
||||
m_wspcPath = UI.getWorkspaceURL();
|
||||
m_signOutPath = UI.getLogoutPageURL();
|
||||
m_helpPath = "/nowhere"; // We don't have this yet XXX.
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(final PageState state, final Element parent) {
|
||||
if (isVisible(state)) {
|
||||
|
|
@ -72,6 +81,15 @@ class GlobalNavigation extends SimpleComponent {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sreq
|
||||
* @param parent
|
||||
* @param name
|
||||
* @param path
|
||||
* @param title
|
||||
* @return
|
||||
*/
|
||||
private static Element link(final HttpServletRequest sreq,
|
||||
final Element parent,
|
||||
final String name,
|
||||
|
|
@ -85,6 +103,11 @@ class GlobalNavigation extends SimpleComponent {
|
|||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private static String lz(final String key) {
|
||||
return (String) ContentSectionPage.globalize(key).localize();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,25 +28,21 @@ import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
|||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.CMSConfig;
|
||||
import com.arsdigita.cms.CMSExcursion;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.*;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.templating.PresentationManager;
|
||||
import com.arsdigita.templating.Templating;
|
||||
import com.arsdigita.toolbox.ui.OIDParameter;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.xml.Document;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -184,20 +180,13 @@ public class ItemSearchPage extends CMSPage {
|
|||
// }
|
||||
//
|
||||
// });
|
||||
}
|
||||
} // END constructor
|
||||
|
||||
|
||||
// private void enableCreatePane(final PageState state) {
|
||||
// final BigDecimal typeParam = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||
// if (typeParam == null) {
|
||||
// m_tabbedPane.setTabVisible(state, m_create, false);
|
||||
// m_create.setVisible(state, false);
|
||||
// } else {
|
||||
// m_tabbedPane.setTabVisible(state, m_create, true);
|
||||
// m_create.setVisible(state, true);
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Creates, and then caches, the Browse pane. Overriding this method to return null will prevent this tab from
|
||||
* Creates, and then caches, the Browse pane.
|
||||
*
|
||||
* Overriding this method to return null will prevent this tab from
|
||||
* appearing. Note: not implemented yet.
|
||||
*/
|
||||
protected ItemSearchBrowsePane getBrowsePane() {
|
||||
|
|
@ -217,7 +206,8 @@ public class ItemSearchPage extends CMSPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates, and then caches, the Creation pane. Overriding this method to return null will prevent this tab from
|
||||
* Creates, and then caches, the Creation pane.
|
||||
* Overriding this method to return null will prevent this tab from
|
||||
* appearing.
|
||||
*/
|
||||
protected ItemSearchPopup getSearchPane() {
|
||||
|
|
@ -239,13 +229,15 @@ public class ItemSearchPage extends CMSPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Created the TabbedPane to use for this page. Sets the class attribute for this tabbed pane. The default
|
||||
* implementation uses a
|
||||
* {@link com.arsdigita.bebop.TabbedPane} and sets the class attribute to "CMS Admin." This implementation also adds
|
||||
* tasks, content sections, and search panes.
|
||||
* Created the TabbedPane to use for this page.
|
||||
*
|
||||
* Sets the class attribute for this tabbed pane. The default implementation
|
||||
* uses a {@link com.arsdigita.bebop.TabbedPane} and sets the class
|
||||
* attribute to "CMS Admin." This implementation also adds tasks,
|
||||
* content sections, and search panes.
|
||||
*
|
||||
* Developers can override this method to add only the tabs they want, or to add additional tabs after the default
|
||||
* CMS tabs are added.
|
||||
* Developers can override this method to add only the tabs they want,
|
||||
* or to add additional tabs after the default CMS tabs are added.
|
||||
*/
|
||||
protected TabbedPane createTabbedPane() {
|
||||
TabbedPane pane = new TabbedPane();
|
||||
|
|
@ -271,7 +263,8 @@ public class ItemSearchPage extends CMSPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds the specified component, with the specified tab name, to the tabbed pane only if it is not null.
|
||||
* Adds the specified component, with the specified tab name, to the
|
||||
* tabbed pane only if it is not null.
|
||||
*
|
||||
* @param pane The pane to which to add the tab
|
||||
* @param tabName The name of the tab if it's added
|
||||
|
|
@ -279,24 +272,16 @@ public class ItemSearchPage extends CMSPage {
|
|||
*/
|
||||
protected void addToPane(TabbedPane pane, String tabName, Component comp) {
|
||||
if (comp != null) {
|
||||
pane.addTab(GlobalizationUtil.globalize("cms.ui.item_search." + tabName).localize().toString(), comp);
|
||||
|
||||
pane.addTab(GlobalizationUtil
|
||||
.globalize("cms.ui.item_search." + tabName)
|
||||
.localize().toString()
|
||||
,comp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When a new tab is selected, reset the state of the formerly-selected pane.
|
||||
*
|
||||
* @param event The event fired by selecting a tab
|
||||
*/
|
||||
//public void actionPerformed(ActionEvent event) {
|
||||
//PageState state = event.getPageState();
|
||||
//Component pane = m_tabbedPane.getCurrentPane(state);
|
||||
//if ( pane == m_browse ) {
|
||||
// MP: reset tasks pane
|
||||
//} else if ( pane == m_search ) {
|
||||
//m_search.reset(state);
|
||||
//}
|
||||
//}
|
||||
|
||||
/**
|
||||
* This strange voodoo from Dan. No idea what it does.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ import com.arsdigita.cms.ContentItem;
|
|||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.WorkspaceServlet;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.ContentCenterServlet;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
|
|
@ -284,11 +284,11 @@ public class ItemSearchWidget extends FormSection
|
|||
params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
|
||||
}
|
||||
|
||||
String searchURL = WorkspaceServlet.getURLStubForClass(
|
||||
String searchURL = ContentCenterServlet.getURLStubForClass(
|
||||
ItemSearchPage.class.getName());
|
||||
s_log.debug("Search URL stub is: " + searchURL);
|
||||
|
||||
searchURL = Workspace.getURL() + searchURL;
|
||||
searchURL = ContentCenter.getURL() + searchURL;
|
||||
|
||||
// TODO Not sure what to do when you get a null here
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.SectionLocaleCollection;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
|
@ -182,7 +182,7 @@ public class SectionConfigurationPage extends CMSPage implements Resettable {
|
|||
|
||||
DimensionalNavbar dn = new DimensionalNavbar();
|
||||
dn.setDelimiter(" - ");
|
||||
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), Workspace.getURL()));
|
||||
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.my_workspace")), ContentCenter.getURL()));
|
||||
dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.sign_out")), Utilities.getLogoutURL()));
|
||||
// FIXME: Write online help, for the time being, do not offer a link
|
||||
// dn.add(new Link( new Label(GlobalizationUtil.globalize("cms.ui.help")), "help"));
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@
|
|||
package com.arsdigita.cms.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.toolbox.ui.ContextBar;
|
||||
import com.arsdigita.web.URL;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -32,17 +33,29 @@ import java.util.List;
|
|||
* @author Justin Ross <jross@redhat.com>
|
||||
* @version $Id: WorkspaceContextBar.java 2286 2012-03-11 09:14:14Z pboy $
|
||||
*/
|
||||
class WorkspaceContextBar extends ContextBar {
|
||||
// Made public (instead of unspecified) in 6.6.8
|
||||
public class WorkspaceContextBar extends ContextBar {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(WorkspaceContextBar.class);
|
||||
(WorkspaceContextBar.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected List entries(final PageState state) {
|
||||
|
||||
final List entries = super.entries(state);
|
||||
|
||||
final String centerTitle = lz("cms.ui.content_center");
|
||||
final String centerPath = Workspace.getURL();
|
||||
// final String centerPath = ContentCenter.getURL();
|
||||
final String centerPath = ContentCenter.getURL();
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Got Url: " + centerPath);
|
||||
}
|
||||
final URL url = URL.there(state.getRequest(), centerPath);
|
||||
|
||||
entries.add(new Entry(centerTitle, url));
|
||||
|
|
|
|||
|
|
@ -19,13 +19,7 @@
|
|||
package com.arsdigita.cms.ui.category;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Grid;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
import com.arsdigita.bebop.Table;
|
||||
import com.arsdigita.bebop.*;
|
||||
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||
import com.arsdigita.categorization.Category;
|
||||
import com.arsdigita.cms.CMS;
|
||||
|
|
@ -38,7 +32,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
|||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
|
@ -135,7 +129,7 @@ public class CategoryItemsBrowser extends Grid {
|
|||
Category cat = (Category)m_sel.getSelectedObject(s);
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
User user = KernelHelper.getCurrentUser( s.getRequest() );
|
||||
User user = (User)Kernel.getContext().getParty();
|
||||
OID oid = null;
|
||||
if (user != null) {
|
||||
oid = user.getOID();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui.workspace;
|
||||
package com.arsdigita.cms.ui.contentcenter;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
|
@ -16,39 +15,43 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui;
|
||||
package com.arsdigita.cms.ui.contentcenter;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.bebop.TabbedPane;
|
||||
import com.arsdigita.bebop.*;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
import com.arsdigita.cms.ui.workspace.TasksPanel;
|
||||
import com.arsdigita.cms.ui.GlobalNavigation;
|
||||
import com.arsdigita.cms.ui.ItemSearch;
|
||||
import com.arsdigita.cms.ui.WorkspaceContextBar;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||
import com.arsdigita.ui.DebugPanel;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.xml.Document;
|
||||
import com.arsdigita.xml.Element;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* <p>The Content Center page.</p>
|
||||
* <p>The Content Center main page. </p>
|
||||
*
|
||||
* The page contains the general header and footer, the breadcrumb, and the
|
||||
* complete content page including the tab bar, the sections/tasks page, the
|
||||
* search page, and the listener to switch between the tabs.
|
||||
*
|
||||
* @author Jack Chung (flattop@arsdigita.com)
|
||||
* @author Michael Pih (pihman@arsdigita.com)
|
||||
* @version $Id: WorkspacePage.java 2280 2012-03-10 23:55:04Z pboy $
|
||||
* @author Peter Boy (pboy@barkhof.uni-bremen.de)
|
||||
* @version $Id: MainPage.java pboy $
|
||||
*/
|
||||
public class WorkspacePage extends CMSPage implements ActionListener {
|
||||
public class MainPage extends Page implements ActionListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(MainPage.class);
|
||||
|
||||
private final static String XSL_CLASS = "CMS Admin";
|
||||
|
||||
|
|
@ -63,27 +66,35 @@ public class WorkspacePage extends CMSPage implements ActionListener {
|
|||
public static final String CONTENT_SECTION = "section_id";
|
||||
|
||||
/**
|
||||
* Construct a new CMSPageWorkspacePage
|
||||
* Construct a new MainPage.
|
||||
*
|
||||
* Creates the complete page ready to be included in the page cache of
|
||||
* ContentCenterServlet.
|
||||
*/
|
||||
public WorkspacePage() { // Constructor Page
|
||||
public MainPage() {
|
||||
|
||||
super(new Label( GlobalizationUtil.globalize
|
||||
("cms.ui.content_center")),
|
||||
new SimpleContainer());
|
||||
|
||||
/* Set the class attribute value (down in SimpleComponent). */
|
||||
setClassAttr("cms-admin");
|
||||
|
||||
BigDecimalParameter typeId = new BigDecimalParameter(CONTENT_TYPE);
|
||||
addGlobalStateParam(typeId);
|
||||
m_typeSel = new ACSObjectSelectionModel
|
||||
(ContentType.class.getName(), ContentType.BASE_DATA_OBJECT_TYPE, typeId);
|
||||
m_typeSel = new ACSObjectSelectionModel(
|
||||
ContentType.class.getName(),
|
||||
ContentType.BASE_DATA_OBJECT_TYPE,
|
||||
typeId
|
||||
);
|
||||
|
||||
BigDecimalParameter sectionId = new BigDecimalParameter
|
||||
(CONTENT_SECTION);
|
||||
BigDecimalParameter sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(sectionId);
|
||||
m_sectionSel = new ACSObjectSelectionModel
|
||||
(ContentSection.class.getName(),
|
||||
ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
sectionId);
|
||||
m_sectionSel = new ACSObjectSelectionModel(
|
||||
ContentSection.class.getName(),
|
||||
ContentSection.BASE_DATA_OBJECT_TYPE,
|
||||
sectionId
|
||||
);
|
||||
|
||||
add( new WorkspaceContextBar() );
|
||||
add( new GlobalNavigation() );
|
||||
|
|
@ -96,12 +107,15 @@ public class WorkspacePage extends CMSPage implements ActionListener {
|
|||
add(m_tabbedPane);
|
||||
|
||||
add(new DebugPanel());
|
||||
|
||||
/* Page complete, locked now. */
|
||||
lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates, and then caches, the Tasks pane. Overriding this
|
||||
* method to return null will prevent this tab from appearing.
|
||||
**/
|
||||
*/
|
||||
protected TasksPanel getTasksPane(ACSObjectSelectionModel typeModel,
|
||||
ACSObjectSelectionModel sectionModel) {
|
||||
if (m_tasks == null) {
|
||||
|
|
@ -122,7 +136,7 @@ public class WorkspacePage extends CMSPage implements ActionListener {
|
|||
return m_search;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private SimpleContainer makeHeader() {
|
||||
PrintListener l = new PrintListener() {
|
||||
public void prepare(PrintEvent event) {
|
||||
|
|
@ -145,7 +159,7 @@ public class WorkspacePage extends CMSPage implements ActionListener {
|
|||
return sc;
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Created the TabbedPane to use for this page. Sets the class
|
||||
|
|
@ -201,4 +215,32 @@ public class WorkspacePage extends CMSPage implements ActionListener {
|
|||
m_search.reset(state);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites bebop.Page#generateXMLHelper to add the name of the user
|
||||
* logged in to the page (displayed as part of the header).
|
||||
* @param ps
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
// ToDo: This code fragment is used by several pages of CMS package. It
|
||||
// should be factored out into a kind of CMSBasePage, as it had been in
|
||||
// the deprecated CMSPage.
|
||||
// Should be checked when refactoring the content section pages to work
|
||||
// as bebop pages without dispatcher mechanism and in new style application.
|
||||
@Override
|
||||
protected Element generateXMLHelper(PageState ps, Document parent) {
|
||||
|
||||
/* Retain elements already included. */
|
||||
Element page = super.generateXMLHelper(ps,parent);
|
||||
|
||||
/* Add name of user logged in. */
|
||||
User user = Web.getContext().getUser();
|
||||
if ( user != null ) {
|
||||
page.addAttribute("name",user.getDisplayName());
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.ui.workspace;
|
||||
package com.arsdigita.cms.ui.contentcenter;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -18,25 +18,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.folder;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||
import com.arsdigita.bebop.Resettable;
|
||||
import com.arsdigita.bebop.SegmentedPanel;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.ChangeEvent;
|
||||
import com.arsdigita.bebop.event.ChangeListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.event.PrintEvent;
|
||||
import com.arsdigita.bebop.event.PrintListener;
|
||||
import com.arsdigita.bebop.*;
|
||||
import com.arsdigita.bebop.event.*;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
|
|
@ -49,7 +32,7 @@ import com.arsdigita.cms.ui.permissions.CMSPermissionsPane;
|
|||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.ObjectPermissionCollection;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
|
|
@ -62,6 +45,7 @@ import com.arsdigita.toolbox.ui.ActionGroup;
|
|||
import com.arsdigita.util.Assert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -314,7 +298,7 @@ public class FolderItemPane extends SegmentedPanel
|
|||
|
||||
m_editFolderAction.setVisible(state, editItem);
|
||||
|
||||
User user = KernelHelper.getCurrentUser(state.getRequest());
|
||||
User user = (User)Kernel.getContext().getParty();
|
||||
PermissionDescriptor perm =
|
||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||
folder,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
|||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.cms.util.LanguageUtil;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.toolbox.ui.ActionGroup;
|
||||
import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||
import com.arsdigita.toolbox.ui.Section;
|
||||
|
|
@ -167,7 +167,7 @@ public class ItemLanguages extends LayoutPanel {
|
|||
if ( template != null ) {
|
||||
Workflow w = template.instantiateNewWorkflow();
|
||||
w.setObjectID(item.getID());
|
||||
w.start(KernelHelper.getCurrentUser(state.getRequest()));
|
||||
w.start(Kernel.getContext().getUser());
|
||||
w.save();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import com.arsdigita.cms.ContentItem;
|
|||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||
import com.arsdigita.cms.ui.BaseItemPane;
|
||||
|
|
@ -370,7 +370,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal(
|
||||
URL.there(state.getRequest(),
|
||||
Workspace.getURL()), true);
|
||||
ContentCenter.getURL()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal(
|
||||
URL.there(state.getRequest(),
|
||||
Workspace.getURL()), true);
|
||||
ContentCenter.getURL()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -726,7 +726,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal(
|
||||
URL.there(state.getRequest(),
|
||||
Workspace.getURL()), true);
|
||||
ContentCenter.getURL()), true);
|
||||
}
|
||||
}
|
||||
} else if (REPUBLISH_AND_RESET.equals(selected)) {
|
||||
|
|
@ -812,7 +812,7 @@ class ItemLifecycleItemPane extends BaseItemPane {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal(
|
||||
URL.there(state.getRequest(),
|
||||
Workspace.getURL()), true);
|
||||
ContentCenter.getURL()), true);
|
||||
}
|
||||
}
|
||||
} else if (UNPUBLISH.equals(selected)) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import com.arsdigita.cms.CMSConfig;
|
|||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentTypeLifecycleDefinition;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.lifecycle.Lifecycle;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinitionCollection;
|
||||
|
|
@ -468,7 +468,7 @@ class ItemLifecycleSelectForm extends BaseForm {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal(
|
||||
URL.there(state.getRequest(),
|
||||
Workspace.getURL()),
|
||||
ContentCenter.getURL()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import com.arsdigita.cms.dispatcher.Utilities;
|
|||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
|
|
@ -389,7 +389,7 @@ public class CMSPermissionsPane extends SimpleContainer
|
|||
|
||||
// Now check for object admin
|
||||
if (!canAccess) {
|
||||
User user = KernelHelper.getCurrentUser();
|
||||
User user = (User)Kernel.getContext().getParty();
|
||||
PermissionDescriptor perm =
|
||||
new PermissionDescriptor(PrivilegeDescriptor.ADMIN,
|
||||
object, user);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.bebop.SimpleContainer;
|
|||
import com.arsdigita.bebop.portal.AbstractPortletRenderer;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.portlet.TaskPortlet;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
|
@ -63,7 +63,7 @@ public class TaskPortletRenderer extends AbstractPortletRenderer {
|
|||
protected void generateBodyXML(PageState pageState, Element parentElement) {
|
||||
|
||||
|
||||
final String contentCenter = Workspace.getURL();
|
||||
final String contentCenter = ContentCenter.getURL();
|
||||
|
||||
|
||||
Link link = new Link("Content Center", contentCenter);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.arsdigita.bebop.form.Option;
|
|||
import com.arsdigita.bebop.form.RadioGroup;
|
||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Workspace;
|
||||
import com.arsdigita.cms.ContentCenter;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.workflow.CMSEngine;
|
||||
import com.arsdigita.cms.workflow.CMSTask;
|
||||
|
|
@ -205,7 +205,7 @@ public final class TaskFinishForm extends CommentAddForm {
|
|||
if (ContentSection.getConfig().getUseStreamlinedCreation()) {
|
||||
throw new RedirectSignal
|
||||
(URL.there(state.getRequest(),
|
||||
Workspace.getURL()),
|
||||
ContentCenter.getURL()),
|
||||
true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class AddNewStyleApplicationEntries extends Program {
|
|||
|
||||
// Update CMS Workspace
|
||||
ApplicationType appType = null;
|
||||
appType = Loader.loadWorkspaceApplicationType();
|
||||
appType = Loader.loadContentCenterApplicationType();
|
||||
// get corresponding package type
|
||||
PackageType packageType = PackageType.findByKey("content-center");
|
||||
// get all installed instances
|
||||
|
|
|
|||
|
|
@ -20,27 +20,16 @@ package com.arsdigita.cms.workflow;
|
|||
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
// import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.kernel.Group;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.UserCollection;
|
||||
import com.arsdigita.kernel.*;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.messaging.Message;
|
||||
import com.arsdigita.notification.Notification;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataOperation;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.Filter;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.*;
|
||||
import com.arsdigita.persistence.metadata.ObjectType;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.versioning.TagCollection;
|
||||
|
|
@ -48,19 +37,13 @@ import com.arsdigita.versioning.Transaction;
|
|||
import com.arsdigita.versioning.TransactionCollection;
|
||||
import com.arsdigita.versioning.Versions;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.workflow.simple.TaskComment;
|
||||
import com.arsdigita.workflow.simple.TaskException;
|
||||
import com.arsdigita.workflow.simple.UserTask;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -290,8 +273,8 @@ public class CMSTask extends UserTask {
|
|||
g11nArgs[0] = item.getDisplayName();
|
||||
g11nArgs[1] = new Double(getTaskType().getID().doubleValue());
|
||||
g11nArgs[2] = fullURL;
|
||||
g11nArgs[3] = KernelHelper.getSiteName();
|
||||
g11nArgs[4] = KernelHelper.getSystemAdministratorEmailAddress();
|
||||
g11nArgs[3] = Web.getConfig().getSiteName();
|
||||
g11nArgs[4] = Kernel.getSecurityConfig().getAdminContactEmail();
|
||||
g11nArgs[5] = new Date();
|
||||
TaskComment comment = getLastCommentInWorkflow();
|
||||
User commenter = null;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
<jsp:directive.page import="com.arsdigita.cms.ContentSectionCollection"/>
|
||||
<jsp:directive.page import="com.arsdigita.cms.SecurityManager"/>
|
||||
<jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
|
||||
<jsp:directive.page import="com.arsdigita.cms.Workspace"/>
|
||||
|
||||
<jsp:scriptlet>
|
||||
ContentSectionCollection sections = ContentSection.getAllSections();
|
||||
|
|
@ -24,7 +25,8 @@
|
|||
|
||||
String url;
|
||||
if (hasAccess) {
|
||||
url = Utilities.getWorkspaceURL();
|
||||
// url = Utilities.getWorkspaceURL();
|
||||
url = Workspace.getURL();
|
||||
} else {
|
||||
url = UI.getWorkspaceURL(request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
*
|
||||
* <ol>
|
||||
* <li>It is common for all pages on a site to have a particular
|
||||
* structure. ie, header, footer, left sidebar & main content * area. </li>
|
||||
* structure. ie, header, footer, left sidebar & main content area. </li>
|
||||
*
|
||||
* <li>It is desirable to customize page structure without making code changes
|
||||
* to individual applications. </li>
|
||||
|
|
@ -83,7 +83,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
* import com.arsdigita.simplesurvey.ui.AdminPanel;
|
||||
* import com.arsdigita.simplesurvey.ui.SurveySelectionModel;
|
||||
* import com.arsdigita.bebop.BigDecimalParameter;
|
||||
* import com.arsdigita.bebop.BebopMapDispatcher;
|
||||
* import com.arsdigita.bebop.page.BebopMapDispatcher;
|
||||
*
|
||||
* public class Dispatcher extends BebopMapDispatcher {
|
||||
*
|
||||
|
|
|
|||
|
|
@ -301,6 +301,8 @@ public class Loader extends PackageLoader {
|
|||
s_log.debug("CoreLoader: Going to execute loadHost().");
|
||||
loadHost();
|
||||
|
||||
// Note: Loading of Subsite is currently required by Login
|
||||
// module otherwise Login doesn't work!
|
||||
s_log.debug("CoreLoader: Going to execute loadSubsite().");
|
||||
loadSubsite(loadKernel());
|
||||
|
||||
|
|
@ -360,6 +362,9 @@ public class Loader extends PackageLoader {
|
|||
}
|
||||
|
||||
/**
|
||||
* .
|
||||
* Note: Loading of Subsite is currently required by Login
|
||||
* module otherwise Login doesn't work!
|
||||
*
|
||||
* @param rootNode
|
||||
* @deprecated will be removed without replacement. Naot needed anymore
|
||||
|
|
|
|||
|
|
@ -543,9 +543,9 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
* @param resp the current response
|
||||
* @param url the destination URL for redirect
|
||||
**/
|
||||
public static void sendRedirect(HttpServletResponse resp,
|
||||
String url)
|
||||
throws IOException {
|
||||
public static void sendRedirect( HttpServletResponse resp,
|
||||
String url)
|
||||
throws IOException {
|
||||
sendExternalRedirect(resp, url);
|
||||
}
|
||||
|
||||
|
|
@ -559,9 +559,9 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
* @param url the destination URL for redirect
|
||||
**/
|
||||
public static void sendRedirect(HttpServletRequest req,
|
||||
HttpServletResponse resp,
|
||||
String url)
|
||||
throws IOException {
|
||||
HttpServletResponse resp,
|
||||
String url)
|
||||
throws IOException {
|
||||
sendExternalRedirect(resp, url);
|
||||
}
|
||||
|
||||
|
|
@ -572,9 +572,9 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
* @param resp the current response
|
||||
* @param url the destination URL for redirect
|
||||
**/
|
||||
public static void sendExternalRedirect(HttpServletResponse resp,
|
||||
String url)
|
||||
throws IOException {
|
||||
public static void sendExternalRedirect( HttpServletResponse resp,
|
||||
String url )
|
||||
throws IOException {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Redirecting to URL '" + url + "'", new Throwable());
|
||||
}
|
||||
|
|
@ -1091,7 +1091,8 @@ public final class DispatcherHelper implements DispatcherConstants {
|
|||
public static Locale getNegotiatedLocale() {
|
||||
KernelConfig kernelConfig = Kernel.getConfig();
|
||||
|
||||
// Set the preferedLocale to the default locale (first entry in the config parameter list)
|
||||
// Set the preferedLocale to the default locale (first entry in the
|
||||
// config parameter list)
|
||||
Locale preferedLocale = new Locale(kernelConfig.getDefaultLanguage(), "", "");
|
||||
|
||||
// The ACCEPTED_LANGUAGES from the client
|
||||
|
|
|
|||
|
|
@ -398,14 +398,15 @@ public abstract class ACSObject extends ObservableDomainObject {
|
|||
* @throws PermissionException if the user does not have the privilege
|
||||
**/
|
||||
public final void assertPrivilege(PrivilegeDescriptor priv) {
|
||||
Party party = KernelHelper.getCurrentEffectiveParty();
|
||||
Party party = Kernel.getContext().getEffectiveParty();
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Check privilege " + priv.getName() +
|
||||
" on object " + getOID() + " against party " +
|
||||
(party == null ? null : party.getOID()));
|
||||
}
|
||||
PermissionService.assertPermission(
|
||||
new PermissionDescriptor(priv, this, party));
|
||||
PermissionService.assertPermission(new PermissionDescriptor(priv,
|
||||
this,
|
||||
party));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -419,9 +420,11 @@ public abstract class ACSObject extends ObservableDomainObject {
|
|||
* this object, false otherwise
|
||||
**/
|
||||
public final boolean checkPrivilege(PrivilegeDescriptor priv) {
|
||||
Party party = KernelHelper.getCurrentEffectiveParty();
|
||||
return PermissionService.checkPermission(
|
||||
new PermissionDescriptor(priv, this, party));
|
||||
Party party = Kernel.getContext().getEffectiveParty();
|
||||
return PermissionService.checkPermission(new PermissionDescriptor(priv,
|
||||
this,
|
||||
party)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.util.Locale;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>The entry point into all the global state that CCM code expects to
|
||||
* have available to it when running, e.g. the current user, the
|
||||
* current resource, etc.</p>
|
||||
|
|
@ -40,12 +39,9 @@ import org.apache.log4j.Logger;
|
|||
* @author Justin Ross
|
||||
* @see com.arsdigita.kernel.Kernel
|
||||
* @see com.arsdigita.kernel.KernelExcursion
|
||||
* @version $Id: KernelContext.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public final class KernelContext {
|
||||
public static final String versionId =
|
||||
"$Id: KernelContext.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||
"$Author: sskracic $" +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(KernelContext.class);
|
||||
|
||||
|
|
@ -106,6 +102,20 @@ public final class KernelContext {
|
|||
public final Party getParty() {
|
||||
return m_party;
|
||||
}
|
||||
/**
|
||||
* Returns the current user.
|
||||
* Backwards compatibility method which returns a user object. Developers
|
||||
* should use getParty whenever possible (party is an abstraction of users
|
||||
* as well as groups).
|
||||
*/
|
||||
public static User getUser() {
|
||||
KernelContext kernelContext = Kernel.getContext();
|
||||
if ( kernelContext.getParty() instanceof User ) {
|
||||
return (User) kernelContext.getParty();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
final void setParty(Party party) {
|
||||
m_party = party;
|
||||
|
|
|
|||
|
|
@ -1,243 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.web.Web;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Provides static methods for accessing kernel-specific data.
|
||||
*
|
||||
* $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
|
||||
*/
|
||||
public class KernelHelper {
|
||||
|
||||
/**
|
||||
* Extracts the KernelRequestContext from the given request.
|
||||
*
|
||||
* @return the KernelRequestContext.
|
||||
*
|
||||
* @throws IllegalStateException if the current request context does not
|
||||
* subclass KernelRequestContext.
|
||||
**/
|
||||
public static KernelRequestContext getKernelRequestContext
|
||||
(HttpServletRequest req) {
|
||||
RequestContext rctx = DispatcherHelper.getRequestContext(req);
|
||||
try {
|
||||
return (KernelRequestContext)rctx;
|
||||
} catch (ClassCastException e) {
|
||||
throw new IllegalStateException
|
||||
("Request context does not subclass KernelRequestContext: "
|
||||
+ rctx.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current HTTP request.
|
||||
*
|
||||
* @return the current HTTP request.
|
||||
*
|
||||
* @deprecated Use {@link DispatcherHelper#getRequest()}.
|
||||
**/
|
||||
public static HttpServletRequest getRequest() {
|
||||
HttpServletRequest r = DispatcherHelper.getRequest();
|
||||
if (r == null) {
|
||||
throw new IllegalStateException("Request is not set");
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name or IP address of the server, for example
|
||||
* "www.redhat.com". This may be different from the host name
|
||||
* the server runs on. It is intended for use in constructing
|
||||
* URLs that refer back to the server but must be constructed
|
||||
* outside of an HTTP request context where this information is
|
||||
* known explicitly.
|
||||
*
|
||||
* <p>The value of serverName is controlled by enterprise.init:
|
||||
* <pre>
|
||||
* init com.arsdigita.kernel.Initializer {
|
||||
* hostName = "prd001.redhat.com";
|
||||
* serverName = "www.redhat.com";
|
||||
* serverPort = "80";
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>If serverName is not defined in enterprise.init, this method
|
||||
* will return hostName. If hostName is not defined it will
|
||||
* return null.
|
||||
*
|
||||
* @version $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
|
||||
* @deprecated This method now delegates to WebConfig. Use {@link
|
||||
* com.arsdigita.web.WebConfig#getServer()} and the object it returns instead of this method.
|
||||
*/
|
||||
|
||||
public synchronized static String getServerName() {
|
||||
return Web.getConfig().getServer().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the port number the server is running on, or null if
|
||||
* not defined.
|
||||
*
|
||||
* @deprecated This method now delegates to WebConfig. Use {@link
|
||||
* com.arsdigita.web.WebConfig#getServer()} and the object it
|
||||
* returns instead of this method.
|
||||
*/
|
||||
|
||||
public synchronized static String getServerPort() {
|
||||
return new Integer(Web.getConfig().getServer().getPort()).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a canonical URL for accessing the server, constructed
|
||||
* from the values of {@link #getServerName} and {@link
|
||||
* #getServerPort}. If the server port is not defined or set to
|
||||
* the standard HTTP port 80 it will not be included in the
|
||||
* URL. If neither the server name nor port are defined, the return
|
||||
* value is simply "http://localhost/".
|
||||
*
|
||||
* @deprecated Use <code>"http://" + Web.getConfig().getServer() +
|
||||
* "/"</code> instead.
|
||||
*/
|
||||
|
||||
public synchronized static String getServerURL() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("http://");
|
||||
|
||||
String serverName = getServerName();
|
||||
if (null == serverName) {
|
||||
sb.append("localhost");
|
||||
} else {
|
||||
sb.append(serverName);
|
||||
}
|
||||
|
||||
String serverPort = getServerPort();
|
||||
if (serverPort != null && !serverPort.equals("80")) {
|
||||
sb.append(':').append(serverPort);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the host name for this server (for example, "arsDigita.com").
|
||||
* The value is controlled by enterprise.init:
|
||||
* <pre>
|
||||
* init com.arsdigita.kernel.Initializer {
|
||||
* hostName = "redhat.com";
|
||||
* siteName = "Red Hat Web Site";
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return the host name.
|
||||
* @deprecated This method will no longer exist in an upcoming
|
||||
* release.
|
||||
*/
|
||||
public synchronized static String getHostName() {
|
||||
return Web.getConfig().getHost().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the site name for this server (for example, "Red Hat Web Site").
|
||||
* The value is controlled by enterprise.init:
|
||||
* <pre>
|
||||
* init com.arsdigita.kernel.Initializer {
|
||||
* hostName = "redhat.com";
|
||||
* siteName = "Red Hat Web Site";
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return the site name.
|
||||
* @deprecated Use <code>Web.getConfig().getSiteName()</code>
|
||||
* instead.
|
||||
*/
|
||||
public synchronized static String getSiteName() {
|
||||
return Web.getConfig().getSiteName();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Get the system administrator's email address. It returns the
|
||||
* email address specified in kernel initializer as
|
||||
* systemAdministratorEmailAddress. This method is only to be
|
||||
* used to obtain a reply-to address for notifications. <b>The
|
||||
* return value may or may not correspond to an actual user
|
||||
* account on the system.</b>.
|
||||
*
|
||||
* <p>For example, when a user tries to change their password,
|
||||
* they receive confirmation via email. This email must appear to
|
||||
* originate from a valid email address on the system. Ideally it
|
||||
* will also correspond to a real person who can be replied to for
|
||||
* help.
|
||||
*
|
||||
* @return email address suitable for reply-to in system notifications
|
||||
* @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code>
|
||||
*/
|
||||
public static synchronized String getSystemAdministratorEmailAddress() {
|
||||
return Kernel.getSecurityConfig().getAdminContactEmail();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Fetches the currently logged in user, or null. This is a
|
||||
* convenience wrapper around {@link #getCurrentUser()}. In the
|
||||
* general case, those are preferrable.
|
||||
*
|
||||
* @param request The HTTP request
|
||||
* @return The currently logged-in user, or null if there is none.
|
||||
* @throws RuntimeException if the logged-in user doesn't exist in
|
||||
* the database
|
||||
* @deprecated See getCurrentUser()
|
||||
**/
|
||||
public static User getCurrentUser(HttpServletRequest request) {
|
||||
return getCurrentUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current user.
|
||||
*
|
||||
* @deprecated Call {@link KernelContext#getParty()} e.g.,
|
||||
* Kernel.getContext().getParty().
|
||||
*/
|
||||
public static User getCurrentUser() {
|
||||
KernelContext kernelContext = Kernel.getContext();
|
||||
if ( kernelContext.getParty() instanceof User ) {
|
||||
return (User) kernelContext.getParty();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Party getCurrentParty() {
|
||||
KernelContext kernelContext = Kernel.getContext();
|
||||
return kernelContext.getParty();
|
||||
}
|
||||
|
||||
public static Party getCurrentEffectiveParty() {
|
||||
KernelContext kernelContext = Kernel.getContext();
|
||||
return kernelContext.getEffectiveParty();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,248 @@
|
|||
/*
|
||||
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Provides static methods for accessing kernel-specific data.
|
||||
*
|
||||
* $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
|
||||
*/
|
||||
public class KernelHelper {
|
||||
|
||||
// /**
|
||||
// * Extracts the KernelRequestContext from the given request.
|
||||
// *
|
||||
// * @return the KernelRequestContext.
|
||||
// *
|
||||
// * @throws IllegalStateException if the current request context does not
|
||||
// * subclass KernelRequestContext.
|
||||
// */
|
||||
// public static KernelRequestContext getKernelRequestContext
|
||||
// (HttpServletRequest req) {
|
||||
// RequestContext rctx = DispatcherHelper.getRequestContext(req);
|
||||
// try {
|
||||
// return (KernelRequestContext)rctx;
|
||||
// } catch (ClassCastException e) {
|
||||
// throw new IllegalStateException
|
||||
// ("Request context does not subclass KernelRequestContext: "
|
||||
// + rctx.getClass().getName());
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the current HTTP request.
|
||||
// *
|
||||
// * @return the current HTTP request.
|
||||
// *
|
||||
// * @deprecated Use {@link DispatcherHelper#getRequest()}.
|
||||
// */
|
||||
// public static HttpServletRequest getRequest() {
|
||||
// HttpServletRequest r = DispatcherHelper.getRequest();
|
||||
// if (r == null) {
|
||||
// throw new IllegalStateException("Request is not set");
|
||||
// }
|
||||
// return r;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the name or IP address of the server, for example
|
||||
// * "www.redhat.com". This may be different from the host name
|
||||
// * the server runs on. It is intended for use in constructing
|
||||
// * URLs that refer back to the server but must be constructed
|
||||
// * outside of an HTTP request context where this information is
|
||||
// * known explicitly.
|
||||
// *
|
||||
// * <p>The value of serverName is controlled by enterprise.init:
|
||||
// * <pre>
|
||||
// * init com.arsdigita.kernel.Initializer {
|
||||
// * hostName = "prd001.redhat.com";
|
||||
// * serverName = "www.redhat.com";
|
||||
// * serverPort = "80";
|
||||
// * }
|
||||
// * </pre>
|
||||
// *
|
||||
// * <p>If serverName is not defined in enterprise.init, this method
|
||||
// * will return hostName. If hostName is not defined it will
|
||||
// * return null.
|
||||
// *
|
||||
// * @version $Id: KernelHelper.java 699 2005-08-12 12:35:18Z sskracic $
|
||||
// * @deprecated This method now delegates to WebConfig. Use {@link
|
||||
// * com.arsdigita.web.WebConfig#getServer()} and the object it returns instead of this method.
|
||||
// */
|
||||
// public synchronized static String getServerName() {
|
||||
// return Web.getConfig().getServer().getName();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the port number the server is running on, or null if
|
||||
// * not defined.
|
||||
// *
|
||||
// * @deprecated This method now delegates to WebConfig. Use {@link
|
||||
// * com.arsdigita.web.WebConfig#getServer()} and the object it
|
||||
// * returns instead of this method.
|
||||
// */
|
||||
// public synchronized static String getServerPort() {
|
||||
// return new Integer(Web.getConfig().getServer().getPort()).toString();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns a canonical URL for accessing the server, constructed
|
||||
// * from the values of {@link #getServerName} and {@link
|
||||
// * #getServerPort}. If the server port is not defined or set to
|
||||
// * the standard HTTP port 80 it will not be included in the
|
||||
// * URL. If neither the server name nor port are defined, the return
|
||||
// * value is simply "http://localhost/".
|
||||
// *
|
||||
// * @ deprecated Use <code>"http://" + Web.getConfig().getServer() +
|
||||
// * "/"</code> instead.
|
||||
// */
|
||||
// public synchronized static String getServerURL() {
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// sb.append("http://");
|
||||
//
|
||||
// String serverName = getServerName();
|
||||
// if (null == serverName) {
|
||||
// sb.append("localhost");
|
||||
// } else {
|
||||
// sb.append(serverName);
|
||||
// }
|
||||
//
|
||||
// String serverPort = getServerPort();
|
||||
// if (serverPort != null && !serverPort.equals("80")) {
|
||||
// sb.append(':').append(serverPort);
|
||||
// }
|
||||
//
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * Retrieves the host name for this server (for example, "arsDigita.com").
|
||||
// * The value is controlled by enterprise.init:
|
||||
// * <pre>
|
||||
// * init com.arsdigita.kernel.Initializer {
|
||||
// * hostName = "redhat.com";
|
||||
// * siteName = "Red Hat Web Site";
|
||||
// * }
|
||||
// * </pre>
|
||||
// *
|
||||
// * @return the host name.
|
||||
// * @deprecated This method will no longer exist in an upcoming
|
||||
// * release.
|
||||
// */
|
||||
// public synchronized static String getHostName() {
|
||||
// return Web.getConfig().getHost().getName();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Retrieves the site name for this server (for example, "Red Hat Web Site").
|
||||
// * The value is controlled by enterprise.init:
|
||||
// * <pre>
|
||||
// * init com.arsdigita.kernel.Initializer {
|
||||
// * hostName = "redhat.com";
|
||||
// * siteName = "Red Hat Web Site";
|
||||
// * }
|
||||
// * </pre>
|
||||
// *
|
||||
// * @return the site name.
|
||||
// * @deprecated Use <code>Web.getConfig().getSiteName()</code>
|
||||
// * instead.
|
||||
// */
|
||||
// public synchronized static String getSiteName() {
|
||||
// return Web.getConfig().getSiteName();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Get the system administrator's email address. It returns the
|
||||
// * email address specified in kernel initializer as
|
||||
// * systemAdministratorEmailAddress. This method is only to be
|
||||
// * used to obtain a reply-to address for notifications. <b>The
|
||||
// * return value may or may not correspond to an actual user
|
||||
// * account on the system.</b>.
|
||||
// *
|
||||
// * <p>For example, when a user tries to change their password,
|
||||
// * they receive confirmation via email. This email must appear to
|
||||
// * originate from a valid email address on the system. Ideally it
|
||||
// * will also correspond to a real person who can be replied to for
|
||||
// * help.
|
||||
// *
|
||||
// * @return email address suitable for reply-to in system notifications
|
||||
// * @deprecated Use <code>Kernel.getSecurityConfig().getAdminContactEmail()</code>
|
||||
// */
|
||||
// public static synchronized String getSystemAdministratorEmailAddress() {
|
||||
// return Kernel.getSecurityConfig().getAdminContactEmail();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Fetches the currently logged in user, or null. This is a
|
||||
// * convenience wrapper around {@link #getCurrentUser()}. In the
|
||||
// * general case, those are preferrable.
|
||||
// *
|
||||
// * @param request The HTTP request
|
||||
// * @return The currently logged-in user, or null if there is none.
|
||||
// * @throws RuntimeException if the logged-in user doesn't exist in
|
||||
// * the database
|
||||
// * @ deprecated See getCurrentUser()
|
||||
// **/
|
||||
// public static User getCurrentUser(HttpServletRequest request) {
|
||||
// return getCurrentUser();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the current user.
|
||||
// *
|
||||
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
|
||||
// * Kernel.getContext().getUser().
|
||||
// */
|
||||
// public static User getCurrentUser() {
|
||||
// KernelContext kernelContext = Kernel.getContext();
|
||||
// if ( kernelContext.getParty() instanceof User ) {
|
||||
// return (User) kernelContext.getParty();
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the current party.
|
||||
// *
|
||||
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
|
||||
// * Kernel.getContext().getParty().
|
||||
// */
|
||||
// public static Party getCurrentParty() {
|
||||
// KernelContext kernelContext = Kernel.getContext();
|
||||
// return kernelContext.getParty();
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the current effective party.
|
||||
// *
|
||||
// * @deprecated Call {@link KernelContext#getParty()} e.g.,
|
||||
// * Kernel.getContext().getEffectiveParty().
|
||||
// */
|
||||
// public static Party getCurrentEffectiveParty() {
|
||||
// KernelContext kernelContext = Kernel.getContext();
|
||||
// return kernelContext.getEffectiveParty();
|
||||
// }
|
||||
}
|
||||
|
|
@ -18,10 +18,12 @@
|
|||
*/
|
||||
package com.arsdigita.kernel;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.security.SessionContext;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.dispatcher.InitialRequestContext;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -31,7 +33,7 @@ import org.apache.log4j.Logger;
|
|||
public class KernelRequestContext extends InitialRequestContext {
|
||||
|
||||
private static final Logger s_cat =
|
||||
Logger.getLogger(KernelRequestContext.class.getName());
|
||||
Logger.getLogger(KernelRequestContext.class.getName());
|
||||
|
||||
private SessionContext m_session;
|
||||
private UserContext m_user;
|
||||
|
|
@ -44,6 +46,27 @@ public class KernelRequestContext extends InitialRequestContext {
|
|||
m_user = user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the KernelRequestContext from the given request.
|
||||
*
|
||||
* @return the KernelRequestContext.
|
||||
* @throws IllegalStateException if the current request context does not
|
||||
* subclass KernelRequestContext.
|
||||
*/
|
||||
public static KernelRequestContext getKernelRequestContext
|
||||
(HttpServletRequest req) {
|
||||
|
||||
RequestContext rctx = DispatcherHelper.getRequestContext(req);
|
||||
try {
|
||||
return (KernelRequestContext)rctx;
|
||||
} catch (ClassCastException e) {
|
||||
throw new IllegalStateException
|
||||
("Request context does not subclass KernelRequestContext: "
|
||||
+ rctx.getClass().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
protected void initialize() {
|
||||
super.initialize();
|
||||
if (isNew()) {
|
||||
|
|
@ -503,6 +504,7 @@ public class SiteNode extends ACSObject {
|
|||
return getSiteNode(path, false);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static SiteNode createSiteNode(String name) {
|
||||
return createSiteNode(name, getRootSiteNode());
|
||||
}
|
||||
|
|
@ -522,10 +524,12 @@ public class SiteNode extends ACSObject {
|
|||
super.beforeSave();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void afterDelete() {
|
||||
s_cache.scheduleRefresh();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static SiteNode createSiteNode(String name, SiteNode parent) {
|
||||
SiteNode siteNode = new SiteNode();
|
||||
siteNode.setName(name);
|
||||
|
|
@ -535,6 +539,7 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String toString() {
|
||||
return "[url: " + getURL() + "]";
|
||||
}
|
||||
|
|
@ -590,6 +595,7 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean equals(Object obj) {
|
||||
if (obj==null) { return false; }
|
||||
|
||||
|
|
@ -599,11 +605,13 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public int hashCode() {
|
||||
return m_node.getID().hashCode() + m_node.getURL().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String toString() {
|
||||
return m_node.toString();
|
||||
}
|
||||
|
|
@ -611,13 +619,16 @@ public class SiteNode extends ACSObject {
|
|||
|
||||
// Caching of Site Nodes
|
||||
// Stores the cached (url, siteNode) mappings.
|
||||
@Deprecated
|
||||
private static class Cache extends PathMapCache {
|
||||
|
||||
@Deprecated
|
||||
public Cache() {
|
||||
super("SiteNodeCache");
|
||||
}
|
||||
|
||||
// implements the PathMapCache interface
|
||||
@Deprecated
|
||||
public String normalize(String path) {
|
||||
if ( path==null ) { throw new NullPointerException("path"); }
|
||||
if ( !path.startsWith("/") ) {
|
||||
|
|
@ -628,6 +639,7 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
// implements the PathMapCache interface
|
||||
@Deprecated
|
||||
public Object retrieve(String path) {
|
||||
DataCollection dc = SessionManager.getSession().retrieve
|
||||
("com.arsdigita.kernel.SiteNode");
|
||||
|
|
@ -650,14 +662,17 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
// implements the PathMapCache interface
|
||||
@Deprecated
|
||||
public void refresh() {
|
||||
clearAll();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
void scheduleRefresh() {
|
||||
super.refreshAfterCommit();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
synchronized SiteNode getNode(String path) {
|
||||
SiteNodeWrapper snw = (SiteNodeWrapper) super.get(path);
|
||||
return snw.m_node;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import com.arsdigita.web.Web;
|
|||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.User;
|
||||
|
||||
|
|
@ -69,6 +68,7 @@ class Permission extends DomainObject {
|
|||
static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.kernel.permissions.Permission";
|
||||
|
||||
@Override
|
||||
protected String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ class Permission extends DomainObject {
|
|||
RuntimeException("Permission entries cannot be modified");
|
||||
}
|
||||
|
||||
Party party = KernelHelper.getCurrentEffectiveParty();
|
||||
Party party = Kernel.getContext().getEffectiveParty();
|
||||
|
||||
if (party == null
|
||||
|| !party.getID().equals(Kernel.getSystemParty().getID())) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import com.arsdigita.domain.DomainObject;
|
|||
import com.arsdigita.domain.GlobalObserver;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.metadata.ObjectType;
|
||||
|
|
@ -93,7 +93,7 @@ public class PermissionsObserver implements GlobalObserver {
|
|||
}
|
||||
|
||||
private boolean isKernelMode() {
|
||||
Party currentParty = KernelHelper.getCurrentEffectiveParty();
|
||||
Party currentParty = Kernel.getContext().getEffectiveParty();
|
||||
|
||||
return (currentParty != null &&
|
||||
currentParty.getID().equals(Kernel.getSystemParty().getID()));
|
||||
|
|
|
|||
|
|
@ -36,13 +36,22 @@ import org.apache.log4j.Logger;
|
|||
* @see CookieLoginModule
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
**/
|
||||
* @version $Id: CookieManager.java 1477 2007-03-14 10:27:16Z chrisgilbert23 $
|
||||
*/
|
||||
public class CookieManager extends CredentialManager {
|
||||
|
||||
public static final String versionId = "$Id: CookieManager.java 1477 2007-03-14 10:27:16Z chrisgilbert23 $ by $Author: chrisgilbert23 $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(CookieManager.class.getName());
|
||||
Logger.getLogger(CookieManager.class.getName());
|
||||
|
||||
/**
|
||||
*
|
||||
* @param module
|
||||
* @param subject
|
||||
* @param handler
|
||||
* @param shared
|
||||
* @param options
|
||||
*/
|
||||
@Override
|
||||
public void initialize(CredentialLoginModule module,
|
||||
Subject subject,
|
||||
CallbackHandler handler,
|
||||
|
|
@ -58,7 +67,7 @@ public class CookieManager extends CredentialManager {
|
|||
*
|
||||
* @return <code>true</code> if the credential is not set or has the
|
||||
* wrong value or should be renewed, <code>false</code> otherwise.
|
||||
**/
|
||||
*/
|
||||
protected boolean shouldSetValue(String value)
|
||||
throws LoginException {
|
||||
if (getModule().requestIsExcluded()) {
|
||||
|
|
@ -80,7 +89,7 @@ public class CookieManager extends CredentialManager {
|
|||
* current request.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
protected final String getValue()
|
||||
throws LoginException {
|
||||
s_log.debug("START getValue");
|
||||
|
|
@ -100,7 +109,7 @@ public class CookieManager extends CredentialManager {
|
|||
* the given value.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
protected final void setValue(String value)
|
||||
throws LoginException {
|
||||
// now we don't automatically set the duration to getCookieMaxAge()
|
||||
|
|
@ -118,7 +127,7 @@ public class CookieManager extends CredentialManager {
|
|||
* <code>getModule().getCredentialName()</code>.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
protected final void deleteValue()
|
||||
throws LoginException {
|
||||
deleteCookie(getModule().getCredentialName());
|
||||
|
|
@ -126,7 +135,7 @@ public class CookieManager extends CredentialManager {
|
|||
|
||||
/**
|
||||
* Deletes the named cookie.
|
||||
**/
|
||||
*/
|
||||
private void deleteCookie(String name)
|
||||
throws LoginException {
|
||||
if (isCookieSet(name)) {
|
||||
|
|
@ -157,7 +166,7 @@ public class CookieManager extends CredentialManager {
|
|||
|
||||
/**
|
||||
* Sets the named cookie to the given value.
|
||||
**/
|
||||
*/
|
||||
private void setCookie(String name, String value, int maxAge)
|
||||
throws LoginException {
|
||||
Cookie cookie = new Cookie(name, value);
|
||||
|
|
@ -176,7 +185,7 @@ public class CookieManager extends CredentialManager {
|
|||
/**
|
||||
* Determines the lifespan of the cookie, using the setting
|
||||
* of the configuration, defaulting to getCookieMaxAge().
|
||||
**/
|
||||
*/
|
||||
protected int getCookieAge() throws LoginException {
|
||||
Integer setting = Kernel.getSecurityConfig().getCookieDurationMinutes();
|
||||
return (setting == null ? getCookieMaxAge() : setting.intValue() * 60);
|
||||
|
|
@ -189,7 +198,7 @@ public class CookieManager extends CredentialManager {
|
|||
*
|
||||
* @return <code>FOREVER_SECS</code> if the user has requested permanent
|
||||
* login; -1 otherwise.
|
||||
**/
|
||||
*/
|
||||
protected int getCookieMaxAge() throws LoginException {
|
||||
return getModule().getForever() ?
|
||||
(int)CredentialLoginModule.FOREVER_SECS : -1;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,8 @@ public class Credential {
|
|||
final byte[] validator;
|
||||
final byte[] calculated;
|
||||
try {
|
||||
validator = (new Base64()).decode(tok.nextToken().getBytes(Crypto.CHARACTER_ENCODING));
|
||||
validator = (new Base64()).decode(tok.nextToken()
|
||||
.getBytes(Crypto.CHARACTER_ENCODING));
|
||||
calculated = createValidator(value, expiration, mac);
|
||||
} catch (ValidatorException ex) {
|
||||
throw new CredentialParsingException(ex.getRootCause());
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ import org.apache.log4j.Logger;
|
|||
* <code>Class.forName()</code>. The JAAS bug will be fixed in JDK 1.4.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: LoginContext.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
**/
|
||||
public class LoginContext {
|
||||
private final static Logger s_log = Logger.getLogger( LoginContext.class );
|
||||
|
||||
public static final String versionId = "$Id: LoginContext.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
private Subject m_subject;
|
||||
private CallbackHandler m_handler;
|
||||
private Map m_shared = new HashMap();
|
||||
|
|
@ -51,7 +51,7 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public LoginContext(String name)
|
||||
throws LoginException {
|
||||
this(name, new Subject());
|
||||
|
|
@ -59,7 +59,7 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public LoginContext(String name,
|
||||
Subject subject)
|
||||
throws LoginException {
|
||||
|
|
@ -76,7 +76,7 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public LoginContext(String name,
|
||||
CallbackHandler handler)
|
||||
throws LoginException {
|
||||
|
|
@ -85,7 +85,7 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public LoginContext(String name,
|
||||
Subject subject,
|
||||
CallbackHandler handler)
|
||||
|
|
@ -142,14 +142,14 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public Subject getSubject() {
|
||||
return m_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public void login() throws LoginException {
|
||||
LoginException first = null;
|
||||
boolean gotFailure = false;
|
||||
|
|
@ -256,7 +256,7 @@ public class LoginContext {
|
|||
|
||||
/**
|
||||
* See <code>javax.security.auth.login.LoginContext</code>.
|
||||
**/
|
||||
*/
|
||||
public void logout() throws LoginException {
|
||||
LoginException first = null;
|
||||
// logout
|
||||
|
|
|
|||
|
|
@ -37,17 +37,17 @@ import org.apache.log4j.Logger;
|
|||
* username/password in shared data for use by other LoginModules.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: PasswordLoginModule.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
**/
|
||||
public abstract class PasswordLoginModule implements LoginModule {
|
||||
|
||||
public static final String versionId = "$Id: PasswordLoginModule.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(PasswordLoginModule.class.getName());
|
||||
Logger.getLogger(PasswordLoginModule.class.getName());
|
||||
|
||||
/** Key for username in shared data map. **/
|
||||
/** Key for username in shared data map. */
|
||||
public static final String NAME_KEY
|
||||
= "javax.security.auth.login.name";
|
||||
/** Key for password in shared data map. **/
|
||||
/** Key for password in shared data map. */
|
||||
public static final String PASSWORD_KEY
|
||||
= "javax.security.auth.login.password";
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ public abstract class PasswordLoginModule implements LoginModule {
|
|||
* thrown by the <code>checkPassword</code> method.
|
||||
*
|
||||
* @see #checkPassword(String, char[])
|
||||
**/
|
||||
*/
|
||||
public boolean login() throws LoginException {
|
||||
s_log.debug("START login");
|
||||
checkPassword(getUsername(), getPassword());
|
||||
|
|
@ -94,7 +94,7 @@ public abstract class PasswordLoginModule implements LoginModule {
|
|||
* @return the username.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
private String getUsername() throws LoginException {
|
||||
// get name from shared data
|
||||
// TODO: only if *Pass option set
|
||||
|
|
@ -123,7 +123,7 @@ public abstract class PasswordLoginModule implements LoginModule {
|
|||
* @return the password.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
private char[] getPassword() throws LoginException {
|
||||
// get password from shared data
|
||||
// TODO: only if *Pass option set
|
||||
|
|
@ -157,7 +157,7 @@ public abstract class PasswordLoginModule implements LoginModule {
|
|||
* @throws AccountLockedException if the account is locked.
|
||||
* @throws FailedLoginException if the password is invalid.
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
protected abstract void checkPassword
|
||||
(String username, char[] password) throws LoginException;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ import org.apache.log4j.Logger;
|
|||
* authentication URL parameter.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: RecoveryLoginModule.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
**/
|
||||
public class RecoveryLoginModule extends UserLoginModule {
|
||||
|
||||
public static final String versionId = "$Id: RecoveryLoginModule.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(RecoveryLoginModule.class.getName());
|
||||
Logger.getLogger(RecoveryLoginModule.class.getName());
|
||||
|
||||
private static final String URL_PARAM_NAME = "ad_user_recover";
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* credential value. Overrides <code>URLManager.shouldSetValue()</code>
|
||||
* to return <code>false</code> so that the recover credential is never
|
||||
* propagated to future requests.
|
||||
**/
|
||||
*/
|
||||
public RecoveryLoginModule() {
|
||||
super(new URLManager(java.util.Collections.EMPTY_SET) {
|
||||
/**
|
||||
|
|
@ -59,6 +59,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
*
|
||||
* @return false
|
||||
**/
|
||||
@Override
|
||||
protected boolean shouldSetValue(String value)
|
||||
throws LoginException {
|
||||
return false;
|
||||
|
|
@ -67,6 +68,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
}
|
||||
|
||||
// implements LoginModule
|
||||
@Override
|
||||
public void initialize(Subject subject,
|
||||
CallbackHandler handler,
|
||||
Map shared,
|
||||
|
|
@ -85,7 +87,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* @return <code>super.commit()</code>.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
public boolean commit()
|
||||
throws LoginException {
|
||||
if (credentialIsSet()) {
|
||||
|
|
@ -101,7 +103,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* @return <code>this.commit()</code>.
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
public boolean abort()
|
||||
throws LoginException {
|
||||
return this.commit();
|
||||
|
|
@ -113,7 +115,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* @return getParamName()
|
||||
*
|
||||
* @throws LoginException if an error occurs.
|
||||
**/
|
||||
*/
|
||||
protected String getCredentialName()
|
||||
throws LoginException {
|
||||
return getParamName();
|
||||
|
|
@ -125,7 +127,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* recovery credential is used check whether the user is recovering.
|
||||
*
|
||||
* @see #isRecovering(Subject)
|
||||
**/
|
||||
*/
|
||||
private void setRecovering() {
|
||||
s_log.debug("setting recovery credential");
|
||||
m_subject.getPublicCredentials().add(getParamName());
|
||||
|
|
@ -137,7 +139,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
*
|
||||
* @return <code>true</code> if the Subject has the recovery credential,
|
||||
* <code>false</code> otherwise.
|
||||
**/
|
||||
*/
|
||||
public static boolean isRecovering(Subject subject) {
|
||||
return subject.getPublicCredentials().contains(getParamName());
|
||||
}
|
||||
|
|
@ -150,7 +152,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
*
|
||||
* @return the name of the recovery login URL parameter.
|
||||
* @see #getParamValue(BigDecimal)
|
||||
**/
|
||||
*/
|
||||
public static String getParamName() {
|
||||
return URL_PARAM_NAME;
|
||||
}
|
||||
|
|
@ -167,7 +169,7 @@ public class RecoveryLoginModule extends UserLoginModule {
|
|||
* @throws CredentialEncodingException if unable to create the value.
|
||||
*
|
||||
* @see #getParamName()
|
||||
**/
|
||||
*/
|
||||
public static String getParamValue(BigDecimal userID)
|
||||
throws CredentialEncodingException {
|
||||
return Credential
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ package com.arsdigita.kernel.security;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Provides methods for
|
||||
* determining security properties for a request.
|
||||
* Provides methods for determining security properties for a request.
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
* @version $Id: SecurityHelper.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
package com.arsdigita.kernel.security;
|
||||
|
||||
import com.arsdigita.util.ParameterProvider;
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.KernelRequestContext;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
|
@ -60,7 +59,7 @@ public class SecurityParameterProvider implements ParameterProvider {
|
|||
public Set getParams(HttpServletRequest req) {
|
||||
// get user and session info
|
||||
KernelRequestContext rctx =
|
||||
KernelHelper.getKernelRequestContext(req);
|
||||
KernelRequestContext.getKernelRequestContext(req);
|
||||
|
||||
// Request context can be null e.g. if called in a request listener
|
||||
if ( rctx == null ) {
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ package com.arsdigita.kernel.security;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.login.LoginException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import javax.security.auth.callback.CallbackHandler;
|
||||
import javax.security.auth.login.LoginException;
|
||||
|
||||
/**
|
||||
* Provide access to the JSESSIONID value as a BigDecimal. This class
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ public class UserContext {
|
|||
public void login(String username,
|
||||
char[] password,
|
||||
boolean forever)
|
||||
throws LoginException {
|
||||
throws LoginException {
|
||||
s_log.debug("START login(username, password, forever)");
|
||||
try {
|
||||
CallbackHandler handler = new LoginCallbackHandler
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ public class SiteNodeRequestContext extends KernelRequestContext {
|
|||
|
||||
/**
|
||||
* @return the site node referenced by this request.
|
||||
* @deprecated
|
||||
*/
|
||||
public SiteNode getSiteNode() {
|
||||
return m_sn;
|
||||
|
|
@ -19,9 +19,9 @@
|
|||
package com.arsdigita.templating;
|
||||
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
import com.arsdigita.kernel.SiteNode;
|
||||
// import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
// import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
// import com.arsdigita.kernel.SiteNode;
|
||||
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.Application;
|
||||
|
|
@ -73,8 +73,11 @@ public class ApplicationPatternGenerator implements PatternGenerator {
|
|||
// redirects.
|
||||
s_log.debug("ApplicationType for >>" +key +
|
||||
"<< not found. Trying SiteNodes instead.");
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
"No ApplicationType found for type name " + key);
|
||||
|
||||
|
||||
/*
|
||||
SiteNodeRequestContext ctx = (SiteNodeRequestContext)
|
||||
DispatcherHelper.getRequestContext(req);
|
||||
|
||||
|
|
@ -90,7 +93,7 @@ public class ApplicationPatternGenerator implements PatternGenerator {
|
|||
|
||||
s_log.debug("ApplicationType for " +key +
|
||||
" could not be found in SiteNodes either. Returning empty String[]");
|
||||
|
||||
return new String[] {};
|
||||
*/
|
||||
// return new String[] {};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,15 +19,11 @@
|
|||
package com.arsdigita.templating;
|
||||
|
||||
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.kernel.SiteNode;
|
||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.Web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -151,20 +147,12 @@ public class URLPatternGenerator implements PatternGenerator {
|
|||
* (i.e. application's PrimaryURL). If no application can be found or
|
||||
* no PrimaryURL can be determined ROOT ("/") is returned.
|
||||
*
|
||||
* XXX fix me, why can't we get this from Web.getConfig.getRequestURL
|
||||
* XXX fix me, why can't we get this from Web.getContext().getRequestURL
|
||||
*
|
||||
* @return primary url of an application or ROOT
|
||||
*/
|
||||
private String getBasePath() {
|
||||
|
||||
// OLD code using kernel.SiteNode etc which is deprecatged and no longer
|
||||
// available
|
||||
// SiteNodeRequestContext ctx = (SiteNodeRequestContext)
|
||||
// DispatcherHelper.getRequestContext(Web.getRequest());
|
||||
// SiteNode node = ctx.getSiteNode();
|
||||
// Assert.exists(node, SiteNode.class);
|
||||
// return node.getURL();
|
||||
|
||||
// retrieve the application of the request
|
||||
Application app = Web.getContext().getApplication();
|
||||
if (app == null) {
|
||||
|
|
@ -172,6 +160,7 @@ public class URLPatternGenerator implements PatternGenerator {
|
|||
} else {
|
||||
return app.getPrimaryURL();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@ import com.arsdigita.globalization.Globalized;
|
|||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* .
|
||||
* Contains methods to simplify globalizing keys
|
||||
* </p>
|
||||
* Utility class for package toolbox.ui, providing methods to simplify
|
||||
* globalizing keys.
|
||||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/16 $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
|
||||
|
||||
|
||||
// /////// Some preparational steps ///////////////
|
||||
// /////// Some preparational steps ///////////////
|
||||
|
||||
/* Determine access privilege: only logged in users may access DS */
|
||||
Party party = Kernel.getContext().getParty();
|
||||
|
|
@ -113,7 +113,7 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
DispatcherHelper.cacheDisable(sresp);
|
||||
|
||||
|
||||
// /////// Everything OK here - DO IT ///////////////
|
||||
// /////// Everything OK here - DO IT ///////////////
|
||||
|
||||
String pathInfo = sreq.getPathInfo();
|
||||
Assert.exists(pathInfo, "String pathInfo");
|
||||
|
|
@ -145,7 +145,7 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
|
||||
|
||||
/**
|
||||
* Adds one Url-Page mapping to the internal mapping table.
|
||||
* Adds one pair of Url - Page to the internal hash map, used as a cache.
|
||||
*
|
||||
* @param pathInfo url stub for a page to display
|
||||
* @param page Page object to display
|
||||
|
|
@ -173,9 +173,7 @@ public class AdminServlet extends BaseApplicationServlet
|
|||
p.addGlobalStateParam(GROUP_ID_PARAM);
|
||||
// p.addGlobalStateParam(APPLICATIONS_ID_PARAM);
|
||||
|
||||
/**
|
||||
* Create User split panel.
|
||||
*/
|
||||
/* Create User split panel. */
|
||||
AdminSplitPanel userSplitPanel =
|
||||
new AdminSplitPanel(USER_NAVBAR_TITLE);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,10 @@ package com.arsdigita.ui.admin;
|
|||
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SingleSelectionModel;
|
||||
import com.arsdigita.bebop.SplitPanel;
|
||||
import com.arsdigita.bebop.event.ChangeEvent;
|
||||
import com.arsdigita.bebop.event.ChangeListener;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.ui.sitemap.SiteListing;
|
||||
import com.arsdigita.ui.sitemap.SiteMapAdminPane;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -36,19 +31,13 @@ public class ApplicationsAdministrationTab extends BoxPanel
|
|||
setAttribute("navbar-title", "Sitemap");
|
||||
// m_componentList = new ArrayList();
|
||||
// m_keys = new ArrayList();
|
||||
SiteListing listing = new SiteListing();
|
||||
listing.setClassAttr("navbar");
|
||||
|
||||
SingleSelectionModel m = listing.getTree().getSelectionModel();
|
||||
SiteMapAdminPane details = new SiteMapAdminPane(m, listing.getCFGLink());
|
||||
|
||||
BoxPanel box = new BoxPanel();
|
||||
box.setClassAttr("main");
|
||||
box.add(details);
|
||||
|
||||
SplitPanel panel = new SplitPanel();
|
||||
panel.setClassAttr("sidebarNavPanel");
|
||||
panel.setLeftComponent(listing);
|
||||
panel.setRightComponent(box);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -73,11 +73,12 @@ public interface LoginConstants
|
|||
public final static String FORM_EMAIL =
|
||||
"emailAddress";
|
||||
public final static String FORM_SCREEN_NAME =
|
||||
"screenName";
|
||||
"screenName";
|
||||
|
||||
// Should not really be named email. Kept this way due to external tests depending on this value.
|
||||
// Should not really be named email. Kept this way due to external tests
|
||||
// depending on this value.
|
||||
public final static String FORM_LOGIN =
|
||||
"email";
|
||||
"email";
|
||||
|
||||
public final static String FORM_ADDITIONAL_EMAIL =
|
||||
"additional_email";
|
||||
|
|
|
|||
|
|
@ -68,19 +68,16 @@ public class LoginServlet extends BebopApplicationServlet {
|
|||
// Define various URLs to subpages of Login to manage administrative tasks.
|
||||
// ////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/** PathInfo into the Login application to access the (optional) newUser
|
||||
* page. Ends with "/" because it is a servlet/directory
|
||||
*/
|
||||
/** PathInfo into the Login application to access the (optional) newUser *
|
||||
* page. Ends with "/" because it is a servlet/directory */
|
||||
public static final String EDIT_USER_PROFILE_PATH_INFO = "/edit-profile/";
|
||||
|
||||
/** PathInfo into the Login application to access the (optional) newUser
|
||||
* page. Ends with "/" because it is a servlet/directory
|
||||
*/
|
||||
/** PathInfo into the Login application to access the (optional) newUser *
|
||||
* page. Ends with "/" because it is a servlet/directory */
|
||||
public static final String NEW_USER_PATH_INFO = "/new-user/";
|
||||
|
||||
/** PathInfo into the Login application to access the (optional) newUser
|
||||
* page. Ends with "/" because it is a servlet/directory
|
||||
*/
|
||||
/** PathInfo into the Login application to access the (optional) newUser *
|
||||
* page. Ends with "/" because it is a servlet/directory */
|
||||
public static final String CHANGE_USER_PASSWORD_PATH_INFO = "/change-password/";
|
||||
|
||||
/** PathInfo into the Login application to access the (optional) newUser
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class PasswordValidationListener
|
|||
* Checks whether the string value of the parameter meets minimum-length
|
||||
* and composition requirements for strong passwords.
|
||||
*/
|
||||
@Override
|
||||
public void validate(ParameterEvent e) {
|
||||
super.validate(e);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,50 +18,63 @@
|
|||
*/
|
||||
package com.arsdigita.ui.login;
|
||||
|
||||
import com.arsdigita.kernel.KernelHelper;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.KernelRequestContext; //Previously SNRC (SiteNode)
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
// Note: Previously used SiteNodeRequestContext, nows using KernelRequestContext
|
||||
// may be one cause that Login doesn't survive if the brwoser window is
|
||||
// closed.
|
||||
/**
|
||||
* Initializes the value of the given parameter to the current user's
|
||||
* screen name. Strangely similar to <code>EmailInitListener</code>.
|
||||
*
|
||||
* @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a>
|
||||
**/
|
||||
* @version $Id: ScreenNameInitListener.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class ScreenNameInitListener implements FormInitListener {
|
||||
|
||||
public static final String versionId = "$Id: ScreenNameInitListener.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(ScreenNameInitListener.class.getName());
|
||||
Logger.getLogger(ScreenNameInitListener.class.getName());
|
||||
private StringParameter m_param;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
public ScreenNameInitListener(StringParameter param) {
|
||||
m_param = param;
|
||||
m_param = param;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void init(FormSectionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
FormData data = event.getFormData();
|
||||
s_log.debug("START");
|
||||
UserContext ctx = KernelHelper
|
||||
.getKernelRequestContext(state.getRequest())
|
||||
.getUserContext();
|
||||
if (!ctx.isLoggedIn()) {
|
||||
s_log.debug("FAILURE not logged in");
|
||||
return;
|
||||
}
|
||||
User user = null;
|
||||
PageState state = event.getPageState();
|
||||
FormData data = event.getFormData();
|
||||
s_log.debug("START");
|
||||
UserContext ctx = KernelRequestContext
|
||||
.getKernelRequestContext(state.getRequest())
|
||||
.getUserContext();
|
||||
if (!ctx.isLoggedIn()) {
|
||||
s_log.debug("FAILURE not logged in");
|
||||
return;
|
||||
}
|
||||
User user = null;
|
||||
user = ctx.getUser();
|
||||
if (user.getScreenName() == null) {
|
||||
s_log.debug("FAILURE null screen name");
|
||||
return;
|
||||
}
|
||||
data.put(m_param.getName(), user.getScreenName());
|
||||
s_log.debug("SUCCESS");
|
||||
if (user.getScreenName() == null) {
|
||||
s_log.debug("FAILURE null screen name");
|
||||
return;
|
||||
}
|
||||
data.put(m_param.getName(), user.getScreenName());
|
||||
s_log.debug("SUCCESS");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,12 +44,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||
* @author Phong Nguyen
|
||||
* @author Sameer Ajmani
|
||||
* @version 1.0
|
||||
* @version $Id: UserAuthenticationListener.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class UserAuthenticationListener implements RequestListener {
|
||||
public static final String versionId =
|
||||
"$Id: UserAuthenticationListener.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||
"$Author: sskracic $" +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(UserAuthenticationListener.class);
|
||||
|
|
@ -67,6 +64,8 @@ public class UserAuthenticationListener implements RequestListener {
|
|||
throw new IllegalStateException("User is not logged in");
|
||||
}
|
||||
|
||||
// Note: aborts processing with an internal error if user not logged in!
|
||||
// Not suiteable just to check log in status.
|
||||
return Web.getUserContext().getUser();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.kernel.User;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationCollection;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
|
@ -74,11 +73,11 @@ public class UserInfo extends SimpleContainer {
|
|||
// add list of links
|
||||
ListPanel list = new ListPanel(false);
|
||||
list.add(new DynamicLink("login.userInfo.logoutLink",
|
||||
UI.getLogoutPageURL()));
|
||||
LoginServlet.getLogoutPageURL()));
|
||||
list.add(new DynamicLink("login.userInfo.editProfileLink",
|
||||
UI.getEditUserProfilePageURL()));
|
||||
LoginServlet.getEditUserProfilePageURL()));
|
||||
list.add(new DynamicLink("login.userInfo.changePasswordLink",
|
||||
UI.getRecoverPasswordPageURL()));
|
||||
LoginServlet.getRecoverPasswordPageURL()));
|
||||
add(list);
|
||||
|
||||
// add user info text
|
||||
|
|
@ -111,7 +110,7 @@ public class UserInfo extends SimpleContainer {
|
|||
objectType = null;
|
||||
}
|
||||
|
||||
// If application type CMS Workspace is installed:
|
||||
// If application type Content-Center (CMS Workspace) is installed:
|
||||
if (objectType != null) {
|
||||
// retrieve all packages of type content-center
|
||||
// works because there may be only one.
|
||||
|
|
@ -120,7 +119,7 @@ public class UserInfo extends SimpleContainer {
|
|||
|
||||
// step through collection of instances of type Workspace
|
||||
// generally there is only a single instance, but obviously
|
||||
// code takes care provided therfe is an instance for
|
||||
// code takes care provided there is an instance for
|
||||
// each subsite.
|
||||
while (workspaceInstances.next()) {
|
||||
// retrieve one Workspace instance of collection
|
||||
|
|
|
|||
|
|
@ -206,6 +206,11 @@ public class UserLoginForm extends Form
|
|||
add(m_loginName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
s_log.info("In init");
|
||||
|
|
@ -234,6 +239,11 @@ public class UserLoginForm extends Form
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
public void validate(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
|
|
@ -266,6 +276,11 @@ public class UserLoginForm extends Form
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
s_log.debug("In process");
|
||||
|
||||
|
|
@ -330,6 +345,12 @@ public class UserLoginForm extends Form
|
|||
// do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
* @param e
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
protected void onBadPassword(FormSectionEvent event,
|
||||
FailedLoginException e)
|
||||
throws FormProcessException {
|
||||
|
|
|
|||
|
|
@ -20,20 +20,20 @@ package com.arsdigita.web;
|
|||
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.domain.DomainServiceInterfaceExposer;
|
||||
// import com.arsdigita.domain.DomainServiceInterfaceExposer;
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.kernel.Group;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.PackageInstance;
|
||||
import com.arsdigita.kernel.PackageType;
|
||||
// import com.arsdigita.kernel.KernelExcursion;
|
||||
// import com.arsdigita.kernel.PackageInstance;
|
||||
// import com.arsdigita.kernel.PackageType;
|
||||
import com.arsdigita.kernel.Resource;
|
||||
import com.arsdigita.kernel.SiteNode;
|
||||
import com.arsdigita.persistence.DataAssociation;
|
||||
import com.arsdigita.persistence.DataAssociationCursor;
|
||||
// import com.arsdigita.kernel.SiteNode;
|
||||
// import com.arsdigita.persistence.DataAssociation;
|
||||
// import com.arsdigita.persistence.DataAssociationCursor;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
// import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
|
@ -47,9 +47,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>A base class for defining a web application. An application has
|
||||
* three important aspects:</p>
|
||||
*
|
||||
* <p>A base class for defining a web application. </p>
|
||||
*
|
||||
* An application has three important aspects:
|
||||
* <ol>
|
||||
* <li><em>Each is a data partition.</em> An application is like a
|
||||
* folder: it contains a user-driven subset of the objects in the
|
||||
|
|
@ -126,7 +126,7 @@ public class Application extends Resource {
|
|||
if (Assert.isEnabled()) {
|
||||
Assert.exists(type, ApplicationType.class);
|
||||
Assert.exists(title, String.class);
|
||||
Assert.isTrue(type.m_legacyFree);
|
||||
// Assert.isTrue(type.m_legacyFree);
|
||||
}
|
||||
|
||||
return Application.make(type, null, title, null, createContainerGroup);
|
||||
|
|
@ -220,15 +220,15 @@ public class Application extends Resource {
|
|||
Assert.isTrue(!fragment.equals(""),
|
||||
"The URL fragment must not be the empty string");
|
||||
}
|
||||
s_log.debug("Application type legacy free: " + type.m_legacyFree );
|
||||
if (type.m_legacyFree) {
|
||||
// s_log.debug("Application type legacy free: " + type.m_legacyFree );
|
||||
// if (type.m_legacyFree) {
|
||||
return Application.make(type,fragment,title,parent,
|
||||
createContainerGroup);
|
||||
} else {
|
||||
s_log.debug("Creating legacy compatible app");
|
||||
return Application.legacyMake(type,fragment,title,parent,
|
||||
createContainerGroup);
|
||||
}
|
||||
// } else {
|
||||
// s_log.debug("Creating legacy compatible app");
|
||||
// return Application.legacyMake(type,fragment,title,parent,
|
||||
// createContainerGroup);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -287,17 +287,17 @@ public class Application extends Resource {
|
|||
return app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates (makes) a legacy compatible application (using deprecated kernel
|
||||
* packageType and sitenode stuff).
|
||||
* @param type
|
||||
* @param fragment
|
||||
* @param title
|
||||
* @param parent
|
||||
* @param createContainerGroup
|
||||
* @return
|
||||
*/
|
||||
private static Application legacyMake(final ApplicationType type,
|
||||
// /**
|
||||
// * Creates (makes) a legacy compatible application (using deprecated kernel
|
||||
// * packageType and sitenode stuff).
|
||||
// * @param type
|
||||
// * @param fragment
|
||||
// * @param title
|
||||
// * @param parent
|
||||
// * @param createContainerGroup
|
||||
// * @return
|
||||
// */
|
||||
/*private static Application legacyMake(final ApplicationType type,
|
||||
final String fragment,
|
||||
final String title,
|
||||
final Application parent,
|
||||
|
|
@ -343,7 +343,7 @@ public class Application extends Resource {
|
|||
}
|
||||
|
||||
return application;
|
||||
}
|
||||
} */
|
||||
|
||||
public static Application retrieveApplication(BigDecimal id) {
|
||||
OID oid = new OID(BASE_DATA_OBJECT_TYPE, id);
|
||||
|
|
@ -385,14 +385,14 @@ public class Application extends Resource {
|
|||
return (Application) result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Can return null.
|
||||
* @param siteNode
|
||||
* @return
|
||||
* @deprecated
|
||||
*/
|
||||
public static Application retrieveApplicationForSiteNode
|
||||
// /**
|
||||
// *
|
||||
// * Can return null.
|
||||
// * @param siteNode
|
||||
// * @return
|
||||
// * @ deprecated
|
||||
// */
|
||||
/* public static Application retrieveApplicationForSiteNode
|
||||
(SiteNode siteNode) {
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery
|
||||
("com.arsdigita.web.applicationForSiteNodeID");
|
||||
|
|
@ -409,7 +409,7 @@ public class Application extends Resource {
|
|||
query.close();
|
||||
|
||||
return application;
|
||||
}
|
||||
} */
|
||||
|
||||
// Can return null.
|
||||
public static Application retrieveApplicationForPath(String path) {
|
||||
|
|
@ -452,13 +452,13 @@ public class Application extends Resource {
|
|||
}
|
||||
|
||||
// COMPAT XXX
|
||||
/**
|
||||
* @deprecated refactor not using deprecated class PackageType. Use
|
||||
* ApplicationType instead
|
||||
*/
|
||||
public PackageType getPackageType() {
|
||||
return getApplicationType().getPackageType();
|
||||
}
|
||||
// /**
|
||||
// * @deprecated refactor not using deprecated class PackageType. Use
|
||||
// * ApplicationType instead
|
||||
// */
|
||||
// public PackageType getPackageType() {
|
||||
// return getApplicationType().getPackageType();
|
||||
// }
|
||||
|
||||
// Can return null.
|
||||
public Application getParentApplication() {
|
||||
|
|
@ -512,37 +512,37 @@ public class Application extends Resource {
|
|||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @deprecated refactor to use other methods of class aüpplication instead
|
||||
*/
|
||||
private PackageInstance getPackageInstance() {
|
||||
// /**
|
||||
// *
|
||||
// * @return
|
||||
// * @deprecated refactor to use other methods of class aüpplication instead
|
||||
// */
|
||||
/* private PackageInstance getPackageInstance() {
|
||||
DataObject dataObject = (DataObject) get("packageInstance");
|
||||
|
||||
Assert.exists(dataObject, DataObject.class);
|
||||
|
||||
return new PackageInstance(dataObject);
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @deprecated refactor to use other methods of class aüpplication instead
|
||||
*/
|
||||
private void setPackageInstance(PackageInstance packageInstance) {
|
||||
// /**
|
||||
// *
|
||||
// * @return
|
||||
// * @deprecated refactor to use other methods of class aüpplication instead
|
||||
// */
|
||||
/* private void setPackageInstance(PackageInstance packageInstance) {
|
||||
Assert.exists(packageInstance, PackageInstance.class);
|
||||
|
||||
setAssociation("packageInstance", packageInstance);
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
*
|
||||
* Needs to be getSiteNodes instead.
|
||||
* @return Can return null.
|
||||
* @deprecated
|
||||
*/
|
||||
public SiteNode getSiteNode() {
|
||||
// /**
|
||||
// *
|
||||
// * Needs to be getSiteNodes instead.
|
||||
// * @return Can return null.
|
||||
// * @deprecated
|
||||
// */
|
||||
/* public SiteNode getSiteNode() {
|
||||
DataObject packageInstance = (DataObject)get("packageInstance");
|
||||
|
||||
DataAssociation siteNodes = (DataAssociation)packageInstance.get
|
||||
|
|
@ -562,7 +562,7 @@ public class Application extends Resource {
|
|||
} else {
|
||||
return new SiteNode(siteNode);
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
// Can return null.
|
||||
/**
|
||||
|
|
@ -649,7 +649,7 @@ public class Application extends Resource {
|
|||
* in parallel we have to use a trailing slash for legacy free applications,
|
||||
* otherwise they will not be found by methods like retrieveApplicationForPath()
|
||||
* which is called by legacy compatible apps including a trailing slash. If
|
||||
* legacy free apps are store without trailing slash the search will never match.
|
||||
* legacy free apps are stored without trailing slash the search will never match.
|
||||
*/
|
||||
// Assert.isTrue
|
||||
// (path.equals("") || (path.startsWith(SLASH)
|
||||
|
|
@ -722,7 +722,7 @@ public class Application extends Resource {
|
|||
//
|
||||
// To support ACSObject services
|
||||
//
|
||||
private static SiteNode makeSiteNode(String urlName, Application parent) {
|
||||
/* private static SiteNode makeSiteNode(String urlName, Application parent) {
|
||||
SiteNode siteNode;
|
||||
|
||||
if (parent == null) {
|
||||
|
|
@ -738,7 +738,7 @@ public class Application extends Resource {
|
|||
Assert.exists(siteNode, SiteNode.class);
|
||||
|
||||
return siteNode;
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* Returns a canonical application URL. This is a utility method
|
||||
|
|
@ -814,10 +814,10 @@ public class Application extends Resource {
|
|||
@Override
|
||||
public void beforeDelete() {
|
||||
super.beforeDelete();
|
||||
SiteNode node = getSiteNode();
|
||||
if (node != null) {
|
||||
node.delete();
|
||||
}
|
||||
// SiteNode node = getSiteNode();
|
||||
// if (node != null) {
|
||||
// node.delete();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -867,8 +867,13 @@ public class Application extends Resource {
|
|||
}
|
||||
|
||||
|
||||
// if application name changes, change name of container group
|
||||
|
||||
/**
|
||||
* .
|
||||
*
|
||||
* Note: If application name changes, change name of container group.
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
@Override
|
||||
public void setTitle (String title) {
|
||||
super.setTitle(title);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package com.arsdigita.web;
|
|||
|
||||
import com.arsdigita.kernel.Group;
|
||||
import com.arsdigita.kernel.ResourceType;
|
||||
import com.arsdigita.kernel.PackageType;
|
||||
// import com.arsdigita.kernel.PackageType;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
|
|
@ -29,7 +29,7 @@ import com.arsdigita.persistence.DataCollection;
|
|||
import com.arsdigita.persistence.DataAssociation;
|
||||
import com.arsdigita.persistence.DataAssociationCursor;
|
||||
import com.arsdigita.persistence.PersistenceException;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
// import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.db.Sequences;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
|
@ -62,8 +62,8 @@ public class ApplicationType extends ResourceType {
|
|||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.web.ApplicationType";
|
||||
|
||||
private PackageType m_packageType;
|
||||
boolean m_legacyFree = false;
|
||||
// private PackageType m_packageType;
|
||||
boolean m_legacyFree = true;
|
||||
|
||||
/**
|
||||
* Constructor creates a new ApplicationType instance to encapsulate a given
|
||||
|
|
@ -75,9 +75,9 @@ public class ApplicationType extends ResourceType {
|
|||
*/
|
||||
public ApplicationType(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
// if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
m_legacyFree = true;
|
||||
} // otherwise leave it on its default value of false
|
||||
// } // otherwise leave it on its default value of false
|
||||
}
|
||||
|
||||
protected ApplicationType(String dataObjectType) {
|
||||
|
|
@ -96,11 +96,11 @@ public class ApplicationType extends ResourceType {
|
|||
final String applicationObjectType) {
|
||||
this(objectType, title, applicationObjectType, false);
|
||||
// under some circumstances m_legacyFree is set correctly to true
|
||||
if (m_legacyFree == false) { //check if default value is correct!
|
||||
if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
m_legacyFree = true;
|
||||
} // otherwise leave it on its default value of false
|
||||
}
|
||||
// if (m_legacyFree == false) { //check if default value is correct!
|
||||
// if (this.getPackageType() == null) { // indicates a legacy free app
|
||||
// m_legacyFree = true;
|
||||
// } // otherwise leave it on its default value of false
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -144,23 +144,23 @@ public class ApplicationType extends ResourceType {
|
|||
// circumstances)
|
||||
// Method overwrites a (overwritable) method provided by the super class to
|
||||
// process a created (empty) data object.
|
||||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
s_log.debug("initialising application type ");
|
||||
if (!isNew() && getPackageType() == null) {
|
||||
s_log.debug("legacy free type");
|
||||
m_legacyFree = true;
|
||||
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public void initialize() {
|
||||
// super.initialize();
|
||||
// s_log.debug("initialising application type ");
|
||||
// if (!isNew() && getPackageType() == null) {
|
||||
// s_log.debug("legacy free type");
|
||||
// m_legacyFree = true;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
private void setDefaults() {
|
||||
// Defaults for standalone applications.
|
||||
setFullPageView(true);
|
||||
setEmbeddedView(false);
|
||||
setWorkspaceApplication(true);
|
||||
// setFullPageView(true);
|
||||
// setEmbeddedView(false);
|
||||
// setWorkspaceApplication(true);
|
||||
setSingleton(false);
|
||||
}
|
||||
|
||||
|
|
@ -175,142 +175,13 @@ public class ApplicationType extends ResourceType {
|
|||
this(BASE_DATA_OBJECT_TYPE, title, applicationObjectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a legacy-compatible application type. Types created
|
||||
* via this constructor use the passed in package type to back the
|
||||
* new application type.
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
protected ApplicationType(final String dataObjectType,
|
||||
final PackageType packageType,
|
||||
final String title,
|
||||
final String applicationObjectType) {
|
||||
this(dataObjectType, packageType, title, applicationObjectType, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Legacy compatible application type
|
||||
* @param dataObjectType
|
||||
* @param packageType
|
||||
* @param title
|
||||
* @param applicationObjectType
|
||||
* @param createContainerGroup
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
protected ApplicationType(final String dataObjectType,
|
||||
final PackageType packageType,
|
||||
final String title,
|
||||
final String applicationObjectType,
|
||||
boolean createContainerGroup) {
|
||||
this(dataObjectType);
|
||||
|
||||
Assert.exists(title, "title");
|
||||
Assert.exists(applicationObjectType, "applicationObjectType");
|
||||
Assert.exists(packageType, "packageType");
|
||||
|
||||
m_packageType = packageType;
|
||||
setPackageType(m_packageType);
|
||||
|
||||
setTitle(title);
|
||||
setApplicationObjectType(applicationObjectType);
|
||||
|
||||
setDefaults();
|
||||
if (createContainerGroup) {
|
||||
createGroup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a legacy-compatible application type using the passed
|
||||
* in package type using an internal constructor (below).
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
public static ApplicationType createApplicationType(PackageType packageType,
|
||||
String title,
|
||||
String applicationObjectType) {
|
||||
return new ApplicationType
|
||||
(BASE_DATA_OBJECT_TYPE, packageType, title, applicationObjectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a legacy-compatible application type. The key
|
||||
* parameter is used to create a legacy package type to back the
|
||||
* new application type.
|
||||
* This variant is applicatable if packageType does not already exist!
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
protected ApplicationType(String dataObjectType, String key, String title,
|
||||
String applicationObjectType) {
|
||||
this(dataObjectType, makePackageType(key, title), title,
|
||||
applicationObjectType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a packageType for a new legacy compatible
|
||||
* application type without an already existing (i.e. installed in db) legacy
|
||||
* application.
|
||||
*
|
||||
* @param key of the package to be created
|
||||
* @param title of the package to be created
|
||||
* @return
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private static PackageType makePackageType(String key, String title) {
|
||||
PackageType packageType = new PackageType();
|
||||
|
||||
Assert.exists(key, "key");
|
||||
Assert.exists(title, "title");
|
||||
|
||||
packageType.setKey(key);
|
||||
packageType.setDisplayName(title);
|
||||
packageType.setURI("http://arsdigita.com/" + key);
|
||||
|
||||
return packageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a legacy-compatible application type. The key
|
||||
* parameter is used to create a legacy package type to back the
|
||||
* new application type.
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
public static ApplicationType createApplicationType(String key, String title,
|
||||
String applicationObjectType) {
|
||||
|
||||
return ApplicationType.createApplicationType(
|
||||
key, title, applicationObjectType, false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a legacy-compatible application type. The key
|
||||
* parameter is used to create a legacy package type to back the
|
||||
* new application type.
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
public static ApplicationType createApplicationType(
|
||||
String key, String title,
|
||||
String applicationObjectType,
|
||||
boolean createContainerGroup) {
|
||||
// See if the package type is already present.
|
||||
|
||||
PackageType packageType = null;
|
||||
|
||||
try {
|
||||
packageType = PackageType.findByKey(key);
|
||||
|
||||
return new ApplicationType
|
||||
(BASE_DATA_OBJECT_TYPE, packageType, title,
|
||||
applicationObjectType, createContainerGroup);
|
||||
} catch (DataObjectNotFoundException nfe) {
|
||||
return new ApplicationType
|
||||
(BASE_DATA_OBJECT_TYPE, key, title, applicationObjectType);
|
||||
}
|
||||
}
|
||||
|
||||
// Param
|
||||
public static ApplicationType retrieveApplicationType(BigDecimal id) {
|
||||
Assert.exists(id, "id");
|
||||
|
||||
|
|
@ -371,65 +242,6 @@ public class ApplicationType extends ResourceType {
|
|||
return new ApplicationTypeCollection(collection);
|
||||
}
|
||||
|
||||
//
|
||||
// Association properties (some by proxy)
|
||||
//
|
||||
|
||||
/**
|
||||
* Can return null.
|
||||
* @return
|
||||
* @deprecated without direct replacement. Refactor to legacy free app.
|
||||
*/
|
||||
public PackageType getPackageType() {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
|
||||
final DataObject dataObject = (DataObject) get("packageType");
|
||||
|
||||
if (dataObject == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new PackageType(dataObject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
*/
|
||||
protected void setPackageType(PackageType packageType) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
|
||||
Assert.exists(packageType, "packageType");
|
||||
setAssociation("packageType", packageType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
*/
|
||||
public void setDispatcherClass(String className) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
|
||||
if (m_packageType == null) {
|
||||
m_packageType = getPackageType();
|
||||
}
|
||||
|
||||
m_packageType.setDispatcherClass(className);
|
||||
}
|
||||
|
||||
//
|
||||
// Member properties
|
||||
//
|
||||
|
|
@ -472,20 +284,20 @@ public class ApplicationType extends ResourceType {
|
|||
return result.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
*/
|
||||
public void setWorkspaceApplication(boolean isWorkspaceApplication) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
// /**
|
||||
// * @deprecated with no replacement.
|
||||
// * @throws UnsupportedOperationException when this method is
|
||||
// * called for an application type without a corresponding package
|
||||
// * type.
|
||||
// */
|
||||
// public void setWorkspaceApplication(boolean isWorkspaceApplication) {
|
||||
// if (m_legacyFree == true) {
|
||||
// throw new UnsupportedOperationException
|
||||
// ("This method is only supported for legacy application types");
|
||||
// }
|
||||
|
||||
set("isWorkspaceApplication", new Boolean(isWorkspaceApplication));
|
||||
}
|
||||
// set("isWorkspaceApplication", new Boolean(isWorkspaceApplication));
|
||||
// }
|
||||
|
||||
public boolean hasFullPageView() {
|
||||
final Boolean result = (Boolean) get("hasFullPageView");
|
||||
|
|
@ -495,46 +307,46 @@ public class ApplicationType extends ResourceType {
|
|||
return result.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
*/
|
||||
protected void setFullPageView(boolean hasFullPageView) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
// /**
|
||||
// * @deprecated with no replacement.
|
||||
// * @throws UnsupportedOperationException when this method is
|
||||
// * called for an application type without a corresponding package
|
||||
// * type.
|
||||
// */
|
||||
// protected void setFullPageView(boolean hasFullPageView) {
|
||||
// if (m_legacyFree == true) {
|
||||
// throw new UnsupportedOperationException
|
||||
// ("This method is only supported for legacy application types");
|
||||
// }
|
||||
|
||||
set("hasFullPageView", new Boolean(hasFullPageView));
|
||||
}
|
||||
// set("hasFullPageView", new Boolean(hasFullPageView));
|
||||
// }
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
*/
|
||||
public boolean hasEmbeddedView() {
|
||||
final Boolean result = (Boolean) get("hasEmbeddedView");
|
||||
// /**
|
||||
// * @deprecated with no replacement.
|
||||
// */
|
||||
// public boolean hasEmbeddedView() {
|
||||
// final Boolean result = (Boolean) get("hasEmbeddedView");
|
||||
|
||||
Assert.exists(result, "Boolean result");
|
||||
// Assert.exists(result, "Boolean result");
|
||||
|
||||
return result.booleanValue();
|
||||
}
|
||||
// return result.booleanValue();
|
||||
// }
|
||||
|
||||
/**
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
*/
|
||||
protected void setEmbeddedView(boolean hasEmbeddedView) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
// /**
|
||||
// * @deprecated with no replacement.
|
||||
// * @throws UnsupportedOperationException when this method is
|
||||
// * called for an application type without a corresponding package
|
||||
// * type.
|
||||
// */
|
||||
// protected void setEmbeddedView(boolean hasEmbeddedView) {
|
||||
// if (m_legacyFree == true) {
|
||||
// throw new UnsupportedOperationException
|
||||
// ("This method is only supported for legacy application types");
|
||||
// }
|
||||
|
||||
set("hasEmbeddedView", new Boolean(hasEmbeddedView));
|
||||
}
|
||||
// set("hasEmbeddedView", new Boolean(hasEmbeddedView));
|
||||
// }
|
||||
|
||||
// Can return null.
|
||||
public String getProfile() {
|
||||
|
|
@ -596,6 +408,7 @@ public class ApplicationType extends ResourceType {
|
|||
* <p>Remove an entry from the list of relevant privileges for
|
||||
* this ApplicationType.</p>
|
||||
*/
|
||||
@Override
|
||||
public void removeRelevantPrivilege(PrivilegeDescriptor privilege) {
|
||||
removeRelevantPrivilege(privilege.getName());
|
||||
}
|
||||
|
|
@ -604,6 +417,7 @@ public class ApplicationType extends ResourceType {
|
|||
* <p>Remove an entry from the list of relevant privileges for
|
||||
* this ApplicationType.</p>
|
||||
*/
|
||||
@Override
|
||||
public void removeRelevantPrivilege(String privilegeName) {
|
||||
OID privOID = new OID("com.arsdigita.kernel.permissions.Privilege",
|
||||
privilegeName);
|
||||
|
|
@ -652,49 +466,49 @@ public class ApplicationType extends ResourceType {
|
|||
// the class name without leading package name.
|
||||
public String getName() {
|
||||
|
||||
if (m_legacyFree == true ) {
|
||||
// if (m_legacyFree == true ) {
|
||||
s_log.debug("Expect XSL templates at " + StringUtils.urlize(getTitle()));
|
||||
return StringUtils.urlize(getTitle());
|
||||
} else {
|
||||
// } else {
|
||||
// m_legacyFree seems sometimes not set correctly! It's odd but the
|
||||
// goal is to get rid of legacy code so it should do it for the
|
||||
// time beeing. We check getPackageType to see if m_legacyFree is
|
||||
// time beeing. We svn rename check getPackageType to see if m_legacyFree is
|
||||
// really set correctly.
|
||||
if (getPackageType() == null) { // indicates legacy free App
|
||||
s_log.debug("Expect XSL templates at "
|
||||
+ StringUtils.urlize(getTitle()));
|
||||
m_legacyFree = true; // correct m_legacyFree for future use
|
||||
return StringUtils.urlize(getTitle());
|
||||
} else {
|
||||
return this.getPackageType().getKey();
|
||||
}
|
||||
// if (getPackageType() == null) { // indicates legacy free App
|
||||
// s_log.debug("Expect XSL templates at "
|
||||
// + StringUtils.urlize(getTitle()));
|
||||
// m_legacyFree = true; // correct m_legacyFree for future use
|
||||
// return StringUtils.urlize(getTitle());
|
||||
// } else {
|
||||
// return this.getPackageType().getKey();
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Declare this ApplicationType to be a singleton. That is to
|
||||
* say, there ought to only ever be one Application of this type
|
||||
* directly under a given Workspace.
|
||||
* @deprecated with no replacement.
|
||||
* @throws UnsupportedOperationException when this method is
|
||||
* @ deprecated with no replacement.
|
||||
* @ throws UnsupportedOperationException when this method is
|
||||
* called for an application type without a corresponding package
|
||||
* type.
|
||||
* Deprecated removed. Decided that also a new type app could be
|
||||
* qualified as singleton. Specifically used in the planned app admin
|
||||
* app.
|
||||
*/
|
||||
public void setSingleton(boolean isSingleton) {
|
||||
if (m_legacyFree == true) {
|
||||
throw new UnsupportedOperationException
|
||||
("This method is only supported for legacy application types");
|
||||
}
|
||||
|
||||
set("isSingleton", new Boolean(isSingleton));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether this ApplicationType is a singleton.
|
||||
* @deprecated with no replacement.
|
||||
* @ deprecated with no replacement.
|
||||
*/
|
||||
public boolean isSingleton() {
|
||||
|
||||
final Boolean result = (Boolean) get("isSingleton");
|
||||
|
||||
Assert.exists(result, "Boolean result");
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ package com.arsdigita.web;
|
|||
import com.arsdigita.dispatcher.InitialRequestContext;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.dispatcher.RequestContext;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.SiteNode;
|
||||
// import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
// import com.arsdigita.kernel.SiteNode;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.KernelRequestContext;
|
||||
import com.arsdigita.kernel.security.SessionContext;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
// import com.arsdigita.sitenode.SiteNodeRequestContext;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
// import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
|
|
@ -206,33 +206,37 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
sreq = DispatcherHelper.restoreOriginalRequest(sreq);
|
||||
|
||||
final InitialRequestContext irc = new InitialRequestContext
|
||||
(sreq, getServletContext());
|
||||
(sreq, getServletContext());
|
||||
final SessionContext sc = uc.getSessionContext();
|
||||
|
||||
final KernelRequestContext krc = new KernelRequestContext
|
||||
(irc, sc, uc);
|
||||
(irc, sc, uc);
|
||||
|
||||
// SiteNode node = null;
|
||||
// Experimental:
|
||||
// if (node == null) {
|
||||
// return krc;
|
||||
// }
|
||||
|
||||
SiteNode node = null;
|
||||
try {
|
||||
node = SiteNode.getSiteNode(app.getPrimaryURL(),
|
||||
true);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
throw new UncheckedWrapperException("cannot find root sitenode");
|
||||
}
|
||||
// try {
|
||||
// node = SiteNode.getSiteNode(app.getPrimaryURL(),
|
||||
// true);
|
||||
// } catch (DataObjectNotFoundException ex) {
|
||||
// throw new UncheckedWrapperException("cannot find root sitenode");
|
||||
// }
|
||||
|
||||
if (node == null) {
|
||||
s_log.debug("There is no site node at this URL; storing a " +
|
||||
"KernelRequestContext");
|
||||
// if (node == null) {
|
||||
// s_log.debug("There is no site node at this URL; storing a " +
|
||||
// "KernelRequestContext");
|
||||
|
||||
return krc;
|
||||
} else {
|
||||
s_log.debug("Creating a SiteNodeRequestContext");
|
||||
// } else {
|
||||
// s_log.debug("Creating a SiteNodeRequestContext");
|
||||
|
||||
final SiteNodeRequestContext snrc = new SiteNodeRequestContext
|
||||
(sreq, krc, node, sreq.getServletPath() + "/");
|
||||
// final SiteNodeRequestContext snrc = new SiteNodeRequestContext
|
||||
// (sreq, krc, node, sreq.getServletPath() + "/");
|
||||
|
||||
return snrc;
|
||||
}
|
||||
// return snrc;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
|
||||
|
||||
/** A logger instance, primarily to assist debugging . */
|
||||
private static Logger s_log = Logger.getLogger(BaseJSP.class);
|
||||
|
||||
/**
|
||||
|
|
@ -53,6 +54,7 @@ public abstract class BaseJSP extends BaseServlet implements HttpJspPage {
|
|||
* @see com.arsdigita.web.BaseServlet
|
||||
* @see com.arsdigita.web.BaseServlet#doService(HttpServletRequest,HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
protected final void doService(final HttpServletRequest sreq,
|
||||
final HttpServletResponse sresp)
|
||||
throws ServletException, IOException {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import com.arsdigita.kernel.Kernel;
|
|||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.kernel.security.UserContext;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.sitenode.ServletErrorReport;
|
||||
import com.arsdigita.util.ResourceManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -168,9 +167,8 @@ public abstract class BaseServlet extends HttpServlet {
|
|||
|
||||
// Now we're ready to service the request.
|
||||
|
||||
/* call flushAll on all non error paths so listeners
|
||||
* run in correct context (bug 108499)
|
||||
*/
|
||||
/* call flushAll on all non error paths so listeners *
|
||||
* run in correct context (bug 108499) */
|
||||
|
||||
try {
|
||||
DeveloperSupport.startStage("BaseServlet.doService");
|
||||
|
|
@ -309,6 +307,13 @@ public abstract class BaseServlet extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sresp
|
||||
* @param transaction
|
||||
* @param rs
|
||||
* @throws IOException
|
||||
*/
|
||||
private void redirect(final HttpServletResponse sresp,
|
||||
final DatabaseTransaction transaction,
|
||||
final RedirectSignal rs)
|
||||
|
|
@ -330,6 +335,12 @@ public abstract class BaseServlet extends HttpServlet {
|
|||
sresp.sendRedirect(url);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sreq
|
||||
* @return
|
||||
*/
|
||||
private URL getRequestURL(HttpServletRequest sreq) {
|
||||
URL url = (URL) sreq.getAttribute(REQUEST_URL_ATTRIBUTE);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.sitenode;
|
||||
package com.arsdigita.web;
|
||||
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
|
|
@ -1,12 +1,23 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
|
||||
|
||||
<jsp:directive.page import="com.arsdigita.ui.UI"/>
|
||||
<jsp:directive.page import="com.arsdigita.web.Web"/>
|
||||
<jsp:directive.page import="com.arsdigita.web.WebContext"/>
|
||||
<jsp:directive.page import="com.arsdigita.web.URL"/>
|
||||
<jsp:directive.page import="com.arsdigita.web.RedirectSignal"/>
|
||||
<jsp:directive.page extends="com.arsdigita.web.BaseJSP"/>
|
||||
|
||||
<jsp:scriptlet>
|
||||
throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
|
||||
false);
|
||||
// throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
|
||||
// false);
|
||||
if (Web.getContext().getUser() == null) {
|
||||
// User not logged in, display public front page
|
||||
throw new RedirectSignal(URL.there(request,UI.getWorkspaceURL(request)),
|
||||
false);
|
||||
} else {
|
||||
// User logged in, redirect to user redirect page
|
||||
throw new RedirectSignal(URL.there(request,UI.getUserRedirectURL(request)),
|
||||
false);
|
||||
}
|
||||
</jsp:scriptlet>
|
||||
</jsp:root>
|
||||
|
|
|
|||
Loading…
Reference in New Issue