You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Florent Guillaume (JIRA)" <ji...@apache.org> on 2009/09/17 18:26:57 UTC
[jira] Issue Comment Edited: (CMIS-52) Discovery Node Types
Dynamically
[ https://issues.apache.org/jira/browse/CMIS-52?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756614#action_12756614 ]
Florent Guillaume edited comment on CMIS-52 at 9/17/09 9:25 AM:
----------------------------------------------------------------
Hi,
Your code refers to JcrCmisMap#isBaseTypeDocument which is not included in the patch...
Stylistic notes:
- you're going overboard parenthesizing boolean tests, for instance this:
{code}
if ((typeId == null) || (typeId.equals(baseType.toString()))) {
{code}
can be simply:
{code}
if (typeId == null || typeId.equals(baseType.toString())) {
{code}
- this can be simplified:
{code}
NodeType nodeType = (NodeType) allNodeTypesIter.next();
{code}
into:
{code}
NodeType nodeType = allNodeTypesIter.nextNodeType();
{code}
- your code:
{code}
if (((!(result.size() > maxItems)) || (maxItems == 0))
&& (!nodeType.isMixin())) {
// If typeId is provided, only the specific type and its
// descendants are returned, otherwise all types are
// returned.
if ((typeId == null)
|| (typeId.equals(baseType.toString()))) {
result.add(new JcrType(nodeType, baseType));
}
}
{code}
I'd rather write (exit early):
{code}
if (nodeType.isMixin()) { // could be moved even higher in the while block
continue;
}
if (typeId == null || typeId.equals(baseType.toString())) {
// If typeId is provided, only the specific type and its
// descendants are returned, otherwise all types are
// returned.
result.add(new JcrType(nodeType, baseType));
if (maxItems != 0 && result.size() > maxItems) {
break;
}
}
{code}
was (Author: fguillaume):
Hi,
Your code refers to JcrCmisMap#isBaseTypeDocument which is not included in the patch...
Stylistic notes:
- you're going overboard parenthesizing boolean tests, for instance this:
if ((typeId == null) || (typeId.equals(baseType.toString()))) {
can be simply:
if (typeId == null || typeId.equals(baseType.toString())) {
- this can be simplified:
NodeType nodeType = (NodeType) allNodeTypesIter.next();
into:
NodeType nodeType = allNodeTypesIter.nextNodeType();
- You code:
if (((!(result.size() > maxItems)) || (maxItems == 0))
&& (!nodeType.isMixin())) {
// If typeId is provided, only the specific type and its
// descendants are returned, otherwise all types are
// returned.
if ((typeId == null)
|| (typeId.equals(baseType.toString()))) {
result.add(new JcrType(nodeType, baseType));
}
}
I'd rather write (exit early):
if (nodeType.isMixin()) { // could be moved even higher in the while block
continue;
}
if (typeId == null || typeId.equals(baseType.toString())) {
// If typeId is provided, only the specific type and its
// descendants are returned, otherwise all types are
// returned.
result.add(new JcrType(nodeType, baseType));
if (maxItems != 0 && result.size() > maxItems) {
break;
}
}
> Discovery Node Types Dynamically
> --------------------------------
>
> Key: CMIS-52
> URL: https://issues.apache.org/jira/browse/CMIS-52
> Project: Chemistry
> Issue Type: Improvement
> Components: jcr
> Reporter: Michael Mertins
> Priority: Minor
> Attachments: patch_chemistry061_jcr_dynamic_nodetypes.txt
>
>
> Node types have to be discovered dynamically in order to allow customized node types and nodes to be read.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.