Search in sources :

Example 1 with SubstitutesMapper

use of org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper in project carbon-business-process by wso2.

the class ActivitiDAO method querySubstituteInfo.

/**
 * Return the list of substitute info based on query parameters.
 * @param model model with only required query parameter values. Leave others as null. By default enabled=false.
 * @return List<SubstitutesDataModel> Result set of substitute info
 */
public List<SubstitutesDataModel> querySubstituteInfo(final PaginatedSubstitutesDataModel model) {
    final RowBounds rw = new RowBounds(model.getStart(), model.getSize());
    CustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>> customSqlExecution = new AbstractCustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>>(SubstitutesMapper.class) {

        public List<SubstitutesDataModel> execute(SubstitutesMapper substitutesMapper) {
            return substitutesMapper.querySubstitutes(rw, model);
        }
    };
    return managementService.executeCustomSql(customSqlExecution);
}
Also used : PaginatedSubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.PaginatedSubstitutesDataModel) SubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.SubstitutesDataModel) AbstractCustomSqlExecution(org.activiti.engine.impl.cmd.AbstractCustomSqlExecution) RowBounds(org.apache.ibatis.session.RowBounds) List(java.util.List) SubstitutesMapper(org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper)

Example 2 with SubstitutesMapper

use of org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper in project carbon-business-process by wso2.

the class ActivitiDAO method updateSubstituteInfo.

/**
 * Update the substitute record for given user
 * @param substitutesDataModel
 * @return updated row count. Ideally should return 1.
 */
public int updateSubstituteInfo(final SubstitutesDataModel substitutesDataModel) {
    substitutesDataModel.setUpdated(new Date());
    CustomSqlExecution<SubstitutesMapper, Integer> customSqlExecution = new AbstractCustomSqlExecution<SubstitutesMapper, Integer>(SubstitutesMapper.class) {

        public Integer execute(SubstitutesMapper substitutesMapper) {
            return substitutesMapper.updateSubstitute(substitutesDataModel);
        }
    };
    return managementService.executeCustomSql(customSqlExecution);
}
Also used : AbstractCustomSqlExecution(org.activiti.engine.impl.cmd.AbstractCustomSqlExecution) SubstitutesMapper(org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper) Date(java.util.Date)

Example 3 with SubstitutesMapper

use of org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper in project carbon-business-process by wso2.

the class ActivitiDAO method querySubstituteInfoWithoutEnabled.

/**
 * Return the list of substitute info based on query parameters except enabled property.
 * @param model data model with only required query parameter values. Leave others as null.
 * @return List<PaginatedSubstitutesDataModel> Result set of substitute info
 */
public List<SubstitutesDataModel> querySubstituteInfoWithoutEnabled(final PaginatedSubstitutesDataModel model) {
    final RowBounds rw = new RowBounds(model.getStart(), model.getSize());
    CustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>> customSqlExecution = new AbstractCustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>>(SubstitutesMapper.class) {

        public List<SubstitutesDataModel> execute(SubstitutesMapper substitutesMapper) {
            return substitutesMapper.querySubstitutesWithoutEnabled(rw, model);
        }
    };
    return managementService.executeCustomSql(customSqlExecution);
}
Also used : PaginatedSubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.PaginatedSubstitutesDataModel) SubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.SubstitutesDataModel) AbstractCustomSqlExecution(org.activiti.engine.impl.cmd.AbstractCustomSqlExecution) RowBounds(org.apache.ibatis.session.RowBounds) List(java.util.List) SubstitutesMapper(org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper)

Aggregations

AbstractCustomSqlExecution (org.activiti.engine.impl.cmd.AbstractCustomSqlExecution)3 SubstitutesMapper (org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper)3 List (java.util.List)2 RowBounds (org.apache.ibatis.session.RowBounds)2 PaginatedSubstitutesDataModel (org.wso2.carbon.bpmn.core.mgt.model.PaginatedSubstitutesDataModel)2 SubstitutesDataModel (org.wso2.carbon.bpmn.core.mgt.model.SubstitutesDataModel)2 Date (java.util.Date)1