Package nexj.core.meta

Examples of nexj.core.meta.Metaclass$ClassPointcutHelper


    * Same as testReadCollection, except that the attributes list has "commonName" in
    * it, e.g. (name (animals commonName)), so no lazy loads should be executed.
    */
   public void testReadHeterogeneousCollectionWithNonLazyPrimitives()
   {
      Metaclass penClass = m_metadata.getMetaclass("AnimalPen");
      Metaclass animalClass = m_metadata.getMetaclass("Animal");
      Instance inst, assocInst;
      InstanceArrayList list, collection;
      int nStartCallCount, nEndCallCount;

      list = (InstanceArrayList)penClass.invoke("read", new Object[]{
         parse("(name (animals commonName (@@ DomesticAnimal petName)))"), null, null, null, null, null
      });

      assertEquals(2, list.size());
      inst = list.getInstance(0);
      assertEquals("Dog pen", inst.getValue("name"));
      collection = (InstanceArrayList)inst.getValue("animals");
      assertEquals(2, collection.size());
      assocInst = collection.getInstance(0);
      nStartCallCount = ((Integer)animalClass.getValue("objectKeyReadCount")).intValue();
      assertEquals("Dog", assocInst.getValue("commonName"))// Loaded during read
      assertEquals("Kerberos", assocInst.getValue("petName"));
      nEndCallCount = ((Integer)animalClass.getValue("objectKeyReadCount")).intValue();
      assertEquals(nStartCallCount, nEndCallCount);
      assertSame(inst, assocInst.getValue("pen"));
      assocInst = collection.getInstance(1);
      assertEquals("Spider", assocInst.getValue("commonName"));
      assertFalse(assocInst.hasValue("petName"));
View Full Code Here


   /**
    * Reads a sub-collection whose values are provided by a composition mapping.
    */
   public void testReadHomogeneousCollection()
   {
      Metaclass domesticAnimalClass = m_metadata.getMetaclass("Animal");
      InstanceArrayList list, collection;
      Instance inst, inst2;

      list = (InstanceArrayList)domesticAnimalClass.invoke("read", new Object[]{
         parse("(commonName (licenses name))"), null, null, null, null, null
      });

      assertEquals(4, list.size());
      inst = list.getInstance(0);
View Full Code Here

      }

      ThreadContextHolder.setContext(m_context);
      m_list = new InstanceArrayList(2);

      Metaclass contact = m_metadata.getMetaclass("Contact");

      m_contact = new Instance(contact, m_context);

      m_contact.setNew();
      m_contact.setValue("firstName", "Plato");
      m_list.setAssociation(m_contact, contact.getAttribute("addresses"), false);
      m_instanceArray = new Instance[2];

      Instance instance = new Instance(m_metadata.getMetaclass("Address"), m_context);

      instance.setNew();
View Full Code Here

    */
   public void testInSQL() throws Exception
   {
      String sRegularJoinAttributes = "(firstName lastName (visits reason (requests code)))";
      String sHeteroJoinAttributes = "(firstName lastName (externalVisits reason (requests code)))";
      Metaclass patientClass = getMetadata().getMetaclass("Patient");

      checkSameResults(patientClass, sRegularJoinAttributes, sHeteroJoinAttributes, "((firstName . #f))");
   }
View Full Code Here

    */
   public void testHeterogeneousJoinOnChildNode() throws Exception
   {
      String sRegularJoinAttributes = "(firstName lastName (visits reason) (children firstName lastName (visits reason)))";
      String sHeteroJoinAttributes = "(firstName lastName (externalVisits reason) (children firstName lastName (externalVisits reason)))";
      Metaclass patientClass = getMetadata().getMetaclass("Patient");

      checkSameResults(patientClass, sRegularJoinAttributes, sHeteroJoinAttributes, "(((@ birthdate) . #f))");
   }
View Full Code Here

    * Q_ExternalRequest
    */
   public void testHeterogeneousJoinWithHomogeneousJoinedQuery() throws Exception
   {
      // Add ZachJr for the duration of this test only...
      Metaclass patientClass = getMetadata().getMetaclass("Patient");
      Instance parent = Query.createRead(patientClass, null, parse("(= (@ firstName) \"Zach\")"),
         null, 1, 0, false, Query.SEC_ALL, m_context).read().getInstance(0);
      Instance child = new Instance(patientClass, m_context);

      child.setNew();
View Full Code Here

    */
   public void testTwoHeterogeneousJoins() throws Exception
   {
      String sRegularJoinAttributes = "(firstName lastName (visits reason) (requests code))";
      String sHeteroJoinAttributes = "(firstName lastName (externalVisits reason) (externalRequests code))";
      Metaclass patientClass = getMetadata().getMetaclass("Patient");

      checkSameResults(patientClass, sRegularJoinAttributes, sHeteroJoinAttributes, "((firstName . #f))");
   }
View Full Code Here

      }
   }

   protected void addColumn(Pair attributes, Lookup map, Query parentQuery, List row)
   {
      Metaclass parentClass = parentQuery.getMetaclass();
      Query query = parentQuery.findAssoc(Query.ASSOC_QUERY, parentClass.getAttribute((Symbol)attributes.getHead()), null, false);
      Instance instance = (Instance)map.get(query);

      for (attributes = attributes.getNext(); attributes != null; attributes = attributes.getNext())
      {
         Object head = attributes.getHead();
View Full Code Here

      //Start work unit 1
      assertNull(context.beginTransaction(true));


      //Create instance in work unit 1
      Metaclass ContactClass = metadata.getMetaclass("Contact");
      Instance contact = (Instance)ContactClass.invoke("new");

      contact.setValue("firstName", "James");

     
      //Switch to work unit 2
View Full Code Here

      //Start work unit 1
      assertNull(context.beginTransaction(true));

      //Create instance in work unit 1
      Metaclass ContactClass = metadata.getMetaclass("Contact");
      Instance contact = (Instance)ContactClass.invoke("new");
     
      contact.setValue("firstName", "Jean-luc");

      //Switch to work unit 2
      UnitOfWork creationUOW = context.beginTransaction(false);
View Full Code Here

TOP

Related Classes of nexj.core.meta.Metaclass$ClassPointcutHelper

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.