cn.schoolwow.util.domain.query.instance.QueryInstanceResponse Maven / Gradle / Ivy
The newest version!
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.GetInstanceFieldArrayFlow;
import cn.schoolwow.util.module.query.instance.service.GetInstanceFieldValueFlow;
import cn.schoolwow.util.module.query.instance.service.GetInstanceFieldsValueFlow;
import java.lang.reflect.Field;
import java.util.List;
public class QueryInstanceResponse {
private QuickFlow quickFlow;
public QueryInstanceResponse(QuickFlow quickFlow) {
this.quickFlow = quickFlow;
}
/**获取所有字段列表*/
public List getFieldArray(){
FlowContext flowContext = quickFlow.executeFlow(new GetInstanceFieldArrayFlow());
List fieldList = (List) flowContext.getData("fieldList");
return fieldList;
}
/**获取指定字段值*/
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;
}
}