Search in sources :

Example 16 with ModelVetoException

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

the class PersistenceFieldElementImpl method setWriteSensitive.

/**
 * Set whether this field element is write sensitive or not.
 * @param flag - if <code>true</code> and this is a derived field, the
 * field element is marked as write sensitive; otherwise, it is not
 * This value is only used if <code>getPersistenceType</code> returns
 * <code>DERIVED</code>
 * @exception ModelException if impossible
 * @see #setReadSensitive
 * @see #setPersistenceType
 * @see PersistenceFieldElement#DERIVED
 */
public void setWriteSensitive(boolean flag) throws ModelException {
    Boolean old = JavaTypeHelper.valueOf(isWriteSensitive());
    Boolean newFlag = JavaTypeHelper.valueOf(flag);
    try {
        fireVetoableChange(PROP_SENSITIVITY, old, newFlag);
        if (flag)
            _derivedModifier |= WRITE_SENSITIVE;
        else
            _derivedModifier &= WRITE_SENSITIVE;
        firePropertyChange(PROP_SENSITIVITY, old, newFlag);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 17 with ModelVetoException

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

the class RelationshipElementImpl method setCollectionClass.

/**
 * Set the collection class for this relationship element.
 * @param collectionClass - a string indicating the type of
 * collection (for example Set, List, Vector, etc.)
 * @exception ModelException if impossible
 */
public void setCollectionClass(String collectionClass) throws ModelException {
    String old = getCollectionClass();
    try {
        fireVetoableChange(PROP_COLLECTION_CLASS, old, collectionClass);
        _collectionClass = collectionClass;
        firePropertyChange(PROP_COLLECTION_CLASS, old, collectionClass);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 18 with ModelVetoException

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

the class RelationshipElementImpl method setUpdateAction.

/**
 * Set the update action for this relationship element.
 * @param action - an integer indicating the update action, one of:
 * {@link RelationshipElement#NONE_ACTION},
 * {@link RelationshipElement#NULLIFY_ACTION},
 * {@link RelationshipElement#RESTRICT_ACTION},
 * {@link RelationshipElement#CASCADE_ACTION}, or
 * {@link RelationshipElement#AGGREGATE_ACTION}
 * @exception ModelException if impossible
 */
public void setUpdateAction(int action) throws ModelException {
    Integer old = new Integer(getUpdateAction());
    Integer newAction = new Integer(action);
    try {
        fireVetoableChange(PROP_UPDATE_ACTION, old, newAction);
        _updateAction = action;
        firePropertyChange(PROP_UPDATE_ACTION, old, newAction);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 19 with ModelVetoException

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

the class RelationshipElementImpl method setUpperBound.

/**
 * Set the upper cardinality bound for this relationship element.
 * @param upperBound - an integer indicating the upper cardinality bound
 * (use {@link java.lang.Integer#MAX_VALUE} for <code>n</code>)
 * @exception ModelException if impossible
 */
public void setUpperBound(int upperBound) throws ModelException {
    Integer old = new Integer(getUpperBound());
    Integer newBound = new Integer(upperBound);
    try {
        fireVetoableChange(PROP_CARDINALITY, old, newBound);
        _upperBound = upperBound;
        firePropertyChange(PROP_CARDINALITY, old, newBound);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 20 with ModelVetoException

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

the class RelationshipElementImpl method setElementClass.

/**
 * Set the element class for this relationship element.
 * @param elementClass - a string indicating the type of elements
 * in the collection.  If primitive types are supported, you can use
 * <code><i>wrapperclass</i>.TYPE.toString()</code> to specify them.
 * @exception ModelException if impossible
 */
public void setElementClass(String elementClass) throws ModelException {
    String old = getElementClass();
    try {
        fireVetoableChange(PROP_ELEMENT_CLASS, old, elementClass);
        _elementClass = elementClass;
        firePropertyChange(PROP_ELEMENT_CLASS, old, elementClass);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Aggregations

ModelVetoException (com.sun.jdo.api.persistence.model.ModelVetoException)26 PropertyVetoException (java.beans.PropertyVetoException)24 ModelException (com.sun.jdo.api.persistence.model.ModelException)4 ArrayList (java.util.ArrayList)2 MappingTableElement (com.sun.jdo.api.persistence.model.mapping.MappingTableElement)1