Beispiel #1
0
 /**
  * Set these rules to be waived or enabled
  *
  * @param rules
  * @param waived
  */
 public static void setWaivedRules(EPlan element, Set<ERule> rules, boolean waived) {
   EcoreEList<String> oldRuleNames = getWaivedRuleNames(element);
   List<String> changedRuleNames = new ArrayList<String>();
   for (ERule rule : rules) {
     changedRuleNames.add(rule.getName());
   }
   if (waived) {
     FeatureTransactionAddAllOperation.execute("waive rule(s)", oldRuleNames, changedRuleNames);
   } else {
     FeatureTransactionRemoveAllOperation.execute(
         "unwaive rule(s)", oldRuleNames, changedRuleNames);
   }
 }
Beispiel #2
0
 /**
  * Set some particular rule to be waived or enabled
  *
  * @param rule
  * @param waived
  */
 public static void setWaived(EPlan element, ERule rule, boolean waived) {
   EcoreEList<String> ruleNames = getWaivedRuleNames(element);
   String name = rule.getName();
   if (waived) {
     FeatureTransactionAddOperation.execute("waive rule", ruleNames, name);
   } else if (!waived) {
     FeatureTransactionRemoveOperation.execute("unwaive rule", ruleNames, name);
   }
 }
Beispiel #3
0
 /**
  * Returns whether or not the rule is waived for this plan
  *
  * @see isEnabled
  * @param rule
  * @return
  */
 public static boolean isWaived(EPlanElement element, ERule rule) {
   RuleAdvisorMember ruleMember = element.getMember(RuleAdvisorMember.class, true);
   List<String> ruleNames =
       WaiverUtils.getExistingWaivedViolations(ruleMember, RuleAdvisorMember.RULE_WAIVERS_KEY);
   if (ruleNames != null) {
     return ruleNames.contains(rule.getName());
   }
   return false;
 }