use of org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor in project Payara by payara.
the class PrefetchDisabledNode method getDescriptor.
@Override
public PrefetchDisabledDescriptor getDescriptor() {
if (descriptor == null) {
descriptor = new PrefetchDisabledDescriptor();
Object parentDesc = getParentNode().getDescriptor();
if (parentDesc instanceof EjbDescriptor) {
descriptor.setEjbDescriptor((EjbDescriptor) parentDesc);
}
}
return descriptor;
}
use of org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor in project Payara by payara.
the class CmpNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, IASEjbCMPEntityDescriptor ejbDescriptor) {
Node cmpNode = super.writeDescriptor(parent, nodeName, ejbDescriptor);
appendTextChild(cmpNode, RuntimeTagNames.MAPPING_PROPERTIES, ejbDescriptor.getMappingProperties());
Map finders = ejbDescriptor.getOneOneFinders();
if (!finders.isEmpty()) {
Node findersNode = appendChild(cmpNode, RuntimeTagNames.ONE_ONE_FINDERS);
FinderNode fn = new FinderNode();
for (Iterator finderIterator = finders.values().iterator(); finderIterator.hasNext(); ) {
IASEjbCMPFinder aFinder = (IASEjbCMPFinder) finderIterator.next();
fn.writeDescriptor(findersNode, RuntimeTagNames.FINDER, aFinder);
}
}
// prefetch-disabled
PrefetchDisabledDescriptor prefetchDisabledDesc = ejbDescriptor.getPrefetchDisabledDescriptor();
if (prefetchDisabledDesc != null) {
PrefetchDisabledNode prefetchDisabledNode = new PrefetchDisabledNode();
prefetchDisabledNode.writeDescriptor(cmpNode, RuntimeTagNames.PREFETCH_DISABLED, prefetchDisabledDesc);
}
return cmpNode;
}
use of org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor in project Payara by payara.
the class MethodHelper method isQueryPrefetchEnabled.
/**
* Returns <code>true</code> if prefetch is enabled for the specified
* method, <code>false</code> otherwise. Prefetch is enabled by default.
* @param method the java.lang.reflect.Method object used to find the
* prefetch setting.
* @return a boolean representing the prefetch setting
*/
public boolean isQueryPrefetchEnabled(Method method) {
boolean enabled = true;
QueryDescriptor queryDescriptor = getQueryDescriptor(method);
if (queryDescriptor != null) {
IASEjbCMPEntityDescriptor cmpDescriptor = (IASEjbCMPEntityDescriptor) getDescriptor();
PrefetchDisabledDescriptor pdDescriptor = cmpDescriptor.getPrefetchDisabledDescriptor();
if (pdDescriptor != null) {
MethodDescriptor methodDescriptor = queryDescriptor.getQueryMethodDescriptor();
enabled = !pdDescriptor.isPrefetchDisabledFor(methodDescriptor);
}
}
return enabled;
}
Aggregations