You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2009/05/26 23:56:37 UTC
svn commit: r778904 - in /webservices/juddi/branches/v3_trunk:
juddi-core/src/main/java/org/apache/juddi/model/ juddi-cxf/persistence/
Author: jfaath
Date: Tue May 26 21:56:37 2009
New Revision: 778904
URL: http://svn.apache.org/viewvc?rev=778904&view=rev
Log:
adjusted model for service projections
Added:
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java (with props)
Modified:
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessService.java
webservices/juddi/branches/v3_trunk/juddi-cxf/persistence/hibernate-persistence.xml
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java?rev=778904&r1=778903&r2=778904&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessEntity.java Tue May 26 21:56:37 2009
@@ -22,9 +22,6 @@
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
@@ -49,7 +46,7 @@
private List<BusinessService> businessServices = new ArrayList<BusinessService>(0);
private List<BusinessDescr> businessDescrs = new ArrayList<BusinessDescr>(0);
- private List<BusinessService> serviceProjections = new ArrayList<BusinessService>(0);
+ private List<ServiceProjection> serviceProjections = new ArrayList<ServiceProjection>(0);
public BusinessEntity() {
}
@@ -164,16 +161,14 @@
public void setBusinessDescrs(List<BusinessDescr> businessDescrs) {
this.businessDescrs = businessDescrs;
}
-
- @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinTable(name="juddiv3_service_projection",
- joinColumns = { @JoinColumn(name = "business_key") },
- inverseJoinColumns = { @JoinColumn(name = "service_key") })
- public List<BusinessService> getServiceProjections() {
- return this.serviceProjections;
+
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "businessEntity")
+ public List<ServiceProjection> getServiceProjections() {
+ return serviceProjections;
}
- public void setServiceProjections(List<BusinessService> serviceProjections) {
+ public void setServiceProjections(List<ServiceProjection> serviceProjections) {
this.serviceProjections = serviceProjections;
}
+
}
Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessService.java?rev=778904&r1=778903&r2=778904&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessService.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/BusinessService.java Tue May 26 21:56:37 2009
@@ -23,7 +23,6 @@
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
@@ -44,7 +43,7 @@
private List<ServiceDescr> serviceDescrs = new ArrayList<ServiceDescr>(0);
private List<BindingTemplate> bindingTemplates = new ArrayList<BindingTemplate>(0);
private ServiceCategoryBag categoryBag;
- private List<BusinessEntity> businessProjections = new ArrayList<BusinessEntity>(0);
+ private List<ServiceProjection> projectingBusinesses = new ArrayList<ServiceProjection>(0);
public BusinessService() {
}
@@ -110,13 +109,12 @@
public void setCategoryBag(ServiceCategoryBag categoryBag) {
this.categoryBag = categoryBag;
}
-
- @ManyToMany(mappedBy="serviceProjections", targetEntity=BusinessEntity.class)
- public List<BusinessEntity> getBusinessProjections() {
- return businessProjections;
- }
-
- public void setBusinessProjections(List<BusinessEntity> businessProjections) {
- this.businessProjections = businessProjections;
+
+ @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "businessService")
+ public List<ServiceProjection> getProjectingBusinesses() {
+ return projectingBusinesses;
+ }
+ public void setProjectingBusinesses(List<ServiceProjection> projectingBusinesses) {
+ this.projectingBusinesses = projectingBusinesses;
}
}
Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java?rev=778904&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java Tue May 26 21:56:37 2009
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ *
+ * Licensed 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.juddi.model;
+
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+import javax.persistence.EmbeddedId;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+@Entity
+@Table(name = "juddiv3_service_projection")
+public class ServiceProjection implements java.io.Serializable {
+
+ @Embeddable
+ public static class Id implements java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Column(name = "business_key", nullable = false, length = 255)
+ private String businessKey;
+ @Column(name = "service_key", nullable = false, length = 255)
+ String serviceKey;
+
+ public Id() {
+ }
+ public Id(String businessKey, String serviceKey) {
+ this.businessKey = businessKey;
+ this.serviceKey = serviceKey;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((businessKey == null) ? 0 : businessKey.hashCode());
+ result = prime * result
+ + ((serviceKey == null) ? 0 : serviceKey.hashCode());
+ return result;
+ }
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Id other = (Id) obj;
+ if (businessKey == null) {
+ if (other.businessKey != null)
+ return false;
+ } else if (!businessKey.equals(other.businessKey))
+ return false;
+ if (serviceKey == null) {
+ if (other.serviceKey != null)
+ return false;
+ } else if (!serviceKey.equals(other.serviceKey))
+ return false;
+ return true;
+ }
+
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ @EmbeddedId
+ private Id id = new Id();
+ @ManyToOne
+ @JoinColumn(name = "business_key", insertable = false, updatable = false)
+ private BusinessEntity businessEntity;
+ @ManyToOne
+ @JoinColumn(name = "service_key", insertable = false, updatable = false)
+ private BusinessService businessService;
+
+ public ServiceProjection() {
+ }
+
+ public ServiceProjection(BusinessEntity businessEntity, BusinessService businessService) {
+ this.businessEntity = businessEntity;
+ this.businessService = businessService;
+
+ this.id.businessKey = businessEntity.entityKey;
+ this.id.serviceKey = businessService.entityKey;
+
+ businessEntity.getServiceProjections().add(this);
+ businessService.getProjectingBusinesses().add(this);
+ }
+
+ public Id getId() {
+ return id;
+ }
+ public void setId(Id id) {
+ this.id = id;
+ }
+
+ public BusinessEntity getBusinessEntity() {
+ return businessEntity;
+ }
+ public void setBusinessEntity(BusinessEntity businessEntity) {
+ this.businessEntity = businessEntity;
+ }
+
+ public BusinessService getBusinessService() {
+ return businessService;
+ }
+ public void setBusinessService(BusinessService businessService) {
+ this.businessService = businessService;
+ }
+
+}
Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/model/ServiceProjection.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: webservices/juddi/branches/v3_trunk/juddi-cxf/persistence/hibernate-persistence.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-cxf/persistence/hibernate-persistence.xml?rev=778904&r1=778903&r2=778904&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-cxf/persistence/hibernate-persistence.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-cxf/persistence/hibernate-persistence.xml Tue May 26 21:56:37 2009
@@ -38,6 +38,7 @@
<class>org.apache.juddi.model.ServiceCategoryBag</class>
<class>org.apache.juddi.model.ServiceDescr</class>
<class>org.apache.juddi.model.ServiceName</class>
+ <class>org.apache.juddi.model.ServiceProjection</class>
<class>org.apache.juddi.model.Subscription</class>
<class>org.apache.juddi.model.SubscriptionChunkToken</class>
<class>org.apache.juddi.model.SubscriptionMatch</class>
---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org