本文整理了Java中org.datanucleus.ExecutionContext.getApiAdapter()
方法的一些代码示例,展示了ExecutionContext.getApiAdapter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext.getApiAdapter()
方法的具体详情如下:
包路径:org.datanucleus.ExecutionContext
类名称:ExecutionContext
方法名:getApiAdapter
暂无
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Returns an identity for a persistable class.
* Processes a FK field and finds the object that it relates to, then returns the identity.
* @param ec The ExecutionContext
* @param rs The ResultSet
* @param param Array of parameter ids in the ResultSet to retrieve
* @return The identity of the Persistence Capable object
*/
public Object getObject(ExecutionContext ec, final ResultSet rs, int[] param)
{
Object value = super.getObject(ec, rs, param);
if (value != null)
{
ApiAdapter api = ec.getApiAdapter();
return api.getIdForObject(value);
}
return null;
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Returns an identity for a persistable class.
* Processes a FK field and finds the object that it relates to, then returns the identity.
* @param ec execution context
* @param rs The ResultSet
* @param param Array of parameter ids in the ResultSet to retrieve
* @return The id of the PC object.
*/
public Object getObject(ExecutionContext ec, final ResultSet rs, int[] param)
{
Object value = super.getObject(ec, rs, param);
if (value != null)
{
ApiAdapter api = ec.getApiAdapter();
return api.getIdForObject(value);
}
return null;
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Utility to validate a value is ok for reading.
* @param op ObjectProvider for the map.
* @param value The value to check.
* @return Whether it is validated.
*/
protected boolean validateValueForReading(ObjectProvider op, Object value)
{
validateValueType(op.getExecutionContext().getClassLoaderResolver(), value);
if (!valuesAreEmbedded && !valuesAreSerialised)
{
ExecutionContext ec = op.getExecutionContext();
if (value != null && (!ec.getApiAdapter().isPersistent(value) ||
ec != ec.getApiAdapter().getExecutionContext(value)) && !ec.getApiAdapter().isDetached(value))
{
return false;
}
}
return true;
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Utility to validate a key is ok for reading.
* @param op ObjectProvider for the map.
* @param key The key to check.
* @return Whether it is validated.
*/
protected boolean validateKeyForReading(ObjectProvider op, Object key)
{
validateKeyType(op.getExecutionContext().getClassLoaderResolver(), key);
if (!keysAreEmbedded && !keysAreSerialised)
{
ExecutionContext ec = op.getExecutionContext();
if (key!=null && (!ec.getApiAdapter().isPersistent(key) ||
ec != ec.getApiAdapter().getExecutionContext(key)) && !ec.getApiAdapter().isDetached(key))
{
return false;
}
}
return true;
}
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* Detach the specified objects from the <code>PersistenceManager</code>.
* @param pcs the instances to detach
* @return the detached instances
* @see #detachCopyAll(Object[])
*/
public <T> Collection<T> detachCopyAll(Collection<T> pcs)
{
assertIsOpen();
assertReadable("detachCopyAll");
// Detach the objects
FetchPlanState state = new DetachState(ec.getApiAdapter());
List detacheds = new ArrayList();
for (T pc : pcs)
{
if (pc == null)
{
detacheds.add(null);
}
else
{
detacheds.add(jdoDetachCopy(pc, state));
}
}
return detacheds;
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Method to check if an element is already persistent or is persistent but managed by a different ExecutionContext.
* @param op The ObjectProvider of this owner
* @param element The element
* @return Whether it is valid for reading.
*/
protected boolean validateElementForReading(ObjectProvider op, Object element)
{
if (!validateElementType(op.getExecutionContext().getClassLoaderResolver(), element))
{
return false;
}
if (element != null && !elementsAreEmbedded && !elementsAreSerialised)
{
ExecutionContext ec = op.getExecutionContext();
if ((!ec.getApiAdapter().isPersistent(element) || ec != ec.getApiAdapter().getExecutionContext(element)) && !ec.getApiAdapter().isDetached(element))
{
return false;
}
}
return true;
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Clear the association from owner to all elements. Observes the necessary dependent field settings
* with respect to whether it should delete the element when doing so.
* @param op ObjectProvider for the container.
*/
public void clear(ObjectProvider op)
{
Collection dependentElements = null;
if (ownerMemberMetaData.getArray().isDependentElement())
{
// Retain the dependent elements that need deleting after clearing
dependentElements = new HashSet();
Iterator iter = iterator(op);
while (iter.hasNext())
{
Object elem = iter.next();
if (op.getExecutionContext().getApiAdapter().isPersistable(elem))
{
dependentElements.add(elem);
}
}
}
clearInternal(op);
if (dependentElements != null && dependentElements.size() > 0)
{
op.getExecutionContext().deleteObjects(dependentElements.toArray());
}
}
代码示例来源:origin: org.datanucleus/datanucleus-mongodb
protected void processSingleRelationField(Object value, ExecutionContext ec, String fieldName)
{
Object valuePC = op.getExecutionContext().persistObjectInternal(value, null, -1, -1);
Object valueId = ec.getApiAdapter().getIdForObject(valuePC);
// TODO Add option to store DBRef here instead of just the id string
dbObject.put(fieldName, IdentityUtils.getPersistableIdentityForId(valueId)); // Store the id String form
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
ApiAdapter api = ownerOP.getExecutionContext().getApiAdapter();
Iterator iter = entrySetStore().iterator(ownerOP);
while (iter.hasNext())
代码示例来源:origin: org.datanucleus/datanucleus-api-jdo
/**
* JDO method to detach a persistent object.
* If the object is of class that is not detachable a transient copy will be returned.
* If the object is not persistent it will be persisted first before detaching a copy.
* @param pc The object
* @return The detached object
*/
public <T> T detachCopy(T pc)
{
assertIsOpen();
if (pc == null)
{
return null;
}
try
{
ec.assertClassPersistable(pc.getClass());
assertReadable("detachCopy");
return jdoDetachCopy(pc, new DetachState(ec.getApiAdapter()));
}
catch (NucleusException ne)
{
throw NucleusJDOHelper.getJDOExceptionForNucleusException(ne);
}
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
if (ec.getApiAdapter().isDetached(element))
elementToRemove = ec.findObject(ec.getApiAdapter().getIdForObject(element), true, false, element.getClass().getName());
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Method to store an object in a field.
* @param fieldNumber Number of the field
* @param value The value to use
*/
public void storeObjectField(int fieldNumber, Object value)
{
ApiAdapter api = ec.getApiAdapter();
if (api.isPersistable(value))
{
api.copyKeyFieldsFromIdToObject(value, new AppIdObjectIdFieldConsumer(api, this), api.getIdForObject(value));
}
else
{
JavaTypeMapping mapping = javaTypeMappings[mappingNum++];
mapping.setObject(ec, statement, getParamsForField(mapping), value);
}
}
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Method to extract the value of the persistable from a ResultSet.
* @param ec The ExecutionContext
* @param resultSet The ResultSet
* @param exprIndex The parameter positions in the result set to use.
* @param ownerOP ObjectProvider for the owning object
* @param fieldNumber Absolute number of field in owner object
* @return The (deserialised) persistable object
*/
public Object getObject(ExecutionContext ec, ResultSet resultSet, int[] exprIndex, ObjectProvider ownerOP, int fieldNumber)
{
Object obj = getDatastoreMapping(0).getObject(resultSet, exprIndex[0]);
if (obj != null)
{
// Assign a StateManager to the serialised object if none present
ObjectProvider embSM = ec.findObjectProvider(obj);
if (embSM == null || ec.getApiAdapter().getExecutionContext(obj) == null)
{
ec.getNucleusContext().getObjectProviderFactory().newForEmbedded(ec, obj, false, ownerOP, fieldNumber);
}
}
return obj;
}
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
/**
* Method to extract the value of the persistable from a ResultSet.
* @param ec execution context
* @param resultSet The ResultSet
* @param exprIndex The parameter positions in the result set to use.
* @param ownerOP ObjectProvider for the owning object
* @param fieldNumber Absolute number of field in owner object
* @return The (deserialised) persistable object
*/
public Object getObject(ExecutionContext ec, ResultSet resultSet, int[] exprIndex, ObjectProvider ownerOP, int fieldNumber)
{
Object obj = getDatastoreMapping(0).getObject(resultSet, exprIndex[0]);
ApiAdapter api = ec.getApiAdapter();
if (api.isPersistable(obj))
{
// Assign a StateManager to the serialised object if none present
ObjectProvider embSM = ec.findObjectProvider(obj);
if (embSM == null || api.getExecutionContext(obj) == null)
{
ec.getNucleusContext().getObjectProviderFactory().newForEmbedded(ec, obj, false, ownerOP, fieldNumber);
}
}
return obj;
}
}
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
if (ec.getApiAdapter().isPersistable(obj))
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
if (!ec.getApiAdapter().isDeleted(oldValue))
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
if (elemOP == null || ec.getApiAdapter().getExecutionContext(elem) == null)
代码示例来源:origin: org.datanucleus/datanucleus-neodatis
ODB odb, AbstractClassMetaData cmd)
if (!ec.getApiAdapter().isPersistable(obj))
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
if (embSM == null || ec.getApiAdapter().getExecutionContext(value) == null)
代码示例来源:origin: org.datanucleus/datanucleus-rdbms
ApiAdapter api = ec.getApiAdapter();
if (mapmd.isDependentKey() && !mapmd.isEmbeddedKey() && api.isPersistable(key))
内容来源于网络,如有侵权,请联系作者删除!