Old versioning NodeService can now handle new content references (for test)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14886 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-06-24 11:45:36 +00:00
parent f13306ce45
commit 104a97f934
2 changed files with 29 additions and 17 deletions

View File

@@ -847,6 +847,9 @@
</bean> </bean>
<bean id="versionNodeService" class="org.alfresco.repo.version.Node2ServiceImpl"> <bean id="versionNodeService" class="org.alfresco.repo.version.Node2ServiceImpl">
<property name="contentDataDAO">
<ref bean="contentDataDAO" />
</property>
<property name="dbNodeService"> <property name="dbNodeService">
<ref bean="mtAwareNodeService" /> <ref bean="mtAwareNodeService" />
</property> </property>

View File

@@ -34,7 +34,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.contentdata.ContentDataDAO;
import org.alfresco.repo.version.common.VersionUtil; import org.alfresco.repo.version.common.VersionUtil;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -79,22 +81,11 @@ public class NodeServiceImpl implements NodeService, VersionModel
*/ */
private static final QName rootAssocName = QName.createQName(VersionModel.NAMESPACE_URI, "versionedState"); private static final QName rootAssocName = QName.createQName(VersionModel.NAMESPACE_URI, "versionedState");
/**
* The db node service, used as the version store implementation
*/
protected NodeService dbNodeService; protected NodeService dbNodeService;
/**
* The repository searcher
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
private SearchService searcher; private SearchService searcher;
/**
* The dictionary service
*/
protected DictionaryService dicitionaryService; protected DictionaryService dicitionaryService;
protected ContentDataDAO contentDataDAO;
/** /**
* Sets the db node service, used as the version store implementation * Sets the db node service, used as the version store implementation
@@ -108,8 +99,6 @@ public class NodeServiceImpl implements NodeService, VersionModel
/** /**
* Sets the searcher * Sets the searcher
*
* @param searcher the searcher
*/ */
public void setSearcher(SearchService searcher) public void setSearcher(SearchService searcher)
{ {
@@ -118,14 +107,20 @@ public class NodeServiceImpl implements NodeService, VersionModel
/** /**
* Sets the dictionary service * Sets the dictionary service
*
* @param dictionaryService the dictionary service
*/ */
public void setDictionaryService(DictionaryService dictionaryService) public void setDictionaryService(DictionaryService dictionaryService)
{ {
this.dicitionaryService = dictionaryService; this.dicitionaryService = dictionaryService;
} }
/**
* Set the DAO to resolved content data reference IDs into ContentData instances
*/
public void setContentDataDAO(ContentDataDAO contentDataDAO)
{
this.contentDataDAO = contentDataDAO;
}
/** /**
* No-op * No-op
*/ */
@@ -359,9 +354,23 @@ public class NodeServiceImpl implements NodeService, VersionModel
{ {
DataTypeDefinition dataTypeDef = propDef.getDataType(); DataTypeDefinition dataTypeDef = propDef.getDataType();
if (dataTypeDef != null) if (dataTypeDef != null)
{
if (dataTypeDef.getName().equals(DataTypeDefinition.CONTENT) && value instanceof Long)
{
try
{
value = contentDataDAO.getContentData((Long)value).getSecond();
}
catch (AlfrescoRuntimeException e)
{
logger.warn("ContentData with ID " + value + " no longer exists for versioned node " + nodeRef);
}
}
else
{ {
value = (Serializable)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, value); value = (Serializable)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, value);
} }
}
else else
{ {
logger.warn("Null dataTypeDefinition for: " + propDef); logger.warn("Null dataTypeDefinition for: " + propDef);