Merged V2.1 to HEAD

6309: Fixed AWC-1195 - Email space users.
   6311: AWC-1378
   6319: Fixed minor caching bug
   6320, 6326: Some fixes to the raw content download servlet available on /dr
   6324: Fix for AWC-1444 (workflow history issue)
   6325: Exceptions that occur in NavigatorPluginBean now correctly logged to the console


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6720 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-09-10 12:58:48 +00:00
parent bf4349d64d
commit f9bad97b04
9 changed files with 74 additions and 69 deletions

View File

@@ -442,6 +442,9 @@
<!-- Email Space Users -->
<action id="email_space_users">
<permissions>
<permission allow="true">ReadPermissions</permission>
</permissions>
<label-id>email_space_users</label-id>
<image>/images/icons/email_users.gif</image>
<action>dialog:emailSpaceUsers</action>

View File

@@ -28,6 +28,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.net.SocketException;
import java.util.Date;
import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -39,7 +40,7 @@ import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.util.ISO8601DateFormat;
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -67,7 +68,12 @@ import org.apache.commons.logging.LogFactory;
* <ul>
* <li><b>alfresco.dr.size:</b> The content size</li>
* <li><b>alfresco.dr.lastModified:</b> The last modified date</li>
* <li><b>alfresco.dr.mimetype:</b> The content mimetype</li>
* <li><b>alfresco.dr.encoding:</b> The content encoding</li>
* <li><b>alfresco.dr.locale:</b> The content locale</li>
* </ul>
* Note that the mimetype, encoding and locale generally fallback to the default
* as implemented by the {@linkplain ContentService#getRawReader(String) raw reader}.
*
* @since 2.1
* @author Derek Hulley
@@ -84,9 +90,6 @@ public class DownloadRawContentServlet extends BaseServlet
private static final String ARG_CONTENT_URL = "contentUrl";
private static final String ARG_INFO_ONLY = "infoOnly";
private static final String HEADER_SIZE = "alfresco.dr.size";
private static final String HEADER_LAST_MODIFIED = "alfresco.dr.lastModified";
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
if (logger.isDebugEnabled())
@@ -154,19 +157,31 @@ public class DownloadRawContentServlet extends BaseServlet
return;
}
long readerSize = reader.getSize();
Date readerLastModified = new Date(reader.getLastModified());
String readerMimetype = reader.getMimetype();
String readerEncoding = reader.getEncoding();
Locale readerLocale = reader.getLocale();
// Set the content info
res.setHeader("alfresco.dr.size", DefaultTypeConverter.INSTANCE.convert(String.class, readerSize));
res.setHeader("alfresco.dr.lastModified", DefaultTypeConverter.INSTANCE.convert(String.class, readerLastModified));
res.setHeader("alfresco.dr.mimetype", readerMimetype);
res.setHeader("alfresco.dr.encoding", readerEncoding);
res.setHeader("alfresco.dr.locale", DefaultTypeConverter.INSTANCE.convert(String.class, readerLocale));
// Pass the stream to the response, unless only the content info was requested
if (infoOnly)
{
// Fill response details
res.setContentType(DEFAULT_MIMETYPE);
res.setCharacterEncoding(DEFAULT_ENCODING);
long readerSize = reader.getSize();
Date readerLastModified = new Date(reader.getLastModified());
// Set the content info
res.setIntHeader(HEADER_SIZE, (int) readerSize);
res.setHeader(HEADER_LAST_MODIFIED, ISO8601DateFormat.format(readerLastModified));
// Pass the stream to the response, unless only the content info was requested
if (!infoOnly)
}
else
{
// Fill response details
res.setContentType(readerMimetype);
res.setCharacterEncoding(readerEncoding);
try
{
OutputStream clientOs = res.getOutputStream();

View File

@@ -52,6 +52,7 @@ import org.alfresco.web.bean.NavigationBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.repo.component.UITree.TreeNode;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -346,6 +347,7 @@ public class NavigatorPluginBean implements IContextListener
}
catch (Throwable err)
{
Utils.addErrorMessage("NavigatorPluginBean exception in getCompanyHomeRootNodes()", err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
@@ -397,6 +399,7 @@ public class NavigatorPluginBean implements IContextListener
}
catch (Throwable err)
{
Utils.addErrorMessage("NavigatorPluginBean exception in getMyHomeRootNodes()", err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
@@ -451,6 +454,7 @@ public class NavigatorPluginBean implements IContextListener
}
catch (Throwable err)
{
Utils.addErrorMessage("NavigatorPluginBean exception in getGuestHomeRootNodes()", err);
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}

View File

@@ -200,7 +200,7 @@ public final class User
NamespaceService namespaceService = registry.getNamespaceService();
ConfigurableService configurableService = Repository.getConfigurableService(fc);
NodeRef person = Application.getCurrentUser(fc).getPerson();
NodeRef person = getPerson();
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
{
// create the configuration folder for this Person node

View File

@@ -55,7 +55,6 @@ import org.apache.commons.logging.LogFactory;
public class UIWorkflowHistory extends SelfRenderingComponent
{
protected WorkflowInstance value = null;
protected Boolean completedMode = null;
private static final Log logger = LogFactory.getLog(UIWorkflowHistory.class);
@@ -85,17 +84,15 @@ public class UIWorkflowHistory extends SelfRenderingComponent
// standard component attributes are restored by the super class
super.restoreState(context, values[0]);
this.value = (WorkflowInstance)values[1];
this.completedMode = (Boolean)values[2];
}
@Override
public Object saveState(FacesContext context)
{
Object values[] = new Object[3];
Object values[] = new Object[2];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.value;
values[2] = this.completedMode;
return values;
}
@@ -116,7 +113,7 @@ public class UIWorkflowHistory extends SelfRenderingComponent
logger.debug("Retrieving workflow history for workflow instance: " + wi);
WorkflowTaskQuery query = new WorkflowTaskQuery();
query.setActive(!getCompletedMode());
query.setActive(null);
query.setProcessId(wi.id);
query.setTaskState(WorkflowTaskState.COMPLETED);
query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
@@ -257,34 +254,4 @@ public class UIWorkflowHistory extends SelfRenderingComponent
{
this.value = value;
}
/**
* @return Returns whether the history is for a completed workflow instance
*/
public boolean getCompletedMode()
{
if (this.completedMode == null)
{
ValueBinding vb = getValueBinding("completedMode");
if (vb != null)
{
this.completedMode = (Boolean)vb.getValue(getFacesContext());
}
}
if (this.completedMode == null)
{
this.completedMode = Boolean.FALSE;
}
return this.completedMode;
}
/**
* @param completedMode Sets whether the history is for a completed workflow instance
*/
public void setCompletedMode(boolean completedMode)
{
this.completedMode = Boolean.valueOf(completedMode);
}
}

View File

@@ -36,7 +36,6 @@ import org.alfresco.web.ui.common.tag.HtmlComponentTag;
public class WorkflowHistoryTag extends HtmlComponentTag
{
private String value;
private String completedMode;
/**
* @see javax.faces.webapp.UIComponentTag#getComponentType()
@@ -62,7 +61,6 @@ public class WorkflowHistoryTag extends HtmlComponentTag
super.setProperties(component);
setStringProperty(component, "value", this.value);
setBooleanProperty(component, "completedMode", this.completedMode);
}
/**
@@ -72,7 +70,6 @@ public class WorkflowHistoryTag extends HtmlComponentTag
{
super.release();
this.value = null;
this.completedMode = null;
}
/**
@@ -84,14 +81,4 @@ public class WorkflowHistoryTag extends HtmlComponentTag
{
this.value = value;
}
/**
* Sets whether the component is showing history for a completed workflow
*
* @param completedMode
*/
public void setCompletedMode(String completedMode)
{
this.completedMode = completedMode;
}
}

View File

@@ -2023,12 +2023,6 @@
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>completedMode</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>

View File

@@ -24,8 +24,15 @@
--%>
<%@ page import="javax.faces.context.FacesContext" %>
<%@ page import="javax.transaction.UserTransaction" %>
<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.alfresco.service.transaction.TransactionService" %>
<%@ page import="org.alfresco.service.cmr.security.PermissionService" %>
<%@ page import="org.alfresco.service.cmr.security.AuthenticationService" %>
<%@ page import="org.alfresco.service.cmr.security.PersonService" %>
<%@ page import="org.alfresco.service.cmr.security.PermissionService" %>
<%@ page import="org.alfresco.service.cmr.repository.NodeRef" %>
<%@ page import="org.alfresco.config.ConfigService" %>
<%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %>
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
@@ -37,13 +44,14 @@
<%-- redirect to the web application's appropriate start page --%>
<%
// get the start location as configured by the web-client config
ConfigService configService = (ConfigService)WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext()).getBean("webClientConfigService");
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(session.getServletContext());
ConfigService configService = (ConfigService)context.getBean("webClientConfigService");
ClientConfigElement configElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement("client");
String location = configElement.getInitialLocation();
// override with the users preference if they have one
User user = (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);
if (user != null && (user.getUserName().equals(PermissionService.GUEST_AUTHORITY) == false))
if (user != null)
{
// ensure construction of the FacesContext before attemping a service call
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
@@ -53,6 +61,33 @@ if (user != null && (user.getUserName().equals(PermissionService.GUEST_AUTHORITY
location = preference;
}
}
else
{
UserTransaction tx = ((TransactionService)context.getBean("TransactionService")).getUserTransaction();;
tx.begin();
try
{
AuthenticationService authService = (AuthenticationService)context.getBean("AuthenticationService");
authService.authenticateAsGuest();
PersonService personService = (PersonService)context.getBean("personService");
NodeRef guestRef = personService.getPerson(PermissionService.GUEST_AUTHORITY);
user = new User(authService.getCurrentUserName(), authService.getCurrentTicket(), guestRef);
// ensure construction of the FacesContext before attemping a service call
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
String preference = (String)PreferencesService.getPreferences(user).getValue("start-location");
if (preference != null)
{
location = preference;
}
tx.commit();
}
catch (Throwable e)
{
try { tx.rollback(); } catch (Throwable tex) {}
}
}
if (NavigationBean.LOCATION_MYALFRESCO.equals(location))
{
response.sendRedirect(request.getContextPath() + "/faces/jsp/dashboards/container.jsp");

View File

@@ -111,7 +111,7 @@
<a:panel id="pending-submission-panel" label="#{msg.workflow_history}" progressive="true"
expanded="false" styleClass="mainSubTitle">
<r:workflowHistory id="workflow-history" value="#{DialogManager.bean.workflowInstance}"
styleClass="workflowHistoryList" completedMode="true" />
styleClass="workflowHistoryList" />
</a:panel>
<f:verbatim></div></f:verbatim>
</a:panel>