Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.TransformationArgument


            m_argList.clear();

            for (int nArg = 0, nArgCount = mapping.getArgumentCount(); nArg != nArgCount; ++nArg)
            {
               TransformationArgument arg = mapping.getArgument(nArg);
               TransformationSource src = arg.getSource();
               int nStartLevel = arg.getStartLevel();
               Object value = getSourceObject(nStartLevel);
               Object parent = getSourceObject(Math.max(0, nStartLevel - 1));
               int nLevel;

               for (nLevel = nStartLevel; nLevel < src.getLevel() && value != null && value != Undefined.VALUE; ++nLevel)
               {
                  parent = value;
                  value = src.getPath(nLevel + 1).getPart().getValue((PropertyMap)parent, Undefined.VALUE);
               }

               if (value == null)
               {
                  if (nLevel != src.getLevel() || !arg.isNull())
                  {
                     bMissing = true;

                     break;
                  }
               }
               else if (value == Undefined.VALUE)
               {
                  if (nLevel != src.getLevel())
                  {
                     bMissing = true;

                     break;
                  }

                  Function fun = arg.getDefaultValueFunction();

                  if (fun == null)
                  {
                     bMissing = true;
View Full Code Here


                  {
                     throw new MetadataException("err.meta.transformation.bothSourceMapping",
                        new Object[]{mapping.getName(), transformation.getName()});
                  }

                  final TransformationArgument argument = new TransformationArgument(sSourceName);

                  if (sMapping == null)
                  {
                     if (sSource == null)
                     {
                        sSource = "";
                     }

                     StringTokenizer tokenizer = new StringTokenizer(sSource);
                     TransformationSource source = transformation.getRoot();

                     while (tokenizer.hasMoreTokens())
                     {
                        String sPartName = tokenizer.nextToken();
                        boolean bFixed = sPartName.endsWith("$");

                        if (bFixed)
                        {
                           sPartName = sPartName.substring(0, sPartName.length() - 1);
                        }

                        source = source.addChild(sPartName);

                        if (bFixed)
                        {
                           mapping.setFixedSource(source, true);
                        }
                     }

                     argument.setSource(source);
                  }
                  else
                  {
                     m_postInheritanceTransformationFixupList.add(new ContextFixup(getHelper())
                     {
                        public void fixup()
                        {
                           argument.setMapping(transformation, sMapping);
                        }
                     });
                  }

                  argument.setNull(XMLUtil.getBooleanAttr(sourceElement, "null", argument.isNull()));
                  argument.setDefaultValue(m_helper.parse(XMLUtil.getStringAttr(sourceElement, "default"), false,
                     sCodeURL + '.' + argument.getName(), transformation.getPosMap(), argument.getDefaultValue(),
                     m_metadata.getGlobalEnvironment()));
                  mapping.addArgument(argument);
               }

               protected String getName(Element element)
View Full Code Here

      {
         m_writer.startElement("Sources");

         for (int i = 0; i < mapping.getArgumentCount(); ++i)
         {
            TransformationArgument argument = mapping.getArgument(i);

            m_writer.openElement("Source");

            if (argument.getName() != null)
            {
               m_writer.writeAttribute("name", argument.getName());
            }

            if (argument.getMapping() != null)
            {
               m_writer.writeAttribute("mapping", argument.getMapping().getName());
            }
            else if (argument.getSource() != null && argument.getSource() != transformation.getRoot())
            {
               StringBuffer tokenBuf = new StringBuffer();

               for (TransformationSource source = argument.getSource();;)
               {
                  String sPrepend = source.getPart().getName();

                  if (mapping.isFixedSource(source))
                  {
                     sPrepend += "$";
                  }

                  tokenBuf.insert(0, (tokenBuf.length() == 0) ? sPrepend : sPrepend + " ");

                  source = source.getParent();

                  if (source == transformation.getRoot())
                  {
                     break;
                  }
               }

               m_writer.writeAttribute("source", tokenBuf.toString());
            }

            if (argument.isNull())
            {
               m_writer.writeAttribute("null", true);
            }

            if (argument.isDefault())
            {
               exportSExpression(argument.getDefaultValue(), false, false, Undefined.VALUE, "default");
            }

            m_writer.closeEmptyElement();
         }
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.TransformationArgument

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.