Examples of AttributeMetaData


Examples of com.proofpoint.configuration.ConfigurationMetadata.AttributeMetadata

                }
            }
        }

        for (ConstraintViolation<?> violation : VALIDATOR.validate(instance)) {
            AttributeMetadata attributeMetadata = configurationMetadata.getAttributes()
                    .get(LOWER_CAMEL.to(UPPER_CAMEL, violation.getPropertyPath().toString()));
            if (attributeMetadata != null) {
                problems.addError("Constraint violation for property '%s': %s (for class %s)",
                        prefix + attributeMetadata.getInjectionPoint().getProperty(), violation.getMessage(), configClass.getName());
            }
            else {
                problems.addError("Constraint violation with property prefix '%s': %s %s (for class %s)",
                        prefix, violation.getPropertyPath(), violation.getMessage(), configClass.getName());
            }
View Full Code Here

Examples of com.rapidminer.operator.ports.metadata.AttributeMetaData

   
    getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.SUPERSET) {
      @Override
      public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) throws UndefinedParameterError {
     
        AttributeMetaData prediction=metaData.getAttributeByName("prediction");
        if (prediction != null) {
          prediction.setType(Ontology.REAL);
        }
        else{
          AttributeMetaData attribute=new AttributeMetaData("prediction",4);
          metaData.addAttribute(attribute);
        }
       
        return metaData;
      }
View Full Code Here

Examples of io.airlift.configuration.ConfigurationMetadata.AttributeMetadata

        }

        Assert.assertEquals(metadata.getAttributes().size(), attributeProperties.keySet().size());

        for (String name : attributeProperties.keySet()) {
            AttributeMetadata attribute = metadata.getAttributes().get(name);
            Assert.assertEquals(attribute.getConfigClass(), configClass);
            Set<String> namesToTest = Sets.newHashSet();
            namesToTest.add(attribute.getInjectionPoint().getProperty());
            for (ConfigurationMetadata.InjectionPointMetaData legacyInjectionPoint : attribute.getLegacyInjectionPoints()) {
                namesToTest.add(legacyInjectionPoint.getProperty());
            }
            Assert.assertEquals(namesToTest, attributeProperties.get(name));
            Assert.assertEquals(attribute.getDescription(), description);
        }
    }
View Full Code Here

Examples of org.apache.myfaces.trinidadinternal.metadata.RegionMetadata.AttributeMetaData

    Map<String, Object> compAttrs = region.getAttributes();
    List<AttributeMetaData> attrs = cmd.getAttributes();
    int sz = attrs.size();
    for(int i=0; i<sz; i++)
    {
      AttributeMetaData attr = attrs.get(i);
      String name = attr.getAttrName();
      Class<?> klass = attr.getAttrClass();
      if (region.getValueBinding(name) != null)
        continue;

      Object compValue = compAttrs.get(name);
      if (compValue == null)
      {
        // if attribute value was not specified then try to default it:
        String defaultValue = attr.getDefaultValue();
        if (defaultValue != null)
        {
          hasErrors |= _typeConvert(compAttrs, name, defaultValue, klass);
        }
        // if no default value was found then make sure the attribute was not
        // required:
        else if (attr.isRequired())
        {
          _LOG.severe("attribute:{0} is missing on componentType:{1}",
                      new Object[] {name, regionType});
          hasErrors = true;
        }
View Full Code Here

Examples of org.carrot2.util.attribute.AttributeMetadata

    /**
     * Build text content to be displayed in the tooltip.
     */
    protected void buildContent(StyledTextContentBuilder builder)
    {
        final AttributeMetadata meta = descriptor.metadata;
        final String INDENT = "    ";

        builder.println("Attribute:", BOLD)
            .print(INDENT)
            .println(meta != null ? meta.getLabelOrTitle() : descriptor.key)
            .println();

        builder.println("Availability:", BOLD)
            .print(INDENT)
            .print(descriptor.requiredAttribute ? "required" : "optional");
View Full Code Here

Examples of org.jboss.metadata.web.spec.AttributeMetaData

* @author Remy Maucherat
*/
public class AttributeMetaDataParser extends MetaDataElementParser {

    public static AttributeMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        AttributeMetaData attributeMD = new AttributeMetaData();

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    attributeMD.setId(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        DescriptionsImpl descriptions = new DescriptionsImpl();
        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            if (DescriptionsMetaDataParser.parse(reader, descriptions)) {
                if (attributeMD.getDescriptions() == null) {
                    attributeMD.setDescriptions(descriptions);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case NAME:
                    attributeMD.setName(reader.getElementText());
                    break;
                case REQUIRED:
                    attributeMD.setRequired(reader.getElementText());
                    break;
                case RTEXPRVALUE:
                    attributeMD.setRtexprvalue(reader.getElementText());
                    break;
                case TYPE:
                    attributeMD.setType(reader.getElementText());
                    break;
                case FRAGMENT:
                    attributeMD.setFragment(reader.getElementText());
                    break;
                case DEFERRED_VALUE:
                    attributeMD.setDeferredValue(DeferredValueMetaDataParser.parse(reader));
                    break;
                case DEFERRED_METHOD:
                    attributeMD.setDeferredMethod(DeferredMethodMetaDataParser.parse(reader));
                    break;
                default: throw unexpectedElement(reader);
            }
        }

View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.metadata.AttributeMetaData

    final ElementType type = element.getElementType();
    final ElementMetaData data = type.getMetaData();
    final AttributeMetaData[] datas = data.getAttributeDescriptions();
    for (int i = 0; i < datas.length; i++)
    {
      final AttributeMetaData attributeMetaData = datas[i];
      if (attributeMetaData.isTransient())
      {
        continue;
      }
      if (isFiltered(attributeMetaData))
      {
        continue;
      }

      final Object attValue = element.getAttribute(attributeMetaData.getNameSpace(), attributeMetaData.getName());
      if (attValue == null)
      {
        continue;
      }
      final ResourceReference[] referencedResources = attributeMetaData.getReferencedResources
          (element, state.getMasterReport().getResourceManager(), attValue);
      for (int j = 0; j < referencedResources.length; j++)
      {
        final ResourceReference reference = referencedResources[j];
        if (reference.isLinked())
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.metadata.AttributeMetaData

        if (value == null)
        {
          continue;
        }

        final AttributeMetaData attrMeta = metaData.getAttributeDescription(namespace, name);
        if (attrMeta == null)
        {
          if (value instanceof String)
          {
            ensureNamespaceDefined(writer, attList, namespace);

            // preserve strings, but discard anything else. Until a attribute has a definition, we cannot
            // hope to understand the attribute's value. String-attributes can be expressed in XML easily,
            // and string is also how all unknown attributes are stored by the parser.
            attList.setAttribute(namespace, name, String.valueOf(value));
          }
          continue;
        }

        if (attrMeta.isTransient())
        {
          continue;
        }
        if (isFiltered(attrMeta))
        {
          continue;
        }
        if (attrMeta.isBulk())
        {
          continue;
        }

        ensureNamespaceDefined(writer, attList, namespace);
        try
        {
          final PropertyEditor propertyEditor = attrMeta.getEditor();
          if (propertyEditor != null)
          {
            propertyEditor.setValue(value);
            attList.setAttribute(namespace, name, propertyEditor.getAsText());
          }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.metadata.AttributeMetaData

        if (value == null)
        {
          continue;
        }

        final AttributeMetaData attrMeta = metaData.getAttributeDescription(namespace, name);
        if (attrMeta == null)
        {
          continue;
        }

        if (attrMeta.isTransient())
        {
          continue;
        }
        if (isFiltered(attrMeta))
        {
          continue;
        }
        if (attrMeta.isBulk() == false)
        {
          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

Examples of org.pentaho.reporting.engine.classic.core.metadata.AttributeMetaData

      System.out.println(prefix + ".grouping=Group");

      final AttributeMetaData[] attributes = type.getAttributeDescriptions();
      for (int j = 0; j < attributes.length; j++)
      {
        final AttributeMetaData attribute = attributes[j];
        final String attrNsPrefix = ElementTypeRegistry.getInstance().getNamespacePrefix(attribute.getNameSpace());
        final String attrPrefix = "element." + type.getName() + ".attribute." +
            attrNsPrefix + "." + attribute.getName();
        System.out.println(attrPrefix + ".display-name=" + attribute.getName());
        System.out.println(attrPrefix + ".description=" + attribute.getName());
        System.out.println(attrPrefix + ".grouping=" + attrNsPrefix);
      }

      final StyleMetaData[] styles = type.getStyleDescriptions();
      for (int j = 0; j < styles.length; j++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.