mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged 1.4 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4252 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4294 . svn revert root\common\common.xml svn resolved root\projects\repository\config\alfresco\script-services-context.xml git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4634 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -58,6 +58,7 @@ public abstract class BaseVersionStoreTest extends BaseSpringTest
|
||||
protected TransactionService transactionService;
|
||||
protected MutableAuthenticationDao authenticationDAO;
|
||||
protected NodeArchiveService nodeArchiveService;
|
||||
protected NodeService nodeService;
|
||||
|
||||
/*
|
||||
* Data used by tests
|
||||
@@ -139,6 +140,7 @@ public abstract class BaseVersionStoreTest extends BaseSpringTest
|
||||
this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent");
|
||||
this.authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("alfDaoImpl");
|
||||
this.nodeArchiveService = (NodeArchiveService) applicationContext.getBean("nodeArchiveService");
|
||||
this.nodeService = (NodeService)applicationContext.getBean("nodeService");
|
||||
|
||||
authenticationService.clearCurrentSecurityContext();
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidAspectException;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.AssociationExistsException;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -39,6 +40,7 @@ import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef.Status;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.QNamePattern;
|
||||
@@ -301,31 +303,29 @@ public class NodeServiceImpl implements NodeService, VersionModel
|
||||
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException
|
||||
{
|
||||
Map<QName, Serializable> result = new HashMap<QName, Serializable>();
|
||||
|
||||
// TODO should be doing this using a path query ..
|
||||
|
||||
Collection<ChildAssociationRef> children = this.dbNodeService.getChildAssocs(convertNodeRef(nodeRef));
|
||||
Collection<ChildAssociationRef> children = this.dbNodeService.getChildAssocs(convertNodeRef(nodeRef), CHILD_QNAME_VERSIONED_ATTRIBUTES, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef child : children)
|
||||
{
|
||||
if (child.getQName().equals(CHILD_QNAME_VERSIONED_ATTRIBUTES))
|
||||
{
|
||||
NodeRef versionedAttribute = child.getChildRef();
|
||||
NodeRef versionedAttribute = child.getChildRef();
|
||||
|
||||
// Get the QName and the value
|
||||
Serializable value = null;
|
||||
QName qName = (QName)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_QNAME);
|
||||
Boolean isMultiValue = (Boolean)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_IS_MULTI_VALUE);
|
||||
if (isMultiValue.booleanValue() == false)
|
||||
{
|
||||
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_VALUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_MULTI_VALUE);
|
||||
}
|
||||
|
||||
result.put(qName, value);
|
||||
// Get the QName and the value
|
||||
Serializable value = null;
|
||||
QName qName = (QName)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_QNAME);
|
||||
PropertyDefinition propDef = this.dicitionaryService.getProperty(qName);
|
||||
|
||||
Boolean isMultiValue = (Boolean)this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_IS_MULTI_VALUE);
|
||||
if (isMultiValue.booleanValue() == false)
|
||||
{
|
||||
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_VALUE);
|
||||
value = (Serializable)DefaultTypeConverter.INSTANCE.convert(propDef.getDataType(), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = this.dbNodeService.getProperty(versionedAttribute, PROP_QNAME_MULTI_VALUE);
|
||||
}
|
||||
|
||||
result.put(qName, value);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -19,11 +19,13 @@ package org.alfresco.repo.version;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ApplicationModel;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -31,6 +33,7 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionHistory;
|
||||
import org.alfresco.service.cmr.version.VersionServiceException;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
@@ -681,4 +684,30 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testAR807()
|
||||
{
|
||||
QName prop = QName.createQName("http://www.alfresco.org/test/versionstorebasetest/1.0", "intProp");
|
||||
|
||||
ChildAssociationRef childAssociation =
|
||||
nodeService.createNode(this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName("http://www.alfresco.org/test/versionstorebasetest/1.0", "integerTest"),
|
||||
TEST_TYPE_QNAME);
|
||||
NodeRef newNode = childAssociation.getChildRef();
|
||||
nodeService.setProperty(newNode, prop, 1);
|
||||
|
||||
Object editionCode = nodeService.getProperty(newNode, prop);
|
||||
assertEquals(editionCode.getClass(), Integer.class);
|
||||
|
||||
Map<String, Serializable> versionProps = new HashMap<String, Serializable>(1);
|
||||
versionProps.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
Version version = versionService.createVersion(newNode, versionProps);
|
||||
|
||||
NodeRef versionNodeRef = version.getFrozenStateNodeRef();
|
||||
assertNotNull(versionNodeRef);
|
||||
|
||||
Object editionCodeArchive = nodeService.getProperty(versionNodeRef, prop);
|
||||
assertEquals(editionCodeArchive.getClass(), Integer.class);
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,9 @@
|
||||
<type>d:text</type>
|
||||
<multiple>true</multiple>
|
||||
</property>
|
||||
<property name="test:intProp">
|
||||
<type>d:int</type>
|
||||
</property>
|
||||
</properties>
|
||||
|
||||
<associations>
|
||||
|
Reference in New Issue
Block a user