. 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

@ -552,7 +552,6 @@ general=General
file_name=File Name file_name=File Name
content_type=Content Type content_type=Content Type
content_format=Content Format content_format=Content Format
author=Author
inline_editable=Inline Editable inline_editable=Inline Editable
locate_document=Locate document to upload locate_document=Locate document to upload
location=Location location=Location

View File

@ -177,7 +177,7 @@
<override from-outcome="deleteSpace" to-view-id="/jsp/forums/delete-topic.jsp" /> <override from-outcome="deleteSpace" to-view-id="/jsp/forums/delete-topic.jsp" />
</navigation> </navigation>
</config> </config>
<config evaluator="node-type" condition="dictionaryModel"> <config evaluator="node-type" condition="dictionaryModel">
<property-sheet> <property-sheet>
<show-property name="modelActive"/> <show-property name="modelActive"/>
@ -251,11 +251,17 @@
</property-sheet> </property-sheet>
</config> </config>
<config evaluator="aspect-name" condition="author">
<property-sheet>
<show-property name="author"/>
</property-sheet>
</config>
<config evaluator="aspect-name" condition="auditable"> <config evaluator="aspect-name" condition="auditable">
<property-sheet> <property-sheet>
<show-property name="creator"/> <show-property name="creator" readOnly="true"/>
<show-property name="created" readOnly="true"/> <show-property name="created" readOnly="true"/>
<show-property name="modifier"/> <show-property name="modifier" readOnly="true"/>
<show-property name="modified" readOnly="true"/> <show-property name="modified" readOnly="true"/>
</property-sheet> </property-sheet>
</config> </config>

View File

@ -565,7 +565,7 @@ public class AdvancedSearchBean
} }
if (this.author != null && this.author.length() != 0) 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) 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.io.Serializable;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; 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 // add the remaining properties
Iterator<String> iterProps = props.keySet().iterator(); Iterator<String> iterProps = props.keySet().iterator();
while (iterProps.hasNext()) while (iterProps.hasNext())

View File

@ -82,7 +82,7 @@ public class AddContentWizard extends BaseContentWizard
if (Repository.extractMetadata(FacesContext.getCurrentInstance(), cr, contentProps)) 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.title = (String)(contentProps.get(ContentModel.PROP_TITLE));
this.description = (String)(contentProps.get(ContentModel.PROP_DESCRIPTION)); 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); Map<QName, Serializable> contentProps = this.nodeService.getProperties(nodeRef);
contentProps.put(ContentModel.PROP_TITLE, this.title); contentProps.put(ContentModel.PROP_TITLE, this.title);
contentProps.put(ContentModel.PROP_DESCRIPTION, this.description); 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 // set up content properties - copy or create the compound property
ContentData contentData = (ContentData)contentProps.get(ContentModel.PROP_CONTENT); ContentData contentData = (ContentData)contentProps.get(ContentModel.PROP_CONTENT);
@ -161,10 +175,12 @@ public abstract class BaseContentWizard extends AbstractWizardBean
Repository.resolveToQName(this.objectType)); Repository.resolveToQName(this.objectType));
NodeRef fileNodeRef = fileInfo.getNodeRef(); 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) 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()) if (logger.isDebugEnabled())

View File

@ -146,7 +146,7 @@
<tr> <tr>
<td><nobr><h:outputText value="#{msg.author}" />:</nobr></td> <td><nobr><h:outputText value="#{msg.author}" />:</nobr></td>
<td> <td>
<h:inputText value="#{EditDocPropsDialog.properties.creator}" size="35" maxlength="1024" /> <h:inputText value="#{EditDocPropsDialog.properties.author}" size="35" maxlength="1024" />
</td> </td>
</tr> </tr>
<tr><td colspan="2" class="paddingRow"></td></tr> <tr><td colspan="2" class="paddingRow"></td></tr>