|
|
@@ -7,9 +7,13 @@ import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
+import com.x.base.core.project.http.EffectivePerson;
|
|
|
import com.x.base.core.project.tools.ListTools;
|
|
|
import com.x.processplatform.core.entity.element.Process;
|
|
|
+import com.x.query.core.express.plan.FilterEntry;
|
|
|
import com.x.query.core.express.plan.ProcessPlatformPlan;
|
|
|
+import com.x.query.core.express.plan.Runtime;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
|
|
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
|
@@ -19,6 +23,7 @@ import com.x.query.core.entity.View;
|
|
|
import com.x.query.core.entity.View_;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
abstract class BaseAction extends StandardJaxrsAction {
|
|
|
|
|
|
@@ -44,6 +49,56 @@ abstract class BaseAction extends StandardJaxrsAction {
|
|
|
return em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult() == 0;
|
|
|
}
|
|
|
|
|
|
+ protected Runtime runtime(EffectivePerson effectivePerson, Business business, View view,
|
|
|
+ List<FilterEntry> filterList, Map<String, String> parameter, Integer count) throws Exception {
|
|
|
+ Runtime runtime = new Runtime();
|
|
|
+ runtime.person = effectivePerson.getDistinguishedName();
|
|
|
+ runtime.identityList = business.organization().identity().listWithPerson(effectivePerson);
|
|
|
+ if(runtime.identityList!=null){
|
|
|
+ for(String identity : runtime.identityList){
|
|
|
+ if(identity.indexOf("@")>-1) {
|
|
|
+ runtime.identityList.add(StringUtils.substringAfter(identity, "@"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runtime.unitList = business.organization().unit().listWithPerson(effectivePerson);
|
|
|
+ if(runtime.unitList!=null){
|
|
|
+ for(String item : runtime.unitList){
|
|
|
+ if(item.indexOf("@")>-1) {
|
|
|
+ runtime.unitList.add(StringUtils.substringAfter(item, "@"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runtime.unitAllList = business.organization().unit().listWithPersonSupNested(effectivePerson);
|
|
|
+ if(runtime.unitAllList!=null){
|
|
|
+ for(String item : runtime.unitAllList){
|
|
|
+ if(item.indexOf("@")>-1) {
|
|
|
+ runtime.unitAllList.add(StringUtils.substringAfter(item, "@"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
|
|
|
+ if(runtime.groupList!=null){
|
|
|
+ for(String item : runtime.groupList){
|
|
|
+ if(item.indexOf("@")>-1) {
|
|
|
+ runtime.groupList.add(StringUtils.substringAfter(item, "@"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runtime.roleList = business.organization().role().listWithPerson(effectivePerson);
|
|
|
+ if(runtime.roleList!=null){
|
|
|
+ for(String item : runtime.roleList){
|
|
|
+ if(item.indexOf("@")>-1) {
|
|
|
+ runtime.roleList.add(StringUtils.substringAfter(item, "@"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ runtime.parameter = parameter;
|
|
|
+ runtime.filterList = filterList;
|
|
|
+ runtime.count = this.getCount(view, count);
|
|
|
+ return runtime;
|
|
|
+ }
|
|
|
+
|
|
|
protected Integer getCount(View view, Integer count) {
|
|
|
Integer viewCount = view.getCount();
|
|
|
Integer wiCount = ((count == null) || (count < 1) || (count > View.MAX_COUNT)) ? View.MAX_COUNT : count;
|