. Fixes/improvements for handling of author/creator in the repository and the web-client:

- added new aspect called "cm:author" with a single text property "cm:author"
 - fixed the content meta-data extractors to set the new cm:author property rather than the system cm:creator property (which was causing a couple of bugs spotted recently)
 - fixed the web-client to set the new cm:author property rather than the cm:creator property from user entered data into the UI
 - fixed web-client config of document properties screen to display cm:author
 - fixed client to not allow editing of the cm:creator value

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2034 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2005-12-13 15:25:56 +00:00
parent 145f72a6e7
commit aedd354dea
7 changed files with 46 additions and 10 deletions

View File

@@ -565,7 +565,7 @@ public class AdvancedSearchBean
}
if (this.author != null && this.author.length() != 0)
{
search.addAttributeQuery(ContentModel.PROP_CREATOR, this.author);
search.addAttributeQuery(ContentModel.PROP_AUTHOR, this.author);
}
if (this.contentFormat != null && this.contentFormat.length() != 0)
{

View File

@@ -19,6 +19,7 @@ package org.alfresco.web.bean;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -146,6 +147,20 @@ public class DocumentPropertiesBean
}
}
// extra and deal with the Author prop if the aspect has not been applied yet
String author = (String)props.get(ContentModel.PROP_AUTHOR);
if (author != null)
{
// add aspect if required
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
{
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, author);
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
}
// else it will get updated in the later setProperties() call
}
// add the remaining properties
Iterator<String> iterProps = props.keySet().iterator();
while (iterProps.hasNext())

View File

@@ -82,7 +82,7 @@ public class AddContentWizard extends BaseContentWizard
if (Repository.extractMetadata(FacesContext.getCurrentInstance(), cr, contentProps))
{
this.author = (String)(contentProps.get(ContentModel.PROP_CREATOR));
this.author = (String)(contentProps.get(ContentModel.PROP_AUTHOR));
this.title = (String)(contentProps.get(ContentModel.PROP_TITLE));
this.description = (String)(contentProps.get(ContentModel.PROP_DESCRIPTION));
}

View File

@@ -111,7 +111,21 @@ public abstract class BaseContentWizard extends AbstractWizardBean
Map<QName, Serializable> contentProps = this.nodeService.getProperties(nodeRef);
contentProps.put(ContentModel.PROP_TITLE, this.title);
contentProps.put(ContentModel.PROP_DESCRIPTION, this.description);
contentProps.put(ContentModel.PROP_CREATOR, this.author);
// add author property
if (this.author != null && this.author.length() != 0)
{
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUTHOR) == false)
{
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, this.author);
this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
}
else
{
contentProps.put(ContentModel.PROP_AUTHOR, this.author);
}
}
// set up content properties - copy or create the compound property
ContentData contentData = (ContentData)contentProps.get(ContentModel.PROP_CONTENT);
@@ -161,10 +175,12 @@ public abstract class BaseContentWizard extends AbstractWizardBean
Repository.resolveToQName(this.objectType));
NodeRef fileNodeRef = fileInfo.getNodeRef();
// set the author (if we have)
// set the author aspect (if we have one)
if (this.author != null && this.author.length() > 0)
{
this.nodeService.setProperty(fileNodeRef, ContentModel.PROP_CREATOR, this.author);
Map<QName, Serializable> authorProps = new HashMap<QName, Serializable>(1, 1.0f);
authorProps.put(ContentModel.PROP_AUTHOR, this.author);
this.nodeService.addAspect(fileNodeRef, ContentModel.ASPECT_AUTHOR, authorProps);
}
if (logger.isDebugEnabled())