@Override protected void doFinish() throws RepositoryException { currentPropDefn.setDefaultValues(getJcrValues()); } }
@Override protected void doFinish() throws RepositoryException { currentPropDefn.setDefaultValues(getJcrValues()); } }
@Override public void build() throws IllegalStateException { template.setAutoCreated(super.autocreate); template.setMandatory(super.isMandatory); template.setOnParentVersion(super.onParent); template.setProtected(super.isProtected); template.setRequiredType(super.requiredType); template.setValueConstraints(constraints.toArray(new String[constraints.size()])); template.setDefaultValues(values.toArray(new Value[values.size()])); template.setMultiple(super.isMultiple); template.setAvailableQueryOperators(super.queryOperators); template.setFullTextSearchable(super.fullTextSearchable); template.setQueryOrderable(super.queryOrderable); @SuppressWarnings("unchecked") List<PropertyDefinitionTemplate> templates = ntd.template.getPropertyDefinitionTemplates(); templates.add(template); }
@Override public void build() throws IllegalStateException { template.setAutoCreated(super.autocreate); template.setMandatory(super.isMandatory); template.setOnParentVersion(super.onParent); template.setProtected(super.isProtected); template.setRequiredType(super.requiredType); template.setValueConstraints(constraints.toArray(new String[constraints.size()])); template.setDefaultValues(values.toArray(new Value[values.size()])); template.setMultiple(super.isMultiple); template.setAvailableQueryOperators(super.queryOperators); template.setFullTextSearchable(super.fullTextSearchable); template.setQueryOrderable(super.queryOrderable); @SuppressWarnings("unchecked") List<PropertyDefinitionTemplate> templates = ntd.template.getPropertyDefinitionTemplates(); templates.add(template); }
@Override public void build() throws IllegalStateException { template.setAutoCreated(super.autocreate); template.setMandatory(super.isMandatory); template.setOnParentVersion(super.onParent); template.setProtected(super.isProtected); template.setRequiredType(super.requiredType); template.setValueConstraints(constraints.toArray(new String[constraints.size()])); template.setDefaultValues(values.toArray(new Value[values.size()])); template.setMultiple(super.isMultiple); template.setAvailableQueryOperators(super.queryOperators); template.setFullTextSearchable(super.fullTextSearchable); template.setQueryOrderable(super.queryOrderable); @SuppressWarnings("unchecked") List<PropertyDefinitionTemplate> templates = ntd.template.getPropertyDefinitionTemplates(); templates.add(template); }
private PropertyDefinitionTemplate getHiddenProperty( final NodeTypeManager ntMgr, final ValueFactory vFac ) throws RepositoryException { PropertyDefinitionTemplate t = ntMgr.createPropertyDefinitionTemplate(); t.setName( PHO + "hidden" ); //$NON-NLS-1$ t.setRequiredType( PropertyType.BOOLEAN ); t.setDefaultValues( new Value[] { vFac.createValue( false ) } ); t.setOnParentVersion( OnParentVersionAction.COPY ); t.setMultiple( false ); return t; }
private PropertyDefinitionTemplate getAclNodeProperty( final NodeTypeManager ntMgr, final ValueFactory vFac ) throws RepositoryException { PropertyDefinitionTemplate t = ntMgr.createPropertyDefinitionTemplate(); t.setName( PHO + "aclNode" ); //$NON-NLS-1$ t.setRequiredType( PropertyType.BOOLEAN ); t.setDefaultValues( new Value[]{ vFac.createValue( false ) } ); t.setOnParentVersion( OnParentVersionAction.COPY ); t.setMultiple( false ); return t; }
public void testSetDefaultValues() throws Exception { PropertyDefinitionTemplate pdt = ntm.createPropertyDefinitionTemplate(); pdt.setRequiredType(PropertyType.LONG); pdt.setDefaultValues(null); assertNull(pdt.getDefaultValues()); pdt.setDefaultValues(new Value[0]); assertNotNull(pdt.getDefaultValues()); assertEquals(0, pdt.getDefaultValues().length); pdt.setDefaultValues(new Value[] { superuser.getValueFactory().createValue(24)}); assertNotNull(pdt.getDefaultValues()); assertEquals(1, pdt.getDefaultValues().length); assertEquals(24, pdt.getDefaultValues()[0].getLong()); assertEquals(PropertyType.LONG, pdt.getDefaultValues()[0].getType()); }
/** * Creates the property definition template. * * @param ntm the ntm * @param prop the prop * @return the property definition template * @throws RepositoryException the repository exception */ private static PropertyDefinitionTemplate createPropertyDefTemplate(NodeTypeManager ntm, String prop, int type) throws RepositoryException { PropertyDefinitionTemplate pdt = ntm.createPropertyDefinitionTemplate(); pdt.setName(prop); pdt.setOnParentVersion(OnParentVersionAction.IGNORE); pdt.setRequiredType(type); pdt.setValueConstraints(null); pdt.setDefaultValues(null); pdt.setFullTextSearchable(true); pdt.setValueConstraints(new String[0]); return pdt; }
public static PropertyDefinitionTemplate createJCRPrimaryTypeProperty(NodeTypeManager nodeTypeManager, String name) throws RepositoryException { PropertyDefinitionTemplate propertyDefinitionTemplate1 = nodeTypeManager.createPropertyDefinitionTemplate(); propertyDefinitionTemplate1.setName("jcr:primaryType"); propertyDefinitionTemplate1.setRequiredType(PropertyType.NAME); propertyDefinitionTemplate1.setDefaultValues(null); propertyDefinitionTemplate1.setAutoCreated(true); propertyDefinitionTemplate1.setMandatory(true); propertyDefinitionTemplate1.setOnParentVersion(OnParentVersionAction.COMPUTE); propertyDefinitionTemplate1.setProtected(true); propertyDefinitionTemplate1.setMultiple(false); ((RegistryPropertyDefinitionTemplate) propertyDefinitionTemplate1).setDeclaringNodeTypeName(name); return propertyDefinitionTemplate1; }
propertyDefinition.setDefaultValues(defaultValues);
private PropertyDefinitionTemplate createBooleanPropTemplate() throws RepositoryException { PropertyDefinitionTemplate pdt = ntm.createPropertyDefinitionTemplate(); pdt.setName(expandedPropName); pdt.setAutoCreated(false); pdt.setMandatory(false); pdt.setOnParentVersion(OnParentVersionAction.IGNORE); pdt.setProtected(false); pdt.setRequiredType(PropertyType.BOOLEAN); pdt.setValueConstraints(null); pdt.setDefaultValues(null); pdt.setMultiple(false); pdt.setAvailableQueryOperators(new String[] { QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO }); pdt.setFullTextSearchable(false); pdt.setQueryOrderable(false); return pdt; } }
@SuppressWarnings( {"unchecked"} ) private NodeTypeTemplate createMixinWithAutoProperty( NodeTypeManager mgr ) throws RepositoryException { NodeTypeTemplate mixinTypeWithAutoProperty = mgr.createNodeTypeTemplate(); mixinTypeWithAutoProperty.setName("mixinTypeWithAutoCreatedProperty"); mixinTypeWithAutoProperty.setMixin(true); PropertyDefinitionTemplate propertyB = mgr.createPropertyDefinitionTemplate(); propertyB.setName(PROPERTY_B); propertyB.setMandatory(true); propertyB.setAutoCreated(true); propertyB.setOnParentVersion(OnParentVersionAction.IGNORE); propertyB.setRequiredType(PropertyType.LONG); propertyB.setDefaultValues(new Value[] {session.getValueFactory().createValue("10")}); mixinTypeWithAutoProperty.getPropertyDefinitionTemplates().add(propertyB); return mixinTypeWithAutoProperty; }
if (pdt.getRequiredType() == PropertyType.STRING) { Value[] vals = {valueFactory.createValue(f.getJcrDefaultValue())}; pdt.setDefaultValues(vals); } else { log.warn("Can only set default value for String properties. Skip for field '{}'", field.getJcrName());
/** * Create a new JCR property definition from the given <code>QPropertyDefinition</code>. * * @param qPd A SPI property definition. * @return the corresponding JCR property definition. * @throws RepositoryException if an error occurs. */ public PropertyDefinition create(QPropertyDefinition qPd) throws RepositoryException { PropertyDefinitionTemplate pt = ntMgr.createPropertyDefinitionTemplate(); pt.setName(getJCRName(qPd.getName())); pt.setAutoCreated(qPd.isAutoCreated()); pt.setMandatory(qPd.isMandatory()); pt.setOnParentVersion(qPd.getOnParentVersion()); pt.setProtected(qPd.isProtected()); pt.setRequiredType(qPd.getRequiredType()); pt.setMultiple(qPd.isMultiple()); pt.setFullTextSearchable(qPd.isFullTextSearchable()); pt.setValueConstraints(createValueConstraints(qPd.getRequiredType(), qPd.getValueConstraints())); pt.setAvailableQueryOperators(qPd.getAvailableQueryOperators()); pt.setQueryOrderable(qPd.isQueryOrderable()); pt.setDefaultValues(createValues(qPd.getDefaultValues())); return pt; }
/** * Create a new JCR property definition from the given <code>QPropertyDefinition</code>. * * @param qPd A SPI property definition. * @return the corresponding JCR property definition. * @throws RepositoryException if an error occurs. */ public PropertyDefinition create(QPropertyDefinition qPd) throws RepositoryException { PropertyDefinitionTemplate pt = ntMgr.createPropertyDefinitionTemplate(); pt.setName(getJCRName(qPd.getName())); pt.setAutoCreated(qPd.isAutoCreated()); pt.setMandatory(qPd.isMandatory()); pt.setOnParentVersion(qPd.getOnParentVersion()); pt.setProtected(qPd.isProtected()); pt.setRequiredType(qPd.getRequiredType()); pt.setMultiple(qPd.isMultiple()); pt.setFullTextSearchable(qPd.isFullTextSearchable()); pt.setValueConstraints(createValueConstraints(qPd.getRequiredType(), qPd.getValueConstraints())); pt.setAvailableQueryOperators(qPd.getAvailableQueryOperators()); pt.setQueryOrderable(qPd.isQueryOrderable()); pt.setDefaultValues(createValues(qPd.getDefaultValues())); return pt; }
vs[i] = ValueFormat.getJCRValue(qValues[i], npResolver, valueFactory); tmpl.setDefaultValues(vs);
vs[i] = ValueFormat.getJCRValue(qValues[i], npResolver, valueFactory); tmpl.setDefaultValues(vs);
defn.setDefaultValues(values);
defn.setDefaultValues(values);