Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

77150: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud)
      73977: ACE-1802 "MT / Cloud Restrict namespace URI of dynamic models."
      ACE-955 "Custom Content Models in Cloud"


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@78008 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-23 16:02:04 +00:00
parent fb70692bac
commit e0cd637688

View File

@@ -35,6 +35,8 @@ import org.alfresco.repo.solr.NodeMetaData;
import org.alfresco.repo.solr.NodeMetaDataParameters;
import org.alfresco.repo.solr.SOLRTrackingComponent;
import org.alfresco.repo.solr.SOLRTrackingComponent.NodeMetaDataQueryCallback;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.Path;
@@ -252,7 +254,8 @@ public class NodesMetaDataGet extends DeclarativeWebScript
private Set<String> ancestors;
private String tenantDomain;
public FreemarkerNodeMetaData(SOLRSerializer solrSerializer, NodeMetaData nodeMetaData) throws IOException, JSONException
public FreemarkerNodeMetaData(final SOLRSerializer solrSerializer, final NodeMetaData nodeMetaData)
throws IOException, JSONException
{
setNodeId(nodeMetaData.getNodeId());
setTenantDomain(nodeMetaData.getTenantDomain());
@@ -287,15 +290,25 @@ public class NodesMetaDataGet extends DeclarativeWebScript
setParentAssocs(nodeMetaData.getParentAssocs());
setParentAssocsCrc(nodeMetaData.getParentAssocsCrc());
setAspects(nodeMetaData.getAspects());
Map<QName, Serializable> props = nodeMetaData.getProperties();
final Map<QName, Serializable> props = nodeMetaData.getProperties();
if(props != null)
{
Map<String, PropertyValue> properties = (props != null ? new HashMap<String, PropertyValue>(props.size()) : null);
for(QName propName : props.keySet())
final Map<String, PropertyValue> properties = (props != null ? new HashMap<String, PropertyValue>(props.size()) : null);
for(final QName propName : props.keySet())
{
Serializable value = props.get(propName);
properties.put(solrSerializer.serializeValue(String.class, propName),
solrSerializer.serialize(propName, value));
// need to run this in tenant context because types may be in a tenant-specific
// dictionary registry
TenantUtil.runAsTenant(new TenantRunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
Serializable value = props.get(propName);
properties.put(solrSerializer.serializeValue(String.class, propName),
solrSerializer.serialize(propName, value));
return null;
}
}, tenantDomain);
}
setProperties(properties);
}