예제 #1
0
    /**
     * Identifies the property rules set that the property belongs to, and notifies
     * it about the property change.
     *
     * @param property The property that has been changed
     */
    private void notifyChanges(String property) {
        if (rulesList.size() == 0) {
            return;
        }

        boolean notified = false;
        Enumeration rules = rulesList.elements();
        while (rules.hasMoreElements() && !notified) {
            IPropertyRules therules = (IPropertyRules)rules.nextElement();
            if (therules.checkPropertyAllowed(property)) {
                therules.handlePropertyChanges(property);
            }
        }

    }
예제 #2
0
 /**
  * Checks that a property is permitted to exist by any of the existing rules sets
  *
  * @param propertyName The name of the property to be set
  * @return true if the property is permitted to store values. false otherwise
  */
 public boolean checkPropertyAllowed(String propertyName) {
     if (rulesList.size() == 0) {
         return true;
     } else {
         boolean allowed = false;
         Enumeration en = rulesList.elements();
         //We're fine if we return true, inclusive rules sets
         while (en.hasMoreElements() && !allowed) {
             IPropertyRules rules = (IPropertyRules)en.nextElement();
             if (rules.checkPropertyAllowed(propertyName)) {
                 allowed = true;
             }
         }
         return allowed;
     }
 }
예제 #3
0
 /**
  * Checks that a property is allowed to store a certain value.
  *
  * @param propertyName  The name of the property to be set
  * @param propertyValue The value to be stored in the given property
  * @return true if the property given is allowed to be stored. false otherwise.
  */
 public boolean checkValueAllowed(String propertyName,
                                  String propertyValue) {
     if (rulesList.size() == 0) {
         return true;
     } else {
         boolean allowed = false;
         Enumeration en = rulesList.elements();
         while (en.hasMoreElements() && !allowed) {
             IPropertyRules rules = (IPropertyRules)en.nextElement();
             if (rules.checkPropertyAllowed(propertyName)) {
                 if (rules.checkValueAllowed(propertyName, propertyValue)) {
                     allowed = true;
                 }
             }
         }
         return allowed;
     }
 }