/** * Create a new ObjectId instance and copy the key fields from the * persistence capable instance to the objectId instance * @param pc The persistence capable object * @param cmd The AbstractClassMetaData * @return The object id for the persistence capable object */ public static Object getNewObjectId(PersistenceCapable pc, AbstractClassMetaData cmd) { Object userOid = pc.jdoNewObjectIdInstance(); if (!cmd.usesSingleFieldIdentityClass()) { pc.jdoCopyKeyFieldsToObjectId(userOid); } return userOid; }
/** Create a new instance of the ObjectId class of this * <code>PersistenceCapable</code> class. * It is intended only for application identity. This method should * not be called for classes that use single field identity; * newObjectIdInstance(Class, Object) should be used instead. * If the class has been * enhanced for datastore identity, or if the class is abstract, * null is returned. * @param pcClass the <code>PersistenceCapable</code> class. * @return the new ObjectId instance, or <code>null</code> if the class * is not registered. */ public Object newObjectIdInstance (Class pcClass) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance(); }
/** Create a new instance of the ObjectId class of this * <code>PersistenceCapable</code> class. * It is intended only for application identity. This method should * not be called for classes that use single field identity; * newObjectIdInstance(Class, Object) should be used instead. * If the class has been * enhanced for datastore identity, or if the class is abstract, * null is returned. * @param pcClass the <code>PersistenceCapable</code> class. * @return the new ObjectId instance, or <code>null</code> if the class * is not registered. */ public Object newObjectIdInstance (Class pcClass) { Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return pcInstance == null?null:pcInstance.jdoNewObjectIdInstance(); }
/** * Method to create a new object identity for the passed object with the supplied MetaData. * Only applies to application-identity cases. * @param pc The persistable object * @param cmd Its metadata * @return The new identity object */ public Object getNewApplicationIdentityObjectId(Object pc, AbstractClassMetaData cmd) { if (pc == null || cmd == null) { return null; } // TODO Change this to Persistable Object id = ((PersistenceCapable)pc).jdoNewObjectIdInstance(); if (!cmd.usesSingleFieldIdentityClass()) { ((PersistenceCapable)pc).jdoCopyKeyFieldsToObjectId(id); } return id; }
/** * Method to create a new object identity for the passed object with the supplied MetaData. * Only applies to application-identity cases. * @param pc The persistable object * @param cmd Its metadata * @return The new identity object */ public Object getNewApplicationIdentityObjectId(Object pc, AbstractClassMetaData cmd) { if (pc == null || cmd == null) { return null; } // TODO Change this to Persistable Object id = ((PersistenceCapable)pc).jdoNewObjectIdInstance(); if (!cmd.usesSingleFieldIdentityClass()) { ((PersistenceCapable)pc).jdoCopyKeyFieldsToObjectId(id); } return id; }
Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return (pcInstance == null)?null:pcInstance.jdoNewObjectIdInstance(obj);
Meta meta = getMeta (pcClass); PersistenceCapable pcInstance = meta.getPC(); return (pcInstance == null)?null:pcInstance.jdoNewObjectIdInstance(obj);
myID = myPC.jdoNewObjectIdInstance(); if (!cmd.usesSingleFieldIdentityClass())
myID = myPC.jdoNewObjectIdInstance(); if (!cmd.usesSingleFieldIdentityClass())