/**
  * TODO: Description.
  *
  * @param service
  * @param config TODO.
  * @throws JsonValueException TODO.
  */
 public Policy(SynchronizationService service, JsonValue config) throws JsonValueException {
   this.service = service;
   situation = config.get("situation").required().asEnum(Situation.class);
   JsonValue action = config.get("action").required();
   if (action.isString()) {
     this.action = action.asEnum(Action.class);
     this.script = null;
     this.scriptScope = null;
   } else {
     this.action = null;
     this.script = Scripts.newInstance("Policy", action);
     if (action.isMap() && action.asMap().size() > 2) {
       // If there is additional attributes then copy them
       scriptScope = action.copy().asMap();
       scriptScope.remove("type");
       scriptScope.remove("source");
       scriptScope.remove("file");
     } else {
       scriptScope = null;
     }
   }
   JsonValue pAction = config.get("postAction");
   if (pAction.isNull()) {
     this.postAction = null;
   } else {
     this.postAction = Scripts.newInstance("PostAction", pAction);
   }
 }