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:
@@ -29,6 +29,8 @@ import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
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;
|
||||
|
||||
/**
|
||||
@@ -44,9 +46,21 @@ public class ContentAwareScriptableQNameMap<K,V> extends ScriptableQNameMap<K,V>
|
||||
private ServiceRegistry services;
|
||||
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.factory = factory;
|
||||
}
|
||||
@@ -62,7 +76,7 @@ public class ContentAwareScriptableQNameMap<K,V> extends ScriptableQNameMap<K,V>
|
||||
if (value == null)
|
||||
{
|
||||
// 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);
|
||||
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.workflow.WorkflowInstance;
|
||||
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.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
@@ -104,9 +106,9 @@ import org.mozilla.javascript.Wrapper;
|
||||
*
|
||||
* @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);
|
||||
|
||||
@@ -436,7 +438,7 @@ public class ScriptNode implements Serializable, Scopeable
|
||||
if (this.targetAssocs == null)
|
||||
{
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NamespacePrefixResolverProvider getter implementation
|
||||
*/
|
||||
public NamespacePrefixResolver getNamespacePrefixResolver()
|
||||
{
|
||||
return this.services.getNamespaceService();
|
||||
}
|
||||
}
|
@@ -25,6 +25,7 @@
|
||||
package org.alfresco.repo.jscript;
|
||||
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolverProvider;
|
||||
import org.alfresco.service.namespace.QNameMap;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class ScriptableQNameMap<K,V> extends QNameMap<K,V> implements Scriptable
|
||||
/**
|
||||
* @param resolver
|
||||
*/
|
||||
public ScriptableQNameMap(NamespacePrefixResolver resolver)
|
||||
public ScriptableQNameMap(NamespacePrefixResolverProvider resolver)
|
||||
{
|
||||
super(resolver);
|
||||
}
|
||||
|
Reference in New Issue
Block a user