Package nexj.core.meta

Examples of nexj.core.meta.Accessor


    * @param reader The reader object.
    * @return True if the query should be executed.
    */
   protected boolean isEnabled(Accessor reader)
   {
      Accessor dispGroup = (Accessor)reader.getValue("dispatchGroup");

      if (dispGroup != null)
      {
         boolean bDispatched = ((Boolean)dispGroup.getValue("dispatched")).booleanValue();

         if (dispGroup == reader)
         {
            if (bDispatched)
            {
               return false;
            }
         }
         else if (((Boolean)reader.getValue("dispatched")).booleanValue() != bDispatched)
         {
            return false;
         }
      }

      Accessor dispParent = (Accessor)reader.getValue("dispatchParent");

      if (dispParent == null)
      {
         if (dispGroup != null && reader != dispGroup)
         {
            reader.setValue("dispatched", Boolean.TRUE);
         }

         return true;
      }

      InstanceList resultList = (InstanceList)dispParent.getValue("results");

      if (resultList == null || resultList.isEmpty())
      {
         return false;
      }

      dispParent = resultList.getInstance(0);

      Pair dispAssoc = (Pair)reader.getValue("dispatchAttribute");
      Pair dispValues = (Pair)reader.getValue("dispatchValues");

      if (dispAssoc == null)
      {
         Metaclass metaclass = dispParent.getMetaclass();

         for (; dispValues != null; dispValues = dispValues.getNext())
         {
            if (m_context.getMetadata().getMetaclass(((Symbol)dispValues.getHead()).getName()).isUpcast(metaclass))
            {
               if (dispGroup != null)
               {
                  dispGroup.setValue("dispatched", Boolean.TRUE);

                  if (reader != dispGroup)
                  {
                     reader.setValue("dispatched", Boolean.TRUE);
                  }
               }

               return true;
            }
         }

         return false;
      }

      Object value;

      for (value = dispParent; value != null && dispAssoc != null; dispAssoc = dispAssoc.getNext())
      {
         dispParent = (Accessor)value;

         Attribute attribute = dispParent.getMetaclass().getAttribute(((Symbol)dispAssoc.getHead()).getName());

         attribute.checkReadAccess(m_context.getPrivilegeSet());
         value = dispParent.getValue(attribute.getOrdinal());
      }

      for (; dispValues != null; dispValues = dispValues.getNext())
      {
         if (Intrinsic.equal(value, dispValues.getHead()))
View Full Code Here


            List assocList = (List)reader.getValue("associations");
            boolean bConj = false;

            for (int i = parentList.size() - 1; i >= 0; --i)
            {
               Accessor parent = (Accessor)parentList.get(i);
               InstanceList resultList = (InstanceList)parent.getValue("results");

               if (resultList == null || resultList.size() == 0)
               {
                  return setEmptyResult(reader);
               }
View Full Code Here

               {
                  throw new TypeMismatchException(getSymbol());
               }

               int nOrdinal = ((Number)ordinal).intValue();
               Accessor accessor = (Accessor)obj;

               if (!Boolean.TRUE.equals(accessor.getValue(nOrdinal)) &&
                  (!(accessor instanceof Instance) ||
                     !Boolean.TRUE.equals(((Instance)accessor).getOldValue(nOrdinal))))
               {
                  throw new SecurityViolationException("err.runtime.access",
                     new Object[]{accessor.getMetaclass().getName()});
               }
            }

            machine.returnValue(null, nArgCount);
View Full Code Here

TOP

Related Classes of nexj.core.meta.Accessor

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.