Merged V1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3925 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@3965 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3966 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-09-29 07:45:33 +00:00
parent d4c5c3562a
commit cba5171884
23 changed files with 386 additions and 197 deletions

View File

@@ -535,6 +535,9 @@ public class BrowseBean implements IContextListener
// push the view mode into the lists
setBrowseViewMode(viewMode);
// setup dispatch context for custom views
this.navigator.setupDispatchContext(this.navigator.getCurrentNode());
navigateBrowseScreen();
}
else
@@ -666,7 +669,7 @@ public class BrowseBean implements IContextListener
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}) );
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr );
this.containerNodes = Collections.<Node>emptyList();
this.contentNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
@@ -840,7 +843,7 @@ public class BrowseBean implements IContextListener
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}) );
FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] {refErr.getNodeRef()}), refErr );
this.containerNodes = Collections.<Node>emptyList();
this.contentNodes = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}

View File

@@ -157,6 +157,8 @@ public class TrashcanBean implements IContextListener
/** User filter search box text */
private String userSearchText = null;
private boolean inProgress = false;
// ------------------------------------------------------------------------------
// Bean property getters and setters
@@ -784,43 +786,54 @@ public class TrashcanBean implements IContextListener
*/
public String recoverListedItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
if (inProgress == true) return null;
// restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs);
}
else
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
}
inProgress = true;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
FacesContext fc = FacesContext.getCurrentInstance();
saveReportDetail(reports);
// restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems)
{
nodeRefs.add(node.getNodeRef());
}
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs);
}
else
{
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
}
tx.commit();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
}
catch (Throwable err)
finally
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
inProgress = false;
}
return OUTCOME_RECOVERY_REPORT;
@@ -831,38 +844,49 @@ public class TrashcanBean implements IContextListener
*/
public String recoverAllItemsOK()
{
FacesContext fc = FacesContext.getCurrentInstance();
if (inProgress == true) return null;
// restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef());
}
else
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
}
inProgress = true;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
FacesContext fc = FacesContext.getCurrentInstance();
saveReportDetail(reports);
// restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports;
if (this.destination == null)
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef());
}
else
{
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
}
tx.commit();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
}
}
catch (Throwable err)
finally
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
// most exceptions will be caught and returned as RestoreNodeReport objects by the service
String reason = err.getMessage();
String msg = MessageFormat.format(
Application.getMessage(fc, Repository.ERROR_GENERIC), reason);
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
fc.addMessage(null, facesMsg);
inProgress = false;
}
return OUTCOME_RECOVERY_REPORT;
@@ -883,6 +907,10 @@ public class TrashcanBean implements IContextListener
*/
public String deleteListedItemsOK()
{
if (inProgress == true) return null;
inProgress = true;
try
{
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
@@ -897,6 +925,10 @@ public class TrashcanBean implements IContextListener
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
finally
{
inProgress = false;
}
return OUTCOME_DIALOGCLOSE;
}
@@ -906,6 +938,10 @@ public class TrashcanBean implements IContextListener
*/
public String deleteAllItemsOK()
{
if (inProgress == true) return null;
inProgress = true;
try
{
this.nodeArchiveService.purgeAllArchivedNodes(Repository.getStoreRef());
@@ -915,6 +951,10 @@ public class TrashcanBean implements IContextListener
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
}
finally
{
inProgress = false;
}
return OUTCOME_DIALOGCLOSE;
}

View File

@@ -48,13 +48,27 @@ public final class DialogManager
*/
public void setCurrentDialog(DialogConfig config)
{
// make sure the managed bean is present
String beanName = config.getManagedBean();
IDialogBean dialog = (IDialogBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), beanName);
if (dialog == null)
Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName);
if (bean == null)
{
throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'");
throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
"' has not been defined");
}
// make sure the bean implements the IDialogBean interface
IDialogBean dialog = null;
if (bean instanceof IDialogBean)
{
dialog = (IDialogBean)bean;
}
else
{
throw new AlfrescoRuntimeException("Failed to start dialog as managed bean '" + beanName +
"' does not implement the required IDialogBean interface");
}
// initialise the managed bean

View File

@@ -5,6 +5,7 @@ import javax.faces.context.FacesContext;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.repo.RepoConstants;
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
@@ -37,14 +38,29 @@ public class CategorySelectorGenerator extends BaseComponentGenerator
protected void setupMandatoryValidation(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item, UIComponent component, boolean realTimeChecking, String idSuffix)
{
// Override the setup of the mandatory validation
// so we can send the _selected id suffix.
// We also enable real time so the page load check disabled
// the ok button if necessary, as the control is used the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_selected");
if (component instanceof UIMultiValueEditor)
{
// Override the setup of the mandatory validation
// so we can send the _current_value id suffix.
// We also enable real time so the page load
// check disables the ok button if necessary, as the user
// adds or removes items from the multi value list the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_current_value");
}
else
{
// Override the setup of the mandatory validation
// so we can send the _selected id suffix.
// We also enable real time so the page load check disabled
// the ok button if necessary, as the control is used the
// page will be refreshed and therefore re-check the status.
super.setupMandatoryValidation(context, propertySheet, item,
component, true, "_selected");
}
}
@Override

View File

@@ -1,5 +1,6 @@
package org.alfresco.web.bean.generator;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -12,12 +13,15 @@ import javax.faces.model.SelectItem;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.service.cmr.dictionary.Constraint;
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.ui.common.ComponentConstants;
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
/**
* Generates a text field component.
@@ -166,6 +170,47 @@ public class TextFieldGenerator extends BaseComponentGenerator
}
}
@Override
@SuppressWarnings("unchecked")
protected void setupConstraints(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem property,
PropertyDefinition propertyDef, UIComponent component)
{
// do the default processing first
super.setupConstraints(context, propertySheet, property,
propertyDef, component);
// if the property type is a number based type and the property
// sheet is in edit mode and validation is turned, on add the
// validateIsNumber validation function
if (propertySheet.inEditMode() && propertySheet.isValidationEnabled() &&
propertyDef != null)
{
// check the type of the property is a number
if (propertyDef.getDataType().getName().equals(DataTypeDefinition.DOUBLE) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.FLOAT) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.INT) ||
propertyDef.getDataType().getName().equals(DataTypeDefinition.LONG))
{
List<String> params = new ArrayList<String>(3);
// add the value parameter
String value = "document.getElementById('" +
component.getClientId(context) + "')";
params.add(value);
// add the validation failed message to show
String msg = Application.getMessage(context, "validation_is_number");
addStringConstraintParam(params,
MessageFormat.format(msg, new Object[] {property.getResolvedDisplayLabel()}));
// add the validation case to the property sheet
propertySheet.addClientValidation(new ClientValidation("validateIsNumber",
params, false));
}
}
}
/**
* Retrieves the list of values constraint for the item, if it has one
*
@@ -174,8 +219,8 @@ public class TextFieldGenerator extends BaseComponentGenerator
* @param item The item being generated
* @return The constraint if the item has one, null otherwise
*/
protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context, UIPropertySheet propertySheet,
PropertySheetItem item)
protected ListOfValuesConstraint getListOfValuesConstraint(FacesContext context,
UIPropertySheet propertySheet, PropertySheetItem item)
{
ListOfValuesConstraint lovConstraint = null;

View File

@@ -16,7 +16,9 @@
*/
package org.alfresco.web.bean.repository;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
@@ -213,4 +215,21 @@ public final class User
return prefRef;
}
/**
* Returns the full name of the user represented by the given NodeRef
*
* @param nodeService The node service instance
* @param user The user to get the full name for
* @return The full name
*/
public static String getFullName(NodeService nodeService, NodeRef user)
{
Map<QName, Serializable> props = nodeService.getProperties(user);
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
return fullName;
}
}

View File

@@ -56,13 +56,27 @@ public final class WizardManager
*/
public void setCurrentWizard(WizardConfig config)
{
// make sure the managed bean is present
String beanName = config.getManagedBean();
IWizardBean wizard = (IWizardBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), beanName);
if (wizard == null)
Object bean = FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), beanName);
if (bean == null)
{
throw new AlfrescoRuntimeException("Failed to find managed bean '" + beanName + "'");
throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName +
"' has not been defined");
}
// make sure the bean implements the IWizardBean interface
IWizardBean wizard = null;
if (bean instanceof IWizardBean)
{
wizard = (IWizardBean)bean;
}
else
{
throw new AlfrescoRuntimeException("Failed to start wizard as managed bean '" + beanName +
"' does not implement the required IWizardBean interface");
}
// initialise the managed bean

View File

@@ -5,6 +5,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.workflow.WorkflowInstance;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean;
@@ -18,7 +19,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class CancelWorkflowDialog extends BaseDialogBean
{
protected String workflowInstanceId;
protected WorkflowInstance workflowInstance;
protected WorkflowService workflowService;
private static final Log logger = LogFactory.getLog(CancelWorkflowDialog.class);
@@ -32,11 +33,17 @@ public class CancelWorkflowDialog extends BaseDialogBean
super.init(parameters);
// make sure the workflow instance id has been passed
this.workflowInstanceId = this.parameters.get("workflow-instance-id");
if (this.workflowInstanceId == null || this.workflowInstanceId.length() == 0)
String workflowInstanceId = this.parameters.get("workflow-instance-id");
if (workflowInstanceId == null || workflowInstanceId.length() == 0)
{
throw new IllegalArgumentException("Cancel workflow dialog called without workflow instance id");
}
this.workflowInstance = workflowService.getWorkflowById(workflowInstanceId);
if (this.workflowInstance == null)
{
throw new IllegalArgumentException("Failed to find workflow instance for id: " + workflowInstanceId);
}
}
@Override
@@ -44,13 +51,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
throws Exception
{
if (logger.isDebugEnabled())
logger.debug("Cancelling workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelling workflow with id: " + this.workflowInstance.id);
// cancel the workflow
this.workflowService.cancelWorkflow(this.workflowInstanceId);
this.workflowService.cancelWorkflow(this.workflowInstance.id);
if (logger.isDebugEnabled())
logger.debug("Cancelled workflow with id: " + this.workflowInstanceId);
logger.debug("Cancelled workflow with id: " + this.workflowInstance.id);
return outcome;
}
@@ -67,9 +74,21 @@ public class CancelWorkflowDialog extends BaseDialogBean
return false;
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "no");
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), "yes");
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns the confirmation to display to the user before deleting the content.
*
@@ -80,8 +99,13 @@ public class CancelWorkflowDialog extends BaseDialogBean
String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
"cancel_workflow_confirm");
return MessageFormat.format(confirmMsg,
new Object[] {this.parameters.get("workflow-instance-name")});
String workflowLabel = this.workflowInstance.definition.title;
if (this.workflowInstance.description != null && this.workflowInstance.description.length() > 0)
{
workflowLabel = workflowLabel + " (" + this.workflowInstance.description + ")";
}
return MessageFormat.format(confirmMsg, new Object[] {workflowLabel});
}
/**

View File

@@ -15,10 +15,6 @@ import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.workflow.WorkflowService;
import org.alfresco.service.namespace.NamespaceService;

View File

@@ -233,9 +233,31 @@ public class StartWorkflowWizard extends BaseWizardBean
return this.nextButtonDisabled;
}
@Override
public String getContainerTitle()
{
String wizTitle = null;
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
String stepName = Application.getWizardManager().getCurrentStepName();
if ("choose-workflow".equals(stepName) == false && this.selectedWorkflow != null)
{
String titlePattern = bundle.getString("start_named_workflow_wizard");
WorkflowDefinition workflowDef = this.workflows.get(this.selectedWorkflow);
wizTitle = MessageFormat.format(titlePattern, new Object[] {workflowDef.title});
}
else
{
wizTitle = bundle.getString("start_workflow_wizard");
}
return wizTitle;
}
// ------------------------------------------------------------------------------
// Event Handlers
/**
* Prepares the dialog to allow the user to add an item to the workflow package
*

View File

@@ -260,7 +260,6 @@ public class WorkflowBean
// add the workflow instance id and name this taks belongs to
node.getProperties().put("workflowInstanceId", task.path.instance.id);
node.getProperties().put("workflowInstanceName", task.path.instance.definition.title);
}
return node;

View File

@@ -21,6 +21,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
/**
@@ -305,27 +306,25 @@ public class UINodeWorkflowInfo extends SelfRenderingComponent
{
out.write("<li>");
out.write(wi.definition.title);
if (wi.definition.description != null && wi.definition.description.length() > 0)
if (wi.description != null && wi.description.length() > 0)
{
out.write(" (");
out.write(wi.definition.description);
out.write("&nbsp;(");
out.write(wi.description);
out.write(")");
}
out.write("&nbsp;");
out.write(" ");
if (wi.startDate != null)
{
out.write(bundle.getString("started_on").toLowerCase());
out.write("&nbsp;");
out.write(format.format(wi.startDate));
out.write("&nbsp;");
out.write(" ");
}
if (wi.initiator != null)
{
out.write(bundle.getString("by"));
out.write("&nbsp;");
String userName = (String)nodeService.getProperty(wi.initiator,
ContentModel.PROP_USERNAME);
out.write(userName);
out.write(User.getFullName(nodeService, wi.initiator));
out.write(".");
}
out.write("</li>");

View File

@@ -8,11 +8,10 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.ValueBinding;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.workflow.WorkflowInstance;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
/**
@@ -87,20 +86,19 @@ public class UIWorkflowSummary extends SelfRenderingComponent
out.write(bundle.getString("title"));
out.write(":</td><td>");
out.write(wi.definition.title);
out.write("</td></tr><tr><td>");
out.write(bundle.getString("description"));
out.write(":</td><td>");
out.write(wi.definition.description);
if (wi.definition.description != null && wi.definition.description.length() > 0)
{
out.write("&nbsp;(");
out.write(wi.definition.description);
out.write(")");
}
out.write("</td></tr><tr><td>");
out.write(bundle.getString("initiated_by"));
out.write(":</td><td>");
if (wi.initiator != null)
{
NodeService nodeService = Repository.getServiceRegistry(
context).getNodeService();
String userName = (String)nodeService.getProperty(
wi.initiator, ContentModel.PROP_USERNAME);
out.write(userName);
out.write(User.getFullName(Repository.getServiceRegistry(
context).getNodeService(), wi.initiator));
}
out.write("</td></tr><tr><td>");
out.write(bundle.getString("started_on"));

View File

@@ -18,7 +18,6 @@
package org.alfresco.web.ui.repo.component.property;
import java.io.IOException;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -47,6 +46,7 @@ import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.DataDictionary;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -704,12 +704,7 @@ public abstract class BaseAssociationEditor extends UIInput
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetRef)))
{
//out.write((String)nodeService.getProperty(targetRef, ContentModel.PROP_USERNAME));
Map<QName, Serializable> props = nodeService.getProperties(targetRef);
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
out.write(fullName);
out.write(User.getFullName(nodeService, targetRef));
}
else
{
@@ -832,17 +827,13 @@ public abstract class BaseAssociationEditor extends UIInput
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(item)))
{
Map<QName, Serializable> props = nodeService.getProperties(item);
String userName = (String)props.get(ContentModel.PROP_USERNAME);
String userName = (String)nodeService.getProperty(item, ContentModel.PROP_USERNAME);
if (userName != null && (userName.equals(PermissionService.GUEST_AUTHORITY) == false))
{
out.write("<option value='");
out.write(item.getId());
out.write("'>");
String firstName = (String)props.get(ContentModel.PROP_FIRSTNAME);
String lastName = (String)props.get(ContentModel.PROP_LASTNAME);
String fullName = firstName + " " + (lastName != null ? lastName : "");
out.write(fullName);
out.write(User.getFullName(nodeService, item));
out.write("</option>");
}
}

View File

@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -157,7 +158,7 @@ public class UIAssociationEditor extends BaseAssociationEditor
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
out.write(User.getFullName(nodeService, targetNode));
}
else
{

View File

@@ -33,6 +33,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.repository.User;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -157,7 +158,7 @@ public class UIChildAssociationEditor extends BaseAssociationEditor
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode)))
{
out.write((String)nodeService.getProperty(targetNode, ContentModel.PROP_USERNAME));
out.write(User.getFullName(nodeService, targetNode));
}
else
{