mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
12795: ALFCOM-2419: ResourceBundleWrapper is no longer (de)serializable after changes merged from 2.1-A rev 8323 12826: Fix for ETHREEOH-37 and ETHREEOH-176. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12828 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -36,8 +36,6 @@ import org.alfresco.service.namespace.NamespaceService;
|
|||||||
*/
|
*/
|
||||||
public class DictionaryNamespaceComponent implements NamespaceService
|
public class DictionaryNamespaceComponent implements NamespaceService
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -3774701459465102431L;
|
|
||||||
/**
|
/**
|
||||||
* Namespace DAO
|
* Namespace DAO
|
||||||
*/
|
*/
|
||||||
@@ -109,5 +107,4 @@ public class DictionaryNamespaceComponent implements NamespaceService
|
|||||||
// TODO:
|
// TODO:
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@ import org.alfresco.service.namespace.NamespacePrefixResolver;
|
|||||||
*/
|
*/
|
||||||
public interface NamespaceDAO extends NamespacePrefixResolver
|
public interface NamespaceDAO extends NamespacePrefixResolver
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a namespace URI
|
* Add a namespace URI
|
||||||
*
|
*
|
||||||
|
@@ -48,8 +48,6 @@ public class NamespaceDAOImpl implements NamespaceDAO
|
|||||||
{
|
{
|
||||||
private static final Log logger = LogFactory.getLog(NamespaceDAOImpl.class);
|
private static final Log logger = LogFactory.getLog(NamespaceDAOImpl.class);
|
||||||
|
|
||||||
private static final long serialVersionUID = -1085431310721591548L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock objects
|
* Lock objects
|
||||||
*/
|
*/
|
||||||
@@ -63,6 +61,7 @@ public class NamespaceDAOImpl implements NamespaceDAO
|
|||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
private TenantService tenantService;
|
private TenantService tenantService;
|
||||||
|
private DictionaryDAO dictionaryDAO;
|
||||||
|
|
||||||
|
|
||||||
public void setTenantService(TenantService tenantService)
|
public void setTenantService(TenantService tenantService)
|
||||||
@@ -80,9 +79,6 @@ public class NamespaceDAOImpl implements NamespaceDAO
|
|||||||
this.prefixesCache = prefixesCache;
|
this.prefixesCache = prefixesCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private DictionaryDAO dictionaryDAO;
|
|
||||||
|
|
||||||
public void registerDictionary(DictionaryDAO dictionaryDAO)
|
public void registerDictionary(DictionaryDAO dictionaryDAO)
|
||||||
{
|
{
|
||||||
this.dictionaryDAO = dictionaryDAO;
|
this.dictionaryDAO = dictionaryDAO;
|
||||||
|
@@ -29,6 +29,8 @@ import org.alfresco.service.ServiceRegistry;
|
|||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.cmr.repository.ContentData;
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,9 +46,21 @@ public class ContentAwareScriptableQNameMap<K,V> extends ScriptableQNameMap<K,V>
|
|||||||
private ServiceRegistry services;
|
private ServiceRegistry services;
|
||||||
private ScriptNode factory;
|
private ScriptNode factory;
|
||||||
|
|
||||||
public ContentAwareScriptableQNameMap(ScriptNode factory, ServiceRegistry services)
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param factory Factory to provide further ScriptNode objects
|
||||||
|
* @param services ServiceRegistry
|
||||||
|
*/
|
||||||
|
public ContentAwareScriptableQNameMap(final ScriptNode factory, final ServiceRegistry services)
|
||||||
{
|
{
|
||||||
super(services.getNamespaceService());
|
super(new NamespacePrefixResolverProvider(){
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return services.getNamespaceService();
|
||||||
|
}
|
||||||
|
});
|
||||||
this.services = services;
|
this.services = services;
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
}
|
}
|
||||||
@@ -62,7 +76,7 @@ public class ContentAwareScriptableQNameMap<K,V> extends ScriptableQNameMap<K,V>
|
|||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
// convert the key to a qname and look up the data-type for the property
|
// convert the key to a qname and look up the data-type for the property
|
||||||
QName qname = QName.resolveToQName(this.resolver, name.toString());
|
QName qname = QName.resolveToQName(getResolver(), name.toString());
|
||||||
PropertyDefinition propDef = this.services.getDictionaryService().getProperty(qname);
|
PropertyDefinition propDef = this.services.getDictionaryService().getProperty(qname);
|
||||||
if (propDef != null && DataTypeDefinition.CONTENT.equals(propDef.getDataType().getName()))
|
if (propDef != null && DataTypeDefinition.CONTENT.equals(propDef.getDataType().getName()))
|
||||||
{
|
{
|
||||||
|
@@ -77,6 +77,8 @@ import org.alfresco.service.cmr.version.VersionHistory;
|
|||||||
import org.alfresco.service.cmr.version.VersionType;
|
import org.alfresco.service.cmr.version.VersionType;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowInstance;
|
import org.alfresco.service.cmr.workflow.WorkflowInstance;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
@@ -104,9 +106,9 @@ import org.mozilla.javascript.Wrapper;
|
|||||||
*
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class ScriptNode implements Serializable, Scopeable
|
public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResolverProvider
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -3378946227712939600L;
|
private static final long serialVersionUID = -3378946227712939601L;
|
||||||
|
|
||||||
private static Log logger = LogFactory.getLog(ScriptNode.class);
|
private static Log logger = LogFactory.getLog(ScriptNode.class);
|
||||||
|
|
||||||
@@ -436,7 +438,7 @@ public class ScriptNode implements Serializable, Scopeable
|
|||||||
if (this.targetAssocs == null)
|
if (this.targetAssocs == null)
|
||||||
{
|
{
|
||||||
// this Map implements the Scriptable interface for native JS syntax property access
|
// this Map implements the Scriptable interface for native JS syntax property access
|
||||||
this.targetAssocs = new ScriptableQNameMap<String, Object>(this.services.getNamespaceService());
|
this.targetAssocs = new ScriptableQNameMap<String, Object>(this);
|
||||||
|
|
||||||
// get the list of target nodes for each association type
|
// get the list of target nodes for each association type
|
||||||
List<AssociationRef> refs = this.nodeService.getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
List<AssociationRef> refs = this.nodeService.getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
||||||
@@ -484,7 +486,7 @@ public class ScriptNode implements Serializable, Scopeable
|
|||||||
if (this.sourceAssocs == null)
|
if (this.sourceAssocs == null)
|
||||||
{
|
{
|
||||||
// this Map implements the Scriptable interface for native JS syntax property access
|
// this Map implements the Scriptable interface for native JS syntax property access
|
||||||
this.sourceAssocs = new ScriptableQNameMap<String, Object>(this.services.getNamespaceService());
|
this.sourceAssocs = new ScriptableQNameMap<String, Object>(this);
|
||||||
|
|
||||||
// get the list of source nodes for each association type
|
// get the list of source nodes for each association type
|
||||||
List<AssociationRef> refs = this.nodeService.getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
List<AssociationRef> refs = this.nodeService.getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
||||||
@@ -532,7 +534,7 @@ public class ScriptNode implements Serializable, Scopeable
|
|||||||
if (this.childAssocs == null)
|
if (this.childAssocs == null)
|
||||||
{
|
{
|
||||||
// this Map implements the Scriptable interface for native JS syntax property access
|
// this Map implements the Scriptable interface for native JS syntax property access
|
||||||
this.childAssocs = new ScriptableQNameMap<String, Object>(this.services.getNamespaceService());
|
this.childAssocs = new ScriptableQNameMap<String, Object>(this);
|
||||||
|
|
||||||
// get the list of child assoc nodes for each association type
|
// get the list of child assoc nodes for each association type
|
||||||
List<ChildAssociationRef> refs = this.nodeService.getChildAssocs(nodeRef);
|
List<ChildAssociationRef> refs = this.nodeService.getChildAssocs(nodeRef);
|
||||||
@@ -2794,4 +2796,13 @@ public class ScriptNode implements Serializable, Scopeable
|
|||||||
*/
|
*/
|
||||||
ScriptNode transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer);
|
ScriptNode transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NamespacePrefixResolverProvider getter implementation
|
||||||
|
*/
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return this.services.getNamespaceService();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -25,6 +25,7 @@
|
|||||||
package org.alfresco.repo.jscript;
|
package org.alfresco.repo.jscript;
|
||||||
|
|
||||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QNameMap;
|
import org.alfresco.service.namespace.QNameMap;
|
||||||
import org.mozilla.javascript.Scriptable;
|
import org.mozilla.javascript.Scriptable;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ public class ScriptableQNameMap<K,V> extends QNameMap<K,V> implements Scriptable
|
|||||||
/**
|
/**
|
||||||
* @param resolver
|
* @param resolver
|
||||||
*/
|
*/
|
||||||
public ScriptableQNameMap(NamespacePrefixResolver resolver)
|
public ScriptableQNameMap(NamespacePrefixResolverProvider resolver)
|
||||||
{
|
{
|
||||||
super(resolver);
|
super(resolver);
|
||||||
}
|
}
|
||||||
|
@@ -46,6 +46,8 @@ import org.alfresco.service.cmr.repository.ContentData;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.QNameMap;
|
import org.alfresco.service.namespace.QNameMap;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
@@ -67,7 +69,7 @@ import freemarker.ext.dom.NodeModel;
|
|||||||
*
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class AVMTemplateNode extends BasePermissionsNode
|
public class AVMTemplateNode extends BasePermissionsNode implements NamespacePrefixResolverProvider
|
||||||
{
|
{
|
||||||
private static Log logger = LogFactory.getLog(AVMTemplateNode.class);
|
private static Log logger = LogFactory.getLog(AVMTemplateNode.class);
|
||||||
|
|
||||||
@@ -172,7 +174,7 @@ public class AVMTemplateNode extends BasePermissionsNode
|
|||||||
{
|
{
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.properties = new QNameMap<String, Serializable>(this.services.getNamespaceService());
|
this.properties = new QNameMap<String, Serializable>(this);
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
{
|
{
|
||||||
descriptor = this.services.getAVMService().lookup(version, path, true);
|
descriptor = this.services.getAVMService().lookup(version, path, true);
|
||||||
@@ -471,6 +473,12 @@ public class AVMTemplateNode extends BasePermissionsNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return this.services.getNamespaceService();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Private helpers
|
// Private helpers
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||||
import org.alfresco.service.cmr.version.Version;
|
import org.alfresco.service.cmr.version.Version;
|
||||||
import org.alfresco.service.cmr.version.VersionHistory;
|
import org.alfresco.service.cmr.version.VersionHistory;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.QNameMap;
|
import org.alfresco.service.namespace.QNameMap;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
@@ -66,7 +68,7 @@ import freemarker.ext.dom.NodeModel;
|
|||||||
*
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class TemplateNode extends BasePermissionsNode
|
public class TemplateNode extends BasePermissionsNode implements NamespacePrefixResolverProvider
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1234390333739034171L;
|
private static final long serialVersionUID = 1234390333739034171L;
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ public class TemplateNode extends BasePermissionsNode
|
|||||||
this.services = services;
|
this.services = services;
|
||||||
this.imageResolver = resolver;
|
this.imageResolver = resolver;
|
||||||
|
|
||||||
this.properties = new QNameMap<String, Serializable>(this.services.getNamespaceService());
|
this.properties = new QNameMap<String, Serializable>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -241,7 +243,7 @@ public class TemplateNode extends BasePermissionsNode
|
|||||||
if (this.targetAssocs == null)
|
if (this.targetAssocs == null)
|
||||||
{
|
{
|
||||||
List<AssociationRef> refs = this.services.getNodeService().getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
List<AssociationRef> refs = this.services.getNodeService().getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
||||||
this.targetAssocs = new QNameMap<String, List<TemplateNode>>(this.services.getNamespaceService());
|
this.targetAssocs = new QNameMap<String, List<TemplateNode>>(this);
|
||||||
for (AssociationRef ref : refs)
|
for (AssociationRef ref : refs)
|
||||||
{
|
{
|
||||||
String qname = ref.getTypeQName().toString();
|
String qname = ref.getTypeQName().toString();
|
||||||
@@ -272,7 +274,7 @@ public class TemplateNode extends BasePermissionsNode
|
|||||||
if (this.sourceAssocs == null)
|
if (this.sourceAssocs == null)
|
||||||
{
|
{
|
||||||
List<AssociationRef> refs = this.services.getNodeService().getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
List<AssociationRef> refs = this.services.getNodeService().getSourceAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
|
||||||
this.sourceAssocs = new QNameMap<String, List<TemplateNode>>(this.services.getNamespaceService());
|
this.sourceAssocs = new QNameMap<String, List<TemplateNode>>(this);
|
||||||
for (AssociationRef ref : refs)
|
for (AssociationRef ref : refs)
|
||||||
{
|
{
|
||||||
String qname = ref.getTypeQName().toString();
|
String qname = ref.getTypeQName().toString();
|
||||||
@@ -303,7 +305,7 @@ public class TemplateNode extends BasePermissionsNode
|
|||||||
if (this.childAssocs == null)
|
if (this.childAssocs == null)
|
||||||
{
|
{
|
||||||
List<ChildAssociationRef> refs = this.services.getNodeService().getChildAssocs(this.nodeRef);
|
List<ChildAssociationRef> refs = this.services.getNodeService().getChildAssocs(this.nodeRef);
|
||||||
this.childAssocs = new QNameMap<String, List<TemplateNode>>(this.services.getNamespaceService());
|
this.childAssocs = new QNameMap<String, List<TemplateNode>>(this);
|
||||||
for (ChildAssociationRef ref : refs)
|
for (ChildAssociationRef ref : refs)
|
||||||
{
|
{
|
||||||
String qname = ref.getTypeQName().toString();
|
String qname = ref.getTypeQName().toString();
|
||||||
@@ -510,9 +512,15 @@ public class TemplateNode extends BasePermissionsNode
|
|||||||
return this.imageResolver;
|
return this.imageResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Inner classes
|
// Inner classes
|
||||||
|
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return this.services.getNamespaceService();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to convert properties into template accessable objects
|
* Class to convert properties into template accessable objects
|
||||||
*/
|
*/
|
||||||
|
@@ -37,6 +37,8 @@ import org.alfresco.service.cmr.repository.ContentData;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.version.Version;
|
import org.alfresco.service.cmr.version.Version;
|
||||||
import org.alfresco.service.cmr.version.VersionType;
|
import org.alfresco.service.cmr.version.VersionType;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.QNameMap;
|
import org.alfresco.service.namespace.QNameMap;
|
||||||
import org.alfresco.util.URLEncoder;
|
import org.alfresco.util.URLEncoder;
|
||||||
@@ -47,7 +49,7 @@ import org.alfresco.util.URLEncoder;
|
|||||||
*
|
*
|
||||||
* @author Kevin Roast
|
* @author Kevin Roast
|
||||||
*/
|
*/
|
||||||
public class VersionHistoryNode extends BaseContentNode
|
public class VersionHistoryNode extends BaseContentNode implements NamespacePrefixResolverProvider
|
||||||
{
|
{
|
||||||
private QNameMap<String, Serializable> properties;
|
private QNameMap<String, Serializable> properties;
|
||||||
private boolean propsRetrieved = false;
|
private boolean propsRetrieved = false;
|
||||||
@@ -77,7 +79,7 @@ public class VersionHistoryNode extends BaseContentNode
|
|||||||
this.version = version;
|
this.version = version;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.services = services;
|
this.services = services;
|
||||||
this.properties = new QNameMap<String, Serializable>(parent.services.getNamespaceService());
|
this.properties = new QNameMap<String, Serializable>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,6 +266,12 @@ public class VersionHistoryNode extends BaseContentNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return this.services.getNamespaceService();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
// Content API
|
// Content API
|
||||||
|
|
||||||
|
@@ -49,6 +49,8 @@ import org.alfresco.service.cmr.workflow.WorkflowService;
|
|||||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
import org.alfresco.service.cmr.workflow.WorkflowTaskState;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.QNameMap;
|
import org.alfresco.service.namespace.QNameMap;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
@@ -160,7 +162,7 @@ public class Workflow extends BaseTemplateProcessorExtension
|
|||||||
/**
|
/**
|
||||||
* Simple bean wrapper around a WorkflowTask item
|
* Simple bean wrapper around a WorkflowTask item
|
||||||
*/
|
*/
|
||||||
public static class WorkflowTaskItem
|
public static class WorkflowTaskItem implements NamespacePrefixResolverProvider
|
||||||
{
|
{
|
||||||
private WorkflowTask task;
|
private WorkflowTask task;
|
||||||
private QNameMap<String, Serializable> properties = null;
|
private QNameMap<String, Serializable> properties = null;
|
||||||
@@ -317,7 +319,7 @@ public class Workflow extends BaseTemplateProcessorExtension
|
|||||||
{
|
{
|
||||||
// convert properties to a QName accessable Map with TemplateNode objects as required
|
// convert properties to a QName accessable Map with TemplateNode objects as required
|
||||||
PropertyConverter converter = new PropertyConverter();
|
PropertyConverter converter = new PropertyConverter();
|
||||||
this.properties = new QNameMap<String, Serializable>(this.services.getNamespaceService());
|
this.properties = new QNameMap<String, Serializable>(this);
|
||||||
for (QName qname : this.task.properties.keySet())
|
for (QName qname : this.task.properties.keySet())
|
||||||
{
|
{
|
||||||
Serializable value = converter.convertProperty(
|
Serializable value = converter.convertProperty(
|
||||||
@@ -327,5 +329,10 @@ public class Workflow extends BaseTemplateProcessorExtension
|
|||||||
}
|
}
|
||||||
return this.properties;
|
return this.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return this.services.getNamespaceService();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -51,6 +51,8 @@ import org.alfresco.service.cmr.repository.NodeService;
|
|||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
import org.alfresco.service.cmr.workflow.WorkflowTransition;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||||
|
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
@@ -151,7 +153,12 @@ public class JscriptWorkflowTask extends BaseScopableProcessorExtension implemen
|
|||||||
|
|
||||||
// instantiate ScriptableQNameMap<String, Serializable> properties
|
// instantiate ScriptableQNameMap<String, Serializable> properties
|
||||||
// from WorkflowTasks's Map<QName, Serializable> properties
|
// from WorkflowTasks's Map<QName, Serializable> properties
|
||||||
this.properties = new ScriptableQNameMap<String, Serializable>(serviceRegistry.getNamespaceService());
|
this.properties = new ScriptableQNameMap<String, Serializable>(new NamespacePrefixResolverProvider(){
|
||||||
|
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||||
|
{
|
||||||
|
return serviceRegistry.getNamespaceService();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Set<QName> keys = cmrWorkflowTask.properties.keySet();
|
Set<QName> keys = cmrWorkflowTask.properties.keySet();
|
||||||
for (QName key : keys)
|
for (QName key : keys)
|
||||||
|
@@ -36,13 +36,9 @@ import java.util.Set;
|
|||||||
* required.
|
* required.
|
||||||
*
|
*
|
||||||
* @author andyh
|
* @author andyh
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DynamicNamespacePrefixResolver implements NamespaceService
|
public class DynamicNamespacePrefixResolver implements NamespaceService
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -7721089444629137409L;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The delegate
|
* The delegate
|
||||||
*/
|
*/
|
||||||
@@ -53,6 +49,7 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
|||||||
*/
|
*/
|
||||||
private HashMap<String, String> map = new HashMap<String, String>();
|
private HashMap<String, String> map = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
public DynamicNamespacePrefixResolver(NamespacePrefixResolver delegate)
|
public DynamicNamespacePrefixResolver(NamespacePrefixResolver delegate)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
@@ -64,6 +61,7 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
|||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add prefix to name space mapping override
|
* Add prefix to name space mapping override
|
||||||
*
|
*
|
||||||
@@ -143,5 +141,4 @@ public class DynamicNamespacePrefixResolver implements NamespaceService
|
|||||||
uris.addAll(map.keySet());
|
uris.addAll(map.keySet());
|
||||||
return uris;
|
return uris;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ import org.alfresco.service.PublicService;
|
|||||||
* @author David Caruana
|
* @author David Caruana
|
||||||
*/
|
*/
|
||||||
@PublicService
|
@PublicService
|
||||||
public interface NamespacePrefixResolver extends Serializable
|
public interface NamespacePrefixResolver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets the namespace URI registered for the given prefix
|
* Gets the namespace URI registered for the given prefix
|
||||||
@@ -76,5 +76,4 @@ public interface NamespacePrefixResolver extends Serializable
|
|||||||
*/
|
*/
|
||||||
@Auditable
|
@Auditable
|
||||||
Collection<String> getURIs();
|
Collection<String> getURIs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
* As a special exception to the terms and conditions of version 2.0 of
|
||||||
|
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||||
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
|
* the FLOSS exception, and it is also available here:
|
||||||
|
* http://www.alfresco.com/legal/licensing
|
||||||
|
*/
|
||||||
|
package org.alfresco.service.namespace;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides support for serializable objects such as the QNameMap that require a
|
||||||
|
* NamespacePrefixResolver to be available. Ensures that the objects can remain
|
||||||
|
* serializable themselves and still maintain a valid NamespacePrefixResolver.
|
||||||
|
*
|
||||||
|
* @author Kevin Roast
|
||||||
|
*/
|
||||||
|
public interface NamespacePrefixResolverProvider extends Serializable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get an object that implements the NamespacePrefixResolver interface
|
||||||
|
*
|
||||||
|
* @return NamespacePrefixResolver
|
||||||
|
*/
|
||||||
|
NamespacePrefixResolver getNamespacePrefixResolver();
|
||||||
|
}
|
@@ -30,8 +30,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.service.ServiceRegistry;
|
|
||||||
import org.alfresco.util.ApplicationContextHelper;
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
@@ -43,39 +41,47 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
*/
|
*/
|
||||||
public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -6578946123712939601L;
|
private static final long serialVersionUID = -6578946123712939602L;
|
||||||
|
|
||||||
protected static Log logger = LogFactory.getLog(QNameMap.class);
|
protected static Log logger = LogFactory.getLog(QNameMap.class);
|
||||||
protected Map<String, Object> contents = new HashMap<String, Object>(16, 1.0f);
|
protected Map<String, Object> contents = new HashMap<String, Object>(16, 1.0f);
|
||||||
protected NamespacePrefixResolver resolver = null;
|
protected NamespacePrefixResolverProvider provider = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param resolver Mandatory NamespacePrefixResolver helper
|
* @param provider Mandatory NamespacePrefixResolverProvider helper
|
||||||
*/
|
*/
|
||||||
public QNameMap(NamespacePrefixResolver resolver)
|
public QNameMap(NamespacePrefixResolverProvider provider)
|
||||||
{
|
{
|
||||||
if (resolver == null)
|
if (provider == null)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("NamespacePrefixResolver is mandatory.");
|
throw new IllegalArgumentException("NamespacePrefixResolverProvider is mandatory.");
|
||||||
}
|
}
|
||||||
this.resolver = resolver;
|
this.provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for Serialization mechanism
|
* Constructor for Serialization mechanism
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
protected QNameMap()
|
protected QNameMap()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to return a NamespacePrefixResolver instance - should -always- be used
|
||||||
|
* rather than holding onto a reference on the heap.
|
||||||
|
*
|
||||||
|
* @return NamespacePrefixResolver
|
||||||
|
*/
|
||||||
|
protected final NamespacePrefixResolver getResolver()
|
||||||
|
{
|
||||||
|
return this.provider.getNamespacePrefixResolver();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see java.util.Map#size()
|
* @see java.util.Map#size()
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +103,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
public boolean containsKey(Object key)
|
public boolean containsKey(Object key)
|
||||||
{
|
{
|
||||||
return (this.contents.containsKey(QName.resolveToQNameString(resolver, key.toString())));
|
return (this.contents.containsKey(QName.resolveToQNameString(getResolver(), key.toString())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,7 +119,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
public Object get(Object key)
|
public Object get(Object key)
|
||||||
{
|
{
|
||||||
String qnameKey = QName.resolveToQNameString(resolver, key.toString());
|
String qnameKey = QName.resolveToQNameString(getResolver(), key.toString());
|
||||||
Object obj = this.contents.get(qnameKey);
|
Object obj = this.contents.get(qnameKey);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
@@ -124,7 +130,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
public Object put(Object key, Object value)
|
public Object put(Object key, Object value)
|
||||||
{
|
{
|
||||||
return this.contents.put(QName.resolveToQNameString(resolver, key.toString()), value);
|
return this.contents.put(QName.resolveToQNameString(getResolver(), key.toString()), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,7 +138,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
public Object remove(Object key)
|
public Object remove(Object key)
|
||||||
{
|
{
|
||||||
return this.contents.remove(QName.resolveToQNameString(resolver, key.toString()));
|
return this.contents.remove(QName.resolveToQNameString(getResolver(), key.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +197,7 @@ public class QNameMap<K,V> implements Map, Cloneable, Serializable
|
|||||||
*/
|
*/
|
||||||
public Object clone()
|
public Object clone()
|
||||||
{
|
{
|
||||||
QNameMap map = new QNameMap(resolver);
|
QNameMap map = new QNameMap(provider);
|
||||||
map.putAll(this);
|
map.putAll(this);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
|
Reference in New Issue
Block a user