Package com.kanner.domain

Examples of com.kanner.domain.Card


   * @param card
   * @return
   */
  public Card create(Card card, PersistenceManager pm) {
   
    Card createdCard = null;
     
    createdCard = pm.makePersistent(card);
   
    // This is an odd thing to do...
    // Necessary thought, as far as I can tell
    createdCard.setId(createdCard.getId());
   
    createdCard = pm.makePersistent(createdCard);
   
    return createdCard;
  }
View Full Code Here


  public boolean update(Card card, PersistenceManager pm) {

    boolean updated = false;
   
    // Get the card already stored in the datastore
    Card currentCard = findById(card.getId(), pm);
    System.out.println("currentCard ID = " + currentCard.getId());
   
    if (currentCard.equals(card)) {
     
      System.out.println("The currentCard and the passed in card are equal");
      updated = true;
     
    } else {
     
      card.setKey(currentCard.getKey());
     
      System.out.println("I'm actually updating the card.");
     
      pm.makePersistent(card);
      updated = true;
View Full Code Here

   *
   * @param id
   */
  public void delete(String id, PersistenceManager pm) {
   
    Card c = pm.getObjectById(Card.class, id);
   
    pm.deletePersistent(c);
  }
View Full Code Here

  @POST
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  public String create(Card card) {
   
    Card createdCard = null;
   
    log.info("Entering createNewCard...");
   
    createdCard = cardSvc.create(card, pm);
   
    System.out.println("createdCard = " + createdCard.getId());
   
    if (createdCard.getKey() == null) {
     
      throw new WebApplicationException(400);
    }
   
    log.info("Leaving createNewCard...");
   
    pm.close();
   
    return createdCard.getId();
  }
View Full Code Here

  @GET
  @Path("/id/{id}")
  @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
  public Card get(@PathParam("id") String id) {
   
    Card returnedCard = null;
   
    returnedCard = cardSvc.findById(id, pm);
   
    pm.close();
   
View Full Code Here

TOP

Related Classes of com.kanner.domain.Card

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.