Package nexj.core.meta.persistence

Examples of nexj.core.meta.persistence.PersistenceMapping$TypeCodeMap$TypeCodeIterator


         Metaclass root = m_metaclass.getPersistenceRoot();

         for (int i = 0, n = root.getPersistenceAliasCount(); i < n; ++i)
         {
            Metaclass alias = root.getPersistenceAlias(i);
            PersistenceMapping mapping = alias.getPersistenceMapping();
            Attribute typeCodeAttr = mapping.getTypeCodeAttribute();

            if (typeCodeAttr != null)
            {
               Metaclass metaclass = mapping.findMetaclassByTypeCode(getValue(typeCodeAttr.getOrdinal()));

               if (metaclass != null)
               {
                  alias = metaclass;
               }
View Full Code Here


    * @param oid The OID. Can be null.
    * @param uow The unit of work.
    */
   protected static void uncache(Metaclass metaclass, OID oid, UnitOfWork uow)
   {
      PersistenceMapping mapping = metaclass.getPersistenceMapping();

      if (mapping != null)
      {
         if (mapping.getCaching() != PersistenceMapping.CACHING_NONE)
         {
            if (oid != null)
            {
               uow.uncache(getInstanceKey(metaclass, oid), UnitOfWork.CACHE_UNPARTITIONED);
            }
         }

         Metaclass root = metaclass.getPersistenceRoot();

         do
         {
            if (mapping.getCaching() == PersistenceMapping.CACHING_CLASS)
            {
               uow.uncache(getClassKey(metaclass, null), UnitOfWork.CACHE_UNPARTITIONED);
            }

            metaclass = metaclass.getBase();
View Full Code Here

      Instance partition = m_partition;

      if (user != null)
      {
         Metaclass metaclass = user.getMetaclass();
         PersistenceMapping mapping = metaclass.getPersistenceMapping();
         Attribute attribute = null;

         assert m_userClass.isUpcast(metaclass);

         if (mapping != null)
         {
            attribute = mapping.getFragmentAttribute();
         }

         if (attribute == null)
         {
            attribute = metaclass.findAttribute("fragmentName");
View Full Code Here

            instance = m_context.lockInstance(metaclass, oid, tobj.getEventName() != null);

            if (instance == null)
            {
               PersistenceMapping mapping = metaclass.getPersistenceMapping();

               if (mapping != null)
               {
                  Object[] valueArray = oid.getValueArray();
                  Key key = mapping.getObjectKey();

                  if (key.getPartCount() != valueArray.length)
                  {
                     throw new RequestException("err.rpc.oidPartCount", new Object[]
                     {
View Full Code Here

                        copyAttributeMapping(childAttribute, parentMetaclass.getAttribute("children"));
                     }

                     protected void copyAttributeMapping(Attribute dst, Attribute src)
                     {
                        PersistenceMapping mapping = src.getMetaclass().getPersistenceMapping();

                        if (mapping.getAttributeMapping(dst) != null)
                        {
                           return;
                        }

                        for (PersistenceMapping baseMapping = mapping;
                           baseMapping != null && baseMapping.isCompatible(mapping);
                           baseMapping = baseMapping.getBaseMapping())
                        {
                           Attribute attribute = baseMapping.getMetaclass().findAttribute(src.getName());

                           if (attribute != null)
                           {
                              AttributeMapping attributeMapping = baseMapping.getAttributeMapping(attribute);

                              if (attributeMapping != null)
                              {
                                 attributeMapping = (AttributeMapping)attributeMapping.clone();

                                 attributeMapping.setPersistenceMapping(mapping);
                                 attributeMapping.setAttribute(dst);

                                 ((ClassMapping)attributeMapping).setMapping(((Metaclass)dst.getType()).getPersistenceMapping());

                                 mapping.addAttributeMapping(attributeMapping);

                                 return;
                              }
                           }
                        }

                        throw new MetadataException("err.meta.enumAssociation",
                           new Object[]{src.getName(), src.getMetaclass().getName()});
                     }
                  });
               }
            });
         }

         final String sTypeCode = XMLUtil.getReqStringAttr(enumerationElement, "typeCode");

         m_inheritance1stPassFixupList.add(new ContextFixup(m_helper)
         {
            public void fixup()
            {
               Attribute attribute = null;

               for (PersistenceMapping mapping = metaclass.getPersistenceMapping();
                  mapping != null; mapping = mapping.getBaseMapping())
               {
                  attribute = mapping.getTypeCodeAttribute();

                  if (attribute != null)
                  {
                     attribute = metaclass.getDerivedAttribute(attribute);
View Full Code Here

    * @param metaclass The class for which the mapping applies.
    * @return The loaded persistence mapping object.
    */
   public PersistenceMapping loadPersistenceMapping(Element element, Metaclass metaclass)
   {
      PersistenceMapping mapping = loadPersistenceMappingDetails(element, metaclass);

      String sLockingAttribute = XMLUtil.getStringAttr(element, "lockingAttribute");

      if (sLockingAttribute != null)
      {
         mapping.setLockingAttribute(metaclass.getAttribute(sLockingAttribute));
      }

      String sTypeCodeAttribute = XMLUtil.getStringAttr(element, "classCodeAttribute");

      if (sTypeCodeAttribute != null)
      {
         mapping.setTypeCodeAttribute(metaclass.getAttribute(sTypeCodeAttribute));
      }

      mapping.setTypeCodeForced(XMLUtil.getBooleanAttr(element, "classCodeForced", false));

      String sFragmentAttribute = XMLUtil.getStringAttr(element, "fragmentAttribute");

      if (sFragmentAttribute != null)
      {
         mapping.setFragmentAttribute(metaclass.getAttribute(sFragmentAttribute));
      }

      String sFragmentReplication = XMLUtil.getStringAttr(element, "fragmentReplication");

      if (sFragmentReplication != null)
      {
         if (sFragmentReplication.equals("unicast"))
         {
            mapping.setFragmentReplication(PersistenceMapping.REPLICATION_UNICAST);
         }
         else if (sFragmentReplication.equals("broadcast"))
         {
            mapping.setFragmentReplication(PersistenceMapping.REPLICATION_BROADCAST);
         }
         else
         {
            throw new MetadataException("err.meta.fragmentReplication",
               new Object[]{sFragmentReplication, metaclass.getName()});
         }
      }

      String sCaching = XMLUtil.getStringAttr(element, "caching");

      if (sCaching != null)
      {
         if (sCaching.equals("instance"))
         {
            mapping.setCaching(PersistenceMapping.CACHING_INSTANCE);
         }
         else if (sCaching.equals("class"))
         {
            mapping.setCaching(PersistenceMapping.CACHING_CLASS);
         }
         else
         {
            throw new MetadataException("err.meta.caching",
               new Object[]{sCaching, metaclass.getName()});
View Full Code Here

      Lookup classMap = new HashTab();

      for (Iterator itr = metadata.getMetaclassIterator(); itr.hasNext();)
      {
         Metaclass metaclass = (Metaclass)itr.next();
         PersistenceMapping mapping = metaclass.getPersistenceMapping();
         Object where = resolve(metaclass, whereMap);

         if (mapping == null ||
            dataSourceSet != null && !dataSourceSet.contains(mapping.getDataSource()) ||
            where == null && bExclusive ||
            Boolean.FALSE.equals(where) ||
            !isWritable(mapping))
         {
            continue;
         }

         Metaclass root = metaclass.getPersistenceRoot();
         Pair attributes = null;

         for (int i = 0, n = metaclass.getInstanceAttributeCount(); i < n; ++i)
         {
            Attribute attribute = metaclass.getInstanceAttribute(i);
            Metaclass declarator = attribute.getDeclarator();

            if (attribute.isPersistent() &&
               attribute.getWhere() == null &&
               (!attribute.isCollection() || attribute.getReverse() == null) &&
               attribute != mapping.getLockingAttribute() &&
               (declarator == metaclass ||
                  declarator.getPersistenceMapping() == null ||
                  declarator.getPersistenceMapping().isCompatible(metaclass.getPersistenceMapping())) &&
               isWritable(metaclass.getPersistenceMapping().getAttributeMapping(attribute)))
            {
View Full Code Here

            Instance inst = (Instance)obj;

            if (inst.getOID() != null)
            {
               Metaclass metaclass = inst.getMetaclass();
               PersistenceMapping mapping = inst.getPersistenceMapping();

               if (isRoot(metaclass) && isWritable(mapping) &&
                   (dataSourceSet == null || dataSourceSet.contains(inst.getPersistenceMapping().getDataSource())))
               {
                  if (bEmpty && !metaclass.getName().equals(Metadata.VERSION_CLASS_NAME) ||
View Full Code Here

         {
            m_persistenceMapping.resolveInheritance();

            if (m_base != null)
            {
               PersistenceMapping baseMapping = m_base.getPersistenceMapping();

               if (baseMapping != null &&
                  baseMapping.isCompatible(m_persistenceMapping))
               {
                  Attribute typeCodeAttr = m_persistenceMapping.getTypeCodeAttribute();

                  if (typeCodeAttr != null &&
                     getDerivedAttribute(baseMapping.getTypeCodeAttribute()) == typeCodeAttr)
                  {
                     m_persistenceRoot = m_base.m_persistenceRoot;
                  }
                  else
                  {
View Full Code Here

                              adep.setHead(new Pair(adep.getHead()));
                              adep = (Pair)adep.getHead();
                           }

                           Metaclass metaclass = (Metaclass)type;
                           PersistenceMapping mapping = null;
                           Attribute typeCodeAttribute = null;

                           for (Metaclass base = metaclass; base != null; base = base.getBase())
                           {
                              PersistenceMapping baseMapping = base.getPersistenceMapping();

                              if (baseMapping != null)
                              {
                                 if (mapping != null && !mapping.isCompatible(baseMapping))
                                 {
View Full Code Here

TOP

Related Classes of nexj.core.meta.persistence.PersistenceMapping$TypeCodeMap$TypeCodeIterator

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.