use of com.sun.jdo.api.persistence.model.ModelVetoException in project Payara by payara.
the class MappingTableElementImpl method setTable.
/**
* Set the table element for this mapping table to the supplied table.
* @param table table element to be used by the mapping table.
* @exception ModelException if impossible
*/
public void setTable(TableElement table) throws ModelException {
String old = getTable();
String newName = table.toString();
try {
fireVetoableChange(PROP_TABLE, old, newName);
_table = newName;
firePropertyChange(PROP_TABLE, old, newName);
setName(_table);
// sync up runtime's object too: force next
// access to getTableObject to recompute it
_tableObject = null;
} catch (PropertyVetoException e) {
throw new ModelVetoException(e);
}
}
use of com.sun.jdo.api.persistence.model.ModelVetoException in project Payara by payara.
the class MappingTableElementImpl method removeReference.
/**
* Removes the referencing key for the supplied table element from list
* of keys in this mapping table.
* @param table mapping table element for which to remove referencing keys
* @exception ModelException if impossible
*/
public void removeReference(MappingTableElement table) throws ModelException {
if (table != null) {
Iterator keyIterator = getReferencingKeys().iterator();
while (keyIterator.hasNext()) {
MappingReferenceKeyElement nextKey = (MappingReferenceKeyElement) keyIterator.next();
if (nextKey.getTable().equals(table)) {
try {
fireVetoableChange(PROP_REFERENCING_KEYS, null, null);
keyIterator.remove();
firePropertyChange(PROP_REFERENCING_KEYS, null, null);
} catch (PropertyVetoException e) {
throw new ModelVetoException(e);
}
}
}
} else {
throw new ModelException(I18NHelper.getMessage(getMessages(), // NOI18N
"mapping.element.null_argument"));
}
}
use of com.sun.jdo.api.persistence.model.ModelVetoException in project Payara by payara.
the class PersistenceClassElementImpl method setObjectIdentityType.
/**
* Set the object identity type of this class element.
* @param type - an integer indicating the object identity type, one of:
* {@link PersistenceClassElement#APPLICATION_IDENTITY},
* {@link PersistenceClassElement#DATABASE_IDENTITY}, or
* {@link PersistenceClassElement#UNMANAGED_IDENTITY}
* @exception ModelException if impossible
*/
public void setObjectIdentityType(int type) throws ModelException {
Integer old = new Integer(getObjectIdentityType());
Integer newType = new Integer(type);
try {
fireVetoableChange(PROP_IDENTITY, old, newType);
_objectIdentityType = type;
firePropertyChange(PROP_IDENTITY, old, newType);
} catch (PropertyVetoException e) {
throw new ModelVetoException(e);
}
}
use of com.sun.jdo.api.persistence.model.ModelVetoException in project Payara by payara.
the class PersistenceFieldElementImpl method setReadSensitive.
/**
* Set whether this field element is read sensitive or not.
* @param flag - if <code>true</code> and this is a derived field, the
* field element is marked as read sensitive; otherwise, it is not
* This value is only used if <code>getPersistenceType</code> returns
* <code>DERIVED</code>
* @exception ModelException if impossible
* @see #setWriteSensitive
* @see #setPersistenceType
* @see PersistenceFieldElement#DERIVED
*/
public void setReadSensitive(boolean flag) throws ModelException {
Boolean old = JavaTypeHelper.valueOf(isReadSensitive());
Boolean newFlag = JavaTypeHelper.valueOf(flag);
try {
fireVetoableChange(PROP_SENSITIVITY, old, newFlag);
if (flag)
_derivedModifier |= READ_SENSITIVE;
else
_derivedModifier &= READ_SENSITIVE;
firePropertyChange(PROP_SENSITIVITY, old, newFlag);
} catch (PropertyVetoException e) {
throw new ModelVetoException(e);
}
}
use of com.sun.jdo.api.persistence.model.ModelVetoException in project Payara by payara.
the class PersistenceFieldElementImpl method setPersistenceType.
/**
* Set the persistence type of this field element.
* @param type - an integer indicating the persistence type, one of:
* {@link PersistenceFieldElement#PERSISTENT} or
* {@link PersistenceFieldElement#DERIVED}
* @exception ModelException if impossible
*/
public void setPersistenceType(int type) throws ModelException {
Integer old = new Integer(getPersistenceType());
Integer newType = new Integer(type);
try {
fireVetoableChange(PROP_PERSISTENCE, old, newType);
_persistenceType = type;
firePropertyChange(PROP_PERSISTENCE, old, newType);
} catch (PropertyVetoException e) {
throw new ModelVetoException(e);
}
}
Aggregations