Include impacted changes for APPC-346,APPC-348
[appc.git] / appc-dispatcher / appc-request-handler / appc-request-handler-core / src / main / java / org / onap / appc / validationpolicy / rules / RuleFactory.java
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.appc.requesthandler.impl;
+package org.onap.appc.validationpolicy.rules;
 
-import org.onap.appc.domainmodel.lcm.RuntimeContext;
-import org.onap.appc.executor.UnstableVNFException;
+import org.onap.appc.domainmodel.lcm.VNFOperation;
 
-public class VMRequestHandlerImpl extends AbstractRequestHandlerImpl{
+import java.util.Set;
 
-    protected void handleRequest(RuntimeContext runtimeContext) {
-        runtimeContext.setIsLockAcquired(false);
-        callWfOperation(runtimeContext);
-    }
+public class RuleFactory {
 
-    @Override
-    public void onRequestExecutionStart(String vnfId, boolean readOnlyActivity, String requestIdentifierString, boolean forceFlag) throws UnstableVNFException {
+    private RuleFactory(){
+        
+    }
 
+    public static Rule createRule(String validationRule, Set<VNFOperation> inclusions, Set<VNFOperation> exclusions){
+        switch (validationRule) {
+            case "Accept":
+                return new AcceptRule(inclusions, exclusions);
+            case "Reject":
+                return new RejectRule(inclusions, exclusions);
+            default:
+                throw new RuntimeException("Rule not supported " + validationRule);
+        }
     }
 }