Package nexj.core.runtime

Examples of nexj.core.runtime.InstanceArrayList$Ref


    */
   public InstanceList next(int nMaxCount)
   {
      if (m_bDone || nMaxCount <= 0)
      {
         return new InstanceArrayList(0);
      }
     
      InstanceList resultList = m_adapter.read(m_query);
     
      m_bDone = true;
     
      if (resultList != null && resultList.size() == 1)
      {
         return resultList;
      }
     
      return new InstanceArrayList(0);
   }
View Full Code Here


    */
   protected InstanceList instantiateList(Object value, Attribute attribute)
   {
      if (value == null)
      {
         return new InstanceArrayList(0);
      }

      if (!(value instanceof List))
      {
         throw new RequestException("err.rpc.collectionType", new Object[]
         {
            attribute.getName(),
            attribute.getMetaclass().getName()
         });
      }

      List list = (List)value;
      int nCount = list.size();
      InstanceList instanceList = new InstanceArrayList(nCount);
      Metaclass type = (Metaclass)attribute.getType();

      for (int i = 0; i < nCount; ++i)
      {
         Object item = list.get(i);

         if (!(item instanceof TransferObject))
         {
            throw new RequestException("err.rpc.collectionItemType", new Object[]
            {
               attribute.getName(),
               attribute.getMetaclass().getName()
            });
         }

         Instance obj = instantiate((TransferObject)item);

         if (obj != null)
         {
            if (!type.isUpcast(obj.getMetaclass()))
            {
               throw new RequestException("err.rpc.classCast", new Object[]
               {
                  obj.getMetaclass().getName(),
                  attribute.getName(),
                  attribute.getMetaclass().getName()
               });
            }

            instanceList.add(obj);
         }
      }

      return instanceList;
   }
View Full Code Here

         List list = (List)value;
         int nCount = list.size();

         if (nCount == 0)
         {
            return new InstanceArrayList(0);
         }

         if (list.get(0) instanceof TransferObject)
         {
            InstanceList instanceList = new InstanceArrayList(nCount);

            for (int i = 0; i < nCount; ++i)
            {
               instanceList.add(instantiate((TransferObject)list.get(i)));
            }

            return instanceList;
         }
View Full Code Here

      if (nPageSize <= 0)
      {
         nPageSize = nCount;
      }

      InstanceList instanceList = new InstanceArrayList();

      for (int i = 0; i < nCount; i += nPageSize)
      {
         InstanceList list = read(metaclass, attributes,
            Pair.list(Symbol.IN_P, Pair.list(Symbol.AT),
               sortedOIDList.subList(i, Math.min(i + nPageSize, nCount))));

         for (int k = 0; k < list.size(); ++k)
         {
            instanceList.add(list.getInstance(k), InstanceList.REPLACE);
         }
      }

      return instanceList;
   }
View Full Code Here

                        if (attribute.isPersistent() &&
                           attribute.isCollection() &&
                           inst.getValueDirect(i) == Undefined.VALUE)
                        {
                           InstanceList list = new InstanceArrayList(0);

                           list.setLazy(false);
                           list.setAssociation(inst, attribute, true);
                           inst.setValueDirect(i, list);
                        }
                     }
                  }
                  else
View Full Code Here

      r2.setValue("class", Symbol.define("UserGroupAssoc"));
      r2.setValue("attributes", parse("(user group)"));
      r2.setValue("orderBy", parse("(((@) . #t))"));
     
      InstanceList p = new InstanceArrayList();
      p.add(r1);
      r2.setValue("parents", p);
     
      List a = new ArrayList();
      a.add(parse("(ugassocs)"));
      r2.setValue("associations", a);
      r2.setValue("dispatchParent", r1);
      r2.setValue("dispatchAttribute", null);
      r2.setValue("dispatchValues", parse("(Group)"));
     
      AssertUtil.assertEquals(getURL("readFMDispatch1.xml"), r2.invoke("read"), parse("(user group)"));

      r2 = new Instance(getMetadata().getMetaclass("SysReader"), Instance.NEW, m_context);

      r2.setValue("class", Symbol.define("UserGroupAssoc"));
      r2.setValue("attributes", parse("(user group)"));
      r2.setValue("orderBy", parse("(((@) . #t))"));

      p = new InstanceArrayList();
      p.add(r1);
      r2.setValue("parents", p);

      a = new ArrayList();
      a.add(parse("(ugassocs)"));
      r2.setValue("associations", a);
      r2.setValue("dispatchParent", r1);
      r2.setValue("dispatchAttribute", parse("(typeCode)"));
      r2.setValue("dispatchValues", parse("(\"G\")"));

      AssertUtil.assertEquals(getURL("readFMDispatch2.xml"), r2.invoke("read"), parse("(user group)"));

      Instance r3 = new Instance(getMetadata().getMetaclass("SysReader"), Instance.NEW, m_context);

      r3.setValue("class", Symbol.define("Principal"));
      r3.setValue("attributes", parse("(name)"));
      r3.setValue("orderBy", parse("(((@ name) . #t))"));
     
      p = new InstanceArrayList();
      p.add(r1);
      r3.setValue("parents", p);
     
      a = new ArrayList();
      a.add(null);
      r3.setValue("associations", a);
View Full Code Here

   {
      return new JavaIntrinsicFunction()
      {
         public boolean invoke(int nArgCount, Machine machine)
         {
            InstanceList list = new InstanceArrayList(Math.max(8, nArgCount));
           
            for (int i = 0; i < nArgCount; ++i)
            {
               Object instance = machine.getArg(i, nArgCount);

               if (!(instance instanceof Instance))
               {
                  throw new TypeMismatchException(getSymbol());
               }

               list.add(instance);
            }

            machine.returnValue(list, nArgCount);

            return false;
View Full Code Here

            }
         }

         int nOffset = 0;
         int nCount = tobjList.size();
         InstanceList instanceList = new InstanceArrayList(nCount);
         InstanceFactory factory = new InstanceFactory(identityMap, null, InstanceFactory.STATE, context);

         for (int i = 0; i < nCount && (m_nMaxCount < 0 || instanceList.size() < m_nMaxCount); ++i)
         {
            TransferObject tobj = (TransferObject)tobjList.get(i);

            m_instance = tobj;

            if (bFiltered || m_where == null || !Boolean.FALSE.equals(m_where.getValue()))
            {
               Instance instance = factory.instantiate(tobj);

               identityMap.clear();

               if (isJoin())
               {
                  join(instance, getAdapter().getOID(instance, m_childItem));
               }

               if (nOffset++ >= m_nOffset)
               {
                  instanceList.add(instance);
               }
            }
         }

         if (bCached && !bMissed && factory.isLockMismatch())
         {
            bCached = false;

            continue;
         }

         if (getOrderByCount() != 0 && instanceList.size() > 1)
         {
            instanceList.sort(this);
         }

         m_instance = null;

         return instanceList;
View Full Code Here

                  if (value instanceof Undefined)
                  {
                     if (value == Undefined.VALUE)
                     {
                        list = new InstanceArrayList();
                        list.setAssociation(container, m_attribute, true);
                        container.setOldValueDirect(m_attribute.getOrdinal(), list);
                     }
                     else
                     {
View Full Code Here

                  if (value instanceof Undefined)
                  {
                     if (value == Undefined.VALUE)
                     {
                        list = new InstanceArrayList();
                        list.setAssociation(container, m_attribute, true);
                        container.setOldValueDirect(m_attribute.getOrdinal(), list);
                     }
                     else
                     {
View Full Code Here

TOP

Related Classes of nexj.core.runtime.InstanceArrayList$Ref

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.