Search in sources :

Example 21 with ModelVetoException

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

the class RelationshipElementImpl method setPrefetch.

/**
 * Set whether this relationship element should prefetch or not.
 * @param flag - if <code>true</code>, the relationship is set to
 * prefetch; otherwise, it is not
 * @exception ModelException if impossible
 */
public void setPrefetch(boolean flag) throws ModelException {
    Boolean old = JavaTypeHelper.valueOf(isPrefetch());
    Boolean newFlag = JavaTypeHelper.valueOf(flag);
    try {
        fireVetoableChange(PROP_PREFETCH, old, newFlag);
        _isPrefetch = flag;
        firePropertyChange(PROP_PREFETCH, old, newFlag);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 22 with ModelVetoException

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

the class RelationshipElementImpl method setDeleteAction.

/**
 * Set the delete action for this relationship element.
 * @param action - an integer indicating the delete 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 setDeleteAction(int action) throws ModelException {
    Integer old = new Integer(getDeleteAction());
    Integer newAction = new Integer(action);
    try {
        fireVetoableChange(PROP_DELETE_ACTION, old, newAction);
        _deleteAction = action;
        firePropertyChange(PROP_DELETE_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 23 with ModelVetoException

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

the class MappingElementImpl method setName.

/**
 * Set the name of this mapping element.
 * @param name the name
 * @exception ModelException if impossible
 */
public void setName(String name) throws ModelException {
    String old = getName();
    try {
        fireVetoableChange(PROP_NAME, old, name);
        _name = name;
        firePropertyChange(PROP_NAME, old, name);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException)

Example 24 with ModelVetoException

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

the class MappingReferenceKeyElementImpl method setTable.

/**
 * Set the mapping table for this referencing key to the supplied table.
 * @param table mapping table element to be used with this key.
 * @exception ModelException if impossible
 */
public void setTable(MappingTableElement table) throws ModelException {
    MappingTableElement old = getTable();
    try {
        fireVetoableChange(PROP_TABLE, old, table);
        setTableInternal(table);
        firePropertyChange(PROP_TABLE, old, table);
    } catch (PropertyVetoException e) {
        throw new ModelVetoException(e);
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelVetoException(com.sun.jdo.api.persistence.model.ModelVetoException) MappingTableElement(com.sun.jdo.api.persistence.model.mapping.MappingTableElement)

Example 25 with ModelVetoException

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

the class MappingTableElementImpl method removeKeyColumn.

/**
 * Removes a column from the primary key of columns in this mapping table.
 * This method should only be used to manipulate the key columns of the
 * primary table.  The secondary table key columns should be manipulated
 * using MappingReferenceKeyElement methods for pairs.
 * @param columnName the relative name of the column to be removed
 * @exception ModelException if impossible
 */
public void removeKeyColumn(String columnName) throws ModelException {
    if (columnName != null) {
        try {
            fireVetoableChange(PROP_KEY_COLUMNS, null, null);
            if (!getKey().remove(columnName)) {
                throw new ModelException(I18NHelper.getMessage(getMessages(), // NOI18N
                "mapping.element.element_not_removed", columnName));
            }
            firePropertyChange(PROP_KEY_COLUMNS, null, null);
            // sync up runtime's object list too
            // @olsen: rather clear objects instead of maintaining them
            // getKeyObjects().remove(column);
            _keyObjects = null;
        } catch (PropertyVetoException e) {
            throw new ModelVetoException(e);
        }
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) ModelException(com.sun.jdo.api.persistence.model.ModelException) 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