diff options
Diffstat (limited to 'src/test/java/com/amazon/carbonado/stored')
7 files changed, 435 insertions, 0 deletions
diff --git a/src/test/java/com/amazon/carbonado/stored/Order.java b/src/test/java/com/amazon/carbonado/stored/Order.java new file mode 100644 index 0000000..91804d9 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Order.java @@ -0,0 +1,68 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.Join;
+import com.amazon.carbonado.Nullable;
+import com.amazon.carbonado.PrimaryKey;
+import com.amazon.carbonado.Query;
+import com.amazon.carbonado.Sequence;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@Alias("TEST_ORDER")
+@PrimaryKey("orderID")
+public interface Order extends Storable<Order> {
+ @Sequence("TEST_ORDER_ID_SEQ")
+ long getOrderID();
+ void setOrderID(long id);
+
+ String getOrderNumber();
+ void setOrderNumber(String value);
+
+ int getOrderTotal();
+ void setOrderTotal(int value);
+
+ @Nullable
+ String getOrderComments();
+ void setOrderComments(String value);
+
+ long getAddressID();
+ void setAddressID(long value);
+
+ @Join
+ @Nullable
+ Address getAddress() throws FetchException;
+ void setAddress(Address value);
+
+ @Join
+ Query<OrderItem> getOrderItems() throws FetchException;
+
+ @Join
+ Query<Shipment> getShipments() throws FetchException;
+
+ @Join
+ Query<Promotion> getPromotions() throws FetchException;
+}
diff --git a/src/test/java/com/amazon/carbonado/stored/OrderItem.java b/src/test/java/com/amazon/carbonado/stored/OrderItem.java new file mode 100644 index 0000000..dba2477 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/OrderItem.java @@ -0,0 +1,68 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.Index;
+import com.amazon.carbonado.Indexes;
+import com.amazon.carbonado.Join;
+import com.amazon.carbonado.PrimaryKey;
+import com.amazon.carbonado.Sequence;
+import com.amazon.carbonado.constraint.IntegerConstraint;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@Alias("TEST_ORDER_ITEM")
+@Indexes({@Index("+orderID"), @Index("+shipmentID")})
+@PrimaryKey("orderItemID")
+public interface OrderItem extends Storable<OrderItem> {
+ @Sequence("TEST_ORDER_ITEM_ID_SEQ")
+ long getOrderItemID();
+ void setOrderItemID(long id);
+
+ long getOrderID();
+ void setOrderID(long value);
+
+ @Join
+ Order getOrder() throws FetchException;
+ void setOrder(Order value);
+
+ String getItemDescription();
+ void setItemDescription(String value);
+
+ int getItemQuantity();
+ @IntegerConstraint(min=1, max=100)
+ void setItemQuantity(int value);
+
+ int getItemPrice();
+ void setItemPrice(int value);
+
+ long getShipmentID();
+ void setShipmentID(long value);
+
+ @Join
+ Shipment getShipment() throws FetchException;
+ void setShipment(Shipment value);
+}
+
diff --git a/src/test/java/com/amazon/carbonado/stored/Promotion.java b/src/test/java/com/amazon/carbonado/stored/Promotion.java new file mode 100644 index 0000000..18f4a2e --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Promotion.java @@ -0,0 +1,55 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.Join;
+import com.amazon.carbonado.PrimaryKey;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@Alias("TEST_PROMOTION")
+@PrimaryKey({"orderID", "promotionID"})
+public interface Promotion extends Storable<Promotion> {
+ long getOrderID();
+ void setOrderID(long value);
+
+ String getPromotionID();
+ void setPromotionID(String value);
+
+ @Join
+ Order getOrder() throws FetchException;
+ void setOrder(Order value);
+
+ @Join
+ Promotion getPromotion() throws FetchException;
+ void setPromotion(Promotion value);
+
+ String getPromotionTitle();
+ void setPromotionTitle(String value);
+
+ String getPromotionDetails();
+ void setPromotionDetails(String value);
+}
+
diff --git a/src/test/java/com/amazon/carbonado/stored/Shipment.java b/src/test/java/com/amazon/carbonado/stored/Shipment.java new file mode 100644 index 0000000..670806d --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Shipment.java @@ -0,0 +1,69 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import org.joda.time.DateTime;
+
+import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.Index;
+import com.amazon.carbonado.Indexes;
+import com.amazon.carbonado.Join;
+import com.amazon.carbonado.PrimaryKey;
+import com.amazon.carbonado.Query;
+import com.amazon.carbonado.Sequence;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@Alias("TEST_SHIPMENT")
+@Indexes(@Index("+orderID"))
+@PrimaryKey("shipmentID")
+public interface Shipment extends Storable<Shipment> {
+ @Sequence("TEST_SHIPMENT_ID_SEQ")
+ long getShipmentID();
+ void setShipmentID(long id);
+
+ String getShipmentNotes();
+ void setShipmentNotes(String value);
+
+ DateTime getShipmentDate();
+ void setShipmentDate(DateTime value);
+
+ long getOrderID();
+ void setOrderID(long value);
+
+ @Join
+ Order getOrder() throws FetchException;
+ void setOrder(Order value);
+
+ long getShipperID();
+ void setShipperID(long value);
+
+ @Join
+ Shipper getShipper() throws FetchException;
+ void setShipper(Shipper value);
+
+ @Join
+ Query<OrderItem> getOrderItems() throws FetchException;
+}
+
diff --git a/src/test/java/com/amazon/carbonado/stored/Shipper.java b/src/test/java/com/amazon/carbonado/stored/Shipper.java new file mode 100644 index 0000000..41e60f4 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/Shipper.java @@ -0,0 +1,52 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.Alias;
+import com.amazon.carbonado.Storable;
+import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.Join;
+import com.amazon.carbonado.PrimaryKey;
+import com.amazon.carbonado.Sequence;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill
+ */
+@Alias("TEST_SHIPPER")
+@PrimaryKey("shipperID")
+public interface Shipper extends Storable<Shipper> {
+ @Sequence("TEST_SHIPPER_ID_SEQ")
+ long getShipperID();
+ void setShipperID(long id);
+
+ String getShipperName();
+ void setShipperName(String value);
+
+ String getShipperDetails();
+ void setShipperDetails(String value);
+
+ long getAddressID();
+ void setAddressID(long value);
+
+ @Join
+ Address getAddress() throws FetchException;
+ void setAddress(Address value);
+}
diff --git a/src/test/java/com/amazon/carbonado/stored/UserAddress.java b/src/test/java/com/amazon/carbonado/stored/UserAddress.java new file mode 100644 index 0000000..466f6eb --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/UserAddress.java @@ -0,0 +1,66 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.*;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill (boneill)
+ */
+@Indexes({
+ @Index({"country", "state", "city"}),
+ @Index({"state", "city"}),
+ @Index("city")
+})
+@PrimaryKey("addressID")
+public abstract class UserAddress implements Storable<UserAddress> {
+ public abstract int getAddressID();
+ public abstract void setAddressID(int id);
+
+ public abstract String getLine1();
+ public abstract void setLine1(String value);
+
+ @Nullable
+ public abstract String getLine2();
+ public abstract void setLine2(String value);
+
+ public abstract String getCity();
+ public abstract void setCity(String value);
+
+ public abstract String getState();
+ public abstract void setState(String value);
+
+ public abstract String getCountry();
+ public abstract void setCountry(String value);
+
+ @Nullable
+ public abstract String getPostalCode();
+ public abstract void setPostalCode(String value);
+
+ @Nullable
+ public abstract Integer getNeighborAddressID();
+ public abstract void setNeighborAddressID(Integer id);
+
+ @Nullable
+ @Join(internal="neighborAddressID", external="addressID")
+ public abstract UserAddress getNeighbor() throws FetchException;
+ public abstract void setNeighbor(UserAddress address) throws FetchException;
+}
diff --git a/src/test/java/com/amazon/carbonado/stored/UserInfo.java b/src/test/java/com/amazon/carbonado/stored/UserInfo.java new file mode 100644 index 0000000..e0bffa4 --- /dev/null +++ b/src/test/java/com/amazon/carbonado/stored/UserInfo.java @@ -0,0 +1,57 @@ +/*
+ * Copyright 2006 Amazon Technologies, Inc. or its affiliates.
+ * Amazon, Amazon.com and Carbonado are trademarks or registered trademarks
+ * of Amazon Technologies, Inc. or its affiliates. All rights reserved.
+ *
+ * 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 com.amazon.carbonado.stored;
+
+import com.amazon.carbonado.*;
+import com.amazon.carbonado.constraint.*;
+
+/**
+ *
+ *
+ * @author Brian S O'Neill (boneill)
+ */
+@Indexes({
+ @Index("firstName"),
+ @Index("lastName"),
+ @Index("addressID")
+})
+@PrimaryKey("userID")
+public abstract class UserInfo implements Storable<UserInfo> {
+ public abstract int getUserID();
+ public abstract void setUserID(int id);
+
+ public abstract int getStateID();
+ @IntegerConstraint(allowed={1, 2, 3})
+ public abstract void setStateID(int state);
+
+ public abstract String getFirstName();
+ @LengthConstraint(min=1, max=50)
+ public abstract void setFirstName(String value);
+
+ public abstract String getLastName();
+ @LengthConstraint(min=1, max=50)
+ public abstract void setLastName(String value);
+
+ public abstract int getAddressID();
+ public abstract void setAddressID(int id);
+
+ @Join
+ public abstract UserAddress getAddress() throws FetchException;
+ public abstract void setAddress(UserAddress address);
+}
|