PageRenderTime 20ms CodeModel.GetById 7ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/com/google/appengine/datanucleus/test/HasOneToManyKeyPkListJDO.java

http://datanucleus-appengine.googlecode.com/
Java | 57 lines | 29 code | 10 blank | 18 comment | 0 complexity | 7c75a00e483422b61e80a3c178e55761 MD5 | raw file
 1/**********************************************************************
 2Copyright (c) 2009 Google Inc.
 3
 4Licensed under the Apache License, Version 2.0 (the "License");
 5you may not use this file except in compliance with the License.
 6You may obtain a copy of the License at
 7
 8http://www.apache.org/licenses/LICENSE-2.0
 9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15**********************************************************************/
16package com.google.appengine.datanucleus.test;
17
18import com.google.appengine.api.datastore.Key;
19import com.google.appengine.datanucleus.Utils;
20
21
22import java.util.Collection;
23import java.util.List;
24
25import javax.jdo.annotations.Element;
26import javax.jdo.annotations.IdGeneratorStrategy;
27import javax.jdo.annotations.Order;
28import javax.jdo.annotations.PersistenceCapable;
29import javax.jdo.annotations.Persistent;
30import javax.jdo.annotations.PrimaryKey;
31
32/**
33 * @author Max Ross <maxr@google.com>
34 */
35@PersistenceCapable(detachable = "true")
36public class HasOneToManyKeyPkListJDO implements HasOneToManyKeyPkJDO {
37
38  @PrimaryKey
39  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
40  private Key key;
41
42  @Element(dependent = "true")
43  @Order(column = "flights_INTEGER_IDX_keypk")
44  private List<Flight> flights = Utils.newArrayList();
45
46  public void addFlight(Flight flight) {
47    flights.add(flight);
48  }
49
50  public Collection<Flight> getFlights() {
51    return flights;
52  }
53
54  public Key getId() {
55    return key;
56  }
57}