public FeatureAttributeDescriptor(AttributeDescriptor ad) {
   super(
       ad.getName(),
       ad.isIndexed(),
       ad.isStored(),
       ad.isTokenized(),
       ad.isMultiValued(),
       ad.getType());
 }
示例#2
0
  private boolean attributeValueMatch(Attribute attribute, AttributeDescriptor descriptor) {

    switch (descriptor.getType().getAttributeFormat()) {
      case STRING:
      case XML:
      case GEOMETRY:
        return attributeValue.equals(attribute.getValue());
      case BOOLEAN:
        return Boolean.valueOf(attributeValue).equals(attribute.getValue());
      case DATE:
        try {
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
          dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
          String mappedDate = dateFormat.format(dateFormat.parse(attributeValue));
          String metacardDate = dateFormat.format((Date) attribute.getValue());
          return mappedDate.equals(metacardDate);
        } catch (ParseException e) {
          LOGGER.debug("Unable to parse date and perform comparison.", e);
          return false;
        }
      case SHORT:
        return Short.valueOf(attributeValue).equals(attribute.getValue());
      case INTEGER:
        return Integer.valueOf(attributeValue).equals(attribute.getValue());
      case LONG:
        return Long.valueOf(attributeValue).equals(attribute.getValue());
      case FLOAT:
        return Float.valueOf(attributeValue).equals(attribute.getValue());
      case DOUBLE:
        return Double.valueOf(attributeValue).equals(attribute.getValue());
      case BINARY:
      case OBJECT:
      default:
        LOGGER.debug("Unsupported Attribute Format was attempted for KML Style Mapping.");
        return false;
    }
  }