cn.schoolwow.util.domain.query.instance.QueryInstanceResponse Maven / Gradle / Ivy
package cn.schoolwow.util.domain.query.instance;
import cn.schoolwow.quickflow.QuickFlow;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.util.module.query.instance.service.GetInstanceFieldValueFlow;
import cn.schoolwow.util.module.query.instance.service.GetInstanceFieldsValueFlow;
public class QueryInstanceResponse {
private QuickFlow quickFlow;
public QueryInstanceResponse(QuickFlow quickFlow) {
this.quickFlow = quickFlow;
}
/**获取指定字段值*/
public Object getSingleFieldValue(String fieldName){
FlowContext flowContext = quickFlow.startFlow(new GetInstanceFieldValueFlow())
.putCurrentCompositeFlowData("fieldName", fieldName)
.execute();
Object fieldValue = flowContext.getData("fieldValue");
return fieldValue;
}
/**获取指定字段值*/
public T getSingleFieldValue(String fieldName, Class classType){
FlowContext flowContext = quickFlow.startFlow(new GetInstanceFieldValueFlow())
.putCurrentCompositeFlowData("fieldName", fieldName)
.execute();
T fieldValue = (T) flowContext.getData("fieldValue");
return fieldValue;
}
/**获取指定多个字段值*/
public Object getMultipleFieldValue(String... fieldNames){
FlowContext flowContext = quickFlow.startFlow(new GetInstanceFieldsValueFlow())
.putCurrentCompositeFlowData("fieldNames", fieldNames)
.execute();
Object fieldValue = flowContext.getData("fieldValue");
return fieldValue;
}
}