I am working on a designer which is very similar to Edmx designer in Visual Studio. I want to add the same validation that Edmx designer applies to Entity and Property Names. Can someone share what are the validation rules i.e. What characters are allowed and what are not. What might be the length of Entity/Property name and other such rules?
Look at the xsds. When loading artifacts (CSDL/MSL/SSDL) there is two step validation 1 - using xsd, 2 internal validation checking additional rules that in most cases cannot be expressed in xsd.
EF6 is open source now but xsd schemas for previous versions have not changed. You can find them here. (Schemas for mapping are in the MappingSpecification folder).
If you look at v3 CSDL schema the name of the property is specified as follows:
<xs:simpleType name="TSimpleIdentifier">
<xs:restriction base="xs:string">
<xs:maxLength value="480" />
<!-- The below pattern represents the allowed identifiers in ECMA specification -->
<xs:pattern value="[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}" />
</xs:restriction>
</xs:simpleType>
If you don't want to bother with xsds and would like to take advantage of the internal validation you can just load your xml to the corresponding item collection. Again in EF6 there have been some overloads added that allows you load artifacts but will not throw an exception if they are invalid but would return null and a list of errors as an out parameter (look for public static factory methods on item collections).
Related
While testing the unchanged CodeEffects asp.net core demo application (Editor 5.0.4.8, Engine 5.0.2.6) I've found an interesting problem.
If I create an execution rule that checks for example if FirstName contains two spaces, I can save this rule without a problem, and in SaveRule action it passes the validation using editor.Rule.IsValid. Here is an example of the rule definition:
<if>
<clause>
<condition type="contains" stringComparison="OrdinalIgnoreCase">
<property name="FirstName" />
<value> </value>
</condition>
</clause>
<then>
<method name="Register">
<value>aaaa</value>
</method>
</then>
</if>
But when refreshing the editor and trying to load this saved rule it won't load into editor. The reason is that the LoadRule controller action returns empty json.
While investigating this further it looks that the editor.GetClientRuleData returns null because the rule is invalid. If I check editor.Rule.IsValid just before calling editor.GetClientRuleData I can see it return false and the editor.Rule.InvalidElements holds one element:
{{c:"",h:"v120"}}
The error message would be "The only allowed operators for empty string values are IS and IS NOT" but of course it's not shown in the editor in the demo project as this is not expected to happen.
Not sure if this is in any way related to the problem, but one obvious difference between LoadRule and SaveRule actions is how the rule is loaded.
When saving the rule, the rule data (coming from the UI) is loaded into editor with
editor.LoadClientData(data.Data);
and when loading the rule it's loaded using the xml (from the storage) effectively calling this:
editor.Rule = Rule.Models.RuleModel.Create(ruleXml, typeof(Models.Patient))
So my question is why can invalid rule pass the validation on save, and then the same rule fails the validation on load? Any fix I can try or a workaround?
This issue has been fixed in the latest version of Rule Editor. You need to update Code Effects references from NuGet:
CodeEffects.Rule.Common - 5.0.2.4, CodeEffects.Rule.Editor.Core - 5.0.4.1 (this is the assembly that contains that fix), CodeEffects.Rule.Editor.Web.Core - 5.0.4.8
i'd like to create new elements, based on the link element. This would be more comfortable for the author than using the role and otherrole attributes to specify the link role.
Unfortunately the DITA-OT 2.2.1 fails with this message:
Required item type of result of template related-links:link.
is element(Q{}link); supplied value has item type
element(Q{}myelement)
Is this a valid approach, or should I stick to otherrole?
Update 1:
The error occurs in the related-links.xsl:
<!-- Ungrouped links have the default-mode
template applied to them. (Can be overridden.) -->
<xsl:template match="*[contains(#class, ' topic/link ')]"
mode="related-links:link"
name="related-links:link."
as="element(link)">
<xsl:sequence select="."/> <!--- error points to this line -->
</xsl:template>
This is clearly a bug in the XSLT implementation as you can't use direct tagname checks with any DITA processing because it will fail in the face of specialization as you're seeing.
Side note: assuming your specialization is a domain, the name for the domain should end in "-d" per the DITA naming conventions:
class="- topic/link mylink-d/mylinktype "
This is a convention not a hard requirement but it's useful to be able to look at the #class value and know if an element comes from a domain or a structural specialization.
I have been struggling for over a week with trying to setup a custom ORBEON REST persistence.
I am using the Struts 2 MVC framework with the following configuration:
<action name="/crud/{appName}/{formName}/form/form.xhtml" class="com.example.CrudController" method="executeForm" />
<action name="/crud/{appName}/{formName}/data/{uuid}/data.xml" class="com.example.CrudController" method="executeData" />
<action name="/search/{appName}/{formName}" class="com.example.SearchController" />
The problem is that only the first action is being called.
From the Form Builder, when I click on a form record (say "foo"), this is called:
GET http://localhost:8080/mycontext/app/crud/myapp/library/form/form.xhtml
Notice that, myapp is the correct application name but library is not the correct form name (which should be "foo").
From Form Runner, when I try the "foo" summary or new pages, this is called:
GET http://localhost:8080/mycontext/app/crud/myapp/foo/form/form.xhtml
This time the form name is correct, however I expected a /search/... call instead. Nevertheless I tried responding with either the xform xml or a query result with no success.
The call to /crud/myapp/library/form/form.xhtml is normal: it isn't done by Form Runner to load your form, but to load your app-specific section templates library, which is stored in the reserved library form name. So most likely your implementation of the persistence API should return a 404, since it doesn't have a form myapp/library.
As to the query to /crud/myapp/foo/form/form.xhtml when you access the new page for a myapp/foo, this is just Form Runner loading the form definition for myapp/foo. The query to the search API is only done by the summary page, to list data for a specific form.
I am trying to compute the repeatControls property of a repeat but get an error
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:repeat id="repeat1" rows="30" value="#{javascript:10}">
<xp:this.repeatControls><![CDATA[${javascript:"true"}]]> </xp:this.repeatControls>
</xp:repeat>
</xp:view>
Here is the error
Description Resource Path Location Type
Could not generate a .java file for the page /test.xsp: Could not find the runtime class for the tag xp:repeat, due to a problem invoking com.ibm.xsp.component.xp.XspDataIterator.getJavaClass(class com.ibm.xsp.page.parse.types.FacesInstance). test.xsp test.nsf/XPages line 1 com.ibm.designer.domino.ide.resources.designerproblem
Is this some kind of bug in DDE or am doing it wrong?
I have tried putting the "true" without quotes as well
I am using notes 9 beta 1
The Repeat (xp:repeat) control specifies the following tooltip for the repeatControls property.
Repeat Controls (boolean:repeatControls)
Specifies if the controls should be created multiple times or the single set of controls should be iterated over multiple times.
The repeatControls property accepts boolean values; specifically either "true" or "false". In Domino Designer from the All Properties View despite the presence of the blue diamond (indicating it can be computed), this property should not be computed.
At design time, the repeatControls property value is used to inform how the compiled XPage is generated hence invalid values prevent this from succeeding; this is the error being reported by Domino Designer and has been logged with the team with reference "DEGN95SMPT".
For example, I have added two rules (rule1.drl and rule2.drl) in Guvnor.
Normally I can retrieve those rules combined by creating a changeset.xml like:
<change-set ...>
<add>
<resource source='http://localhost/guvnor/org.drools.guvnor.Guvnor/package/name/LATEST.drl' type='DRL' basicAuthentication="enabled" username="username" password="password" />
</add>
</change-set>
And load the changeset.xml by codes:
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Test Agent", kaconf);
kagent.applyChangeSet(ResourceFactory.newClassPathResource("changeset.xml"));
knowledgeBase = kagent.getKnowledgeBase();
But how I can retrieve specific rule only? e.g. rule2.drl
Of course I can change the url in changeset.xml to
<resource source='http://localhost/guvnor/org.drools.guvnor.Guvnor/package/name/LATEST/rule2.drl' type='DRL' basicAuthentication="enabled" username="username" password="password" />
But I found that the response file miss the package name and all the import statements, for example:
package com.packname;
import namespace.EntityA;
When we need to execute especific drl package we use diferent changeset for each package/snapshot.
If the rules are related use different pojos for separate the rule, because you know the guvnor compile all your rules from a package in one big .drl, this could be slow if you have a hundred of rule-then-end's and iterate it with different pojo instances.
The URL patterns for packages and individual assets is different. For assets (e.g. DRLs) the pattern is:
<resource source='http://localhost:9090/drools-guvnor/rest/packages/test/assets/MyRule/source' type='DRL' />
My workaround to this problem is to create two different packages, one for rule1.drl and one for rule2.drl. So my program read these two rule by two different changeset.