I am currently working on JIRA
(BRMS does not allow rule
names to contain an apostrophe character ( ' )). The problem is caused
by using rule name inputted by users as the name to add a node, see
below (in PackageItem.java):
Node rulesFolder = this.node.getNode( ASSET_FOLDER_NAME );
ruleNode = rulesFolder.addNode( assetName, AssetItem.RULE_NODE_TYPE_NAME);
The javax.jcr.Node.addNode(String relPath, String primaryNodeTypeName)
method will through RepositoryException if the relPath parameter
contains apostrophe character ( ' ). Had a quick check with JSR-170, it
is true that apostrophe character ( ' ) is not allowed in a path name.
char ::= nonspace | ' '
nonspace ::= (* Any Unicode character except: '/', ':', '[',
''', '"', '|' or any whitespace
There are two possible ways I can think of to have this fixed, none of
them are ideal though.
a. We valid the rule name inputted by users, the validation rule is in
line with JSR-170. This approach is not ideal because a rule named
"Jervis' rule" is perfect valid in my opinion.
b. Somehow we transform the rule name to sth else if it is not a valid
relative path according to JSR-170. This approach may require a data
structure somewhere to store the original rule name and transformed
relative path name. As I am pretty new to Drools, I am not sure how to
best get this done.
Any thoughts or suggestions are highly welcome.