📄 activity.java
字号:
// continue execution proceed(exeContext); } /** * Sets the status of all outgoing links to <code>false</code>. To avoid violating control * dependencies, this is only performed after the status of all incoming links has been * determined. */ public void eliminatePath(Token token) { if (!targets.isEmpty()) { setTargetsToken(token); if (!areTargetsDetermined(token)) return; } if (!sources.isEmpty()) setSourcesNegativeStatus(token); } private void setSourcesNegativeStatus(Token token) { for (int i = 0, n = sources.size(); i < n; i++) { LinkDefinition source = (LinkDefinition) sources.get(i); source.getInstance(token).statusDetermined(false); } } public void targetDetermined(Token token) { // ignore the notification until every link is determined if (!areTargetsDetermined(token)) return; try { if (!equals(token.getNode())) { // token left: dealing with a path previously eliminated by a structure setSourcesNegativeStatus(token); } else if (evaluateJoinCondition(token)) execute(new ExecutionContext(token)); } catch (BpelFaultException e) { raiseException(e, new ExecutionContext(token)); } } protected boolean suppressJoinFailure() { return suppressJoinFailure != null ? suppressJoinFailure.booleanValue() : getCompositeActivity().suppressJoinFailure(); } // standard attributes and elements // ///////////////////////////////////////////////////////////////////////////// public JoinCondition getJoinCondition() { return joinCondition; } public void setJoinCondition(JoinCondition joinCondition) { this.joinCondition = joinCondition; } public Boolean getSuppressJoinFailure() { return suppressJoinFailure; } public void setSuppressJoinFailure(Boolean suppressJoinFailure) { this.suppressJoinFailure = suppressJoinFailure; } /** * Retrieves a target link by name. */ public LinkDefinition getTarget(String name) { if (!targets.isEmpty()) { for (int i = 0, n = targets.size(); i < n; i++) { LinkDefinition target = (LinkDefinition) targets.get(i); if (name.equals(target.getName())) return target; } } return null; } /** * Retrieves a list of all target {@linkplain LinkDefinition links}. */ public List getTargets() { return targets; } /** * Adds a bidirectional relation between this activity and the given target link. * @throws IllegalArgumentException if link is null */ public void addTarget(LinkDefinition link) { if (link == null) throw new IllegalArgumentException("link is null"); targets.add(link); link.setTarget(this); } /** * Removes the bidirectional relation between this activity and the given target link. * @throws IllegalArgumentException if link is null */ public void removeTarget(LinkDefinition link) { if (link == null) throw new IllegalArgumentException("link is null"); if (targets.remove(link)) link.setTarget(null); } /** * Retrieves a source link by name. */ public LinkDefinition getSource(String name) { if (!sources.isEmpty()) { for (int i = 0, n = sources.size(); i < n; i++) { LinkDefinition source = (LinkDefinition) sources.get(i); if (name.equals(source.getName())) return source; } } return null; } /** * Retrieves a list of all source {@linkplain LinkDefinition links}. */ public List getSources() { return sources; } /** * Adds a bidirectional relation between this activity and the given source link. * @throws IllegalArgumentException if link is null */ public void addSource(LinkDefinition link) { if (link == null) throw new IllegalArgumentException("link is null"); sources.add(link); link.setSource(this); } /** * Removes the bidirectional relation between this activity and the given source link. * @throws IllegalArgumentException if link is null */ public void removeSource(LinkDefinition link) { if (link == null) throw new IllegalArgumentException("link is null"); if (sources.remove(link)) link.setSource(null); } /** * Returns the immediately enclosing composite activity. */ public CompositeActivity getCompositeActivity() { return compositeActivity; } /** * Sets the immediately enclosing composite activity. */ void setCompositeActivity(CompositeActivity compositeActivity) { this.compositeActivity = compositeActivity; } // utility methods // ///////////////////////////////////////////////////////////////////////////// /** * Detaches this activity from its immediately enclosing * {@linkplain #getCompositeActivity() composite activity}. */ public void detachFromParent() { if (compositeActivity != null) { compositeActivity.removeNode(this); compositeActivity = null; } } /** * Returns the enclosing process definition. */ public BpelProcessDefinition getBpelProcessDefinition() { return (BpelProcessDefinition) getProcessDefinition(); } /** * Returns the nearest enclosing scope. */ public Scope getScope() { // easy way out: composite activity is not a scope if (!compositeActivity.isScope()) return compositeActivity.getScope(); // check whether composite activity has the proper type already if (compositeActivity instanceof Scope) return (Scope) compositeActivity; // acquire proxy of the proper type JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); BpelGraphSession graphSession = BpelGraphSession.getContextInstance(jbpmContext); Scope scope = graphSession.loadScope(compositeActivity.getId()); // update composite activity reference compositeActivity = scope; return scope; } /** * Mirrors the {@link #getDefaultLeavingTransition()} method to ease manipulation of activities * with a single arriving transition. Notice that every standard activity in a BPEL process has * one arriving and one leaving transition because links are implemented as context variables. */ public Transition getDefaultArrivingTransition() { return (Transition) getArrivingTransitions().iterator().next(); } /** * An activity is initial if there is no basic activity that logically precedes it in the behavior * of the process. */ public boolean isInitial() { return (compositeActivity == null || compositeActivity.isInitial() && compositeActivity.isChildInitial(this)) && getTargets().isEmpty(); } /** * Connects this activity to the given activity by creating an implicit transition between them. */ public void connect(Activity activity) { // create an implicit transition Transition transition = new Transition(); transition.setName(getName() + '-' + activity.getName()); transition.setProcessDefinition(processDefinition); // add transition to edge nodes addLeavingTransition(transition); activity.addArrivingTransition(transition); } /** * Tells whether this activity is connected to the given activity. */ public boolean isConnected(Activity activity) { return findTransition(activity) != null; } /** * Disconnects this activity from the given activity by removing the implicit transition between * them. */ public void disconnect(Activity activity) { Transition transition = findTransition(activity); if (transition != null) { removeLeavingTransition(transition); activity.removeArrivingTransition(transition); } } private Transition findTransition(Activity activity) { List leavingTransitions = getLeavingTransitions(); if (leavingTransitions != null) { Set arrivingTransitions = activity.getArrivingTransitions(); if (arrivingTransitions != null) { for (int i = 0, n = leavingTransitions.size(); i < n; i++) { Transition transition = (Transition) leavingTransitions.get(i); if (arrivingTransitions.contains(transition)) return transition; } } } return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -