Search in sources :

Example 1 with PropertyUniqueContextEntity

use of org.alfresco.repo.domain.propval.PropertyUniqueContextEntity in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method getPropertyUniqueContextByValues.

@Override
protected PropertyUniqueContextEntity getPropertyUniqueContextByValues(Long valueId1, Long valueId2, Long valueId3) {
    PropertyUniqueContextEntity entity = new PropertyUniqueContextEntity();
    entity.setValue1PropId(valueId1);
    entity.setValue2PropId(valueId2);
    entity.setValue3PropId(valueId3);
    entity = template.selectOne(SELECT_PROPERTY_UNIQUE_CTX_BY_VALUES, entity);
    return entity;
}
Also used : PropertyUniqueContextEntity(org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)

Example 2 with PropertyUniqueContextEntity

use of org.alfresco.repo.domain.propval.PropertyUniqueContextEntity in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method deletePropertyUniqueContext.

public void deletePropertyUniqueContext(Long id) {
    PropertyUniqueContextEntity entity = new PropertyUniqueContextEntity();
    entity.setId(id);
    template.delete(DELETE_PROPERTY_UNIQUE_CTX_BY_ID, entity);
}
Also used : PropertyUniqueContextEntity(org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)

Example 3 with PropertyUniqueContextEntity

use of org.alfresco.repo.domain.propval.PropertyUniqueContextEntity in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method getPropertyUniqueContextById.

@Override
protected PropertyUniqueContextEntity getPropertyUniqueContextById(Long id) {
    PropertyUniqueContextEntity entity = new PropertyUniqueContextEntity();
    entity.setId(id);
    entity = template.selectOne(SELECT_PROPERTY_UNIQUE_CTX_BY_ID, entity);
    return entity;
}
Also used : PropertyUniqueContextEntity(org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)

Example 4 with PropertyUniqueContextEntity

use of org.alfresco.repo.domain.propval.PropertyUniqueContextEntity in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method getPropertyUniqueContextByValues.

@Override
protected void getPropertyUniqueContextByValues(final PropertyUniqueContextCallback callback, Long... valueIds) {
    PropertyUniqueContextEntity entity = new PropertyUniqueContextEntity();
    for (int i = 0; i < valueIds.length; i++) {
        switch(i) {
            case 0:
                entity.setValue1PropId(valueIds[i]);
                break;
            case 1:
                entity.setValue2PropId(valueIds[i]);
                break;
            case 2:
                entity.setValue3PropId(valueIds[i]);
                break;
            default:
                throw new IllegalArgumentException("Only 3 ids allowed");
        }
    }
    ResultHandler valueResultHandler = new ResultHandler() {

        public void handleResult(ResultContext context) {
            PropertyUniqueContextEntity result = (PropertyUniqueContextEntity) context.getResultObject();
            Long id = result.getId();
            Long propId = result.getPropertyId();
            Serializable[] keys = new Serializable[3];
            keys[0] = result.getValue1PropId();
            keys[1] = result.getValue2PropId();
            keys[2] = result.getValue3PropId();
            callback.handle(id, propId, keys);
        }
    };
    template.select(SELECT_PROPERTY_UNIQUE_CTX_BY_VALUES, entity, valueResultHandler);
// Done
}
Also used : ResultContext(org.apache.ibatis.session.ResultContext) Serializable(java.io.Serializable) RollupResultHandler(org.alfresco.ibatis.RollupResultHandler) ResultHandler(org.apache.ibatis.session.ResultHandler) PropertyUniqueContextEntity(org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)

Example 5 with PropertyUniqueContextEntity

use of org.alfresco.repo.domain.propval.PropertyUniqueContextEntity in project alfresco-repository by Alfresco.

the class PropertyValueDAOImpl method createPropertyUniqueContext.

@Override
protected PropertyUniqueContextEntity createPropertyUniqueContext(Long valueId1, Long valueId2, Long valueId3, Long propertyId) {
    PropertyUniqueContextEntity entity = new PropertyUniqueContextEntity();
    entity.setValue1PropId(valueId1);
    entity.setValue2PropId(valueId2);
    entity.setValue3PropId(valueId3);
    entity.setPropertyId(propertyId);
    template.insert(INSERT_PROPERTY_UNIQUE_CTX, entity);
    return entity;
}
Also used : PropertyUniqueContextEntity(org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)

Aggregations

PropertyUniqueContextEntity (org.alfresco.repo.domain.propval.PropertyUniqueContextEntity)5 Serializable (java.io.Serializable)1 RollupResultHandler (org.alfresco.ibatis.RollupResultHandler)1 ResultContext (org.apache.ibatis.session.ResultContext)1 ResultHandler (org.apache.ibatis.session.ResultHandler)1