| | |
| | | { |
| | | if (entryDN.equals(baseDN)) |
| | | { |
| | | return getSchemaEntry(entryDN, false); |
| | | return getSchemaEntry(entryDN, false, true); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Generates and returns a schema entry for the Directory Server. |
| | | * |
| | |
| | | */ |
| | | public Entry getSchemaEntry(DN entryDN, boolean includeSchemaFile) |
| | | { |
| | | return getSchemaEntry(entryDN, includeSchemaFile, false); |
| | | } |
| | | |
| | | /** |
| | | * Generates and returns a schema entry for the Directory Server. |
| | | * |
| | | * @param entryDN The DN to use for the generated entry. |
| | | * @param includeSchemaFile A boolean indicating if the X-SCHEMA-FILE |
| | | * extension should be used when generating |
| | | * the entry. |
| | | * @param ignoreShowAllOption A boolean indicating if the showAllAttributes |
| | | * parameter should be ignored or not. It must |
| | | * only considered for Search operation, and |
| | | * definitely ignored for Modify operations, i.e. |
| | | * when calling through getEntry(). |
| | | * |
| | | * @return The schema entry that was generated. |
| | | */ |
| | | private Entry getSchemaEntry(DN entryDN, boolean includeSchemaFile, |
| | | boolean ignoreShowAllOption) |
| | | { |
| | | LinkedHashMap<AttributeType, List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | |
| | |
| | | |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | if (attributeTypesType.isOperational() && (!showAllAttributes)) |
| | | if (attributeTypesType.isOperational() && |
| | | (ignoreShowAllOption || (!showAllAttributes))) |
| | | { |
| | | operationalAttrs.put(attributeTypesType, attrList); |
| | | } |
| | |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | |
| | | if (objectClassesType.isOperational() && (!showAllAttributes)) |
| | | if (objectClassesType.isOperational() && |
| | | (ignoreShowAllOption || (!showAllAttributes))) |
| | | { |
| | | operationalAttrs.put(objectClassesType, attrList); |
| | | } |
| | |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | |
| | | if (matchingRulesType.isOperational() && (!showAllAttributes)) |
| | | if (matchingRulesType.isOperational() && |
| | | (ignoreShowAllOption || (!showAllAttributes))) |
| | | { |
| | | operationalAttrs.put(matchingRulesType, attrList); |
| | | } |
| | |
| | | // writer when we're done. |
| | | try |
| | | { |
| | | ldifWriter.writeEntry(getSchemaEntry(baseDNs[0], true)); |
| | | ldifWriter.writeEntry(getSchemaEntry(baseDNs[0], true, true)); |
| | | } |
| | | catch (Exception e) |
| | | { |