From 85c5abb89c416bc3a2384da3ae5d6779e2951cd3 Mon Sep 17 00:00:00 2001 From: jacky6024 Date: Mon, 4 Dec 2017 10:05:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E8=AF=B7=E6=B1=82=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=8C=85=E5=86=85=E5=AE=B9=E6=97=B6=E4=B8=8D=E5=86=8D=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E8=8E=B7=E5=8F=96=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DefaultKnowledgePackageService.java | 2 +- .../RepositoryResourceProvider.java | 2 +- .../servlet/common/CommonServletHandler.java | 2 +- .../flow/RuleFlowDesignerServletHandler.java | 2 +- .../servlet/xml/XmlServletHandler.java | 2 +- .../bstek/urule/builder/KnowledgeBuilder.java | 7 ++++-- .../urule/builder/ResourceLibraryBuilder.java | 9 +++++--- .../bstek/urule/builder/RulesRebuilder.java | 5 ++++- .../ActionLibraryResourceBuilder.java | 4 ++-- .../ConstantLibraryResourceBuilder.java | 4 ++-- .../DecisionTableResourceBuilder.java | 4 ++-- .../resource/DecisionTreeResourceBuilder.java | 4 ++-- .../builder/resource/FlowResourceBuilder.java | 4 ++-- .../ParameterLibraryResourceBuilder.java | 4 ++-- .../builder/resource/ResourceBuilder.java | 2 +- .../resource/RuleSetResourceBuilder.java | 4 ++-- .../resource/ScorecardResourceBuilder.java | 4 ++-- .../ScriptDecisionTableResourceBuilder.java | 4 ++-- .../VariableLibraryResourceBuilder.java | 4 ++-- .../com/bstek/urule/parse/AbstractParser.java | 4 ++-- .../bstek/urule/parse/AbstractRuleParser.java | 8 +++---- .../urule/parse/ActionLibraryParser.java | 2 +- .../parse/CommonFunctionActionParser.java | 4 ++-- .../urule/parse/ComplexArithmeticParser.java | 6 ++--- .../urule/parse/ConsolePrintActionParser.java | 4 ++-- .../urule/parse/ConstantLibraryParser.java | 2 +- .../com/bstek/urule/parse/CriteriaParser.java | 6 ++--- .../bstek/urule/parse/CriterionParser.java | 4 ++-- .../parse/ExecuteMethodActionParser.java | 4 ++-- .../com/bstek/urule/parse/JunctionParser.java | 4 ++-- .../com/bstek/urule/parse/LeftParser.java | 22 +++++++++---------- .../java/com/bstek/urule/parse/LhsParser.java | 8 +++---- .../com/bstek/urule/parse/LoopRuleParser.java | 10 ++++----- .../urule/parse/NamedJunctionParser.java | 8 +++---- .../com/bstek/urule/parse/OtherParser.java | 4 ++-- .../urule/parse/ParameterLibraryParser.java | 4 ++-- .../com/bstek/urule/parse/ParenParser.java | 6 ++--- .../java/com/bstek/urule/parse/Parser.java | 2 +- .../java/com/bstek/urule/parse/RhsParser.java | 8 +++---- .../com/bstek/urule/parse/RuleParser.java | 4 ++-- .../com/bstek/urule/parse/RuleSetParser.java | 8 +++---- .../urule/parse/SimpleArithmeticParser.java | 4 ++-- .../bstek/urule/parse/SpringBeanParser.java | 2 +- .../com/bstek/urule/parse/ValueParser.java | 8 +++---- .../parse/VariableAssignActionParser.java | 4 ++-- .../urule/parse/VariableCategoryParser.java | 4 ++-- .../urule/parse/VariableLibraryParser.java | 4 ++-- .../com/bstek/urule/parse/VariableParser.java | 2 +- .../decisiontree/ActionTreeNodeParser.java | 4 ++-- .../decisiontree/ConditionTreeNodeParser.java | 10 ++++----- .../decisiontree/DecisionTreeParser.java | 4 ++-- .../decisiontree/VariableTreeNodeParser.java | 6 ++--- .../ActionLibraryDeserializer.java | 4 ++-- .../ConstantLibraryDeserializer.java | 4 ++-- .../DecisionTableDeserializer.java | 4 ++-- .../DecisionTreeDeserializer.java | 4 ++-- .../parse/deserializer/Deserializer.java | 2 +- .../parse/deserializer/FlowDeserializer.java | 4 ++-- .../ParameterLibraryDeserializer.java | 4 ++-- .../deserializer/RuleSetDeserializer.java | 4 ++-- .../deserializer/ScorecardDeserializer.java | 4 ++-- .../ScriptDecisionTableDeserializer.java | 4 ++-- .../VariableLibraryDeserializer.java | 4 ++-- .../urule/parse/flow/ActionNodeParser.java | 2 +- .../urule/parse/flow/DecisionNodeParser.java | 2 +- .../bstek/urule/parse/flow/EndNodeParser.java | 2 +- .../parse/flow/FlowDefinitionParser.java | 4 ++-- .../urule/parse/flow/ForkNodeParser.java | 2 +- .../urule/parse/flow/JoinNodeParser.java | 2 +- .../urule/parse/flow/RuleNodeParser.java | 2 +- .../parse/flow/RulePackageNodeParser.java | 2 +- .../urule/parse/flow/ScriptNodeParser.java | 2 +- .../urule/parse/flow/StartNodeParser.java | 2 +- .../parse/scorecard/AttributeRowParser.java | 2 +- .../urule/parse/scorecard/CardCellParser.java | 6 ++--- .../parse/scorecard/CustomColParser.java | 2 +- .../parse/scorecard/ScorecardParser.java | 8 +++---- .../bstek/urule/parse/table/CellParser.java | 8 +++---- .../bstek/urule/parse/table/ColumnParser.java | 2 +- .../parse/table/DecisionTableParser.java | 8 +++---- .../bstek/urule/parse/table/JointParser.java | 10 ++++----- .../bstek/urule/parse/table/RowParser.java | 2 +- .../urule/parse/table/ScriptCellParser.java | 2 +- .../table/ScriptDecisionTableParser.java | 8 +++---- 84 files changed, 194 insertions(+), 185 deletions(-) diff --git a/urule-console/src/main/java/com/bstek/urule/console/DefaultKnowledgePackageService.java b/urule-console/src/main/java/com/bstek/urule/console/DefaultKnowledgePackageService.java index ab0f8ed0..70e961cc 100644 --- a/urule-console/src/main/java/com/bstek/urule/console/DefaultKnowledgePackageService.java +++ b/urule-console/src/main/java/com/bstek/urule/console/DefaultKnowledgePackageService.java @@ -64,7 +64,7 @@ public KnowledgePackage buildKnowledgePackage(String packageInfo,boolean withPer for(ResourceItem item:list){ resourceBase.addResource(item.getPath(),item.getVersion(),withPermission); } - KnowledgeBase knowledgeBase=knowledgeBuilder.buildKnowledgeBase(resourceBase); + KnowledgeBase knowledgeBase=knowledgeBuilder.buildKnowledgeBase(resourceBase,withPermission); KnowledgePackage knowledgePackage=knowledgeBase.getKnowledgePackage(); return knowledgePackage; }catch(Exception ex){ diff --git a/urule-console/src/main/java/com/bstek/urule/console/repository/RepositoryResourceProvider.java b/urule-console/src/main/java/com/bstek/urule/console/repository/RepositoryResourceProvider.java index bd693a87..ea1e4236 100644 --- a/urule-console/src/main/java/com/bstek/urule/console/repository/RepositoryResourceProvider.java +++ b/urule-console/src/main/java/com/bstek/urule/console/repository/RepositoryResourceProvider.java @@ -35,7 +35,7 @@ public class RepositoryResourceProvider implements ResourceProvider { @Override public Resource provide(String path, String version) { - return null; + return provide(path,version,true); } @Override public Resource provide(String path,String version,boolean withPermiossion) { diff --git a/urule-console/src/main/java/com/bstek/urule/console/servlet/common/CommonServletHandler.java b/urule-console/src/main/java/com/bstek/urule/console/servlet/common/CommonServletHandler.java index 2d14ace8..8f4b78ef 100644 --- a/urule-console/src/main/java/com/bstek/urule/console/servlet/common/CommonServletHandler.java +++ b/urule-console/src/main/java/com/bstek/urule/console/servlet/common/CommonServletHandler.java @@ -267,7 +267,7 @@ public void loadXml(HttpServletRequest req, HttpServletResponse resp) throws Ser Element element=parseXml(inputStream); for(Deserializer des:deserializers){ if(des.support(element)){ - result.add(des.deserialize(element)); + result.add(des.deserialize(element,true)); if(des instanceof ActionLibraryDeserializer){ isaction=true; } diff --git a/urule-console/src/main/java/com/bstek/urule/console/servlet/flow/RuleFlowDesignerServletHandler.java b/urule-console/src/main/java/com/bstek/urule/console/servlet/flow/RuleFlowDesignerServletHandler.java index 03be9a05..531b1058 100644 --- a/urule-console/src/main/java/com/bstek/urule/console/servlet/flow/RuleFlowDesignerServletHandler.java +++ b/urule-console/src/main/java/com/bstek/urule/console/servlet/flow/RuleFlowDesignerServletHandler.java @@ -80,7 +80,7 @@ public void loadFlowDefinition(HttpServletRequest req, HttpServletResponse resp) inputStream=repositoryService.readFile(file,version); } Element root=parseXml(inputStream); - FlowDefinition fd = flowDeserializer.deserialize(root); + FlowDefinition fd = flowDeserializer.deserialize(root,true); inputStream.close(); writeObjectToJson(resp, new FlowDefinitionWrapper(fd)); } diff --git a/urule-console/src/main/java/com/bstek/urule/console/servlet/xml/XmlServletHandler.java b/urule-console/src/main/java/com/bstek/urule/console/servlet/xml/XmlServletHandler.java index b385cf0f..fab12418 100644 --- a/urule-console/src/main/java/com/bstek/urule/console/servlet/xml/XmlServletHandler.java +++ b/urule-console/src/main/java/com/bstek/urule/console/servlet/xml/XmlServletHandler.java @@ -101,7 +101,7 @@ public void loadXml(HttpServletRequest req, HttpServletResponse resp) throws Ser Element element=parseXml(inputStream); for(Deserializer des:deserializers){ if(des.support(element)){ - result.add(des.deserialize(element)); + result.add(des.deserialize(element,true)); if(des instanceof ActionLibraryDeserializer){ isaction=true; } diff --git a/urule-core/src/main/java/com/bstek/urule/builder/KnowledgeBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/KnowledgeBuilder.java index 505b88f8..25281fe3 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/KnowledgeBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/KnowledgeBuilder.java @@ -59,6 +59,9 @@ public class KnowledgeBuilder extends AbstractBuilder{ private DSLRuleSetBuilder dslRuleSetBuilder; public static final String BEAN_ID="urule.knowledgeBuilder"; public KnowledgeBase buildKnowledgeBase(ResourceBase resourceBase) throws IOException{ + return buildKnowledgeBase(resourceBase,true); + } + public KnowledgeBase buildKnowledgeBase(ResourceBase resourceBase,boolean withPermission) throws IOException{ KnowledgePackageService knowledgePackageService=(KnowledgePackageService)applicationContext.getBean(KnowledgePackageService.BEAN_ID); List rules=new ArrayList(); Map libMap=new HashMap(); @@ -77,7 +80,7 @@ public KnowledgeBase buildKnowledgeBase(ResourceBase resourceBase) throws IOExce if(!builder.support(root)){ continue; } - Object object=builder.build(root); + Object object=builder.build(root,withPermission); ResourceType type=builder.getType(); if(type.equals(ResourceType.RuleSet)){ RuleSet ruleSet=(RuleSet)object; @@ -125,7 +128,7 @@ public KnowledgeBase buildKnowledgeBase(ResourceBase resourceBase) throws IOExce break; } } - ResourceLibrary resourceLibrary=resourceLibraryBuilder.buildResourceLibrary(libMap.values()); + ResourceLibrary resourceLibrary=resourceLibraryBuilder.buildResourceLibrary(libMap.values(),withPermission); buildLoopRules(rules, resourceLibrary); Rete rete=reteBuilder.buildRete(rules, resourceLibrary); return new KnowledgeBase(rete,flowMap,retriveNoLhsRules(rules)); diff --git a/urule-core/src/main/java/com/bstek/urule/builder/ResourceLibraryBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/ResourceLibraryBuilder.java index 04306b4e..321daf12 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/ResourceLibraryBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/ResourceLibraryBuilder.java @@ -41,8 +41,11 @@ */ public class ResourceLibraryBuilder extends AbstractBuilder{ private BuiltInActionLibraryBuilder builtInActionLibraryBuilder; - @SuppressWarnings("unchecked") public ResourceLibrary buildResourceLibrary(Collection libraries){ + return buildResourceLibrary(libraries,true); + } + @SuppressWarnings("unchecked") + public ResourceLibrary buildResourceLibrary(Collection libraries,boolean withPermission){ if(libraries==null){ libraries=Collections.EMPTY_LIST; } @@ -52,7 +55,7 @@ public ResourceLibrary buildResourceLibrary(Collection libraries){ List parameterVariableCategories=new ArrayList(); ResourceBase resourceBase=newResourceBase(); for(Library lib:libraries){ - resourceBase.addResource(lib.getPath(),lib.getVersion()); + resourceBase.addResource(lib.getPath(),lib.getVersion(),withPermission); } for(Resource resource:resourceBase.getResources()){ String content=resource.getContent(); @@ -61,7 +64,7 @@ public ResourceLibrary buildResourceLibrary(Collection libraries){ if(!builder.support(root)){ continue; } - Object object=builder.build(root); + Object object=builder.build(root,withPermission); ResourceType type=builder.getType(); if(type.equals(ResourceType.ActionLibrary)){ ActionLibrary al=(ActionLibrary)object; diff --git a/urule-core/src/main/java/com/bstek/urule/builder/RulesRebuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/RulesRebuilder.java index a5fa8c3b..4b55a717 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/RulesRebuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/RulesRebuilder.java @@ -82,13 +82,16 @@ public class RulesRebuilder { private ResourceLibraryBuilder resourceLibraryBuilder; public void rebuildRules(List libraries, List rules) { + rebuildRules(libraries,rules,true); + } + public void rebuildRules(List libraries, List rules,boolean withPermission) { if(libraries==null){ return; } if(rules==null){ return; } - ResourceLibrary resLibraries=resourceLibraryBuilder.buildResourceLibrary(libraries); + ResourceLibrary resLibraries=resourceLibraryBuilder.buildResourceLibrary(libraries,withPermission); for(Rule rule:rules){ Map namedMap=new HashMap(); if(rule.getLhs()!=null){ diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ActionLibraryResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ActionLibraryResourceBuilder.java index fbc5b2c2..1bbd2a91 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ActionLibraryResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ActionLibraryResourceBuilder.java @@ -27,8 +27,8 @@ */ public class ActionLibraryResourceBuilder implements ResourceBuilder { private ActionLibraryDeserializer actionLibraryDeserializer; - public ActionLibrary build(Element root) { - return actionLibraryDeserializer.deserialize(root); + public ActionLibrary build(Element root,boolean withPermission) { + return actionLibraryDeserializer.deserialize(root,withPermission); } public void setActionLibraryDeserializer(ActionLibraryDeserializer actionLibraryDeserializer) { diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ConstantLibraryResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ConstantLibraryResourceBuilder.java index 89c9f47d..3b56792e 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ConstantLibraryResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ConstantLibraryResourceBuilder.java @@ -26,8 +26,8 @@ */ public class ConstantLibraryResourceBuilder implements ResourceBuilder { private ConstantLibraryDeserializer constantLibraryDeserializer; - public ConstantLibrary build(Element root) { - return constantLibraryDeserializer.deserialize(root); + public ConstantLibrary build(Element root,boolean withPermission) { + return constantLibraryDeserializer.deserialize(root,withPermission); } public boolean support(Element root) { return constantLibraryDeserializer.support(root); diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTableResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTableResourceBuilder.java index 4fb31e29..b771c7bd 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTableResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTableResourceBuilder.java @@ -26,8 +26,8 @@ */ public class DecisionTableResourceBuilder implements ResourceBuilder { private DecisionTableDeserializer decisionTableDeserializer; - public DecisionTable build(Element root) { - return decisionTableDeserializer.deserialize(root); + public DecisionTable build(Element root,boolean withPermission) { + return decisionTableDeserializer.deserialize(root,withPermission); } public ResourceType getType() { return ResourceType.DecisionTable; diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTreeResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTreeResourceBuilder.java index 5619f61f..145cbc2c 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTreeResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/DecisionTreeResourceBuilder.java @@ -27,8 +27,8 @@ public class DecisionTreeResourceBuilder implements ResourceBuilder { private DecisionTreeDeserializer decisionTreeDeserializer; @Override - public DecisionTree build(Element root) { - return decisionTreeDeserializer.deserialize(root); + public DecisionTree build(Element root,boolean withPermission) { + return decisionTreeDeserializer.deserialize(root,withPermission); } @Override public ResourceType getType() { diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/FlowResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/FlowResourceBuilder.java index 9f1d3ff4..9e662704 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/FlowResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/FlowResourceBuilder.java @@ -26,8 +26,8 @@ */ public class FlowResourceBuilder implements ResourceBuilder { private FlowDeserializer flowDeserializer; - public FlowDefinition build(Element root) { - return flowDeserializer.deserialize(root); + public FlowDefinition build(Element root,boolean withPermission) { + return flowDeserializer.deserialize(root,withPermission); } public ResourceType getType() { return ResourceType.Flow; diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ParameterLibraryResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ParameterLibraryResourceBuilder.java index 48c74e6b..6ae02087 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ParameterLibraryResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ParameterLibraryResourceBuilder.java @@ -30,12 +30,12 @@ public class ParameterLibraryResourceBuilder implements ResourceBuilder { private ParameterLibraryDeserializer parameterLibraryDeserializer; @Override - public VariableCategory build(Element root) { + public VariableCategory build(Element root,boolean withPermission) { VariableCategory category=new VariableCategory(); category.setName(VariableCategory.PARAM_CATEGORY); category.setClazz(HashMap.class.getName()); category.setType(CategoryType.Clazz); - category.setVariables(parameterLibraryDeserializer.deserialize(root)); + category.setVariables(parameterLibraryDeserializer.deserialize(root,withPermission)); return category; } @Override diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ResourceBuilder.java index eef4ffd5..8c501d69 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ResourceBuilder.java @@ -23,7 +23,7 @@ * @since 2014年12月22日 */ public interface ResourceBuilder{ - T build(Element root); + T build(Element root,boolean withPermission); boolean support(Element root); ResourceType getType(); } diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/RuleSetResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/RuleSetResourceBuilder.java index 9083aadf..3bc15b61 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/RuleSetResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/RuleSetResourceBuilder.java @@ -26,8 +26,8 @@ */ public class RuleSetResourceBuilder implements ResourceBuilder { private RuleSetDeserializer ruleSetDeserializer; - public RuleSet build(Element root) { - return ruleSetDeserializer.deserialize(root); + public RuleSet build(Element root,boolean withPermission) { + return ruleSetDeserializer.deserialize(root,withPermission); } public boolean support(Element root) { return ruleSetDeserializer.support(root); diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ScorecardResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ScorecardResourceBuilder.java index 0856b1d0..e4cbb470 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ScorecardResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ScorecardResourceBuilder.java @@ -58,8 +58,8 @@ public class ScorecardResourceBuilder implements ResourceBuilder { private ScorecardDeserializer scorecardDeserializer; private RulesRebuilder rulesRebuilder; @Override - public ScoreRule build(Element root) { - ScorecardDefinition scorecard = scorecardDeserializer.deserialize(root); + public ScoreRule build(Element root,boolean withPermission) { + ScorecardDefinition scorecard = scorecardDeserializer.deserialize(root,withPermission); ScoreRule scoreRule=new ScoreRule(); scoreRule.setName(scorecard.getName()); scoreRule.setEffectiveDate(scorecard.getEffectiveDate()); diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/ScriptDecisionTableResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/ScriptDecisionTableResourceBuilder.java index 6c10ebb4..fc50aa4c 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/ScriptDecisionTableResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/ScriptDecisionTableResourceBuilder.java @@ -26,8 +26,8 @@ */ public class ScriptDecisionTableResourceBuilder implements ResourceBuilder { private ScriptDecisionTableDeserializer scriptDecisionTableDeserializer; - public ScriptDecisionTable build(Element root) { - return scriptDecisionTableDeserializer.deserialize(root); + public ScriptDecisionTable build(Element root,boolean withPermission) { + return scriptDecisionTableDeserializer.deserialize(root,withPermission); } public ResourceType getType() { return ResourceType.ScriptDecisionTable; diff --git a/urule-core/src/main/java/com/bstek/urule/builder/resource/VariableLibraryResourceBuilder.java b/urule-core/src/main/java/com/bstek/urule/builder/resource/VariableLibraryResourceBuilder.java index 2745df57..3ccaf5cd 100644 --- a/urule-core/src/main/java/com/bstek/urule/builder/resource/VariableLibraryResourceBuilder.java +++ b/urule-core/src/main/java/com/bstek/urule/builder/resource/VariableLibraryResourceBuilder.java @@ -26,9 +26,9 @@ */ public class VariableLibraryResourceBuilder implements ResourceBuilder { private VariableLibraryDeserializer variableLibraryDeserializer; - public VariableLibrary build(Element root) { + public VariableLibrary build(Element root,boolean withPermission) { VariableLibrary lib=new VariableLibrary(); - lib.setVariableCategories(variableLibraryDeserializer.deserialize(root)); + lib.setVariableCategories(variableLibraryDeserializer.deserialize(root,withPermission)); return lib; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/AbstractParser.java b/urule-core/src/main/java/com/bstek/urule/parse/AbstractParser.java index 00e84e14..0d70e668 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/AbstractParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/AbstractParser.java @@ -29,7 +29,7 @@ * @since 2015年2月28日 */ public abstract class AbstractParser implements Parser { - protected List parseParameters(Element element,ValueParser valueParser) { + protected List parseParameters(Element element,ValueParser valueParser,boolean withPermission) { List parameters=new ArrayList(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -46,7 +46,7 @@ protected List parseParameters(Element element,ValueParser valueParse } Element e=(Element)o; if(valueParser.support(e.getName())){ - Value value=valueParser.parse(e); + Value value=valueParser.parse(e,withPermission); parameter.setValue(value); break; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/AbstractRuleParser.java b/urule-core/src/main/java/com/bstek/urule/parse/AbstractRuleParser.java index 8940cf54..14103ff5 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/AbstractRuleParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/AbstractRuleParser.java @@ -33,7 +33,7 @@ public abstract class AbstractRuleParser implements Parser { protected LhsParser lhsParser; protected RhsParser rhsParser; private OtherParser otherParser; - public void parseRule(Rule rule,Element element) { + public void parseRule(Rule rule,Element element,boolean withPermission) { rule.setName(element.attributeValue("name")); String salience=element.attributeValue("salience"); if(StringUtils.isNotEmpty(salience)){ @@ -81,11 +81,11 @@ public void parseRule(Rule rule,Element element) { } Element ele=(Element)obj; if(lhsParser.support(ele.getName())){ - rule.setLhs(lhsParser.parse(ele)); + rule.setLhs(lhsParser.parse(ele,withPermission)); }else if(rhsParser.support(ele.getName())){ - rule.setRhs(rhsParser.parse(ele)); + rule.setRhs(rhsParser.parse(ele,withPermission)); }else if(otherParser.support(ele.getName())){ - rule.setOther(otherParser.parse(ele)); + rule.setOther(otherParser.parse(ele,withPermission)); }else if(ele.getName().equals("remark")){ rule.setRemark(ele.getText()); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ActionLibraryParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ActionLibraryParser.java index 2e940654..94490049 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ActionLibraryParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ActionLibraryParser.java @@ -28,7 +28,7 @@ * @since 2014年12月23日 */ public class ActionLibraryParser implements Parser { - public ActionLibrary parse(Element element) { + public ActionLibrary parse(Element element,boolean withPermission) { ActionLibrary lib=new ActionLibrary(); for(Object obj:element.elements()){ if(obj==null){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/CommonFunctionActionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/CommonFunctionActionParser.java index 64df355d..7bf5886f 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/CommonFunctionActionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/CommonFunctionActionParser.java @@ -27,7 +27,7 @@ */ public class CommonFunctionActionParser extends ActionParser { @Override - public Action parse(Element element) { + public Action parse(Element element,boolean withPermission) { ExecuteCommonFunctionAction action=new ExecuteCommonFunctionAction(); action.setLabel(element.attributeValue("function-label")); action.setName(element.attributeValue("function-name")); @@ -51,7 +51,7 @@ public Action parse(Element element) { if(!e.getName().equals("value")){ continue; } - p.setObjectParameter(valueParser.parse(e)); + p.setObjectParameter(valueParser.parse(e,withPermission)); } action.setParameter(p); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ComplexArithmeticParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ComplexArithmeticParser.java index 6e85179e..7734542b 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ComplexArithmeticParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ComplexArithmeticParser.java @@ -27,7 +27,7 @@ public class ComplexArithmeticParser implements Parser { private ValueParser valueParser; private ParenParser parenParser; - public ComplexArithmetic parse(Element element) { + public ComplexArithmetic parse(Element element,boolean withPermission) { ComplexArithmetic arithmetic=new ComplexArithmetic(); ArithmeticType arithmeticType=ArithmeticType.valueOf(element.attributeValue("type")); arithmetic.setType(arithmeticType); @@ -37,9 +37,9 @@ public ComplexArithmetic parse(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - arithmetic.setValue(valueParser.parse(ele)); + arithmetic.setValue(valueParser.parse(ele,withPermission)); }else if(parenParser.support(ele.getName())){ - arithmetic.setValue(parenParser.parse(ele)); + arithmetic.setValue(parenParser.parse(ele,withPermission)); } } return arithmetic; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ConsolePrintActionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ConsolePrintActionParser.java index 631cb644..d9c8a244 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ConsolePrintActionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ConsolePrintActionParser.java @@ -25,7 +25,7 @@ * @since 2014年12月23日 */ public class ConsolePrintActionParser extends ActionParser { - public Action parse(Element element) { + public Action parse(Element element,boolean withPermission) { ConsolePrintAction action=new ConsolePrintAction(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -33,7 +33,7 @@ public Action parse(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - action.setValue(valueParser.parse(ele)); + action.setValue(valueParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ConstantLibraryParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ConstantLibraryParser.java index 7bd76a25..df8bdbd7 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ConstantLibraryParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ConstantLibraryParser.java @@ -31,7 +31,7 @@ */ public class ConstantLibraryParser implements Parser { public static final String BEAN_ID="urule.constantLibraryParser"; - public ConstantLibrary parse(Element element) { + public ConstantLibrary parse(Element element,boolean withPermission) { List categories=new ArrayList(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/CriteriaParser.java b/urule-core/src/main/java/com/bstek/urule/parse/CriteriaParser.java index e9979ec7..538a0064 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/CriteriaParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/CriteriaParser.java @@ -28,7 +28,7 @@ public class CriteriaParser extends CriterionParser { private ValueParser valueParser; private LeftParser leftParser; - public Criterion parse(Element element) { + public Criterion parse(Element element,boolean withPermission) { Criteria criteria=new Criteria(); Op op=Op.valueOf(element.attributeValue("op")); criteria.setOp(op); @@ -39,9 +39,9 @@ public Criterion parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(name.equals("value")){ - criteria.setValue(valueParser.parse(ele)); + criteria.setValue(valueParser.parse(ele,withPermission)); }else if(name.equals("left")){ - criteria.setLeft(leftParser.parse(ele)); + criteria.setLeft(leftParser.parse(ele,withPermission)); } } return criteria; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/CriterionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/CriterionParser.java index 54f58292..91022ba3 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/CriterionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/CriterionParser.java @@ -32,7 +32,7 @@ public abstract class CriterionParser extends AbstractParser implements ApplicationContextAware { protected Collection criterionParsers; - protected List parseCriterion(Element element){ + protected List parseCriterion(Element element,boolean withPermission){ List list=null; for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -43,7 +43,7 @@ protected List parseCriterion(Element element){ for(CriterionParser parser:criterionParsers){ if(parser.support(name)){ if(list==null)list=new ArrayList(); - Criterion criterion=parser.parse(ele); + Criterion criterion=parser.parse(ele,withPermission); if(criterion!=null){ list.add(criterion); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ExecuteMethodActionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ExecuteMethodActionParser.java index 091dad37..714d2ad7 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ExecuteMethodActionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ExecuteMethodActionParser.java @@ -28,13 +28,13 @@ * @since 2014年12月23日 */ public class ExecuteMethodActionParser extends ActionParser { - public Action parse(Element element) { + public Action parse(Element element,boolean withPermission) { ExecuteMethodAction action=new ExecuteMethodAction(); action.setBeanId(element.attributeValue("bean")); action.setBeanLabel(element.attributeValue("bean-label")); action.setMethodLabel(element.attributeValue("method-label")); action.setMethodName(element.attributeValue("method-name")); - List parameters = parseParameters(element,valueParser); + List parameters = parseParameters(element,valueParser,withPermission); action.setParameters(parameters); return action; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/JunctionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/JunctionParser.java index a7d03831..5b2b8247 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/JunctionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/JunctionParser.java @@ -27,8 +27,8 @@ * @since 2014年12月23日 */ public class JunctionParser extends CriterionParser { - public Criterion parse(Element element) { - List list=parseCriterion(element); + public Criterion parse(Element element,boolean withPermission) { + List list=parseCriterion(element,withPermission); if(list==null || list.size()==0){ return null; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/LeftParser.java b/urule-core/src/main/java/com/bstek/urule/parse/LeftParser.java index 4f906f7d..211acf68 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/LeftParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/LeftParser.java @@ -36,7 +36,7 @@ public class LeftParser extends AbstractParser { private SimpleArithmeticParser arithmeticParser; private ValueParser valueParser; @Override - public Left parse(Element element) { + public Left parse(Element element,boolean withPermission) { Left left=new Left(); String type=element.attributeValue("type"); if(StringUtils.isNotEmpty(type)){ @@ -49,16 +49,16 @@ public Left parse(Element element) { left.setLeftPart(buildVariableLeftPart(element)); break; case function: - left.setLeftPart(buildFunctionLeftPart(element)); + left.setLeftPart(buildFunctionLeftPart(element,withPermission)); break; case method: - left.setLeftPart(buildMethodLeftPart(element)); + left.setLeftPart(buildMethodLeftPart(element,withPermission)); break; case parameter: left.setLeftPart(buildVariableLeftPart(element)); break; case commonfunction: - left.setLeftPart(buildCommonFunctionLeftPart(element)); + left.setLeftPart(buildCommonFunctionLeftPart(element,withPermission)); case NamedReference: throw new RuleException("Not support reference type."); case all: @@ -76,14 +76,14 @@ public Left parse(Element element) { } Element ele=(Element)obj; if(arithmeticParser.support(ele.getName())){ - left.setArithmetic(arithmeticParser.parse(ele)); + left.setArithmetic(arithmeticParser.parse(ele,withPermission)); } } return left; } - private CommonFunctionLeftPart buildCommonFunctionLeftPart(Element element){ + private CommonFunctionLeftPart buildCommonFunctionLeftPart(Element element,boolean withPermission){ CommonFunctionLeftPart part=new CommonFunctionLeftPart(); part.setName(element.attributeValue("function-name")); part.setLabel(element.attributeValue("function-label")); @@ -107,27 +107,27 @@ private CommonFunctionLeftPart buildCommonFunctionLeftPart(Element element){ if(!e.getName().equals("value")){ continue; } - p.setObjectParameter(valueParser.parse(e)); + p.setObjectParameter(valueParser.parse(e,withPermission)); } part.setParameter(p); } return part; } - private MethodLeftPart buildMethodLeftPart(Element element){ + private MethodLeftPart buildMethodLeftPart(Element element,boolean withPermission){ MethodLeftPart part=new MethodLeftPart(); part.setBeanId(element.attributeValue("bean-name")); part.setBeanLabel(element.attributeValue("bean-label")); part.setMethodLabel(element.attributeValue("method-label")); part.setMethodName(element.attributeValue("method-name")); - part.setParameters(parseParameters(element, valueParser)); + part.setParameters(parseParameters(element, valueParser,withPermission)); return part; } - private FunctionLeftPart buildFunctionLeftPart(Element element){ + private FunctionLeftPart buildFunctionLeftPart(Element element,boolean withPermission){ FunctionLeftPart part=new FunctionLeftPart(); part.setName(element.attributeValue("name")); - part.setParameters(parseParameters(element, valueParser)); + part.setParameters(parseParameters(element, valueParser,withPermission)); return part; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/LhsParser.java b/urule-core/src/main/java/com/bstek/urule/parse/LhsParser.java index 79d8839a..abf5503d 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/LhsParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/LhsParser.java @@ -31,13 +31,13 @@ */ public class LhsParser implements Parser,ApplicationContextAware { private Collection criterionParsers; - public Lhs parse(Element element) { + public Lhs parse(Element element,boolean withPermission) { Lhs lhs=new Lhs(); - lhs.setCriterion(parseCriterion(element)); + lhs.setCriterion(parseCriterion(element,withPermission)); return lhs; } - public Criterion parseCriterion(Element element){ + public Criterion parseCriterion(Element element,boolean withPermission){ Criterion criterion=null; for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -47,7 +47,7 @@ public Criterion parseCriterion(Element element){ String name=ele.getName(); for(CriterionParser parser:criterionParsers){ if(parser.support(name)){ - criterion=(Criterion)parser.parse(ele); + criterion=(Criterion)parser.parse(ele,withPermission); if(criterion!=null){ break; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/LoopRuleParser.java b/urule-core/src/main/java/com/bstek/urule/parse/LoopRuleParser.java index a3a7821b..6b8b17df 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/LoopRuleParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/LoopRuleParser.java @@ -28,9 +28,9 @@ */ public class LoopRuleParser extends AbstractRuleParser { private ValueParser valueParser; - public LoopRule parse(Element element) { + public LoopRule parse(Element element,boolean withPermission) { LoopRule rule=new LoopRule(); - parseRule(rule, element); + parseRule(rule, element,withPermission); LoopStart loopStart=new LoopStart(); rule.setLoopStart(loopStart); @@ -43,9 +43,9 @@ public LoopRule parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(name.equals("loop-start")){ - loopStart.setActions(rhsParser.parseActions(ele)); + loopStart.setActions(rhsParser.parseActions(ele,withPermission)); }else if(name.equals("loop-end")){ - loopEnd.setActions(rhsParser.parseActions(ele)); + loopEnd.setActions(rhsParser.parseActions(ele,withPermission)); }else if(name.equals("loop-target")){ LoopTarget loopTarget=new LoopTarget(); rule.setLoopTarget(loopTarget); @@ -55,7 +55,7 @@ public LoopRule parse(Element element) { } Element e=(Element)eleObj; if(valueParser.support(e.getName())){ - loopTarget.setValue(valueParser.parse(e)); + loopTarget.setValue(valueParser.parse(e,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/NamedJunctionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/NamedJunctionParser.java index 1b82b4ad..8f2bb667 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/NamedJunctionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/NamedJunctionParser.java @@ -34,7 +34,7 @@ */ public class NamedJunctionParser extends CriterionParser { private ValueParser valueParser; - public Criterion parse(Element element) { + public Criterion parse(Element element,boolean withPermission) { NamedJunction junction=new NamedJunction(); junction.setReferenceName(element.attributeValue("reference-name")); junction.setVariableCategory(element.attributeValue("var-category")); @@ -50,12 +50,12 @@ public Criterion parse(Element element) { if(!name.equals("named-criteria")){ continue; } - items.add(parseNamedItem(ele)); + items.add(parseNamedItem(ele,withPermission)); } return junction; } - private NamedItem parseNamedItem(Element element){ + private NamedItem parseNamedItem(Element element,boolean withPermission){ NamedItem item=new NamedItem(); String variable=element.attributeValue("var"); if(StringUtils.isNotEmpty(variable)){ @@ -76,7 +76,7 @@ private NamedItem parseNamedItem(Element element){ } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - item.setValue(valueParser.parse(ele)); + item.setValue(valueParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/OtherParser.java b/urule-core/src/main/java/com/bstek/urule/parse/OtherParser.java index 626befab..de6d9d48 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/OtherParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/OtherParser.java @@ -30,7 +30,7 @@ */ public class OtherParser implements Parser,ApplicationContextAware { private Collection actionParsers; - public Other parse(Element element) { + public Other parse(Element element,boolean withPermission) { Other other=new Other(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -40,7 +40,7 @@ public Other parse(Element element) { String name=ele.getName(); for(ActionParser actionParser:actionParsers){ if(actionParser.support(name)){ - other.addAction(actionParser.parse(ele)); + other.addAction(actionParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ParameterLibraryParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ParameterLibraryParser.java index 8906d18b..d682f157 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ParameterLibraryParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ParameterLibraryParser.java @@ -29,7 +29,7 @@ public class ParameterLibraryParser implements Parser> { private VariableParser variableParser; @Override - public List parse(Element element) { + public List parse(Element element,boolean withPermission) { List variables=new ArrayList(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -38,7 +38,7 @@ public List parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(name.equals("parameter")){ - variables.add(variableParser.parse(ele)); + variables.add(variableParser.parse(ele,withPermission)); } } return variables; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ParenParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ParenParser.java index 7b9d81a7..757212c0 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ParenParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ParenParser.java @@ -27,7 +27,7 @@ public class ParenParser implements Parser { private ValueParser valueParser; private ComplexArithmeticParser arithmeticParser; @Override - public ParenValue parse(Element element) { + public ParenValue parse(Element element,boolean withPermission) { ParenValue value=new ParenValue(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -35,9 +35,9 @@ public ParenValue parse(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - value.setValue(valueParser.parse(ele)); + value.setValue(valueParser.parse(ele,withPermission)); }else if(arithmeticParser.support(ele.getName())){ - value.setArithmetic(arithmeticParser.parse(ele)); + value.setArithmetic(arithmeticParser.parse(ele,withPermission)); } } return value; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/Parser.java b/urule-core/src/main/java/com/bstek/urule/parse/Parser.java index 5dbd0ecf..65c5d156 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/Parser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/Parser.java @@ -23,5 +23,5 @@ */ public interface Parser { boolean support(String name); - T parse(Element element); + T parse(Element element,boolean withPermission); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/RhsParser.java b/urule-core/src/main/java/com/bstek/urule/parse/RhsParser.java index 5c0420c3..429dc4cb 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/RhsParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/RhsParser.java @@ -33,12 +33,12 @@ */ public class RhsParser implements Parser,ApplicationContextAware { private Collection actionParsers; - public Rhs parse(Element element) { + public Rhs parse(Element element,boolean withPermission) { Rhs rhs=new Rhs(); - rhs.setActions(parseActions(element)); + rhs.setActions(parseActions(element,withPermission)); return rhs; } - public List parseActions(Element element){ + public List parseActions(Element element,boolean withPermission){ List actions=new ArrayList(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -48,7 +48,7 @@ public List parseActions(Element element){ String name=ele.getName(); for(ActionParser actionParser:actionParsers){ if(actionParser.support(name)){ - actions.add(actionParser.parse(ele)); + actions.add(actionParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/RuleParser.java b/urule-core/src/main/java/com/bstek/urule/parse/RuleParser.java index 380f3cd5..dadc095f 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/RuleParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/RuleParser.java @@ -24,9 +24,9 @@ * @since 2014年12月23日 */ public class RuleParser extends AbstractRuleParser { - public Rule parse(Element element) { + public Rule parse(Element element,boolean withPermission) { Rule rule=new Rule(); - parseRule(rule, element); + parseRule(rule, element,withPermission); return rule; } public boolean support(String name) { diff --git a/urule-core/src/main/java/com/bstek/urule/parse/RuleSetParser.java b/urule-core/src/main/java/com/bstek/urule/parse/RuleSetParser.java index 72ea4a28..940bd74e 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/RuleSetParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/RuleSetParser.java @@ -35,7 +35,7 @@ public class RuleSetParser implements Parser { private RuleParser ruleParser; private LoopRuleParser loopRuleParser; private RulesRebuilder rulesRebuilder; - public RuleSet parse(Element element) { + public RuleSet parse(Element element,boolean withPermission) { RuleSet ruleSet=new RuleSet(); String parameterLibrary=element.attributeValue("parameter-library"); if(StringUtils.isNotEmpty(parameterLibrary)){ @@ -52,9 +52,9 @@ public RuleSet parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(ruleParser.support(name)){ - rules.add(ruleParser.parse(ele)); + rules.add(ruleParser.parse(ele,withPermission)); }else if(loopRuleParser.support(name)){ - rules.add(loopRuleParser.parse(ele)); + rules.add(loopRuleParser.parse(ele,withPermission)); }else if(name.equals("import-variable-library")){ ruleSet.addLibrary(new Library(ele.attributeValue("path"),null,LibraryType.Variable)); }else if(name.equals("import-constant-library")){ @@ -68,7 +68,7 @@ public RuleSet parse(Element element) { } } ruleSet.setRules(rules); - rulesRebuilder.rebuildRules(ruleSet.getLibraries(), rules); + rulesRebuilder.rebuildRules(ruleSet.getLibraries(), rules,withPermission); return ruleSet; } public void setRulesRebuilder(RulesRebuilder rulesRebuilder) { diff --git a/urule-core/src/main/java/com/bstek/urule/parse/SimpleArithmeticParser.java b/urule-core/src/main/java/com/bstek/urule/parse/SimpleArithmeticParser.java index c3b9e65e..0d80b2d2 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/SimpleArithmeticParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/SimpleArithmeticParser.java @@ -26,7 +26,7 @@ * @since 2014年12月23日 */ public class SimpleArithmeticParser implements Parser { - public SimpleArithmetic parse(Element element) { + public SimpleArithmetic parse(Element element,boolean withPermission) { SimpleArithmetic arithmetic=new SimpleArithmetic(); ArithmeticType arithmeticType=ArithmeticType.valueOf(element.attributeValue("type")); arithmetic.setType(arithmeticType); @@ -39,7 +39,7 @@ public SimpleArithmetic parse(Element element) { } Element ele=(Element)obj; if(this.support(ele.getName())){ - value.setArithmetic(this.parse(ele)); + value.setArithmetic(this.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/SpringBeanParser.java b/urule-core/src/main/java/com/bstek/urule/parse/SpringBeanParser.java index 00c1910b..9afc5b68 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/SpringBeanParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/SpringBeanParser.java @@ -27,7 +27,7 @@ * @since 2014年12月23日 */ public class SpringBeanParser implements Parser { - public SpringBean parse(Element element) { + public SpringBean parse(Element element,boolean withPermission) { SpringBean bean=new SpringBean(); bean.setId(element.attributeValue("id")); for(Object obj:element.elements()){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/ValueParser.java b/urule-core/src/main/java/com/bstek/urule/parse/ValueParser.java index 1ceba892..7b70de49 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/ValueParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/ValueParser.java @@ -41,7 +41,7 @@ */ public class ValueParser extends AbstractParser { private ComplexArithmeticParser arithmeticParser; - public Value parse(Element element) { + public Value parse(Element element,boolean withPermission) { AbstractValue av=null; ValueType type=ValueType.valueOf(element.attributeValue("type")); if(type.equals(ValueType.Input)){ @@ -88,7 +88,7 @@ public Value parse(Element element) { mv.setMethodName(methodName); String methodLabel=element.attributeValue("method-label"); mv.setMethodLabel(methodLabel); - List parameters = parseParameters(element,this); + List parameters = parseParameters(element,this,withPermission); mv.setParameters(parameters); av=mv; }else if(type.equals(ValueType.CommonFunction)){ @@ -115,7 +115,7 @@ public Value parse(Element element) { if(!e.getName().equals("value")){ continue; } - p.setObjectParameter(this.parse(e)); + p.setObjectParameter(this.parse(e,withPermission)); } value.setParameter(p); } @@ -150,7 +150,7 @@ public Value parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(arithmeticParser.support(name)){ - av.setArithmetic(arithmeticParser.parse(ele)); + av.setArithmetic(arithmeticParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/VariableAssignActionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/VariableAssignActionParser.java index c583e6a5..37f753cf 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/VariableAssignActionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/VariableAssignActionParser.java @@ -27,7 +27,7 @@ * @since 2014年12月23日 */ public class VariableAssignActionParser extends ActionParser { - public Action parse(Element element) { + public Action parse(Element element,boolean withPermission) { VariableAssignAction action=new VariableAssignAction(); String referenceName=element.attributeValue("reference-name"); if(StringUtils.isNotEmpty(referenceName)){ @@ -59,7 +59,7 @@ public Action parse(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - action.setValue(valueParser.parse(ele)); + action.setValue(valueParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/VariableCategoryParser.java b/urule-core/src/main/java/com/bstek/urule/parse/VariableCategoryParser.java index fdc8c1be..7dca3572 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/VariableCategoryParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/VariableCategoryParser.java @@ -26,7 +26,7 @@ */ public class VariableCategoryParser implements Parser { private VariableParser variableParser; - public VariableCategory parse(Element element) { + public VariableCategory parse(Element element,boolean withPermission) { VariableCategory category=new VariableCategory(); category.setName(element.attributeValue("name")); category.setClazz(element.attributeValue("clazz")); @@ -38,7 +38,7 @@ public VariableCategory parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(variableParser.support(name)){ - category.addVariable(variableParser.parse(ele)); + category.addVariable(variableParser.parse(ele,withPermission)); } } return category; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/VariableLibraryParser.java b/urule-core/src/main/java/com/bstek/urule/parse/VariableLibraryParser.java index 8f2e468e..75020e53 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/VariableLibraryParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/VariableLibraryParser.java @@ -28,7 +28,7 @@ */ public class VariableLibraryParser implements Parser> { private VariableCategoryParser variableCategoryParser; - public List parse(Element element) { + public List parse(Element element,boolean withPermission) { List variableCategories=new ArrayList(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -37,7 +37,7 @@ public List parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(variableCategoryParser.support(name)){ - variableCategories.add(variableCategoryParser.parse(ele)); + variableCategories.add(variableCategoryParser.parse(ele,withPermission)); } } return variableCategories; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/VariableParser.java b/urule-core/src/main/java/com/bstek/urule/parse/VariableParser.java index 21b43a24..e9bf1f7e 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/VariableParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/VariableParser.java @@ -26,7 +26,7 @@ * @since 2014年12月23日 */ public class VariableParser implements Parser { - public Variable parse(Element element) { + public Variable parse(Element element,boolean withPermission) { Variable variable=new Variable(); variable.setName(element.attributeValue("name")); variable.setLabel(element.attributeValue("label")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ActionTreeNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ActionTreeNodeParser.java index c0431bd5..186d0b35 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ActionTreeNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ActionTreeNodeParser.java @@ -37,7 +37,7 @@ public class ActionTreeNodeParser implements Parser,ApplicationContextAware { private Collection actionParsers; @Override - public ActionTreeNode parse(Element element) { + public ActionTreeNode parse(Element element,boolean withPermission) { ActionTreeNode node=new ActionTreeNode(); node.setNodeType(TreeNodeType.action); List actions=new ArrayList(); @@ -50,7 +50,7 @@ public ActionTreeNode parse(Element element) { for(ActionParser actionParser:actionParsers){ if(actionParser.support(name)){ - actions.add(actionParser.parse(ele)); + actions.add(actionParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ConditionTreeNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ConditionTreeNodeParser.java index 83637ac3..5300cb4c 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ConditionTreeNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/ConditionTreeNodeParser.java @@ -37,7 +37,7 @@ public class ConditionTreeNodeParser implements Parser { private VariableTreeNodeParser variableTreeNodeParser; private ActionTreeNodeParser actionTreeNodeParser; @Override - public ConditionTreeNode parse(Element element) { + public ConditionTreeNode parse(Element element,boolean withPermission) { ConditionTreeNode node=new ConditionTreeNode(); node.setNodeType(TreeNodeType.condition); node.setOp(Op.valueOf(element.attributeValue("op"))); @@ -51,17 +51,17 @@ public ConditionTreeNode parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(valueParser.support(name)){ - node.setValue(valueParser.parse(ele)); + node.setValue(valueParser.parse(ele,withPermission)); }else if(support(name)){ - ConditionTreeNode cn=parse(ele); + ConditionTreeNode cn=parse(ele,withPermission); cn.setParentNode(node); conditionTreeNodes.add(cn); }else if(variableTreeNodeParser.support(name)){ - VariableTreeNode vn=variableTreeNodeParser.parse(ele); + VariableTreeNode vn=variableTreeNodeParser.parse(ele,withPermission); vn.setParentNode(node); variableTreeNodes.add(vn); }else if(actionTreeNodeParser.support(name)){ - ActionTreeNode an=actionTreeNodeParser.parse(ele); + ActionTreeNode an=actionTreeNodeParser.parse(ele,withPermission); an.setParentNode(node); actionTreeNodes.add(an); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/DecisionTreeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/DecisionTreeParser.java index 2ebba72c..08961845 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/DecisionTreeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/DecisionTreeParser.java @@ -50,7 +50,7 @@ public class DecisionTreeParser implements Parser { private VariableTreeNodeParser variableTreeNodeParser; private RulesRebuilder rulesRebuilder; @Override - public DecisionTree parse(Element element) { + public DecisionTree parse(Element element,boolean withPermission) { DecisionTree tree=new DecisionTree(); String salience=element.attributeValue("salience"); @@ -92,7 +92,7 @@ public DecisionTree parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(variableTreeNodeParser.support(name)){ - tree.setVariableTreeNode(variableTreeNodeParser.parse(ele)); + tree.setVariableTreeNode(variableTreeNodeParser.parse(ele,withPermission)); }if(name.equals("import-variable-library")){ libs.add(new Library(ele.attributeValue("path"),null,LibraryType.Variable)); }else if(name.equals("import-constant-library")){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/VariableTreeNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/VariableTreeNodeParser.java index 6ddf490f..32376dc4 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/VariableTreeNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/decisiontree/VariableTreeNodeParser.java @@ -34,7 +34,7 @@ public class VariableTreeNodeParser implements Parser { private LeftParser leftParser; private ConditionTreeNodeParser conditionTreeNodeParser; @Override - public VariableTreeNode parse(Element element) { + public VariableTreeNode parse(Element element,boolean withPermission) { VariableTreeNode node=new VariableTreeNode(); node.setNodeType(TreeNodeType.variable); List conditionTreeNodes=new ArrayList(); @@ -45,9 +45,9 @@ public VariableTreeNode parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(name.equals("left")){ - node.setLeft(leftParser.parse(ele)); + node.setLeft(leftParser.parse(ele,withPermission)); }else if(conditionTreeNodeParser.support(name)){ - ConditionTreeNode cn=conditionTreeNodeParser.parse(ele); + ConditionTreeNode cn=conditionTreeNodeParser.parse(ele,withPermission); cn.setParentNode(node); conditionTreeNodes.add(cn); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ActionLibraryDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ActionLibraryDeserializer.java index 9406fb9f..7cb360b1 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ActionLibraryDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ActionLibraryDeserializer.java @@ -27,8 +27,8 @@ public class ActionLibraryDeserializer implements Deserializer { public static final String BEAN_ID="urule.actionLibraryDeserializer"; private ActionLibraryParser actionLibraryParser; - public ActionLibrary deserialize(Element root) { - return actionLibraryParser.parse(root); + public ActionLibrary deserialize(Element root,boolean withPermission) { + return actionLibraryParser.parse(root,withPermission); } public boolean support(Element root) { return actionLibraryParser.support(root.getName()); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ConstantLibraryDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ConstantLibraryDeserializer.java index 438d695f..8cc9b951 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ConstantLibraryDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ConstantLibraryDeserializer.java @@ -27,8 +27,8 @@ public class ConstantLibraryDeserializer implements Deserializer { public static final String BEAN_ID="urule.constantLibraryDeserializer"; private ConstantLibraryParser constantLibraryParser; - public ConstantLibrary deserialize(Element root) { - return constantLibraryParser.parse(root); + public ConstantLibrary deserialize(Element root,boolean withPermission) { + return constantLibraryParser.parse(root,withPermission); } public boolean support(Element root) { return constantLibraryParser.support(root.getName()); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTableDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTableDeserializer.java index 24a71154..17aed6af 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTableDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTableDeserializer.java @@ -27,8 +27,8 @@ public class DecisionTableDeserializer implements Deserializer{ public static final String BEAN_ID="urule.decisionTableDeserializer"; private DecisionTableParser decisionTableParser; - public DecisionTable deserialize(Element root) { - return decisionTableParser.parse(root); + public DecisionTable deserialize(Element root,boolean withPermission) { + return decisionTableParser.parse(root,withPermission); } public boolean support(Element root) { return decisionTableParser.support(root.getName()); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTreeDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTreeDeserializer.java index 4bee567c..15490c5a 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTreeDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/DecisionTreeDeserializer.java @@ -28,8 +28,8 @@ public class DecisionTreeDeserializer implements Deserializer { public static final String BEAN_ID="urule.decisionTreeDeserializer"; private DecisionTreeParser decisionTreeParser; @Override - public DecisionTree deserialize(Element root) { - return decisionTreeParser.parse(root); + public DecisionTree deserialize(Element root,boolean withPermission) { + return decisionTreeParser.parse(root,withPermission); } public void setDecisionTreeParser(DecisionTreeParser decisionTreeParser) { this.decisionTreeParser = decisionTreeParser; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/Deserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/Deserializer.java index aa7777f4..b0386840 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/Deserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/Deserializer.java @@ -21,6 +21,6 @@ * @since 2014年12月23日 */ public interface Deserializer{ - T deserialize(Element root); + T deserialize(Element root,boolean withPermission); boolean support(Element root); } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/FlowDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/FlowDeserializer.java index 2d225299..e0a1d027 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/FlowDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/FlowDeserializer.java @@ -26,8 +26,8 @@ public class FlowDeserializer implements Deserializer{ public static final String BEAN_ID="urule.flowDeserializer"; private FlowDefinitionParser flowDefinitionParser; - public FlowDefinition deserialize(Element root) { - return (FlowDefinition)flowDefinitionParser.parse(root); + public FlowDefinition deserialize(Element root,boolean withPermission) { + return (FlowDefinition)flowDefinitionParser.parse(root,withPermission); } public boolean support(Element root) { if(flowDefinitionParser.support(root.getName())){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ParameterLibraryDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ParameterLibraryDeserializer.java index 31fad0ab..844ef4c8 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ParameterLibraryDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ParameterLibraryDeserializer.java @@ -30,8 +30,8 @@ public class ParameterLibraryDeserializer implements Deserializer public static final String BEAN_ID="urule.parameterLibraryDeserializer"; private ParameterLibraryParser parameterLibraryParser; @Override - public List deserialize(Element root) { - return parameterLibraryParser.parse(root); + public List deserialize(Element root,boolean withPermission) { + return parameterLibraryParser.parse(root,withPermission); } @Override public boolean support(Element root) { diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/RuleSetDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/RuleSetDeserializer.java index 4938802d..7002cf23 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/RuleSetDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/RuleSetDeserializer.java @@ -27,8 +27,8 @@ public class RuleSetDeserializer implements Deserializer{ public static final String BEAN_ID="urule.ruleSetDeserializer"; private RuleSetParser ruleSetParser; - public RuleSet deserialize(Element root) { - return ruleSetParser.parse(root); + public RuleSet deserialize(Element root,boolean withPermission) { + return ruleSetParser.parse(root,withPermission); } public boolean support(Element root) { if(ruleSetParser.support(root.getName())){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScorecardDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScorecardDeserializer.java index 5f683e65..ff6bd0f4 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScorecardDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScorecardDeserializer.java @@ -28,8 +28,8 @@ public class ScorecardDeserializer implements Deserializer public static final String BEAN_ID="urule.scorecardDeserializer"; private ScorecardParser scorecardParser; @Override - public ScorecardDefinition deserialize(Element root) { - ScorecardDefinition card=scorecardParser.parse(root); + public ScorecardDefinition deserialize(Element root,boolean withPermission) { + ScorecardDefinition card=scorecardParser.parse(root,withPermission); return card; } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScriptDecisionTableDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScriptDecisionTableDeserializer.java index 6529ce24..7c150e2d 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScriptDecisionTableDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/ScriptDecisionTableDeserializer.java @@ -27,8 +27,8 @@ public class ScriptDecisionTableDeserializer implements Deserializer{ public static final String BEAN_ID="urule.scriptDecisionTableDeserializer"; private ScriptDecisionTableParser scriptDecisionTableParser; - public ScriptDecisionTable deserialize(Element root) { - return scriptDecisionTableParser.parse(root); + public ScriptDecisionTable deserialize(Element root,boolean withPermission) { + return scriptDecisionTableParser.parse(root,withPermission); } public boolean support(Element root) { return scriptDecisionTableParser.support(root.getName()); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/VariableLibraryDeserializer.java b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/VariableLibraryDeserializer.java index 2ca788e2..006e4402 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/deserializer/VariableLibraryDeserializer.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/deserializer/VariableLibraryDeserializer.java @@ -30,8 +30,8 @@ public class VariableLibraryDeserializer implements Deserializer>{ public static final String BEAN_ID="urule.variableLibraryDeserializer"; private VariableLibraryParser variableLibraryParser; - public List deserialize(Element root) { - return variableLibraryParser.parse(root); + public List deserialize(Element root,boolean withPermission) { + return variableLibraryParser.parse(root,withPermission); } public boolean support(Element root) { if(variableLibraryParser.support(root.getName())){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/ActionNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/ActionNodeParser.java index 002935fc..35e900f4 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/ActionNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/ActionNodeParser.java @@ -24,7 +24,7 @@ * @since 2014年12月23日 */ public class ActionNodeParser extends FlowNodeParser { - public ActionNode parse(Element element) { + public ActionNode parse(Element element,boolean withPermission) { ActionNode action=new ActionNode(element.attributeValue("name")); action.setActionBean(element.attributeValue("action-bean")); action.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/DecisionNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/DecisionNodeParser.java index 896da735..24d44d22 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/DecisionNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/DecisionNodeParser.java @@ -30,7 +30,7 @@ * @since 2014年12月23日 */ public class DecisionNodeParser extends FlowNodeParser { - public DecisionNode parse(Element element) { + public DecisionNode parse(Element element,boolean withPermission) { DecisionNode decision=new DecisionNode(element.attributeValue("name")); decision.setEventBean(element.attributeValue("event-bean")); String decitionType=element.attributeValue("decision-type"); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/EndNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/EndNodeParser.java index 76e2eda7..83f0c124 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/EndNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/EndNodeParser.java @@ -24,7 +24,7 @@ * @since 2014年12月23日 */ public class EndNodeParser extends FlowNodeParser { - public EndNode parse(Element element) { + public EndNode parse(Element element,boolean withPermission) { EndNode end=new EndNode(element.attributeValue("name")); end.setConnections(parseConnections(element)); end.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/FlowDefinitionParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/FlowDefinitionParser.java index cb4fe9eb..e64d78cc 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/FlowDefinitionParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/FlowDefinitionParser.java @@ -38,7 +38,7 @@ @SuppressWarnings("rawtypes") public class FlowDefinitionParser implements Parser,ApplicationContextAware { private Collection nodeParsers; - public FlowDefinition parse(Element element) { + public FlowDefinition parse(Element element,boolean withPermission) { FlowDefinition flow=new FlowDefinition(); flow.setId(element.attributeValue("id")); String debug=element.attributeValue("debug"); @@ -63,7 +63,7 @@ public FlowDefinition parse(Element element) { }else{ for(FlowNodeParser parser:nodeParsers){ if(parser.support(ele.getName())){ - nodes.add((FlowNode)parser.parse(ele)); + nodes.add((FlowNode)parser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/ForkNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/ForkNodeParser.java index 5e0e015c..f2f149e2 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/ForkNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/ForkNodeParser.java @@ -24,7 +24,7 @@ * @since 2014年12月23日 */ public class ForkNodeParser extends FlowNodeParser { - public ForkNode parse(Element element) { + public ForkNode parse(Element element,boolean withPermission) { ForkNode fork=new ForkNode(element.attributeValue("name")); fork.setConnections(parseConnections(element)); fork.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/JoinNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/JoinNodeParser.java index d256fd07..d78c8b6a 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/JoinNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/JoinNodeParser.java @@ -24,7 +24,7 @@ * @since 2014年12月23日 */ public class JoinNodeParser extends FlowNodeParser { - public JoinNode parse(Element element) { + public JoinNode parse(Element element,boolean withPermission) { JoinNode join=new JoinNode(element.attributeValue("name")); join.setConnections(parseConnections(element)); join.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/RuleNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/RuleNodeParser.java index a41fcbbc..b455c794 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/RuleNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/RuleNodeParser.java @@ -25,7 +25,7 @@ */ public class RuleNodeParser extends FlowNodeParser { @Override - public RuleNode parse(Element element) { + public RuleNode parse(Element element,boolean withPermission) { RuleNode node=new RuleNode(element.attributeValue("name")); node.setFile(element.attributeValue("file")); node.setVersion(element.attributeValue("version")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/RulePackageNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/RulePackageNodeParser.java index bb4a06db..86e56870 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/RulePackageNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/RulePackageNodeParser.java @@ -25,7 +25,7 @@ */ public class RulePackageNodeParser extends FlowNodeParser { @Override - public RulePackageNode parse(Element element) { + public RulePackageNode parse(Element element,boolean withPermission) { RulePackageNode node=new RulePackageNode(element.attributeValue("name")); node.setConnections(parseConnections(element)); node.setProject(element.attributeValue("project")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/ScriptNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/ScriptNodeParser.java index 0bfbdc71..21e4a768 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/ScriptNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/ScriptNodeParser.java @@ -25,7 +25,7 @@ */ public class ScriptNodeParser extends FlowNodeParser { @Override - public ScriptNode parse(Element element) { + public ScriptNode parse(Element element,boolean withPermission) { ScriptNode node =new ScriptNode(); node.setName(element.attributeValue("name")); node.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/flow/StartNodeParser.java b/urule-core/src/main/java/com/bstek/urule/parse/flow/StartNodeParser.java index 69466721..373cafbe 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/flow/StartNodeParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/flow/StartNodeParser.java @@ -24,7 +24,7 @@ * @since 2014年12月23日 */ public class StartNodeParser extends FlowNodeParser { - public StartNode parse(Element element) { + public StartNode parse(Element element,boolean withPermission) { StartNode start=new StartNode(element.attributeValue("name")); start.setConnections(parseConnections(element)); start.setEventBean(element.attributeValue("event-bean")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/AttributeRowParser.java b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/AttributeRowParser.java index c7595e82..0612865d 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/AttributeRowParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/AttributeRowParser.java @@ -30,7 +30,7 @@ */ public class AttributeRowParser implements Parser { @Override - public AttributeRow parse(Element element) { + public AttributeRow parse(Element element,boolean withPermission) { AttributeRow row=new AttributeRow(); row.setRowNumber(Integer.valueOf(element.attributeValue("row-number"))); List rows=new ArrayList(); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CardCellParser.java b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CardCellParser.java index f803f269..f902e5dd 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CardCellParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CardCellParser.java @@ -33,7 +33,7 @@ public class CardCellParser implements Parser { private ValueParser valueParser; private JointParser jointParser; @Override - public CardCell parse(Element element) { + public CardCell parse(Element element,boolean withPermission) { CardCell cell=new CardCell(); cell.setType(CellType.valueOf(element.attributeValue("type"))); cell.setCol(Integer.valueOf(element.attributeValue("col"))); @@ -51,9 +51,9 @@ public CardCell parse(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - cell.setValue(valueParser.parse(ele)); + cell.setValue(valueParser.parse(ele,withPermission)); }else if(jointParser.support(ele.getName())){ - cell.setJoint(jointParser.parse(ele)); + cell.setJoint(jointParser.parse(ele,withPermission)); } } return cell; diff --git a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CustomColParser.java b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CustomColParser.java index aea55fa2..df720c7e 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CustomColParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/CustomColParser.java @@ -26,7 +26,7 @@ */ public class CustomColParser implements Parser { @Override - public CustomCol parse(Element element) { + public CustomCol parse(Element element,boolean withPermission) { CustomCol col=new CustomCol(); col.setColNumber(Integer.parseInt(element.attributeValue("col-number"))); col.setName(element.attributeValue("name")); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/ScorecardParser.java b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/ScorecardParser.java index 22a083f4..ee16cc9f 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/scorecard/ScorecardParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/scorecard/ScorecardParser.java @@ -52,7 +52,7 @@ public class ScorecardParser implements Parser { private CustomColParser customColParser=new CustomColParser(); private RulesRebuilder rulesRebuilder; @Override - public ScorecardDefinition parse(Element element) { + public ScorecardDefinition parse(Element element,boolean withPermission) { ScorecardDefinition card=new ScorecardDefinition(); card.setName(element.attributeValue("name")); card.setScoringType(ScoringType.valueOf(element.attributeValue("scoring-type"))); @@ -124,11 +124,11 @@ public ScorecardDefinition parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(cardCellParser.support(name)){ - cells.add(cardCellParser.parse(ele)); + cells.add(cardCellParser.parse(ele,withPermission)); }else if(attributeRowParser.support(name)){ - rows.add(attributeRowParser.parse(ele)); + rows.add(attributeRowParser.parse(ele,withPermission)); }else if(customColParser.support(name)){ - cols.add(customColParser.parse(ele)); + cols.add(customColParser.parse(ele,withPermission)); }else if(name.equals("import-variable-library")){ card.addLibrary(new Library(ele.attributeValue("path"),null,LibraryType.Variable)); }else if(name.equals("import-constant-library")){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/CellParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/CellParser.java index b9013d5c..3f02feab 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/CellParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/CellParser.java @@ -35,7 +35,7 @@ public class CellParser implements Parser,ApplicationContextAware { private JointParser jointParser; private ValueParser valueParser; private Collection actionParsers; - public Cell parse(Element element) { + public Cell parse(Element element,boolean withPermission) { Cell cell=new Cell(); cell.setRow(Integer.valueOf(element.attributeValue("row"))); cell.setCol(Integer.valueOf(element.attributeValue("col"))); @@ -47,13 +47,13 @@ public Cell parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(jointParser.support(name)){ - cell.setJoint(jointParser.parse(ele)); + cell.setJoint(jointParser.parse(ele,withPermission)); }else if(valueParser.support(name)){ - cell.setValue(valueParser.parse(ele)); + cell.setValue(valueParser.parse(ele,withPermission)); }else{ for(ActionParser parser:actionParsers){ if(parser.support(name)){ - cell.setAction(parser.parse(ele)); + cell.setAction(parser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/ColumnParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/ColumnParser.java index 613b9b36..4dcd1b8d 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/ColumnParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/ColumnParser.java @@ -28,7 +28,7 @@ * @since 2015年1月19日 */ public class ColumnParser implements Parser { - public Column parse(Element element) { + public Column parse(Element element,boolean withPermission) { Column col=new Column(); col.setNum(Integer.valueOf(element.attributeValue("num"))); col.setType(ColumnType.valueOf(element.attributeValue("type"))); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/DecisionTableParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/DecisionTableParser.java index 4ead7960..e3ef1ef2 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/DecisionTableParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/DecisionTableParser.java @@ -47,7 +47,7 @@ public class DecisionTableParser implements Parser { private ColumnParser columnParser; private CellParser cellParser; private RulesRebuilder rulesRebuilder; - public DecisionTable parse(Element element) { + public DecisionTable parse(Element element,boolean withPermission) { DecisionTable table =new DecisionTable(); String salience=element.attributeValue("salience"); if(StringUtils.isNotEmpty(salience)){ @@ -85,11 +85,11 @@ public DecisionTable parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(rowParser.support(name)){ - table.addRow(rowParser.parse(ele)); + table.addRow(rowParser.parse(ele,withPermission)); }else if(columnParser.support(name)){ - table.addColumn(columnParser.parse(ele)); + table.addColumn(columnParser.parse(ele,withPermission)); }else if(cellParser.support(name)){ - table.addCell(cellParser.parse(ele)); + table.addCell(cellParser.parse(ele,withPermission)); }if(name.equals("import-variable-library")){ table.addLibrary(new Library(ele.attributeValue("path"),null,LibraryType.Variable)); }else if(name.equals("import-constant-library")){ diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/JointParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/JointParser.java index 4450041e..df53fc61 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/JointParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/JointParser.java @@ -30,7 +30,7 @@ */ public class JointParser implements Parser { private ValueParser valueParser; - public Joint parse(Element element) { + public Joint parse(Element element,boolean withPermission) { Joint joint=new Joint(); joint.setType(JointType.valueOf(element.attributeValue("type"))); for(Object obj:element.elements()){ @@ -39,14 +39,14 @@ public Joint parse(Element element) { } Element ele=(Element)obj; if(ele.getName().equals("condition")){ - joint.addCondition(parseCondition(ele)); + joint.addCondition(parseCondition(ele,withPermission)); }else if(support(ele.getName())){ - joint.addJoint(parse(ele)); + joint.addJoint(parse(ele,withPermission)); } } return joint; } - public Condition parseCondition(Element element) { + public Condition parseCondition(Element element,boolean withPermission) { Condition condition=new Condition(); condition.setOp(Op.valueOf(element.attributeValue("op"))); for(Object obj:element.elements()){ @@ -55,7 +55,7 @@ public Condition parseCondition(Element element) { } Element ele=(Element)obj; if(valueParser.support(ele.getName())){ - condition.setValue(valueParser.parse(ele)); + condition.setValue(valueParser.parse(ele,withPermission)); break; } } diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/RowParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/RowParser.java index 7567cf34..05b3c88a 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/RowParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/RowParser.java @@ -25,7 +25,7 @@ * @since 2015年1月19日 */ public class RowParser implements Parser { - public Row parse(Element element) { + public Row parse(Element element,boolean withPermission) { Row row=new Row(); row.setHeight(Integer.valueOf(element.attributeValue("height"))); row.setNum(Integer.valueOf(element.attributeValue("num"))); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptCellParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptCellParser.java index 1c7548b9..31022748 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptCellParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptCellParser.java @@ -25,7 +25,7 @@ * @since 2015年1月19日 */ public class ScriptCellParser implements Parser{ - public ScriptCell parse(Element element) { + public ScriptCell parse(Element element,boolean withPermission) { ScriptCell cell=new ScriptCell(); cell.setRow(Integer.valueOf(element.attributeValue("row"))); cell.setCol(Integer.valueOf(element.attributeValue("col"))); diff --git a/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptDecisionTableParser.java b/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptDecisionTableParser.java index 35cb6c70..09da118b 100644 --- a/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptDecisionTableParser.java +++ b/urule-core/src/main/java/com/bstek/urule/parse/table/ScriptDecisionTableParser.java @@ -30,7 +30,7 @@ public class ScriptDecisionTableParser implements Parser { private RowParser rowParser; private ColumnParser columnParser; private ScriptCellParser scriptCellParser; - public ScriptDecisionTable parse(Element element) { + public ScriptDecisionTable parse(Element element,boolean withPermission) { ScriptDecisionTable table =new ScriptDecisionTable(); for(Object obj:element.elements()){ if(obj==null || !(obj instanceof Element)){ @@ -39,11 +39,11 @@ public ScriptDecisionTable parse(Element element) { Element ele=(Element)obj; String name=ele.getName(); if(rowParser.support(name)){ - table.addRow(rowParser.parse(ele)); + table.addRow(rowParser.parse(ele,withPermission)); }else if(columnParser.support(name)){ - table.addColumn(columnParser.parse(ele)); + table.addColumn(columnParser.parse(ele,withPermission)); }else if(scriptCellParser.support(name)){ - table.addCell(scriptCellParser.parse(ele)); + table.addCell(scriptCellParser.parse(ele,withPermission)); }if(name.equals("import-variable-library")){ table.addLibrary(new Library(ele.attributeValue("path"),null,LibraryType.Variable)); }else if(name.equals("import-constant-library")){