You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/08/24 08:21:10 UTC

svn commit: r569267 - in /myfaces/orchestra/trunk/examples/src/main: java/org/apache/myfaces/examples/lib/ java/org/apache/myfaces/examples/mops/ java/org/apache/myfaces/examples/mops/backings/ java/org/apache/myfaces/examples/mops/dao/ java/org/apache...

Author: imario
Date: Thu Aug 23 23:21:09 2007
New Revision: 569267

URL: http://svn.apache.org/viewvc?rev=569267&view=rev
Log:
started off a new example - mops - MyFaces Orchestra PetStore


Added:
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/backings/
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/dao/
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/lib/
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/Product.java
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ProductPrice.java
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShopCustomer.java
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCart.java
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCartItem.java
Modified:
    myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
    myfaces/orchestra/trunk/examples/src/main/resources/META-INF/persistence.xml

Modified: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java?rev=569267&r1=569266&r2=569267&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java (original)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/lib/FacesConst.java Thu Aug 23 23:21:09 2007
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+
 package org.apache.myfaces.examples.lib;
 
 public final class FacesConst

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/CustomerGroup.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,68 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Version;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+
+@Entity
+public class CustomerGroup
+{
+	private Long id;
+
+	private String description;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	public String getDescription()
+	{
+		return description;
+	}
+
+	public void setDescription(String description)
+	{
+		this.description = description;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+}
\ No newline at end of file

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/Product.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/Product.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/Product.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/Product.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Version;
+
+@Entity
+public class Product
+{
+	private Long id;
+
+	private String productNumber;
+
+	private String description;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy= GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	public String getDescription()
+	{
+		return description;
+	}
+
+	public void setDescription(String description)
+	{
+		this.description = description;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+}

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ProductPrice.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ProductPrice.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ProductPrice.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ProductPrice.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,121 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+import java.util.Date;
+
+@Entity
+public class ProductPrice
+{
+	private Long id;
+
+	private Product product;
+
+	private CustomerGroup customerGroup;
+
+	private Date validFrom;
+
+	private Date validTo;
+	
+	private double price;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy= GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	public Product getProduct()
+	{
+		return product;
+	}
+
+	public void setProduct(Product product)
+	{
+		this.product = product;
+	}
+
+	@Temporal(value= TemporalType.DATE)
+	public Date getValidFrom()
+	{
+		return validFrom;
+	}
+
+	public void setValidFrom(Date validFrom)
+	{
+		this.validFrom = validFrom;
+	}
+
+	@Temporal(value= TemporalType.DATE)
+	public Date getValidTo()
+	{
+		return validTo;
+	}
+
+	public void setValidTo(Date validTo)
+	{
+		this.validTo = validTo;
+	}
+
+	public double getPrice()
+	{
+		return price;
+	}
+
+	public void setPrice(double price)
+	{
+		this.price = price;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+
+	public CustomerGroup getCustomerGroup()
+	{
+		return customerGroup;
+	}
+
+	public void setCustomerGroup(CustomerGroup customerGroup)
+	{
+		this.customerGroup = customerGroup;
+	}
+}
\ No newline at end of file

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShopCustomer.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShopCustomer.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShopCustomer.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShopCustomer.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+@Entity
+public class ShopCustomer
+{
+	private Long id;
+
+	private String firstName;
+
+	private String lastName;
+
+	private String email;
+
+	private CustomerGroup customerGroup;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	public String getFirstName()
+	{
+		return firstName;
+	}
+
+	public void setFirstName(String firstName)
+	{
+		this.firstName = firstName;
+	}
+
+	public String getLastName()
+	{
+		return lastName;
+	}
+
+	public void setLastName(String lastName)
+	{
+		this.lastName = lastName;
+	}
+
+	public String getEmail()
+	{
+		return email;
+	}
+
+	public void setEmail(String email)
+	{
+		this.email = email;
+	}
+
+	public CustomerGroup getCustomerGroup()
+	{
+		return customerGroup;
+	}
+
+	public void setCustomerGroup(CustomerGroup customerGroup)
+	{
+		this.customerGroup = customerGroup;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+}
\ No newline at end of file

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCart.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCart.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCart.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCart.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Version;
+import javax.persistence.OneToMany;
+import javax.persistence.FetchType;
+import java.util.Set;
+
+@Entity
+public class ShoppingCart
+{
+	private Long id;
+
+	private ShopCustomer shopCustomer;
+	
+	private Set<ShoppingCartItem> shoppingCartItem;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	public ShopCustomer getCustomer()
+	{
+		return shopCustomer;
+	}
+
+	public void setCustomer(ShopCustomer shopCustomer)
+	{
+		this.shopCustomer = shopCustomer;
+	}
+
+	@OneToMany(fetch= FetchType.LAZY, mappedBy = "shoppingCart")
+	public Set<ShoppingCartItem> getShoppingCartItem()
+	{
+		return shoppingCartItem;
+	}
+
+	public void setShoppingCartItem(Set<ShoppingCartItem> shoppingCartItem)
+	{
+		this.shoppingCartItem = shoppingCartItem;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+}
\ No newline at end of file

Added: myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCartItem.java?rev=569267&view=auto
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCartItem.java (added)
+++ myfaces/orchestra/trunk/examples/src/main/java/org/apache/myfaces/examples/mops/model/ShoppingCartItem.java Thu Aug 23 23:21:09 2007
@@ -0,0 +1,96 @@
+/*
+ * 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.myfaces.examples.mops.model;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Version;
+
+@Entity
+public class ShoppingCartItem
+{
+	private Long id;
+
+	private ShoppingCart shoppingCart;
+
+	private Product product;
+
+	private long quantity;
+
+	private Long version;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.TABLE)
+	public Long getId()
+	{
+		return id;
+	}
+
+	public void setId(Long id)
+	{
+		this.id = id;
+	}
+
+	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+	public ShoppingCart getShoppingCart()
+	{
+		return shoppingCart;
+	}
+
+	public void setShoppingCart(ShoppingCart shoppingCart)
+	{
+		this.shoppingCart = shoppingCart;
+	}
+
+	public Product getProduct()
+	{
+		return product;
+	}
+
+	public void setProduct(Product product)
+	{
+		this.product = product;
+	}
+
+	public long getQuantity()
+	{
+		return quantity;
+	}
+
+	public void setQuantity(long quantity)
+	{
+		this.quantity = quantity;
+	}
+
+	@Version
+	public Long getVersion()
+	{
+		return version;
+	}
+
+	public void setVersion(Long version)
+	{
+		this.version = version;
+	}
+}
\ No newline at end of file

Modified: myfaces/orchestra/trunk/examples/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/examples/src/main/resources/META-INF/persistence.xml?rev=569267&r1=569266&r2=569267&view=diff
==============================================================================
--- myfaces/orchestra/trunk/examples/src/main/resources/META-INF/persistence.xml (original)
+++ myfaces/orchestra/trunk/examples/src/main/resources/META-INF/persistence.xml Thu Aug 23 23:21:09 2007
@@ -34,5 +34,12 @@
 			<class>org.apache.myfaces.examples.ballot.model.Vote</class>
 			<class>org.apache.myfaces.examples.ballot.model.Voter</class>
 			<class>org.apache.myfaces.examples.dynaForm.model.SimpleEntity</class>
+
+			<class>org.apache.myfaces.examples.mops.model.ShopCustomer</class>
+			<class>org.apache.myfaces.examples.mops.model.CustomerGroup</class>
+			<class>org.apache.myfaces.examples.mops.model.Product</class>
+			<class>org.apache.myfaces.examples.mops.model.ProductPrice</class>
+			<class>org.apache.myfaces.examples.mops.model.ShoppingCart</class>
+			<class>org.apache.myfaces.examples.mops.model.ShoppingCartItem</class>
 		</persistence-unit>
 </persistence>