/jbpm-flow/src/main/java/org/jbpm/workflow/core/node/EndNode.java

https://github.com/michelpohle/jbpm · Java · 69 lines · 37 code · 12 blank · 20 comment · 3 complexity · c4e80e5105fab025ef7a7a8840176ec0 MD5 · raw file

  1. /**
  2. * Copyright 2005 JBoss Inc
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.jbpm.workflow.core.node;
  17. import org.drools.definition.process.Connection;
  18. import org.jbpm.workflow.core.impl.ExtendedNodeImpl;
  19. /**
  20. * Default implementation of an end node.
  21. *
  22. * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
  23. */
  24. public class EndNode extends ExtendedNodeImpl {
  25. private static final String[] EVENT_TYPES =
  26. new String[] { EVENT_NODE_ENTER };
  27. private static final long serialVersionUID = 510l;
  28. private boolean terminate = true;
  29. public boolean isTerminate() {
  30. return terminate;
  31. }
  32. public void setTerminate(boolean terminate) {
  33. this.terminate = terminate;
  34. }
  35. public String[] getActionTypes() {
  36. return EVENT_TYPES;
  37. }
  38. public void validateAddIncomingConnection(final String type, final Connection connection) {
  39. super.validateAddIncomingConnection(type, connection);
  40. if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) {
  41. throw new IllegalArgumentException(
  42. "This type of node only accepts default incoming connection type!");
  43. }
  44. if (getFrom() != null) {
  45. throw new IllegalArgumentException(
  46. "This type of node cannot have more than one incoming connection!");
  47. }
  48. }
  49. public void validateAddOutgoingConnection(final String type, final Connection connection) {
  50. throw new UnsupportedOperationException(
  51. "An end node does not have an outgoing connection!");
  52. }
  53. public void validateRemoveOutgoingConnection(final String type, final Connection connection) {
  54. throw new UnsupportedOperationException(
  55. "An end node does not have an outgoing connection!");
  56. }
  57. }