예제 #1
0
 /**
  * Returns the SAX 2.0 attribute type string from the type of a JDOM Attribute.
  *
  * @param type <code>int</code> the type of the JDOM attribute.
  * @return <code>String</code> the SAX 2.0 attribute type string.
  * @see org.jdom2.Attribute#getAttributeType
  * @see org.xml.sax.Attributes#getType
  */
 private static String getAttributeTypeName(AttributeType type) {
   switch (type) {
     case UNDECLARED:
       return "CDATA";
     default:
       return type.name();
   }
 }
예제 #2
0
  /**
   * Indicates whether the specified attribute should be included in the entries read from the LDIF.
   *
   * @param attributeType The attribute type for which to make the determination.
   * @return <CODE>true</CODE> if the specified attribute should be included in the entries read
   *     from the LDIF, or <CODE>false</CODE> if not.
   */
  public boolean includeAttribute(AttributeType attributeType) {
    if (!excludeAttributes.isEmpty() && excludeAttributes.contains(attributeType)) {
      return false;
    }

    if ((excludeAllOpAttrs && attributeType.isOperational())
        || (excludeAllUserAttrs && !attributeType.isOperational())) {
      return false;
    }

    if ((includeAllUserAttrs && !attributeType.isOperational())
        || (includeAllOpAttrs && attributeType.isOperational())) {
      return true;
    }

    if (!includeAttributes.isEmpty()) {
      return includeAttributes.contains(attributeType);
    } else if ((includeAllUserAttrs && attributeType.isOperational())
        || (includeAllOpAttrs && !attributeType.isOperational())) {
      return false;
    }
    return true;
  }