(non-Javadoc)

@see javax.persistence.EntityManager#getDelegate()
199400
@Override
    public Object getDelegate()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "em.getDelegate();\n" + toString());

        return getEMInvocationInfo(false).getDelegate();
    }
655058
private final IterableSubject delegate() {
    IterableSubject delegate = check().that(actual());
    if (internalCustomName() != null) {
      delegate = delegate.named(internalCustomName());
    }
    return delegate;
  }
120190
public void setDelegate(Object delegate) {
        this.delegate = delegate;
        this.metaClass = InvokerHelper.getMetaClass(delegate.getClass());
    }
483313
public PersistenceManager getPersistenceManager() {
        if (persistenceManager == null) {
            try {
                persistenceManager = getPresentationManager().newPersistenceManager();
            } catch (Exception ex) {
                getPresentationManager().error(ex);
                throw new ConnectionNotFoundException();
            }
        }
        return persistenceManager;
    }
489908
public ComputerLauncher getDelegatedLauncher() {
        ComputerLauncher l = launcher;
        while (true) {
            if (l instanceof DelegatingComputerLauncher) {
                l = ((DelegatingComputerLauncher) l).getLauncher();
            } else if (l instanceof ComputerLauncherFilter) {
                l = ((ComputerLauncherFilter) l).getCore();
            } else {
                break;
            }
        }
        return l;
    }
370786
protected final Object getIdentifier(Object value, SharedSessionContractImplementor session) throws HibernateException {
		if ( value == null ) {
			return null;
		}

		//isNotEmbedded copied from EntityType#isNotEmbedded
		boolean isNotEmbedded = isNotEmbedded( session );
		if ( isNotEmbedded ) {
			return value;
		}

		final String associatedEntityName = delegate.getAssociatedEntityName();
		final String uniqueKeyPropertyName = delegate.getRHSUniqueKeyPropertyName();

		if ( StringHelper.isEmpty( uniqueKeyPropertyName ) ) {
			return ForeignKeys.getEntityIdentifierIfNotUnsaved( associatedEntityName, value, session ); //tolerates nulls
		}
		else {
			final EntityPersister persister = session.getFactory().getMetamodel().entityPersister( delegate.getAssociatedEntityName() );

			Object propertyValue = persister.getPropertyValue( value, uniqueKeyPropertyName );
			// We now have the value of the property-ref we reference.  However,
			// we need to dig a little deeper, as that property might also be
			// an entity type, in which case we need to resolve its identifier
			Type type = persister.getPropertyType( uniqueKeyPropertyName );
			GridType gridType = typeTranslator.getType( type );
			if ( gridType.isEntityType() ) {
				propertyValue = ( (EntityType) gridType ).getIdentifier( propertyValue, session );
			}

			return propertyValue;
		}
	}
449205
public <E> ObjectGraph generateGraph(E entity, PersistenceDelegator delegator, NodeState state)
    {

        this.builder.assign(this);
        Node node = generate(entity, delegator, delegator.getPersistenceCache(), state);
        this.builder.assignHeadNode(node);
        return this.builder.getGraph();
    }
572646
protected static UploadStatusDelegate getUploadStatusDelegate(String uploadId) {
        WeakReference<UploadStatusDelegate> reference = uploadDelegates.get(uploadId);

        if (reference == null)
            return null;

        UploadStatusDelegate delegate = reference.get();

        if (delegate == null) {
            uploadDelegates.remove(uploadId);
            Logger.info(TAG, "\n\n\nUpload delegate for upload with Id " + uploadId + " is gone!\n" +
                    "Probably you have set it in an activity and the user navigated away from it\n" +
                    "before the upload was completed. From now on, the events will be dispatched\n" +
                    "with broadcast intents. If you see this message, consider switching to the\n" +
                    "UploadServiceBroadcastReceiver registered globally in your manifest.\n" +
                    "Read this:\n" +
                    "https://github.com/gotev/android-upload-service/wiki/Monitoring-upload-status\n");
        }

        return delegate;
    }
7900
private void handleWithDelegate(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
        //Delegate to handler
        boolean foundHandler = REST_HANDLER_CONTAINER.handleRequest(new ServletRESTRequestImpl(request), new ServletRESTResponseImpl(response));
        //RESTHandler handler = REST_HANDLER_CONTAINER.getHandler(pathInfo);
        if (!foundHandler) {
            //No handler found, so we send back a 404 "not found" response.
            String errorMsg = Tr.formatMessage(tc, "HANDLER_NOT_FOUND_ERROR", request.getRequestURI());
            response.sendError(HttpServletResponse.SC_NOT_FOUND, errorMsg);
        }
    }
772127
public static DelegateExecution getCurrentDelegationExecution() {
    BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext();
    ExecutionEntity executionEntity = null;
    if (bpmnExecutionContext != null) {
      executionEntity = bpmnExecutionContext.getExecution();
    }
    return executionEntity;
  }
307021
@Deprecated
    public final Session getSession() {
        while (true) {
            String cachedToken = null;
            Session oldSession = null;

            synchronized (this.lock) {
                if (userSetSession != null) {
                    return userSetSession;
                }
                if ((session != null) || !sessionInvalidated) {
                    return session;
                }

                cachedToken = accessToken;
                oldSession = session;
            }

            if (cachedToken == null) {
                return null;
            }

            // At this point we do not have a valid session, but mAccessToken is
            // non-null.
            // So we can try building a session based on that.
            List<String> permissions;
            if (oldSession != null) {
                permissions = oldSession.getPermissions();
            } else if (pendingAuthorizationPermissions != null) {
                permissions = Arrays.asList(pendingAuthorizationPermissions);
            } else {
                permissions = Collections.<String>emptyList();
            }

            Session newSession = new Session.Builder(pendingAuthorizationActivity).
                    setApplicationId(mAppId).
                    setTokenCachingStrategy(getTokenCache()).
                    build();
            if (newSession.getState() != SessionState.CREATED_TOKEN_LOADED) {
                return null;
            }
            Session.OpenRequest openRequest =
                    new Session.OpenRequest(pendingAuthorizationActivity).setPermissions(permissions);
            openSession(newSession, openRequest, !permissions.isEmpty());

            Session invalidatedSession = null;
            Session returnSession = null;

            synchronized (this.lock) {
                if (sessionInvalidated || (session == null)) {
                    invalidatedSession = session;
                    returnSession = session = newSession;
                    sessionInvalidated = false;
                }
            }

            if (invalidatedSession != null) {
                invalidatedSession.close();
            }

            if (returnSession != null) {
                return returnSession;
            }
            // Else token state changed between the synchronized blocks, so
            // retry..
        }
    }
260590
protected Entity getEntity() throws ConverterException {
        final String _entity = getConfig("entity");
        if (_entity == null) {
            throw new ConverterException("collection.converter.entity.cannot.be.null");
        }
        final Entity entity = PresentationManager.getPm().getEntity(_entity);
        if (entity == null) {
            throw new ConverterException("collection.converter.entity.cannot.be.null");
        }
        return entity;
    }
1040096
public int getDelegationKeyCacheLifetime() {

        int valueInt = 0;

        String valueStr = System.getProperty(DELEGATION_KEY_CACHE_LIFETIME);

        if (valueStr != null && valueStr.length() > 0) {
            int parsedvalueInt = Integer.parseInt(valueStr);
            if (parsedvalueInt > 0) {
                valueInt = parsedvalueInt;
            }
        }

        if (valueInt == -1) { // Didn't find a system property
            valueStr = getProperty(DELEGATION_KEY_CACHE_LIFETIME);
            if (valueStr != null && valueStr.length() > 0) {
                int parsedvalueInt = Integer.parseInt(valueStr);
                if (parsedvalueInt > 0) {
                    valueInt = parsedvalueInt;
                }
            }
        }
        return valueInt;
    }
347865
function findDelegate(start) {
  let frag = start;
  let delegate, el;

  out: while (frag) {
    // find next element
    el = 0;
    while (!el && frag) {
      if (frag.owner.type === ELEMENT) el = frag.owner;
      if (frag.owner.ractive && frag.owner.ractive.delegate === false) break out;
      frag = frag.parent || frag.componentParent;
    }

    if (el.delegate === false) break out;
    delegate = el.delegate || el;

    // find next repeated fragment
    while (frag) {
      if (frag.iterations) break;
      if (frag.owner.ractive && frag.owner.ractive.delegate === false) break out;
      frag = frag.parent || frag.componentParent;
    }
  }

  return delegate;
}
927010
public <T> boolean registerDelegate(Delegate<T> delegate)
    {
        return registerDelegate(delegate.typeClass().getName(), delegate);
    }
479239
public EntityContainer getEntityContainer(boolean ignorenull) throws PMException {
        if (ignorenull) {
            return entityContainer;
        }
        if (entityContainer == null) {
            throw new PMException("pm_core.entity.not.found");
        }
        return entityContainer;
    }
556481
protected void delegate(StreamMessage<T> delegate) {
        requireNonNull(delegate, "delegate");

        if (!delegateUpdater.compareAndSet(this, null, delegate)) {
            throw new IllegalStateException("delegate set already");
        }

        if (abortPending != 0) {
            delegate.abort();
        }

        if (!completionFuture().isDone()) {
            delegate.completionFuture().handle((unused, cause) -> {
                if (cause == null) {
                    completionFuture().complete(null);
                } else {
                    completionFuture().completeExceptionally(cause);
                }
                return null;
            }).exceptionally(CompletionActions::log);
        }

        safeOnSubscribeToDelegate();
    }