Examples of SubChild


Examples of com.google.appengine.datanucleus.test.jpa.UnidirectionalOneToOneSubclassesJPA.SubChild

  public void testSubParentWithSubChild() throws EntityNotFoundException {
    // insertion
    SubParentWithSubChild parent = new SubParentWithSubChild();
    parent.setSuperParentString("super parent string");
    parent.setSubParentString("sub parent string");
    SubChild subChild = new SubChild();
    subChild.setAString("a string");
    subChild.setBString("b string");
    parent.setSuperParentSubChild(subChild);

    beginTxn();
    em.persist(parent);
    commitTxn();
    Entity parentEntity =
        ds.get(KeyFactory.createKey(kindForClass(parent.getClass()), parent.getId()));
    Entity superParentSubChildEntity = ds.get(subChild.getId());
    assertEquals(3, parentEntity.getProperties().size());
    assertEquals("super parent string", parentEntity.getProperty("superParentString"));
    assertEquals("sub parent string", parentEntity.getProperty("subParentString"));
    assertEquals(superParentSubChildEntity.getKey(), parentEntity.getProperty("subChild_id"));
   
    assertEquals(2, superParentSubChildEntity.getProperties().size());
    assertEquals("a string", superParentSubChildEntity.getProperty("aString"));
    assertEquals("b string", superParentSubChildEntity.getProperty("bString"));

    // lookup
    beginTxn();
    parent = em.find(parent.getClass(), parent.getId());
    assertEquals("super parent string", parent.getSuperParentString());
    assertEquals("sub parent string", parent.getSubParentString());
    assertEquals(subChild.getId(), parent.getSuperParentSubChild().getId());
    commitTxn();

    beginTxn();
    subChild = em.find(subChild.getClass(), subChild.getId());
    assertEquals("a string", subChild.getAString());
    assertEquals("b string", subChild.getBString());
    commitTxn();

    // cascade delete
    beginTxn();
    em.remove(em.merge(parent));
    commitTxn();

    assertEquals(0, countForClass(parent.getClass()));
    assertEquals(0, countForClass(subChild.getClass()));
  }
View Full Code Here

Examples of com.google.appengine.datanucleus.test.jpa.UnidirectionalOneToOneSubclassesJPA.SubChild

  public void testSuperParentWithSubChild() throws EntityNotFoundException {
    // insertion
    SuperParentWithSubChild parent = new SuperParentWithSubChild();
    parent.setSuperParentString("super parent string");

    SubChild subChild = new SubChild();
    subChild.setAString("a string");
    subChild.setBString("b string");
    parent.setSuperParentSubChild(subChild);

    beginTxn();
    em.persist(parent);
    commitTxn();
    Entity parentEntity =
        ds.get(KeyFactory.createKey(kindForClass(parent.getClass()), parent.getId()));
    Entity superParentSubChildEntity = ds.get(subChild.getId());
    assertEquals(2, parentEntity.getProperties().size());
    assertEquals("super parent string", parentEntity.getProperty("superParentString"));
    assertEquals(superParentSubChildEntity.getKey(), parentEntity.getProperty("subChild_id"));

    assertEquals(2, superParentSubChildEntity.getProperties().size());
    assertEquals("a string", superParentSubChildEntity.getProperty("aString"));
    assertEquals("b string", superParentSubChildEntity.getProperty("bString"));

    // lookup
    beginTxn();
    parent = em.find(parent.getClass(), parent.getId());
    assertEquals("super parent string", parent.getSuperParentString());
    assertEquals(subChild.getId(), parent.getSuperParentSubChild().getId());
    commitTxn();

    beginTxn();
    subChild = em.find(subChild.getClass(), subChild.getId());
    assertEquals("a string", subChild.getAString());
    assertEquals("b string", subChild.getBString());
    commitTxn();

    // cascade delete
    beginTxn();
    em.remove(em.merge(parent));
    commitTxn();

    assertEquals(0, countForClass(parent.getClass()));
    assertEquals(0, countForClass(subChild.getClass()));
  }
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  }


  @Override
  public void run(IAction action) {
    final SubChild selSubChild = getSelectedSubChild();
    final IFile agentFile = getSelectedSubChildAgentFile();
    final String parentNodeName = getSelectedSubChild().getContainer().getName();
   
    IRunnableWithProgress op = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) throws InvocationTargetException {
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  }
 
 
  private SubChild getSelectedSubChild(){
    if(_selection instanceof TreeSelection){   
      SubChild selectedSubChild = (SubChild)((TreeSelection)_selection).getFirstElement();
      return  selectedSubChild;
    }
    return null;
  }
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

    }
    return null;
  }
 
  private IFile getSelectedSubChildAgentFile(){
    SubChild s = getSelectedSubChild();
    if(s != null){
      return s.getContainer().getContainer();
    }
    return null;
  }
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  }


  @Override
  public void run(IAction action) {
    final SubChild selSubChild = getSelectedSubChild();
    final IFile agentFile = getSelectedSubChildAgentFile();
    final String parentNodeName = getSelectedSubChild().getContainer().getName();
   
    IRunnableWithProgress op = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) throws InvocationTargetException {
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  }
 
 
  private SubChild getSelectedSubChild(){
    if(_selection instanceof TreeSelection){   
      SubChild selectedSubChild = (SubChild)((TreeSelection)_selection).getFirstElement();
      return  selectedSubChild;
    }
    return null;
  }
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

    }
    return null;
  }
 
  private IFile getSelectedSubChildAgentFile(){
    SubChild s = getSelectedSubChild();
    if(s != null){
      return s.getContainer().getContainer();
    }
    return null;
  }
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  }


  @Override
  public void run(IAction action) {
    final SubChild selSubChild = getSelectedSubChild();
    final IFile agentFile = getSelectedSubChildAgentFile();
    final String parentNodeName = getSelectedSubChild().getContainer().getName();
   
    IRunnableWithProgress op = new IRunnableWithProgress() {
      public void run(IProgressMonitor monitor) throws InvocationTargetException {
View Full Code Here

Examples of es.upm.dit.gsi.eclipse.jadex.navigator.SubChild

  /*
   * Method for getting the selected subchild
   */
  private SubChild getSelectedSubChild(){
    if(_selection instanceof TreeSelection){   
      SubChild selectedSubChild = (SubChild)((TreeSelection)_selection).getFirstElement();
      return  selectedSubChild;
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.