Package nexj.core.meta

Examples of nexj.core.meta.Attribute$IndirectInverseDependency


    */
   public void associate(int nOrdinal, Instance instance, boolean bDirect)
   {
      load();

      Attribute attribute = m_metaclass.getInstanceAttribute(nOrdinal);

      if (attribute.isCollection())
      {
         Object value = getValueDirect(nOrdinal);
         InstanceList list;

         if (value instanceof Undefined)
         {
            list = new InstanceArrayList();

            setValueDirect(nOrdinal, list);
            list.setAssociation(this, attribute, true);
         }
         else
         {
            list = (InstanceList)value;
         }

         if (list.add(instance, InstanceList.REPLACE | InstanceList.DIRECT | InstanceList.WEAK | InstanceList.TRACK))
         {
            if (!bDirect)
            {
               attribute.invalidateDependency(this, Invalid.VALUE);
            }
         }
      }
      else if (bDirect)
      {
View Full Code Here


    */
   public void dissociate(int nOrdinal, Instance instance, boolean bDirect)
   {
      load();

      Attribute attribute = m_metaclass.getInstanceAttribute(nOrdinal);

      if (attribute.isCollection())
      {
         Object value;

         if (bDirect)
         {
            value = getValueDirect(nOrdinal);
         }
         else
         {
            value = getValue(nOrdinal);
            attribute.invalidateDependency(this, Invalid.VALUE);
         }

         if (!(value instanceof Undefined))
         {
            InstanceList list = (InstanceList)value;

            list.remove(instance, (bDirect) ? InstanceList.DIRECT : InstanceList.DIRECT | InstanceList.TRACK);
         }
      }
      else
      {
         if (bDirect)
         {
            setValueDirect(nOrdinal, null);
         }
         else
         {
            attribute.invalidateDependency(this, Invalid.VALUE);
            assign(attribute, null, false);
         }
      }
   }
View Full Code Here

      if (!m_metaclass.isReadable(m_context.getPrivilegeSet()))
      {
         return false;
      }

      Attribute attribute = m_metaclass.getReadAccessAttribute();

      if (attribute != null)
      {
         if (m_context.isSecure())
         {
            Object value = (attribute.isStatic()) ?
               m_metaclass.getValue(attribute.getOrdinal()) :
                  getValue(attribute.getOrdinal());

            if (!Boolean.TRUE.equals(value))
            {
               return false;
            }
View Full Code Here

         return false;
      }

      if (m_nState != NEW)
      {
         Attribute accessAttribute = attribute.getAccessAttribute();

         if (accessAttribute != null)
         {
            int nOrdinal = accessAttribute.getOrdinal();

            if (accessAttribute.isStatic())
            {
               return !Boolean.FALSE.equals(m_metaclass.getValue(nOrdinal));
            }

            return !Boolean.FALSE.equals(getValue(nOrdinal)) ||
View Full Code Here

    */
   public void checkUpdateAccess(int nOrdinal, Instance instance) throws SecurityViolationException
   {
      load();

      Attribute attribute = m_metaclass.getInstanceAttribute(nOrdinal);

      if (attribute.isCollection())
      {
         Object value = getValueDirect(nOrdinal);

         if (value instanceof InstanceList)
         {
            InstanceList list = (InstanceList)value;

            if (!list.isLazy() && list.contains(instance))
            {
               return;
            }
         }
      }
      else
      {
         if (getValueDirect(nOrdinal) == instance)
         {
            return;
         }
      }

      if (!isUpdateable(attribute))
      {
         if (attribute.isCollection())
         {
            InstanceList list = (InstanceList)getValue(nOrdinal);

            if (list == null || !list.contains(instance))
            {
View Full Code Here

    */
   private void setAliases(InstanceList list)
   {
      assert !isLazy();

      Attribute attribute = list.getAttribute();
      Attribute alias = attribute.getAlias();

      if (alias != null)
      {
         while (alias.getOrdinal() != attribute.getOrdinal())
         {
            Object value = getValueDirect(alias.getOrdinal());

            if (value != null && !(value instanceof Undefined))
            {
               if (value instanceof InstanceList)
               {
                  InstanceList aliasList = (InstanceList)value;

                  if (aliasList.getCount() != 0)
                  {
                     list.setLoading();
                  }

                  if (list.getCount() != 0)
                  {
                     aliasList.setLoading();
                  }
               }
               else
               {
                  list.setLoading();
               }
            }

            alias = alias.getAlias();
         }
      }
   }
View Full Code Here

    */
   protected void updateAliases(Attribute attribute)
   {
      assert !isLazy();

      Attribute alias = attribute.getAlias();

      if (alias != null)
      {
         while (alias.getOrdinal() != attribute.getOrdinal())
         {
            Object value = getValueDirect(alias.getOrdinal());

            if (value != null && !(value instanceof Undefined))
            {
               if (value instanceof InstanceList)
               {
                  ((InstanceList)value).setLoading();
               }
            }

            alias = alias.getAlias();
         }
      }
   }
View Full Code Here

               setAliases(list);
            }
         }
         else if (bAssoc)
         {
            Attribute reverse = attribute.getReverse();

            if (reverse != null)
            {
               int nRevOrdinal = reverse.getOrdinal();

               if (oldValue instanceof Instance && attribute.isReverseOf(reverse))
               {
                  Instance instance = (Instance)oldValue;
View Full Code Here

    */
   public void setValue(int nOrdinal, Object value)
   {
      assert !isLazy();

      Attribute attribute = m_metaclass.getInstanceAttribute(nOrdinal);

      value = convert(attribute, value);

      Object oldValue = getValueDirect(nOrdinal);

      if (!ObjUtil.equal(oldValue, value))
      {
         if (!isLoading())
         {
            checkUpdateAccess(attribute);

            if (oldValue == Undefined.VALUE && attribute.isReverseInverseDependencyPersistent())
            {
               oldValue = getValue(nOrdinal);
            }

            if (m_nState == DIRTY || m_nState == NEW)
            {
               if (m_uow != m_context.getUnitOfWork() && m_context.isUnitOfWorkGlobal())
               {
                  throw new TransactionException("err.runtime.wrongTransaction",
                     new Object[]{getLazyClassName()});
               }

               if (!isEventPending())
               {
                  m_context.getUnitOfWork().addChange(this);
               }

               setEventPending(true);
            }
            else
            {
               setDirty();
            }

            if (attribute.isCalculated())
            {
               setOverridden(nOrdinal);
            }

            attribute.invalidateDependency(this, Invalid.VALUE);
         }

         if (attribute.isCollection())
         {
            if (attribute.getType().isPrimitive())
            {
               setValueDirect(nOrdinal, (List)value);
            }
            else
            {
               InstanceList list = (InstanceList)value;

               if (list != null && !isLoading())
               {
                  list.checkUpdateAccess(attribute.getReverse(), this);
               }

               setValueDirect(nOrdinal, list);

               if (list != null)
               {
                  list.setAssociation(this, attribute, isLoading());
                  setAliases(list);
               }
            }
         }
         else
         {
            Attribute reverse = attribute.getReverse();

            if (reverse != null)
            {
               int nRevOrdinal = reverse.getOrdinal();

               if (oldValue instanceof Instance && attribute.isReverseOf(reverse))
               {
                  Instance instance = (Instance)oldValue;

View Full Code Here

    */
   public void setValue(String sName, Object value)
   {
      load();

      Attribute attribute = m_metaclass.getAttribute(sName);

      if (attribute.isStatic())
      {
         m_metaclass.setValue(attribute.getOrdinal(), value);
      }
      else
      {
         setValue(attribute.getOrdinal(), value);
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.Attribute$IndirectInverseDependency

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.