Java Code Examples for javax.jcr.nodetype.NodeTypeManager#createPropertyDefinitionTemplate()
The following examples show how to use
javax.jcr.nodetype.NodeTypeManager#createPropertyDefinitionTemplate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentSessionFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
private NodeTypeTemplate createMyCollabFolderType(NodeTypeManager manager) throws RepositoryException { // Create content node type NodeTypeTemplate contentTypeTemplate = manager.createNodeTypeTemplate(); contentTypeTemplate.setAbstract(false); contentTypeTemplate.setMixin(false); contentTypeTemplate.setName("mycollab:folder"); contentTypeTemplate.setPrimaryItemName("folder"); contentTypeTemplate.setDeclaredSuperTypeNames(new String[]{NodeType.NT_FOLDER}); contentTypeTemplate.setQueryable(true); contentTypeTemplate.setOrderableChildNodes(false); PropertyDefinitionTemplate createdPropertyTemplate = manager .createPropertyDefinitionTemplate(); createdPropertyTemplate.setMultiple(false); createdPropertyTemplate.setName("mycollab:createdUser"); createdPropertyTemplate.setMandatory(true); createdPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(createdPropertyTemplate); PropertyDefinitionTemplate descPropertyTemplate = manager .createPropertyDefinitionTemplate(); descPropertyTemplate.setMultiple(false); descPropertyTemplate.setName("jcr:description"); descPropertyTemplate.setMandatory(false); descPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(descPropertyTemplate); return contentTypeTemplate; }
Example 2
Source File: PageSessionFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
private NodeTypeTemplate createWikiFolderType(NodeTypeManager manager) throws RepositoryException { // Create content node type NodeTypeTemplate folderTypeTemplate = manager.createNodeTypeTemplate(); folderTypeTemplate.setAbstract(false); folderTypeTemplate.setMixin(false); folderTypeTemplate.setName("wiki:folder"); folderTypeTemplate.setPrimaryItemName("folder"); folderTypeTemplate.setDeclaredSuperTypeNames(new String[]{NodeType.NT_FOLDER}); folderTypeTemplate.setQueryable(true); folderTypeTemplate.setOrderableChildNodes(false); PropertyDefinitionTemplate createdPropertyTemplate = manager.createPropertyDefinitionTemplate(); createdPropertyTemplate.setMultiple(false); createdPropertyTemplate.setName("wiki:createdUser"); createdPropertyTemplate.setMandatory(true); createdPropertyTemplate.setRequiredType(PropertyType.STRING); folderTypeTemplate.getPropertyDefinitionTemplates().add(createdPropertyTemplate); PropertyDefinitionTemplate namePropertyTemplate = manager.createPropertyDefinitionTemplate(); namePropertyTemplate.setMultiple(false); namePropertyTemplate.setName("wiki:name"); namePropertyTemplate.setMandatory(true); namePropertyTemplate.setRequiredType(PropertyType.STRING); folderTypeTemplate.getPropertyDefinitionTemplates().add(namePropertyTemplate); PropertyDefinitionTemplate descPropertyTemplate = manager.createPropertyDefinitionTemplate(); descPropertyTemplate.setMultiple(false); descPropertyTemplate.setName("wiki:description"); descPropertyTemplate.setMandatory(true); descPropertyTemplate.setRequiredType(PropertyType.STRING); folderTypeTemplate.getPropertyDefinitionTemplates().add(descPropertyTemplate); return folderTypeTemplate; }
Example 3
Source File: ContentSessionFactory.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
private NodeTypeTemplate createMyCollabContentType(NodeTypeManager manager) throws RepositoryException { LOG.info("Register mycollab content type"); NodeType hierachyNode = manager.getNodeType(NodeType.NT_HIERARCHY_NODE); // Create content node type NodeTypeTemplate contentTypeTemplate = manager.createNodeTypeTemplate(hierachyNode); contentTypeTemplate.setAbstract(false); contentTypeTemplate.setMixin(false); contentTypeTemplate.setName("mycollab:content"); contentTypeTemplate.setPrimaryItemName("content"); contentTypeTemplate.setDeclaredSuperTypeNames(new String[]{NodeType.NT_HIERARCHY_NODE}); contentTypeTemplate.setQueryable(true); contentTypeTemplate.setOrderableChildNodes(false); PropertyDefinitionTemplate createdUserPropertyTemplate = manager .createPropertyDefinitionTemplate(); createdUserPropertyTemplate.setMultiple(false); createdUserPropertyTemplate.setName("mycollab:createdUser"); createdUserPropertyTemplate.setMandatory(true); createdUserPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(createdUserPropertyTemplate); PropertyDefinitionTemplate contentPathPropertyTemplate = manager.createPropertyDefinitionTemplate(); contentPathPropertyTemplate.setMultiple(false); contentPathPropertyTemplate.setName("mycollab:contentPath"); contentPathPropertyTemplate.setMandatory(false); contentPathPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(contentPathPropertyTemplate); PropertyDefinitionTemplate thumbnailPathPropertyTemplate = manager.createPropertyDefinitionTemplate(); thumbnailPathPropertyTemplate.setMultiple(false); thumbnailPathPropertyTemplate.setName("mycollab:thumbnailPath"); thumbnailPathPropertyTemplate.setMandatory(false); thumbnailPathPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(thumbnailPathPropertyTemplate); PropertyDefinitionTemplate lastModifiedUserPropertyTemplate = manager.createPropertyDefinitionTemplate(); lastModifiedUserPropertyTemplate.setMultiple(false); lastModifiedUserPropertyTemplate.setName("mycollab:lastModifiedUser"); lastModifiedUserPropertyTemplate.setMandatory(true); lastModifiedUserPropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(lastModifiedUserPropertyTemplate); PropertyDefinitionTemplate mimeTypePropertyTemplate = manager .createPropertyDefinitionTemplate(); mimeTypePropertyTemplate.setMultiple(false); mimeTypePropertyTemplate.setName("mycollab:mimeType"); mimeTypePropertyTemplate.setMandatory(false); mimeTypePropertyTemplate.setRequiredType(PropertyType.STRING); contentTypeTemplate.getPropertyDefinitionTemplates().add(mimeTypePropertyTemplate); PropertyDefinitionTemplate sizePropertyTemplate = manager.createPropertyDefinitionTemplate(); sizePropertyTemplate.setMultiple(false); sizePropertyTemplate.setName("mycollab:size"); sizePropertyTemplate.setMandatory(true); sizePropertyTemplate.setRequiredType(PropertyType.LONG); contentTypeTemplate.getPropertyDefinitionTemplates().add(sizePropertyTemplate); return contentTypeTemplate; }
Example 4
Source File: PageSessionFactory.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
private NodeTypeTemplate createWikiPageType(NodeTypeManager manager) throws RepositoryException { LOG.info("Register MyCollab content type"); NodeType hierachyNode = manager.getNodeType(NodeType.NT_HIERARCHY_NODE); // Create content node type NodeTypeTemplate pageTypeTemplate = manager.createNodeTypeTemplate(hierachyNode); pageTypeTemplate.setAbstract(false); pageTypeTemplate.setMixin(false); pageTypeTemplate.setName("wiki:page"); pageTypeTemplate.setPrimaryItemName("page"); pageTypeTemplate.setDeclaredSuperTypeNames(new String[]{NodeType.NT_HIERARCHY_NODE}); pageTypeTemplate.setQueryable(true); pageTypeTemplate.setOrderableChildNodes(false); LOG.debug("PROPERTY {} {}", pageTypeTemplate.getDeclaredPropertyDefinitions().length, pageTypeTemplate.getDeclaredChildNodeDefinitions().length); PropertyDefinitionTemplate subjectPropertyTemplate = manager.createPropertyDefinitionTemplate(); subjectPropertyTemplate.setMultiple(false); subjectPropertyTemplate.setName("wiki:subject"); subjectPropertyTemplate.setMandatory(true); subjectPropertyTemplate.setRequiredType(PropertyType.STRING); pageTypeTemplate.getPropertyDefinitionTemplates().add(subjectPropertyTemplate); PropertyDefinitionTemplate contentPropertyTemplate = manager.createPropertyDefinitionTemplate(); contentPropertyTemplate.setMultiple(false); contentPropertyTemplate.setName("wiki:content"); contentPropertyTemplate.setMandatory(true); contentPropertyTemplate.setRequiredType(PropertyType.STRING); pageTypeTemplate.getPropertyDefinitionTemplates().add(contentPropertyTemplate); PropertyDefinitionTemplate lockPropertyTemplate = manager.createPropertyDefinitionTemplate(); lockPropertyTemplate.setMultiple(false); lockPropertyTemplate.setName("wiki:isLock"); lockPropertyTemplate.setMandatory(false); lockPropertyTemplate.setRequiredType(PropertyType.BOOLEAN); pageTypeTemplate.getPropertyDefinitionTemplates().add(lockPropertyTemplate); PropertyDefinitionTemplate statusPropertyTemplate = manager.createPropertyDefinitionTemplate(); statusPropertyTemplate.setMultiple(false); statusPropertyTemplate.setName("wiki:status"); statusPropertyTemplate.setMandatory(true); statusPropertyTemplate.setRequiredType(PropertyType.STRING); pageTypeTemplate.getPropertyDefinitionTemplates().add(statusPropertyTemplate); PropertyDefinitionTemplate categoryPropertyTemplate = manager.createPropertyDefinitionTemplate(); categoryPropertyTemplate.setMultiple(false); categoryPropertyTemplate.setName("wiki:category"); categoryPropertyTemplate.setMandatory(false); categoryPropertyTemplate.setRequiredType(PropertyType.STRING); pageTypeTemplate.getPropertyDefinitionTemplates().add(categoryPropertyTemplate); PropertyDefinitionTemplate createdPropertyTemplate = manager.createPropertyDefinitionTemplate(); createdPropertyTemplate.setMultiple(false); createdPropertyTemplate.setName("wiki:createdUser"); createdPropertyTemplate.setMandatory(true); createdPropertyTemplate.setRequiredType(PropertyType.STRING); pageTypeTemplate.getPropertyDefinitionTemplates().add(createdPropertyTemplate); return pageTypeTemplate; }