private static void addActivities( Set<TransitionTarget> visited, List<TransitionTarget> targets, IActivity activity, TransitionOptions options, boolean forward, Stack<TransitionStep> steps) { ModelElementList<ITransition> transitions = forward ? activity.getOutTransitions() : activity.getInTransitions(); JoinSplitType jsType = forward ? activity.getSplitType() : activity.getJoinType(); if (JoinSplitType.And == jsType && transitions.size() > 1) { IActivity target = consume( activity, asList(transitions), CollectionUtils.<ITransition>newHashSet(), forward, options.areLoopsAllowed()); if (target != null) { addActivity(visited, targets, target, options, forward, steps); } } else { for (ITransition transition : transitions) { IActivity target = forward ? transition.getToActivity() : transition.getFromActivity(); jsType = forward ? target.getJoinType() : target.getSplitType(); if (JoinSplitType.And != jsType) { addActivity(visited, targets, target, options, forward, steps); } } } }
private static void addActivity( Set<TransitionTarget> visited, List<TransitionTarget> targets, IActivity target, TransitionOptions options, boolean forward, Stack<TransitionStep> steps) { TransitionTarget candidate = TransitionTargetFactory.createTransitionTarget(target, steps, forward); if (!visited.add(candidate)) { // target already visited, stop processing return; } if (target.getBooleanAttribute(PredefinedConstants.ACTIVITY_IS_RELOCATE_TARGET_ATT)) { // found a relocation target, check filters String processIdPattern = options.getProcessIdPattern(); if (processIdPattern == null || target.getProcessDefinition().getId().matches(processIdPattern)) { String activityIdPattern = options.getActivityIdPattern(); if (activityIdPattern == null || target.getId().matches(activityIdPattern)) { targets.add(candidate); } } } if (options.isTransitionIntoSubprocessesAllowed() && target.getImplementationType() == ImplementationType.SubProcess && target.getSubProcessMode() != SubProcessModeKey.ASYNC_SEPARATE) { IProcessDefinition process = target.getImplementationProcessDefinition(); if (process != null) { steps.push(TransitionTargetFactory.createTransitionStep(target)); addActivities(visited, targets, process, options, forward, steps); steps.pop(); } } addActivities(visited, targets, target, options, forward, steps); }
private static void addActivities( Set<TransitionTarget> visited, List<TransitionTarget> targets, IActivityInstance ai, TransitionOptions options, boolean forward, Stack<TransitionStep> steps) { if (ai != null) { steps.push(TransitionTargetFactory.createTransitionStep(ai)); // add activities from current process definition addActivities(visited, targets, ai.getActivity(), options, forward, steps); // step up into the calling process - starting activity cannot be a relocation target if (options.isTransitionOutOfSubprocessesAllowed()) { addActivities( visited, targets, ai.getProcessInstance().getStartingActivityInstance(), options, forward, steps); } steps.pop(); } }
private Request obtainRequest( Target<TranscodeType> target, BaseRequestOptions<?> requestOptions, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int overrideWidth, int overrideHeight) { requestOptions.lock(); return SingleRequest.obtain( context, model, transcodeClass, requestOptions, overrideWidth, overrideHeight, priority, target, requestListener, requestCoordinator, context.getEngine(), transitionOptions.getTransitionFactory()); }
private Request buildRequestRecursive( Target<TranscodeType> target, @Nullable ThumbnailRequestCoordinator parentCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int overrideWidth, int overrideHeight) { if (thumbnailBuilder != null) { // Recursive case: contains a potentially recursive thumbnail request builder. if (isThumbnailBuilt) { throw new IllegalStateException( "You cannot use a request as both the main request and a " + "thumbnail, consider using clone() on the request(s) passed to thumbnail()"); } TransitionOptions<?, ? super TranscodeType> thumbTransitionOptions = thumbnailBuilder.transitionOptions; if (DEFAULT_ANIMATION_OPTIONS.equals(thumbTransitionOptions)) { thumbTransitionOptions = transitionOptions; } Priority thumbPriority = thumbnailBuilder.requestOptions.isPrioritySet() ? thumbnailBuilder.requestOptions.getPriority() : getThumbnailPriority(priority); int thumbOverrideWidth = thumbnailBuilder.requestOptions.getOverrideWidth(); int thumbOverrideHeight = thumbnailBuilder.requestOptions.getOverrideHeight(); if (Util.isValidDimensions(overrideWidth, overrideHeight) && !thumbnailBuilder.requestOptions.isValidOverride()) { thumbOverrideWidth = requestOptions.getOverrideWidth(); thumbOverrideHeight = requestOptions.getOverrideHeight(); } ThumbnailRequestCoordinator coordinator = new ThumbnailRequestCoordinator(parentCoordinator); Request fullRequest = obtainRequest( target, requestOptions, coordinator, transitionOptions, priority, overrideWidth, overrideHeight); isThumbnailBuilt = true; // Recursively generate thumbnail requests. Request thumbRequest = thumbnailBuilder.buildRequestRecursive( target, coordinator, thumbTransitionOptions, thumbPriority, thumbOverrideWidth, thumbOverrideHeight); isThumbnailBuilt = false; coordinator.setRequests(fullRequest, thumbRequest); return coordinator; } else if (thumbSizeMultiplier != null) { // Base case: thumbnail multiplier generates a thumbnail request, but cannot recurse. ThumbnailRequestCoordinator coordinator = new ThumbnailRequestCoordinator(parentCoordinator); Request fullRequest = obtainRequest( target, requestOptions, coordinator, transitionOptions, priority, overrideWidth, overrideHeight); BaseRequestOptions<?> thumbnailOptions = requestOptions.clone().sizeMultiplier(thumbSizeMultiplier); Request thumbnailRequest = obtainRequest( target, thumbnailOptions, coordinator, transitionOptions, getThumbnailPriority(priority), overrideWidth, overrideHeight); coordinator.setRequests(fullRequest, thumbnailRequest); return coordinator; } else { // Base case: no thumbnail. return obtainRequest( target, requestOptions, parentCoordinator, transitionOptions, priority, overrideWidth, overrideHeight); } }