Search in sources :

Example 1 with PrefetchDisabledDescriptor

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;
}
Also used : PrefetchDisabledDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 2 with PrefetchDisabledDescriptor

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;
}
Also used : PrefetchDisabledDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor) Node(org.w3c.dom.Node) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) Iterator(java.util.Iterator) IASEjbCMPFinder(org.glassfish.ejb.deployment.descriptor.runtime.IASEjbCMPFinder) Map(java.util.Map)

Example 3 with PrefetchDisabledDescriptor

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;
}
Also used : IASEjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.IASEjbCMPEntityDescriptor) PrefetchDisabledDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor) QueryDescriptor(org.glassfish.ejb.deployment.descriptor.QueryDescriptor) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Aggregations

PrefetchDisabledDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.PrefetchDisabledDescriptor)3 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)1 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 IASEjbCMPEntityDescriptor (org.glassfish.ejb.deployment.descriptor.IASEjbCMPEntityDescriptor)1 QueryDescriptor (org.glassfish.ejb.deployment.descriptor.QueryDescriptor)1 IASEjbCMPFinder (org.glassfish.ejb.deployment.descriptor.runtime.IASEjbCMPFinder)1 Node (org.w3c.dom.Node)1