void checkReadOnly(ObjEntity entity) throws CayenneRuntimeException { if (entity.isReadOnly()) { StringBuffer message = new StringBuffer(); message .append("Attempt to modify object(s) mapped to a read-only entity: ") .append(entity.getName()); if (entity != null) { message.append(" '").append(entity.getName()).append("'"); } message.append(". Can't commit changes."); throw new CayenneRuntimeException(message.toString()); } }
void checkReadOnly(ObjEntity entity) throws CayenneRuntimeException { if (entity == null) { throw new NullPointerException("Entity must not be null."); } if (entity.isReadOnly()) { throw new CayenneRuntimeException("Attempt to modify object(s) mapped to a read-only entity: '%s'. " + "Can't commit changes.", entity.getName()); } }
/** * Merges changes reflected in snapshot map to the object. Changes made to attributes * and to-one relationships will be merged. In case an object is already modified, * modified properties will not be overwritten. */ static void mergeObjectWithSnapshot( ObjEntity entity, DataObject object, DataRow snapshot) { int state = object.getPersistenceState(); if (entity.isReadOnly() || state == PersistenceState.HOLLOW) { refreshObjectWithSnapshot(entity, object, snapshot, true); } else if (state != PersistenceState.COMMITTED) { forceMergeWithSnapshot(entity, object, snapshot); } else { // do not invalidate to-many relationships, since they might have // just been prefetched... refreshObjectWithSnapshot(entity, object, snapshot, false); } }
/** * Merges changes reflected in snapshot map to the object. Changes made to attributes * and to-one relationships will be merged. In case an object is already modified, * modified properties will not be overwritten. */ static void mergeObjectWithSnapshot( DataContext context, ClassDescriptor descriptor, Persistent object, DataRow snapshot) { int state = object.getPersistenceState(); if (state == PersistenceState.HOLLOW || descriptor.getEntity().isReadOnly()) { refreshObjectWithSnapshot(descriptor, object, snapshot, true); } else if (state != PersistenceState.COMMITTED) { forceMergeWithSnapshot(context, descriptor, object, snapshot); } else { // do not invalidate to-many relationships, since they might have // just been prefetched... refreshObjectWithSnapshot(descriptor, object, snapshot, false); } }
superClassName.setText(entity.getSuperClassName()); className.setText(entity.getClassName()); readOnly.setSelected(entity.isReadOnly());
if (isReadOnly()) { encoder.print("\" readOnly=\"true");
if (isReadOnly()) { encoder.print("\" readOnly=\"true");