NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
NodeTypeIterator types = manager.getAllNodeTypes();
while (types.hasNext()) {
NodeType type = types.nextNodeType();
PropertyDefinition propDefs[] = type.getDeclaredPropertyDefinitions();
for (int i = 0; i < propDefs.length; i++) {
PropertyDefinition propDef = propDefs[i];
if (propertyType != ANY_PROPERTY_TYPE &&
propDef.getRequiredType() != propertyType) {
continue;
}
if (propertyType == ANY_PROPERTY_TYPE &&
propDef.getRequiredType() == PropertyType.UNDEFINED) {
continue;
}
if (multiple && !propDef.isMultiple()) {
continue;
}
if (!multiple && propDef.isMultiple()) {
continue;
}
if (isProtected && !propDef.isProtected()) {
continue;
}
if (!isProtected && propDef.isProtected()) {
continue;
}
String vc[] = propDef.getValueConstraints();
if (!constraints && vc != null && vc.length > 0) {
continue;
}
if (constraints) {
// property def with constraints requested
if (vc == null || vc.length == 0) {
// property def has no constraints
continue;
}
}
if (!residual && propDef.getName().equals("*")) {
continue;
}
if (residual && !propDef.getName().equals("*")) {
continue;
}
// also skip property residual property definition if there
// is another residual definition