use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testVersionItem.
/** Test for the <code>version</code> parent version action. */
public void testVersionItem() {
QPropertyDefinition def = getPropDef("itemNodeType", "versionItem");
assertEquals("versionItem onParentVersion", OnParentVersionAction.VERSION, def.getOnParentVersion());
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testStringProperty.
/** Test for the <code>string</code> property definition type. */
public void testStringProperty() {
QPropertyDefinition def = getPropDef("propertyNodeType", "stringProperty");
assertEquals("stringProperty requiredType", PropertyType.STRING, def.getRequiredType());
assertEquals("stringProperty valueConstraints", 1, def.getValueConstraints().length);
assertEquals("stringProperty valueConstraints[0]", "bananas?", (def.getValueConstraints())[0].getString());
assertEquals("stringProperty defaultValues", 2, def.getDefaultValues().length);
assertEquals("stringProperty defaultValues[0]", "banana", getDefaultValue(def, 0));
assertEquals("stringProperty defaultValues[1]", "bananas", getDefaultValue(def, 1));
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testEmptyItem.
/** Test for the empty item definition. */
public void testEmptyItem() {
QPropertyDefinition def = getPropDef("itemNodeType", "emptyItem");
assertEquals("emptyItem autoCreate", false, def.isAutoCreated());
assertEquals("emptyItem mandatory", false, def.isMandatory());
assertEquals("emptyItem onParentVersion", OnParentVersionAction.IGNORE, def.getOnParentVersion());
assertEquals("emptyItem protected", false, def.isProtected());
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit by apache.
the class TestAll method testMandatoryItem.
/** Test for the <code>mandatory</code> item definition attribute. */
public void testMandatoryItem() {
QPropertyDefinition def = getPropDef("itemNodeType", "mandatoryItem");
assertEquals("mandatoryItem mandatory", true, def.isMandatory());
}
use of org.apache.jackrabbit.spi.QPropertyDefinition in project jackrabbit-oak by apache.
the class RepositoryUpgrade method createNodeTypeTemplate.
private NodeTypeTemplate createNodeTypeTemplate(ValueFactory valueFactory, NodeTypeManager ntMgr, String oakName, QNodeTypeDefinition def) throws RepositoryException {
NodeTypeTemplate tmpl = ntMgr.createNodeTypeTemplate();
tmpl.setName(oakName);
tmpl.setAbstract(def.isAbstract());
tmpl.setMixin(def.isMixin());
tmpl.setOrderableChildNodes(def.hasOrderableChildNodes());
tmpl.setQueryable(def.isQueryable());
Name primaryItemName = def.getPrimaryItemName();
if (primaryItemName != null) {
tmpl.setPrimaryItemName(getOakName(primaryItemName));
}
Name[] supertypes = def.getSupertypes();
if (supertypes != null && supertypes.length > 0) {
List<String> names = newArrayListWithCapacity(supertypes.length);
for (Name supertype : supertypes) {
names.add(getOakName(supertype));
}
tmpl.setDeclaredSuperTypeNames(names.toArray(new String[names.size()]));
}
List<PropertyDefinitionTemplate> propertyDefinitionTemplates = tmpl.getPropertyDefinitionTemplates();
for (QPropertyDefinition qpd : def.getPropertyDefs()) {
PropertyDefinitionTemplate pdt = createPropertyDefinitionTemplate(valueFactory, ntMgr, qpd);
propertyDefinitionTemplates.add(pdt);
}
// + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition protected sns
List<NodeDefinitionTemplate> nodeDefinitionTemplates = tmpl.getNodeDefinitionTemplates();
for (QNodeDefinition qnd : def.getChildNodeDefs()) {
NodeDefinitionTemplate ndt = createNodeDefinitionTemplate(ntMgr, qnd);
nodeDefinitionTemplates.add(ndt);
}
return tmpl;
}
Aggregations