mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8372: Merged V2.1 to V2.2 8314: Merged V2.0 to V2.1 7750: Fix for ACT-475: ContentStoreCleaner causes OutOfMemoryError 8332: Made content URL column larger to accommodate the extra locale info present in 2.1 8334: Build fix: V2.1 tighter on authentication for getTempWriter 8376: Merged V2.1 to V2.2 8325: Fix for AWC-1089 8361: Workaround for WCM-882: All metadata extracters can now handle zero length files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8497 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -39,6 +39,7 @@ import org.alfresco.repo.domain.ChildAssoc;
|
||||
import org.alfresco.repo.domain.Node;
|
||||
import org.alfresco.repo.domain.NodeStatus;
|
||||
import org.alfresco.repo.node.BaseNodeServiceTest;
|
||||
import org.alfresco.repo.node.db.NodeDaoService.NodePropertyHandler;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -297,7 +298,15 @@ public class DbNodeServiceImplTest extends BaseNodeServiceTest
|
||||
collection);
|
||||
|
||||
// get a list of all content values
|
||||
List<Serializable> allContentDatas = nodeDaoService.getPropertyValuesByActualType(contentDataType);
|
||||
final List<Serializable> allContentDatas = new ArrayList<Serializable>(500);
|
||||
NodePropertyHandler handler = new NodePropertyHandler()
|
||||
{
|
||||
public void handle(Node node, Serializable value)
|
||||
{
|
||||
allContentDatas.add(value);
|
||||
}
|
||||
};
|
||||
nodeDaoService.getPropertyValuesByActualType(contentDataType, handler);
|
||||
assertTrue("At least two instances expected", allContentDatas.size() >= 2);
|
||||
assertTrue("Single content data not present in results",
|
||||
allContentDatas.contains(contentDataSingle));
|
||||
|
@@ -277,12 +277,20 @@ public interface NodeDaoService
|
||||
public void deleteNodeAssoc(NodeAssoc assoc);
|
||||
|
||||
/**
|
||||
* Fetch all property values for the given type definition. This will also dig out values that
|
||||
* Iterate over all property values for the given type definition. This will also dig out values that
|
||||
* were persisted as type <b>d:any</b>.
|
||||
*
|
||||
* @param actualDataTypeDefinition the persisted type to retrieve
|
||||
* @param handler the callback to use while iterating over the URLs
|
||||
* @return Returns the values for the given type definition
|
||||
*/
|
||||
public List<Serializable> getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition);
|
||||
public void getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition, NodePropertyHandler handler);
|
||||
|
||||
/**
|
||||
* Get properties with the given type and string value.
|
||||
* TODO: Refactor as in getPropertyValuesByActualType
|
||||
*/
|
||||
public Collection<Node> getNodesWithPropertyStringValueForStore(StoreRef storeRef, QName propQName, String propStringValue);
|
||||
|
||||
/**
|
||||
* @return Returns the total number of nodes in the ADM repository
|
||||
@@ -293,7 +301,16 @@ public interface NodeDaoService
|
||||
*/
|
||||
public int getNodeCount(final StoreRef storeRef);
|
||||
|
||||
public Collection<Node> getNodesWithPropertyStringValueForStore(final StoreRef storeRef, final QName propQName, final String propStringValue);
|
||||
/**
|
||||
* Iterface to handle callbacks when iterating over properties
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface NodePropertyHandler
|
||||
{
|
||||
void handle(Node node, Serializable value);
|
||||
}
|
||||
|
||||
public Transaction getTxnById(long txnId);
|
||||
/**
|
||||
|
@@ -1376,7 +1376,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
getHibernateTemplate().delete(assoc);
|
||||
}
|
||||
|
||||
public List<Serializable> getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition)
|
||||
public void getPropertyValuesByActualType(DataTypeDefinition actualDataTypeDefinition, NodePropertyHandler handler)
|
||||
{
|
||||
// get the in-database string representation of the actual type
|
||||
QName typeQName = actualDataTypeDefinition.getName();
|
||||
@@ -1393,7 +1393,6 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
};
|
||||
ScrollableResults results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
// Loop through, extracting content URLs
|
||||
List<Serializable> convertedValues = new ArrayList<Serializable>(1000);
|
||||
TypeConverter converter = DefaultTypeConverter.INSTANCE;
|
||||
int unflushedCount = 0;
|
||||
while(results.next())
|
||||
@@ -1418,16 +1417,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Serializable convertedValue = null;
|
||||
try
|
||||
{
|
||||
Serializable convertedValue = (Serializable) converter.convert(actualDataTypeDefinition, value);
|
||||
// it converted, so add it
|
||||
convertedValues.add(convertedValue);
|
||||
convertedValue = (Serializable) converter.convert(actualDataTypeDefinition, value);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// The value can't be converted - forget it
|
||||
}
|
||||
if (convertedValue != null)
|
||||
{
|
||||
handler.handle(node, convertedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
unflushedCount++;
|
||||
@@ -1438,7 +1440,6 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
unflushedCount = 0;
|
||||
}
|
||||
}
|
||||
return convertedValues;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user