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

@@ -34,7 +34,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.contentdata.ContentDataDAO;
import org.alfresco.repo.version.common.VersionUtil;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
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");
/**
* The db node service, used as the version store implementation
*/
protected NodeService dbNodeService;
/**
* The repository searcher
*/
@SuppressWarnings("unused")
private SearchService searcher;
/**
* The dictionary service
*/
protected DictionaryService dicitionaryService;
protected ContentDataDAO contentDataDAO;
/**
* Sets the db node service, used as the version store implementation
@@ -108,8 +99,6 @@ public class NodeServiceImpl implements NodeService, VersionModel
/**
* Sets the searcher
*
* @param searcher the searcher
*/
public void setSearcher(SearchService searcher)
{
@@ -118,14 +107,20 @@ public class NodeServiceImpl implements NodeService, VersionModel
/**
* Sets the dictionary service
*
* @param dictionaryService the dictionary service
*/
public void setDictionaryService(DictionaryService 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
*/
@@ -360,7 +355,21 @@ public class NodeServiceImpl implements NodeService, VersionModel
DataTypeDefinition dataTypeDef = propDef.getDataType();
if (dataTypeDef != null)
{
value = (Serializable)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, value);
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);
}
}
else
{