Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
1.6.1, 1.8.1
-
None
-
None
-
The repository is file system based:
File driveFile = new File(directory, "oakrepo"); File repositoryFile = new File(driveFile, "repository"); File dataStoreFile = new File(driveFile, "datastore"); BlobStore blobStore = new FileBlobStore(dataStoreFile.getAbsolutePath()); fileStore = FileStoreBuilder.fileStoreBuilder(repositoryFile).withBlobStore(blobStore).build(); nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build(); Jcr jcr = new Jcr(nodeStore); repository = jcr.createRepository();
The repository is file system based: File driveFile = new File(directory, "oakrepo" ); File repositoryFile = new File(driveFile, "repository" ); File dataStoreFile = new File(driveFile, "datastore" ); BlobStore blobStore = new FileBlobStore(dataStoreFile.getAbsolutePath()); fileStore = FileStoreBuilder.fileStoreBuilder(repositoryFile).withBlobStore(blobStore).build(); nodeStore = SegmentNodeStoreBuilders.builder(fileStore).build(); Jcr jcr = new Jcr(nodeStore); repository = jcr.createRepository();
Description
I've defined a custom mixin with s single long property. When I add that mixin to a node I can set a value of a different type (e.g. string) without any error. Same behaviour if I define the mixin using the customCND or using the NodeTypeTemplate.
Here the code example:
NodeTypeManager nodeTypeManager = session.getWorkspace().getNodeTypeManager(); NodeTypeTemplate nt = nodeTypeManager.createNodeTypeTemplate(); nt.setName("custom:runtime"); nt.setMixin(true); PropertyDefinitionTemplate opt = nodeTypeManager.createPropertyDefinitionTemplate(); opt.setMandatory(false); opt.setName("custom:runtimeTest"); opt.setRequiredType(PropertyType.LONG); opt.setOnParentVersion(OnParentVersionAction.COPY); List pdt = nt.getPropertyDefinitionTemplates(); pdt.add(opt); nodeTypeManager.registerNodeType(nt, true); session.save(); Node mynode = JcrUtils.getOrAddNode(session.getRootNode(), "mynode"); mynode.addMixin("custom:runtime"); session.save(); mynode.setProperty("custom:runtimeTest", "my test value"); session.save();
If I open the repository using oak-run the property custom:runtimeTest has type STRING and not LONG (attached image)