Esempio n. 1
0
 private PositionCollection packagePositionsToCollection(List<Position> positions) {
   PositionCollection positionCollection = new PositionCollection();
   // create a new arraylist of positions and loat the List<position> into it
   ArrayList<Position> positionsArray = new ArrayList<Position>(positions);
   // set the appropriate field of the collection
   positionCollection.setPositions(positionsArray);
   // return the collection.
   return positionCollection;
 }
Esempio n. 2
0
 public PositionCollection getAllPositions() {
   // define the select all query string
   String queryString = "SELECT p FROM Position p";
   // execute the query on the database
   //
   TypedQuery<Position> query = this.entityManager.createQuery(queryString, Position.class);
   List<Position> positions = query.getResultList();
   // initialize a positions collection object
   PositionCollection positionCollection = new PositionCollection();
   // create a new arraylist of positions and loat the List<position> into it
   ArrayList<Position> positionsArray = new ArrayList<Position>(positions);
   // set the appropriate field of the collection
   positionCollection.setPositions(positionsArray);
   // return the collection.
   return positionCollection;
 }