You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by lw...@apache.org on 2006/12/12 07:59:56 UTC

svn commit: r486048 - in /incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa: BPELDAOConnectionImpl.java CorrelatorDAOImpl.java MessageExchangeDAOImpl.java ProcessDAOImpl.java ProcessInstanceDAOImpl.java ScopeDAOImpl.java XmlDataDAOImpl.java

Author: lwaterman
Date: Mon Dec 11 22:59:55 2006
New Revision: 486048

URL: http://svn.apache.org/viewvc?view=rev&rev=486048
Log:
Fixed several unique key problems

Modified:
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
    incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java Mon Dec 11 22:59:55 2006
@@ -1,3 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
 package org.apache.ode.dao.jpa;
 
 import java.util.ArrayList;
@@ -86,6 +106,7 @@
 
 	public ProcessDAO createProcess(QName pid, QName type, String guid) {
 		ProcessDAOImpl ret = new ProcessDAOImpl(pid,type,guid,this);
+		
 		_processes.add(ret);
 		return ret;
 	}
@@ -167,6 +188,15 @@
 	
 	public void setEntityManger(EntityManager em) {
 		_em = em;
+	}
+	
+	void removeProcess(ProcessDAOImpl p) {
+		_processes.remove(p);
+		
+		if ( _em != null ) {
+			_em.remove(p);
+		}
+		
 	}
 
 }

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -45,10 +45,7 @@
 @Table(name="ODE_CORRELATOR")
 public class CorrelatorDAOImpl implements CorrelatorDAO {
 	
-	@Id @Column(name="CORRELATOR_ID") 
-	@GeneratedValue(strategy=GenerationType.AUTO)
-	private Long _correlatorId;
-	@Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey;
+	@Id @Column(name="CORRELATOR_KEY") private String _correlatorKey;
 	@OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
 	private Collection<MessageRouteDAOImpl> _routes = new ArrayList<MessageRouteDAOImpl>();
 	@OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
@@ -63,7 +60,9 @@
 
 	public void addRoute(String routeGroupId, ProcessInstanceDAO target,
 			int index, CorrelationKey correlationKey) {
-		_routes.add(new MessageRouteDAOImpl(correlationKey,routeGroupId,index,(ProcessInstanceDAOImpl)target));
+		MessageRouteDAOImpl mr = new MessageRouteDAOImpl(correlationKey,routeGroupId,index,(ProcessInstanceDAOImpl)target);
+		
+		_routes.add(mr);
 	}
 
 	public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -70,7 +70,6 @@
 	@Transient private Element _eprElement;
 	@Basic @Column(name="FAULT") private String _fault;
 	@Basic @Column(name="FAULT_EXPLANATION") private String _faultExplanation;
-	@Basic @Column(name="MESSAGE_EXCHANGE_KEY") private String _messageExchangeId;
 	@Basic @Column(name="OPERATION") private String _operation;
 	@Basic @Column(name="PARTNER_LINK_MODEL_ID") private int _partnerLinkModelId;
 	@Basic @Column(name="PATTERN") private String _pattern;
@@ -108,7 +107,8 @@
 	}
 	
 	public MessageDAO createMessage(QName type) {
-		return new MessageDAOImpl(type,this);
+		MessageDAOImpl ret = new MessageDAOImpl(type,this);
+		return ret ;
 	}
 
 	public QName getCallee() {

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package org.apache.ode.dao.jpa;
 
 import java.util.ArrayList;
@@ -31,8 +50,6 @@
 @Entity
 @Table(name="ODE_PROCESS")
 public class ProcessDAOImpl implements ProcessDAO {
-	@PersistenceUnit
-	private EntityManager em;
 	
 	@Id @Column(name="PROCESS_ID") 
 	@GeneratedValue(strategy=GenerationType.AUTO)
@@ -60,12 +77,15 @@
 	}
 	
 	public void addCorrelator(String correlator) {
-		_correlators.add(new CorrelatorDAOImpl(correlator));
+		CorrelatorDAOImpl corr = new CorrelatorDAOImpl(correlator);
+		
+		_correlators.add(corr);
 	}
 
 	public ProcessInstanceDAO createInstance(
 			CorrelatorDAO instantiatingCorrelator) {
 		ProcessInstanceDAOImpl inst = new ProcessInstanceDAOImpl((CorrelatorDAOImpl)instantiatingCorrelator, this,_connection);
+		_connection.getEntityManager().persist(inst);
 		_instances.add(inst);
 		_numInstances++;
 		
@@ -73,9 +93,7 @@
 	}
 
 	public void delete() {
-		if ( _connection.getEntityManager() != null ) {
-			_connection.getEntityManager().remove(this);
-		}
+		_connection.removeProcess(this);
 	}
 
 	public Collection<ProcessInstanceDAO> findInstance(CorrelationKey cckey) {
@@ -124,6 +142,8 @@
 
 	public void instanceCompleted(ProcessInstanceDAO instance) {
 		// TODO Auto-generated method stub
+		String tmp = "complete";
+		
 	}
 
 	public void removeRoutes(String routeId, ProcessInstanceDAO target) {

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 package org.apache.ode.dao.jpa;
 
 import java.util.ArrayList;
@@ -97,6 +116,9 @@
 		
 		_rootScope = (parentScope == null)?ret:_rootScope;
 		
+		// Must persist the scope to generate a scope ID
+		_connection.getEntityManager().persist(ret);
+		
 		return ret;
 	}
 
@@ -262,6 +284,7 @@
 	public void setFault(QName faultName, String explanation, int faultLineNo,
 			int activityId, Element faultMessage) {
 		_fault = new FaultDAOImpl(faultName,explanation,faultLineNo,activityId,faultMessage);
+		
 	}
 
 	public void setLastActiveTime(Date dt) {

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -116,6 +116,10 @@
 			// an explicit create pattern isn't used ( i.e. similar to
 			// PartnerLink creation )
 			ret = new CorrelationSetDAOImpl(this,corrSetName);
+			
+			// Persist the new correlation set to generate an ID
+			_connection.getEntityManager().persist(ret);
+			
 			_correlationSets.add(ret);
 		}
 		

Modified: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java?view=diff&rev=486048&r1=486047&r2=486048
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java (original)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java Mon Dec 11 22:59:55 2006
@@ -53,7 +53,6 @@
 	@Lob @Column(name="DATA") private String _data;
 	@Transient private Node _node;
 	@Basic @Column(name="IS_SIMPLE_TYPE") private boolean _isSimpleType;
-	@Basic @Column(name="IS_NULL") private boolean _isNull;
 	@Basic @Column(name="NAME") private String _name;
 	@Basic @Column(name="PROPERTIES") private Properties _props = new Properties();
 	@Version @Column(name="VERSION") private long _version;
@@ -105,7 +104,7 @@
 	}
 
 	public boolean isNull() {
-		return _isNull;
+		return _data == null;
 	}
 
 	public void remove() {