juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfa...@apache.org
Subject svn commit: r733150 - in /webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi: config/ model/ validation/
Date Fri, 09 Jan 2009 20:59:46 GMT
Author: jfaath
Date: Fri Jan  9 12:59:46 2009
New Revision: 733150

URL: http://svn.apache.org/viewvc?rev=733150&view=rev
Log:
removed need for the KeyGeneratorKeyId class, fixed a minor bug with saving child entities

Removed:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKeyId.java
Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKey.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/OverviewDoc.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/UddiEntityPublisher.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java?rev=733150&r1=733149&r2=733150&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/config/Install.java
Fri Jan  9 12:59:46 2009
@@ -23,7 +23,6 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.List;
-import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.UUID;
 
@@ -45,7 +44,6 @@
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.mapping.MappingApiToModel;
 import org.apache.juddi.model.KeyGeneratorKey;
-import org.apache.juddi.model.KeyGeneratorKeyId;
 import org.apache.juddi.model.UddiEntityPublisher;
 import org.apache.juddi.query.PersistenceManager;
 import org.apache.juddi.validation.ValidatePublish;
@@ -415,13 +413,7 @@
 		
 		em.persist(modelTModel);
 		
-		int id = 0;
-		Set<KeyGeneratorKey> keyGenList = publisher.getKeyGeneratorKeys();
-		if (keyGenList != null)
-			id = keyGenList.size();
-		
 		KeyGeneratorKey keyGenKey = new KeyGeneratorKey();
-		keyGenKey.setId(new KeyGeneratorKeyId(publisher.getAuthorizedName(), id));
 		keyGenKey.setPublisher(publisher);
 		keyGenKey.setKeygenTModelKey(modelTModel.getEntityKey());
 		publisher.getKeyGeneratorKeys().add(keyGenKey);

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKey.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKey.java?rev=733150&r1=733149&r2=733150&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKey.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/KeyGeneratorKey.java
Fri Jan  9 12:59:46 2009
@@ -16,9 +16,11 @@
  */
 
 import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
 import javax.persistence.Table;
@@ -31,29 +33,29 @@
 public class KeyGeneratorKey implements java.io.Serializable {
 
 	private static final long serialVersionUID = 1L;
-	private KeyGeneratorKeyId id;
+	private Long id;
 	private UddiEntityPublisher publisher;
 	private String keygenTModelKey;
 
 	public KeyGeneratorKey() {
 	}
 
-	public KeyGeneratorKey(KeyGeneratorKeyId id, UddiEntityPublisher publisher, String keygenTModelKey)
{
-		this.id = id;
+	public KeyGeneratorKey(UddiEntityPublisher publisher, String keygenTModelKey) {
 		this.publisher = publisher;
 		this.keygenTModelKey = keygenTModelKey;
 	}
 
-	@EmbeddedId
-	public KeyGeneratorKeyId getId() {
+	@Id
+	@GeneratedValue(strategy=GenerationType.AUTO)
+	public Long getId() {
 		return this.id;
 	}
-	public void setId(KeyGeneratorKeyId id) {
+	public void setId(Long id) {
 		this.id = id;
 	}
 
 	@ManyToOne(fetch = FetchType.LAZY)
-	@JoinColumn(name = "authorized_name", nullable = false, insertable = false, updatable =
false)
+	@JoinColumn(name = "authorized_name", nullable = false)
 	public UddiEntityPublisher getPublisher() {
 		return this.publisher;
 	}

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/OverviewDoc.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/OverviewDoc.java?rev=733150&r1=733149&r2=733150&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/OverviewDoc.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/OverviewDoc.java
Fri Jan  9 12:59:46 2009
@@ -88,7 +88,7 @@
 	}
 	
 	@ManyToOne(fetch = FetchType.LAZY)
-	@JoinColumn(name = "tmodel_id", nullable = true)
+	@JoinColumn(name = "entity_key", nullable = true)
 	public Tmodel getTmodel() {
 		return this.tmodel;
 	}

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/UddiEntityPublisher.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/UddiEntityPublisher.java?rev=733150&r1=733149&r2=733150&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/UddiEntityPublisher.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/UddiEntityPublisher.java
Fri Jan  9 12:59:46 2009
@@ -73,8 +73,7 @@
 		this.keyGeneratorKeys = keyGeneratorKeys;
 	}
 	public void addKeyGeneratorKey(String keygenTModelKey) {
-		KeyGeneratorKeyId keyGenKeyId = new KeyGeneratorKeyId(this.authorizedName, this.keyGeneratorKeys.size());
-		KeyGeneratorKey keyGenKey = new KeyGeneratorKey(keyGenKeyId, this, keygenTModelKey);
+		KeyGeneratorKey keyGenKey = new KeyGeneratorKey(this, keygenTModelKey);
 		keyGeneratorKeys.add(keyGenKey);
 	}
 	public void removeKeyGeneratorKey(String keygenTModelKey) {
@@ -156,7 +155,7 @@
 		DynamicQuery checkTokensQry = new DynamicQuery();
 		checkTokensQry.append("select k.keygenTModelKey from KeyGeneratorKey k ");
 
-		DynamicQuery.Parameter pubParam = new DynamicQuery.Parameter("k.id.authorizedName", 
+		DynamicQuery.Parameter pubParam = new DynamicQuery.Parameter("k.publisher.authorizedName",

 																	 this.authorizedName, 
 																	 DynamicQuery.PREDICATE_NOTEQUALS);
 		checkTokensQry.WHERE().pad().appendGroupedAnd(pubParam).pad();

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java?rev=733150&r1=733149&r2=733150&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidatePublish.java
Fri Jan  9 12:59:46 2009
@@ -430,9 +430,20 @@
 				Object obj = em.find(org.apache.juddi.model.BusinessService.class, entityKey);
 				if (obj != null) {
 					entityExists = true;
+
+					org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService)obj;
+					
+					// If the object exists, and the parentKey was not found to this point, then a save
on an existing service with a blank
+					// business key has occurred.  It is set here and added to the entity being saved -
a necessary step for the object to be
+					// persisted properly. (This condition makes some validation tests below unnecessary
as the parent is "verified" but it's OK to
+					// still run them).
+					if (parentKey == null || parentKey.length() == 0) {
+						parentKey = bs.getBusinessEntity().getEntityKey();
+						businessService.setBusinessKey(parentKey);
+					}
+					
 					// If existing service trying to be saved has a different parent key, then we have a
problem
 					// TODO: moving services is allowed according to spec?
-					org.apache.juddi.model.BusinessService bs = (org.apache.juddi.model.BusinessService)obj;
 					if (!parentKey.equals(bs.getBusinessEntity().getEntityKey()))
 						throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.businessservice.ParentMismatch",
parentKey + ", " + bs.getBusinessEntity().getEntityKey()));
 					
@@ -537,9 +548,20 @@
 			Object obj = em.find(org.apache.juddi.model.BindingTemplate.class, entityKey);
 			if (obj != null) {
 				entityExists = true;
+
+				org.apache.juddi.model.BindingTemplate bt = (org.apache.juddi.model.BindingTemplate)obj;
+
+				// If the object exists, and the parentKey was not found to this point, then a save on
an existing binding with a blank
+				// service key has occurred.  It is set here and added to the entity being saved - a
necessary step for the object to be
+				// persisted properly. (This condition makes some validation tests below unnecessary
as the parent is "verified" but it's OK to
+				// still run them).
+				if (parentKey == null || parentKey.length() == 0) {
+					parentKey = bt.getBusinessService().getEntityKey();
+					bindingTemplate.setServiceKey(parentKey);
+				}
+				
 				// If existing binding trying to be saved has a different parent key, then we have a
problem
 				// TODO: moving bindings is allowed according to spec?
-				org.apache.juddi.model.BindingTemplate bt = (org.apache.juddi.model.BindingTemplate)obj;
 				if (!parentKey.equals(bt.getBusinessService().getEntityKey()))
 					throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.bindingtemplate.ParentMismatch",
parentKey + ", " + bt.getBusinessService().getEntityKey()));
 				



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message