[jbpm-commits] JBoss JBPM SVN: r1909 - in jbossbpm/spec/trunk/modules: ri/src/main/java/org/jboss/bpm/model/internal and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Aug 17 01:37:06 EDT 2008


Author: thomas.diesler at jboss.com
Date: 2008-08-17 01:37:05 -0400 (Sun, 17 Aug 2008)
New Revision: 1909

Removed:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NameSupport.java
Modified:
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
   jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
   jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java
Log:
Remove NameSupport

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/FlowObject.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -30,9 +30,14 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface FlowObject extends GraphicalElement, NameSupport
+public interface FlowObject extends GraphicalElement
 {
   /**
+   * Get the unique name.
+   */
+  String getName();
+  
+  /**
    * Get the associated Process
    */
   Process getProcess();

Deleted: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NameSupport.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NameSupport.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/NameSupport.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.model;
-
-//$Id$
-
-/**
- * Implementing {@link BPMNElement} have can be uniquely identified 
- * in the {@link Process} by name.
- * 
- * @author thomas.diesler at jboss.com
- * @since 08-Jul-2008
- */
-public interface NameSupport
-{
-  /**
-   * Get the unique name.
-   */
-  String getName();
-}
\ No newline at end of file

Modified: jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java
===================================================================
--- jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/api/src/main/java/org/jboss/bpm/model/Process.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -35,12 +35,12 @@
  * @author thomas.diesler at jboss.com
  * @since 08-Jul-2008
  */
-public interface Process extends SupportingElement, NameSupport, PropertySupport
+public interface Process extends SupportingElement, PropertySupport
 {
   /**
    * Defines the type of a {@link Process}
    */
-  enum ProcessType
+  public enum ProcessType
   {
     None, Private, Abstract, Collaboration
   };
@@ -48,12 +48,17 @@
   /**
    * Defines the status a {@link Process} can be in
    */
-  enum ProcessStatus
+  public enum ProcessStatus
   {
     None, Ready, Active, Cancelled, Aborting, Aborted, Completing, Completed
   };
 
   /**
+   * Get the unique name.
+   */
+  String getName();
+  
+  /**
    * Get the process type
    */
   ProcessType getProcessType();

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/BPMNElementImpl.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -27,10 +27,9 @@
 
 import org.jboss.bpm.client.ObjectNameFactory;
 import org.jboss.bpm.model.BPMNElement;
-import org.jboss.bpm.model.Event;
 import org.jboss.bpm.model.ConnectingObject;
+import org.jboss.bpm.model.Event;
 import org.jboss.bpm.model.Gateway;
-import org.jboss.bpm.model.NameSupport;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.Task;
 import org.jboss.util.id.UID;
@@ -63,19 +62,23 @@
     StringBuilder str = new StringBuilder(ID_DOMAIN + ":");
     if (this instanceof Event)
     {
-      str.append("type=Event");
+      Event event = (Event)this;
+      str.append("type=Event,name=" + event.getName());
     }
     else if (this instanceof Process)
     {
-      str.append("type=Process");
+      Process proc = (Process)this;
+      str.append("type=Process,name=" + proc.getName());
     }
     else if (this instanceof Task)
     {
-      str.append("type=Task");
+      Task task = (Task)this;
+      str.append("type=Task,name=" + task.getName());
     }
     else if (this instanceof Gateway)
     {
-      str.append("type=Gateway");
+      Gateway gateway = (Gateway)this;
+      str.append("type=Gateway,name=" + gateway.getName());
     }
     else if (this instanceof ConnectingObject)
     {
@@ -85,10 +88,6 @@
     {
       str.append("type=Other");
     }
-    if (this instanceof NameSupport)
-    {
-      str.append(",name=" + ((NameSupport)this).getName());
-    }
     str.append(",id=" + new UID());
     this.id = ObjectNameFactory.create(str.toString());
   }

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowImpl.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -24,7 +24,7 @@
 //$Id$
 
 import org.jboss.bpm.model.ConnectingObject;
-import org.jboss.bpm.model.GraphicalElement;
+import org.jboss.bpm.model.FlowObject;
 
 /**
  * A Flow is a graphical line connecting two objects in a BPD. There are two types of Flow: Sequence Flow and Message Flow, each with their own line style. Flow is also
@@ -38,8 +38,8 @@
 {
   private String name;
   private String targetName;
-  private GraphicalElement source;
-  private GraphicalElement target;
+  private FlowObject source;
+  private FlowObject target;
 
   public FlowImpl(String targetName)
   {
@@ -59,22 +59,22 @@
     this.name = name;
   }
 
-  public GraphicalElement getSourceRef()
+  public FlowObject getSourceRef()
   {
     return source;
   }
 
-  protected void setSourceRef(GraphicalElement source)
+  protected void setSourceRef(FlowObject source)
   {
     this.source = source;
   }
 
-  public GraphicalElement getTargetRef()
+  public FlowObject getTargetRef()
   {
     return target;
   }
   
-  protected void setTargetRef(GraphicalElement target)
+  protected void setTargetRef(FlowObject target)
   {
     this.target = target;
   }

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/FlowObjectImpl.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -29,7 +29,6 @@
 import org.jboss.bpm.model.Gateway;
 import org.jboss.bpm.model.MultipleInFlowSupport;
 import org.jboss.bpm.model.MultipleOutFlowSupport;
-import org.jboss.bpm.model.NameSupport;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.SingleInFlowSupport;
 import org.jboss.bpm.model.SingleOutFlowSupport;
@@ -54,7 +53,7 @@
   private FlowHandler flowHandler;
   private SignalHandler signalHandler;
   private ExecutionHandler executionHandler;
-  
+
   public FlowObjectImpl(String name)
   {
     this.name = name;
@@ -104,12 +103,12 @@
   {
     this.signalHandler = signalHandler;
   }
-  
+
   public void execute(Token token)
   {
     callExecutionHandler(token);
   }
-  
+
   /**
    * Execute external business logic
    */
@@ -127,30 +126,23 @@
   {
     // noting to do
   }
-  
+
   @Override
   protected void initialize(Process proc)
   {
     super.initialize(proc);
     this.proc = proc;
 
-    if (this instanceof NameSupport)
-    {
-      // Check required name
-      String name = ((NameSupport)this).getName();
-      if (name == null)
-        throw new InvalidProcessException("Name is required for: " + this);
+    // Check required name
+    if (name == null)
+      throw new InvalidProcessException("Name is required for: " + this);
 
-      // Check name uniqueness
-      for (FlowObject aux : proc.getFlowObjects())
-      {
-        if (aux != this && aux instanceof NameSupport)
-        {
-          String auxName = ((NameSupport)aux).getName();
-          if (name.equals(auxName))
-            throw new NameNotUniqueException(this.toString());
-        }
-      }
+    // Check name uniqueness
+    for (FlowObject aux : proc.getFlowObjects())
+    {
+      String auxName = aux.getName();
+      if (aux != this && name.equals(auxName))
+        throw new NameNotUniqueException(toString());
     }
 
     // Initialize in/out flows

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/ProcessImpl.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -45,7 +45,6 @@
 import org.jboss.bpm.model.FlowObject;
 import org.jboss.bpm.model.InputSet;
 import org.jboss.bpm.model.Message;
-import org.jboss.bpm.model.NameSupport;
 import org.jboss.bpm.model.OutputSet;
 import org.jboss.bpm.model.Process;
 import org.jboss.bpm.model.Property;
@@ -309,14 +308,10 @@
     FlowObject flowObject = null;
     for (FlowObject aux : flowObjects)
     {
-      if (aux instanceof NameSupport)
+      if (name.equals(aux.getName()))
       {
-        NameSupport auxnfo = (NameSupport)aux;
-        if (name.equals(auxnfo.getName()))
-        {
-          flowObject = aux;
-          break;
-        }
+        flowObject = aux;
+        break;
       }
     }
     return flowObject;

Modified: jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java
===================================================================
--- jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java	2008-08-16 14:50:11 UTC (rev 1908)
+++ jbossbpm/spec/trunk/modules/ri/src/main/java/org/jboss/bpm/model/internal/SequenceFlowImpl.java	2008-08-17 05:37:05 UTC (rev 1909)
@@ -24,8 +24,7 @@
 //$Id$
 
 import org.jboss.bpm.model.Expression;
-import org.jboss.bpm.model.GraphicalElement;
-import org.jboss.bpm.model.NameSupport;
+import org.jboss.bpm.model.FlowObject;
 import org.jboss.bpm.model.SequenceFlow;
 
 /**
@@ -65,10 +64,10 @@
   
   public String toString()
   {
-    GraphicalElement sourceRef = getSourceRef();
-    GraphicalElement targetRef = getTargetRef();
-    String srcName = (sourceRef instanceof NameSupport ? ((NameSupport)sourceRef).getName() : sourceRef.getID().getCanonicalName());
-    String tarName = (targetRef instanceof NameSupport ? ((NameSupport)targetRef).getName() : targetRef.getID().getCanonicalName());
+    FlowObject sourceRef = getSourceRef();
+    FlowObject targetRef = getTargetRef();
+    String srcName = (sourceRef.getName() != null ? sourceRef.getName() : sourceRef.getID().getCanonicalName());
+    String tarName = (targetRef.getName() != null ? targetRef.getName() : targetRef.getID().getCanonicalName());
     return "SequenceFlow[" + srcName + "->" + tarName + "]";
   }
 }
\ No newline at end of file




More information about the jbpm-commits mailing list