. 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 6accb7a795
commit cafe3fb51f
12 changed files with 78 additions and 23 deletions

View File

@@ -26,6 +26,9 @@ import org.alfresco.repo.content.metadata.MetadataExtracter;
import org.alfresco.repo.content.metadata.MetadataExtracterRegistry;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -96,6 +99,19 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
{
this.contentService = contentService;
}
/**
* The dictionary service
*/
private DictionaryService dictionaryService;
/**
* @param dictService The DictionaryService to set.
*/
public void setDictionaryService(DictionaryService dictService)
{
this.dictionaryService = dictService;
}
/**
* Our Extracter
@@ -140,10 +156,29 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
boolean changed = false;
for (QName key : newProps.keySet())
{
// check if we need to add an aspect for the prop
ClassDefinition propClass = dictionaryService.getProperty(key).getContainerClass();
if (propClass.isAspect() &&
nodeService.hasAspect(actionedUponNodeRef, propClass.getName()) == false)
{
Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>(3, 1.0f);
for (QName defKey : propClass.getProperties().keySet())
{
if (dictionaryService.getProperty(defKey).isMandatory())
{
aspectProps.put(defKey, allProps.get(defKey));
allProps.remove(defKey);
}
}
nodeService.addAspect(actionedUponNodeRef, propClass.getName(), aspectProps);
}
Serializable value = newProps.get(key);
if (value == null)
{
continue; // Content extracters shouldn't do this
}
// Look up the old value, and check for nulls
Serializable oldValue = allProps.get(key);
if (oldValue == null || oldValue.toString().length() == 0)
@@ -152,11 +187,11 @@ public class ContentMetadataExtracter extends ActionExecuterAbstractBase
changed = true;
}
}
// TODO: Should we be adding the associated aspects or is
// that done by the type system
// (or are ad-hoc properties allowed?)
if (changed)
{
nodeService.setProperties(actionedUponNodeRef, allProps);
}
}
}
}