Package nexj.core.meta

Examples of nexj.core.meta.Metaclass$Local


                           Instance instance = ref.getInstance();

                           if (instance != null && !instance.isLazy() &&
                              instance.getState() != NEW && instance.getOID() != null)
                           {
                              Metaclass metaclass = instance.getMetaclass();

                              if (metaclass.getPersistenceMapping() != null)
                              {
                                 for (int i = 0, n = metaclass.getInstanceAttributeCount(); i < n; ++i)
                                 {
                                    Attribute attribute = metaclass.getInstanceAttribute(i);

                                    if (!attribute.isCollection() && attribute.isPersistent() &&
                                       instance.getOldValueDirect(i) == this)
                                    {
                                       if (!Query.createRead(metaclass, new Pair(attribute.getSymbol()),
View Full Code Here


      if (m_uow != null && (m_oid != null || m_nState == NEW))
      {
         load();
         uncache(m_metaclass, m_oid, m_uow);

         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

            {
               uow.uncache(getInstanceKey(metaclass, oid), UnitOfWork.CACHE_UNPARTITIONED);
            }
         }

         Metaclass root = metaclass.getPersistenceRoot();

         do
         {
            if (mapping.getCaching() == PersistenceMapping.CACHING_CLASS)
            {
View Full Code Here

    * @param typeCode The type code.
    * @return The found metaclass, or null if not found.
    */
   public Metaclass findMetaclassByTypeCode(Object typeCode) throws MetadataLookupException
   {
      Metaclass metaclass = null;
     
      if (m_typeCodeMap != null && typeCode != null)
      {
         metaclass = (Metaclass)m_typeCodeMap.get(typeCode);
      }
View Full Code Here

    * @return The found metaclass.
    * @throws MetadataLookupException if the type code is invalid.
    */
   public Metaclass getMetaclassByTypeCode(Object typeCode) throws MetadataLookupException
   {
      Metaclass metaclass = findMetaclassByTypeCode(typeCode);
     
      if (metaclass == null)
      {
         throw new MetadataLookupException("err.meta.typeCodeLookup",
            String.valueOf(typeCode), m_metaclass);
View Full Code Here

    * @return The persistence mapping of the base class, or null if not available.
    */
   public PersistenceMapping getBaseMapping()
   {
      PersistenceMapping mapping = null;
      Metaclass base = m_metaclass.getBase();

      if (base != null)
      {
         mapping = base.getPersistenceMapping();

         if (mapping != null)
         {
            mapping = mapping.findMapping(this);
         }
View Full Code Here

    * @param upgrade The upgrade this UpgradeVersion will be used for (not null).
    */
   public static VersionUpgrade create(
      String sName, Metadata metadata, Machine machine, Upgrade upgrade)
   {
      Metaclass versionClass = metadata.getMetaclass(Metadata.VERSION_CLASS_NAME);
      PersistenceMapping mapping = versionClass.getPersistenceMapping();
      DataSource ds = mapping.getDataSource();

      if (ds instanceof RelationalDatabase) // SysVersion persisted in RDBMS
      {
         Table table = ((RelationalMapping)mapping).getPrimaryTable();
         RelationalSchemaUpgrade version = new RelationalSchemaUpgrade(sName);
         ExecStep step = new ExecStep();
         SQLScript script = new SQLScript();
         SQLStatement stmt = new SQLStatement();

         stmt.setSQL("update ${table:"+ table.getName() +"} set " +
                     table.getColumn("loaded").getQuotedName() + "=0");
         script.addStatement(stmt);
         step.getScriptHolder().addScript(script);
         version.setDataSource(ds);
         version.addStep(step);

         return version;
      }

      // SysVersion accessible via a Scheme function
      ScriptUpgrade version = new ScriptUpgrade(sName);

      // (SysVersion 'unload)
      version.setBody(
         Pair.list(
            Pair.list(versionClass.getSymbol(), Pair.list(Symbol.QUOTE, Symbol.define("unload")))));
      version.setUpgrade(upgrade); // required for compile() to work
      version.compile(machine);

      return version;
   }
View Full Code Here

      {
         m_accessAttribute = null;
      }
      else
      {
         Metaclass metaclass;

         if (m_attribute != null)
         {
            metaclass = m_attribute.getMetaclass();
         }
         else
         {
            metaclass = m_metaclass;
         }

         if (metaclass != null)
         {
            m_accessAttribute = metaclass.getAttribute(sName);
         }
      }
   }
View Full Code Here

   /**
    * @see nexj.core.persistence.virtual.VirtualWork#execute(nexj.core.persistence.Work[], int, int)
    */
   public void execute(Work[] workArray, final int nStart, final int nEnd)
   {
      Metaclass metaclass = m_instance.getMetaclass();
      int nAttributeCount = metaclass.getInstanceAttributeCount();
      VirtualMapping mapping = (VirtualMapping)m_mapping;
      WorkMapping operation = mapping.getCreateMapping();
      Attribute lockingAttribute = mapping.getLockingAttribute();
      int nLockingOrdinal = (lockingAttribute == null) ? -1 : lockingAttribute.getOrdinal();
      String sLockingAttributeName = (lockingAttribute == null) ? null :  lockingAttribute.getName();
      VirtualDataSourceFragment fragment = (VirtualDataSourceFragment)getFragment();
      ArrayList tobjList = new ArrayList(nEnd - nStart);

      for (int i = nStart; i < nEnd; i++)
      {
         Instance instance = workArray[i].getInstance();
         TransferObject tobj = new TransferObject(instance.getOID(), metaclass.getName(), EVENT, nAttributeCount);

         for (int k = 0; k < nAttributeCount; k++)
         {
            if (instance.isDirty(k))
            {
               Attribute attribute = metaclass.getInstanceAttribute(k);
               AttributeMapping attrMapping = m_mapping.getAttributeMapping(attribute);

               if (attrMapping != null)
               {
                  int nKeyPart = (attrMapping instanceof VirtualPrimitiveMapping) ?
View Full Code Here

    * @param event The event.
    * @param pair The flow function list.
    */
   protected void addDerivedFlowFunctions(Pair assoc, Event event, Pair pair)
   {
      Metaclass metaclass = event.getMetaclass();
     
      for (int i = 0, nCount = metaclass.getDerivedCount(); i < nCount; ++i)
      {
         Event derived = metaclass.getDerived(i).findEvent(event.getName(), event.getArgumentCount());
         Pair dpair = (Pair)m_functionMap.get(derived, assoc);
        
         if (pair != null)
         {
            dpair = Pair.append(pair, dpair);
View Full Code Here

TOP

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

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.