mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -442,6 +442,9 @@
|
|||||||
|
|
||||||
<!-- Email Space Users -->
|
<!-- Email Space Users -->
|
||||||
<action id="email_space_users">
|
<action id="email_space_users">
|
||||||
|
<permissions>
|
||||||
|
<permission allow="true">ReadPermissions</permission>
|
||||||
|
</permissions>
|
||||||
<label-id>email_space_users</label-id>
|
<label-id>email_space_users</label-id>
|
||||||
<image>/images/icons/email_users.gif</image>
|
<image>/images/icons/email_users.gif</image>
|
||||||
<action>dialog:emailSpaceUsers</action>
|
<action>dialog:emailSpaceUsers</action>
|
||||||
|
@@ -28,6 +28,7 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
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.ContentIOException;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
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.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -67,7 +68,12 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li><b>alfresco.dr.size:</b> The content size</li>
|
* <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.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>
|
* </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
|
* @since 2.1
|
||||||
* @author Derek Hulley
|
* @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_CONTENT_URL = "contentUrl";
|
||||||
private static final String ARG_INFO_ONLY = "infoOnly";
|
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
|
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
@@ -154,19 +157,31 @@ public class DownloadRawContentServlet extends BaseServlet
|
|||||||
return;
|
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
|
// Fill response details
|
||||||
res.setContentType(DEFAULT_MIMETYPE);
|
res.setContentType(DEFAULT_MIMETYPE);
|
||||||
res.setCharacterEncoding(DEFAULT_ENCODING);
|
res.setCharacterEncoding(DEFAULT_ENCODING);
|
||||||
|
}
|
||||||
long readerSize = reader.getSize();
|
else
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
// Fill response details
|
||||||
|
res.setContentType(readerMimetype);
|
||||||
|
res.setCharacterEncoding(readerEncoding);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OutputStream clientOs = res.getOutputStream();
|
OutputStream clientOs = res.getOutputStream();
|
||||||
|
@@ -52,6 +52,7 @@ import org.alfresco.web.bean.NavigationBean;
|
|||||||
import org.alfresco.web.bean.repository.Repository;
|
import org.alfresco.web.bean.repository.Repository;
|
||||||
import org.alfresco.web.data.IDataContainer;
|
import org.alfresco.web.data.IDataContainer;
|
||||||
import org.alfresco.web.data.QuickSort;
|
import org.alfresco.web.data.QuickSort;
|
||||||
|
import org.alfresco.web.ui.common.Utils;
|
||||||
import org.alfresco.web.ui.repo.component.UITree.TreeNode;
|
import org.alfresco.web.ui.repo.component.UITree.TreeNode;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -346,6 +347,7 @@ public class NavigatorPluginBean implements IContextListener
|
|||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
|
Utils.addErrorMessage("NavigatorPluginBean exception in getCompanyHomeRootNodes()", err);
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -397,6 +399,7 @@ public class NavigatorPluginBean implements IContextListener
|
|||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
|
Utils.addErrorMessage("NavigatorPluginBean exception in getMyHomeRootNodes()", err);
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -451,6 +454,7 @@ public class NavigatorPluginBean implements IContextListener
|
|||||||
}
|
}
|
||||||
catch (Throwable err)
|
catch (Throwable err)
|
||||||
{
|
{
|
||||||
|
Utils.addErrorMessage("NavigatorPluginBean exception in getGuestHomeRootNodes()", err);
|
||||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -200,7 +200,7 @@ public final class User
|
|||||||
NamespaceService namespaceService = registry.getNamespaceService();
|
NamespaceService namespaceService = registry.getNamespaceService();
|
||||||
ConfigurableService configurableService = Repository.getConfigurableService(fc);
|
ConfigurableService configurableService = Repository.getConfigurableService(fc);
|
||||||
|
|
||||||
NodeRef person = Application.getCurrentUser(fc).getPerson();
|
NodeRef person = getPerson();
|
||||||
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
|
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
|
||||||
{
|
{
|
||||||
// create the configuration folder for this Person node
|
// create the configuration folder for this Person node
|
||||||
|
@@ -55,7 +55,6 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
public class UIWorkflowHistory extends SelfRenderingComponent
|
public class UIWorkflowHistory extends SelfRenderingComponent
|
||||||
{
|
{
|
||||||
protected WorkflowInstance value = null;
|
protected WorkflowInstance value = null;
|
||||||
protected Boolean completedMode = null;
|
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(UIWorkflowHistory.class);
|
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
|
// standard component attributes are restored by the super class
|
||||||
super.restoreState(context, values[0]);
|
super.restoreState(context, values[0]);
|
||||||
this.value = (WorkflowInstance)values[1];
|
this.value = (WorkflowInstance)values[1];
|
||||||
this.completedMode = (Boolean)values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object saveState(FacesContext context)
|
public Object saveState(FacesContext context)
|
||||||
{
|
{
|
||||||
Object values[] = new Object[3];
|
Object values[] = new Object[2];
|
||||||
// standard component attributes are saved by the super class
|
// standard component attributes are saved by the super class
|
||||||
values[0] = super.saveState(context);
|
values[0] = super.saveState(context);
|
||||||
values[1] = this.value;
|
values[1] = this.value;
|
||||||
values[2] = this.completedMode;
|
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +113,7 @@ public class UIWorkflowHistory extends SelfRenderingComponent
|
|||||||
logger.debug("Retrieving workflow history for workflow instance: " + wi);
|
logger.debug("Retrieving workflow history for workflow instance: " + wi);
|
||||||
|
|
||||||
WorkflowTaskQuery query = new WorkflowTaskQuery();
|
WorkflowTaskQuery query = new WorkflowTaskQuery();
|
||||||
query.setActive(!getCompletedMode());
|
query.setActive(null);
|
||||||
query.setProcessId(wi.id);
|
query.setProcessId(wi.id);
|
||||||
query.setTaskState(WorkflowTaskState.COMPLETED);
|
query.setTaskState(WorkflowTaskState.COMPLETED);
|
||||||
query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
|
query.setOrderBy(new WorkflowTaskQuery.OrderBy[] {
|
||||||
@@ -257,34 +254,4 @@ public class UIWorkflowHistory extends SelfRenderingComponent
|
|||||||
{
|
{
|
||||||
this.value = value;
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ import org.alfresco.web.ui.common.tag.HtmlComponentTag;
|
|||||||
public class WorkflowHistoryTag extends HtmlComponentTag
|
public class WorkflowHistoryTag extends HtmlComponentTag
|
||||||
{
|
{
|
||||||
private String value;
|
private String value;
|
||||||
private String completedMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||||
@@ -62,7 +61,6 @@ public class WorkflowHistoryTag extends HtmlComponentTag
|
|||||||
super.setProperties(component);
|
super.setProperties(component);
|
||||||
|
|
||||||
setStringProperty(component, "value", this.value);
|
setStringProperty(component, "value", this.value);
|
||||||
setBooleanProperty(component, "completedMode", this.completedMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +70,6 @@ public class WorkflowHistoryTag extends HtmlComponentTag
|
|||||||
{
|
{
|
||||||
super.release();
|
super.release();
|
||||||
this.value = null;
|
this.value = null;
|
||||||
this.completedMode = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,14 +81,4 @@ public class WorkflowHistoryTag extends HtmlComponentTag
|
|||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether the component is showing history for a completed workflow
|
|
||||||
*
|
|
||||||
* @param completedMode
|
|
||||||
*/
|
|
||||||
public void setCompletedMode(String completedMode)
|
|
||||||
{
|
|
||||||
this.completedMode = completedMode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -2023,12 +2023,6 @@
|
|||||||
<required>false</required>
|
<required>false</required>
|
||||||
<rtexprvalue>true</rtexprvalue>
|
<rtexprvalue>true</rtexprvalue>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
||||||
<attribute>
|
|
||||||
<name>completedMode</name>
|
|
||||||
<required>false</required>
|
|
||||||
<rtexprvalue>true</rtexprvalue>
|
|
||||||
</attribute>
|
|
||||||
</tag>
|
</tag>
|
||||||
|
|
||||||
<tag>
|
<tag>
|
||||||
|
@@ -24,8 +24,15 @@
|
|||||||
--%>
|
--%>
|
||||||
|
|
||||||
<%@ page import="javax.faces.context.FacesContext" %>
|
<%@ 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.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.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.config.ConfigService" %>
|
||||||
<%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %>
|
<%@ page import="org.alfresco.web.app.servlet.AuthenticationHelper" %>
|
||||||
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
|
<%@ page import="org.alfresco.web.app.servlet.FacesHelper" %>
|
||||||
@@ -37,13 +44,14 @@
|
|||||||
<%-- redirect to the web application's appropriate start page --%>
|
<%-- redirect to the web application's appropriate start page --%>
|
||||||
<%
|
<%
|
||||||
// get the start location as configured by the web-client config
|
// 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");
|
ClientConfigElement configElement = (ClientConfigElement)configService.getGlobalConfig().getConfigElement("client");
|
||||||
String location = configElement.getInitialLocation();
|
String location = configElement.getInitialLocation();
|
||||||
|
|
||||||
// override with the users preference if they have one
|
// override with the users preference if they have one
|
||||||
User user = (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);
|
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
|
// ensure construction of the FacesContext before attemping a service call
|
||||||
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
|
FacesContext fc = FacesHelper.getFacesContext(request, response, application);
|
||||||
@@ -53,6 +61,33 @@ if (user != null && (user.getUserName().equals(PermissionService.GUEST_AUTHORITY
|
|||||||
location = preference;
|
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))
|
if (NavigationBean.LOCATION_MYALFRESCO.equals(location))
|
||||||
{
|
{
|
||||||
response.sendRedirect(request.getContextPath() + "/faces/jsp/dashboards/container.jsp");
|
response.sendRedirect(request.getContextPath() + "/faces/jsp/dashboards/container.jsp");
|
||||||
|
@@ -111,7 +111,7 @@
|
|||||||
<a:panel id="pending-submission-panel" label="#{msg.workflow_history}" progressive="true"
|
<a:panel id="pending-submission-panel" label="#{msg.workflow_history}" progressive="true"
|
||||||
expanded="false" styleClass="mainSubTitle">
|
expanded="false" styleClass="mainSubTitle">
|
||||||
<r:workflowHistory id="workflow-history" value="#{DialogManager.bean.workflowInstance}"
|
<r:workflowHistory id="workflow-history" value="#{DialogManager.bean.workflowInstance}"
|
||||||
styleClass="workflowHistoryList" completedMode="true" />
|
styleClass="workflowHistoryList" />
|
||||||
</a:panel>
|
</a:panel>
|
||||||
<f:verbatim></div></f:verbatim>
|
<f:verbatim></div></f:verbatim>
|
||||||
</a:panel>
|
</a:panel>
|
||||||
|
Reference in New Issue
Block a user