Search in sources :

Example 1 with PersistenceMemberElement

use of com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement in project Payara by payara.

the class PersistenceMemberElementImpl method firePropertyChange.

/**
 * Fires property change event.  This method overrides that of
 * PersistenceElementImpl to update the PersistenceClassElementImpl's
 * modified status.
 * @param name property name
 * @param o old value
 * @param n new value
 */
protected final void firePropertyChange(String name, Object o, Object n) {
    // even though o == null and n == null will signify a change, that
    // is consistent with PropertyChangeSupport's behavior and is
    // necessary for this to work
    boolean noChange = ((o != null) && (n != null) && o.equals(n));
    PersistenceClassElement classElement = ((PersistenceMemberElement) _element).getDeclaringClass();
    super.firePropertyChange(name, o, n);
    if ((classElement != null) && !noChange)
        classElement.setModified(true);
}
Also used : PersistenceMemberElement(com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement) PersistenceClassElement(com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement)

Example 2 with PersistenceMemberElement

use of com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement in project Payara by payara.

the class PersistenceMemberElementImpl method fireVetoableChange.

/**
 * Fires vetoable change event.  This method overrides that of
 * PersistenceElementImpl to give listeners a chance to block
 * changes on the persistence class element modified status.
 * @param name property name
 * @param o old value
 * @param n new value
 * @exception PropertyVetoException when the change is vetoed by a listener
 */
protected final void fireVetoableChange(String name, Object o, Object n) throws PropertyVetoException {
    // even though o == null and n == null will signify a change, that
    // is consistent with PropertyChangeSupport's behavior and is
    // necessary for this to work
    boolean noChange = ((o != null) && (n != null) && o.equals(n));
    PersistenceClassElement classElement = ((PersistenceMemberElement) _element).getDeclaringClass();
    super.fireVetoableChange(name, o, n);
    if ((classElement != null) && !noChange) {
        ((PersistenceElementImpl) classElement.getImpl()).fireVetoableChange(PROP_MODIFIED, Boolean.FALSE, Boolean.TRUE);
    }
}
Also used : PersistenceMemberElement(com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement) PersistenceClassElement(com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement)

Aggregations

PersistenceClassElement (com.sun.jdo.api.persistence.model.jdo.PersistenceClassElement)2 PersistenceMemberElement (com.sun.jdo.api.persistence.model.jdo.PersistenceMemberElement)2