/** * Checks to see if this property has a match in the cascade list to return if enabled or * disabled. * * @param state * @param propertyObj * @return t/f */ private boolean isXToXCascadeEnabledByConfig( TreeMap<String, CascadeState> state, PropertyObj target) { if (target == null) { return false; } String classPackage = this.getClazz().getClassPackage(); String className = this.getClazz().getClassName(); String targetClassPackage = target.getClazz().getClassPackage(); String targetClassName = target.getClazz().getClassName(); String targetPropertyName = target.getPropertyName(); CascadeState match = matchCascade( state, "*.*.*", "*." + className + ".*", "*." + className + "." + propertyName, classPackage + ".*." + propertyName, classPackage + ".*.*", classPackage + "." + className + ".*", "*.*." + propertyName, classPackage + "." + className + "." + propertyName); if (match == null) { match = matchCascade( state, "to:*.*.*", "to:*." + targetClassName + ".*", "to:*." + targetClassName + "." + targetPropertyName, "to:" + targetClassPackage + ".*." + targetPropertyName, "to:" + targetClassPackage + ".*.*", "to:" + targetClassPackage + "." + targetClassName + ".*", "to:*.*." + targetPropertyName, "to:" + targetClassPackage + "." + targetClassName + "." + targetPropertyName); } // get the default boolean enableCascading = state.get("*").isCascadeEnabled(); if (match != null) { // we're using: default... EXCEPT enableCascading = match.isCascadeEnabled(); } return enableCascading; }
/** * Checks to see if this property has a match in the cascade list to return if enabled or * disabled. * * @param state * @param propertyObj * @return t/f */ private Set<String> getXToXCascadeType(TreeMap<String, CascadeState> state, PropertyObj target) { String classPackage = this.getClazz().getClassPackage(); String className = this.getClazz().getClassName(); String targetClassPackage = target.getClazz().getClassPackage(); String targetClassName = target.getClazz().getClassName(); String targetPropertyName = target.getPropertyName(); CascadeState match = matchCascade( state, "*.*.*", "*." + className + ".*", "*." + className + "." + this.propertyName, classPackage + ".*." + this.propertyName, classPackage + ".*.*", classPackage + "." + className + ".*", "*.*." + this.propertyName, classPackage + "." + className + "." + this.propertyName); if (match == null) { match = matchCascade( state, "to:*.*.*", "to:*." + targetClassName + ".*", "to:*." + targetClassName + "." + targetPropertyName, "to:" + targetClassPackage + ".*." + targetPropertyName, "to:" + targetClassPackage + ".*.*", "to:" + targetClassPackage + "." + targetClassName + ".*", "to:*.*." + targetPropertyName, "to:" + targetClassPackage + "." + targetClassName + "." + targetPropertyName); } // get the default Set<String> cascadeType = state.get("*").getCascadeType(); if (match != null) { // we're using: default... EXCEPT cascadeType = match.getCascadeType(); } return cascadeType; }