Package org.pentaho.reporting.libraries.xmlns.common

Examples of org.pentaho.reporting.libraries.xmlns.common.AttributeList


          continue;
        }

        if ("Resource".equals(attrMeta.getValueRole()))
        {
          final AttributeList attList = new AttributeList();
          if (attList.isNamespaceUriDefined(namespace) == false &&
              writer.isNamespaceDefined(namespace) == false)
          {
            attList.addNamespaceDeclaration("autoGenNS", namespace);
          }

          if (value instanceof URL)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "url");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else if (value instanceof ResourceKey)
          {
            try
            {
              final ResourceKey key = (ResourceKey) value;
              final ResourceManager resourceManager = bundle.getResourceManager();
              final ResourceKey bundleKey = bundle.getBundleKey().getParent();
              final String serializedKey = resourceManager.serialize(bundleKey, key);
              attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "resource-key");
              writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
              writer.writeTextNormalized(serializedKey, true);
              writer.writeCloseTag();
            }
            catch (ResourceException re)
            {
              logger.error("Could not serialize the ResourceKey: " + re.getMessage(), re);
              throw new IOException("Could not serialize the ResourceKey: " + re.getMessage());
            }
          }
          else if (value instanceof File)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "file");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else if (value instanceof String)
          {
            attList.setAttribute(AttributeNames.Core.NAMESPACE, "resource-type", "local-ref");
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(String.valueOf(value), true);
            writer.writeCloseTag();
          }
          else
          {
            logger.warn("Unknown value-type in resource-attribute " + namespace + ":" + name);
          }

          continue;
        }

        if ("Expression".equals(attrMeta.getValueRole()) && value instanceof Expression)
        {
          // write attribute-expressions.
          final AttributeList attList = new AttributeList();
          attList.setAttribute(BundleNamespaces.LAYOUT, "attribute-namespace", namespace);
          attList.setAttribute(BundleNamespaces.LAYOUT, "attribute-name", name);
          ExpressionWriterUtility.writeExpressionCore
              (bundle, state, (Expression) value, writer, BundleNamespaces.LAYOUT, "expression", attList);
          continue;
        }

        try
        {
          final PropertyEditor propertyEditor = attrMeta.getEditor();
          if (propertyEditor != null)
          {

            propertyEditor.setValue(value);
            final String text = propertyEditor.getAsText();

            final AttributeList attList = new AttributeList();
            if (attList.isNamespaceUriDefined(namespace) == false &&
                writer.isNamespaceDefined(namespace) == false)
            {
              attList.addNamespaceDeclaration("autoGenNS", namespace);
            }
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(text, true);
            writer.writeCloseTag();
          }
          else
          {
            final String attrValue = ConverterRegistry.toAttributeValue(value);
            final AttributeList attList = new AttributeList();
            if (attList.isNamespaceUriDefined(namespace) == false &&
                writer.isNamespaceDefined(namespace) == false)
            {
              attList.addNamespaceDeclaration("autoGenNS", namespace);
            }
            writer.writeTag(namespace, attrMeta.getName(), attList, XmlWriter.OPEN);
            writer.writeTextNormalized(attrValue, true);
            writer.writeCloseTag();
          }
View Full Code Here


      final String namespace = attributeNamespaces[i];
      final String[] attributeNames = element.getAttributeExpressionNames(namespace);
      for (int j = 0; j < attributeNames.length; j++)
      {
        final String name = attributeNames[j];
        final AttributeList attList = new AttributeList();
        attList.setAttribute(BundleNamespaces.LAYOUT, "namespace", namespace);
        attList.setAttribute(BundleNamespaces.LAYOUT, "name", name);
        final Expression ex = element.getAttributeExpression(namespace, name);
        ExpressionWriterUtility.writeExpressionCore
            (bundle, state, ex, writer, BundleNamespaces.LAYOUT, "attribute-expression", attList);
      }
    }
View Full Code Here

          '/' + subReportState.getFileName() + "content.xml", XmlWriterSupport.OPEN);

      for (int i = 0; i < inputMappings.length; i++)
      {
        final ParameterMapping mapping = inputMappings[i];
        final AttributeList attrs = new AttributeList();
        attrs.setAttribute(BundleNamespaces.LAYOUT, "master-fieldname", mapping.getName());
        attrs.setAttribute(BundleNamespaces.LAYOUT, "detail-fieldname", mapping.getAlias());
        xmlWriter.writeTag(BundleNamespaces.LAYOUT, "input-parameter", attrs, XmlWriterSupport.CLOSE);
      }

      for (int i = 0; i < outputMappings.length; i++)
      {
        final ParameterMapping mapping = outputMappings[i];
        final AttributeList attrs = new AttributeList();
        attrs.setAttribute(BundleNamespaces.LAYOUT, "master-fieldname", mapping.getName());
        attrs.setAttribute(BundleNamespaces.LAYOUT, "detail-fieldname", mapping.getAlias());
        xmlWriter.writeTag(BundleNamespaces.LAYOUT, "output-parameter", attrs, XmlWriterSupport.CLOSE);
      }
      xmlWriter.writeCloseTag();
    }
  }
View Full Code Here

    {
      throw new NullPointerException();
    }


    final AttributeList rootAttrs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(StaticDataFactoryModule.NAMESPACE) == false)
    {
      rootAttrs.addNamespaceDeclaration("data", StaticDataFactoryModule.NAMESPACE);
    }
    xmlWriter.writeTag(StaticDataFactoryModule.NAMESPACE, "direct-static-datasource", rootAttrs, XmlWriterSupport.OPEN);

    xmlWriter.writeCloseTag();
  }
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "label", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    xmlWriter.writeCloseTag();
  }
View Full Code Here

    if (parameterNames.isEmpty())
    {
      return;
    }

    final AttributeList p = new AttributeList();
    p.setAttribute(ExtParserModule.NAMESPACE, "name", parameterName);
    if (isUseParameterObjectDescription(parameterDefinition, parameterValue) == false)
    {
      p.setAttribute(ExtParserModule.NAMESPACE, "class", parameterValue.getClass().getName());
    }

    final XmlWriter writer = getXmlWriter();
    if (ObjectWriter.isBasicObject(parameterNames, parameterDescription))
    {
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "resource-message", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    xmlWriter.writeCloseTag();

  }
View Full Code Here

      throw new NullPointerException();
    }

    final NamedStaticDataFactory staticDataFactory = (NamedStaticDataFactory) dataFactory;

    final AttributeList rootAttrs = new AttributeList();
    if (xmlWriter.isNamespaceDefined(StaticDataFactoryModule.NAMESPACE) == false)
    {
      rootAttrs.addNamespaceDeclaration("data", StaticDataFactoryModule.NAMESPACE);
    }
    xmlWriter.writeTag(StaticDataFactoryModule.NAMESPACE, "static-datasource", rootAttrs, XmlWriterSupport.OPEN);

    final String[] queryNames = staticDataFactory.getQueryNames();
    for (int i = 0; i < queryNames.length; i++)
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "crosstab-title-header", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    writeChildElements(bundle, state, xmlWriter, (Band) element);
    xmlWriter.writeCloseTag();
View Full Code Here

    if (element == null)
    {
      throw new NullPointerException();
    }

    final AttributeList attList = createMainAttributes(element, xmlWriter);
    xmlWriter.writeTag(BundleNamespaces.LAYOUT, "message", attList, XmlWriterSupport.OPEN);
    writeElementBody(bundle, state, element, xmlWriter);
    xmlWriter.writeCloseTag();

  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.common.AttributeList

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.