jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Piovesana (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-7479) custom property does not respect type
Date Mon, 07 May 2018 07:41:00 GMT

    [ https://issues.apache.org/jira/browse/OAK-7479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465567#comment-16465567
] 

Marco Piovesana commented on OAK-7479:
--------------------------------------

Hi Marcel,

thanks for the clarification, but then I have another question: if I set the "onParentVersion"
to IGNORE the property is not copied in the frozen node, why it does respect that constraint
but not the type?

> custom property does not respect type 
> --------------------------------------
>
>                 Key: OAK-7479
>                 URL: https://issues.apache.org/jira/browse/OAK-7479
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.6.1, 1.8.1
>         Environment: The repository is file system based:
> {code:java}
> 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();
> {code}
>            Reporter: Marco Piovesana
>            Priority: Major
>         Attachments: oakRunImage.png
>
>
> 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:
> {code:java}
> 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();{code}
> If I open the repository using oak-run the property {{custom:runtimeTest}} has type STRING
and not LONG (attached image)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message