Search in sources :

Example 11 with NodePropertyEntity

use of org.alfresco.repo.domain.node.NodePropertyEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method selectNodePropertiesByDataType.

@SuppressWarnings("rawtypes")
@Override
public List<NodePropertyEntity> selectNodePropertiesByDataType(QName dataType, long minNodeId, long maxNodeId) {
    int typeOrdinal = NodePropertyValue.convertToTypeOrdinal(dataType);
    IdsEntity ids = new IdsEntity();
    ids.setIdOne((long) typeOrdinal);
    ids.setIdTwo(minNodeId);
    ids.setIdThree(maxNodeId);
    final List<NodePropertyEntity> properties = new ArrayList<NodePropertyEntity>();
    template.select(SELECT_PROPERTIES_BY_ACTUAL_TYPE, ids, new ResultHandler() {

        @Override
        public void handleResult(ResultContext context) {
            properties.add((NodePropertyEntity) context.getResultObject());
        }
    });
    return properties;
}
Also used : ResultContext(org.apache.ibatis.session.ResultContext) DefaultResultContext(org.apache.ibatis.executor.result.DefaultResultContext) IdsEntity(org.alfresco.ibatis.IdsEntity) NodePropertyEntity(org.alfresco.repo.domain.node.NodePropertyEntity) ArrayList(java.util.ArrayList) ResultHandler(org.apache.ibatis.session.ResultHandler)

Example 12 with NodePropertyEntity

use of org.alfresco.repo.domain.node.NodePropertyEntity in project alfresco-repository by Alfresco.

the class NodeDAOImpl method deleteNodeProperties.

@Override
protected int deleteNodeProperties(Long nodeId, Set<Long> qnameIds) {
    NodePropertyEntity prop = new NodePropertyEntity();
    // Node
    prop.setNodeId(nodeId);
    // QNames
    if (qnameIds != null) {
        if (qnameIds.isEmpty()) {
            // Nothing to do
            return 0;
        }
        prop.setQnameIds(new ArrayList<Long>(qnameIds));
    }
    return template.delete(DELETE_NODE_PROPERTIES, prop);
}
Also used : NodePropertyEntity(org.alfresco.repo.domain.node.NodePropertyEntity)

Aggregations

NodePropertyEntity (org.alfresco.repo.domain.node.NodePropertyEntity)12 NodePropertyKey (org.alfresco.repo.domain.node.NodePropertyKey)5 ArrayList (java.util.ArrayList)4 NodePropertyValue (org.alfresco.repo.domain.node.NodePropertyValue)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 IdsEntity (org.alfresco.ibatis.IdsEntity)2 BatchProcessor (org.alfresco.repo.batch.BatchProcessor)2 QName (org.alfresco.service.namespace.QName)2 DefaultResultContext (org.apache.ibatis.executor.result.DefaultResultContext)2 ResultContext (org.apache.ibatis.session.ResultContext)2 ResultHandler (org.apache.ibatis.session.ResultHandler)2 Serializable (java.io.Serializable)1 HashSet (java.util.HashSet)1 SealedObject (javax.crypto.SealedObject)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 BatchProcessWorkProvider (org.alfresco.repo.batch.BatchProcessWorkProvider)1 NodeVersionKey (org.alfresco.repo.domain.node.NodeVersionKey)1 RetryingTransactionHelper (org.alfresco.repo.transaction.RetryingTransactionHelper)1 RetryingTransactionCallback (org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback)1