I am not sure if ScriptAssert can be applied on Field. I am trying the below ScriptAssert but all the time it returns the message "Value is Mandatory" even the _this.OBJSTATE != 'CANCELLED'. Can someone please help??
<?xml version="1.0" encoding="UTF-8"?>
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
<default-package>x.x</default-package>
<bean class="x.class" ignore-annotations="true">
<field name="OBJSTATE">
<constraint annotation="javax.validation.constraints.Pattern">
<message>Value should be CANCELLED/RELEASED</message>
<element name="regexp">^(CANCELLED)$|^(RELEASED)$</element>
</constraint>
<constraint annotation="javax.validation.constraints.NotNull">
<message>Field is Mandatory</message>
</constraint>
<constraint annotation="org.hibernate.validator.constraints.NotBlank">
<message>Value is Mandatory</message>
</constraint>
</field>
<field name="T1PONumber">
<constraint annotation="org.hibernate.validator.constraints.ScriptAssert" >
<message>Value is Mandatory</message>
<element name="lang">javascript</element>
<element name="script" >
<value>_this.OBJSTATE == 'CANCELLED'</value>
</element>
</constraint>
</field>
</bean>
</constraint-mappings>
ScriptAssert should be applied to class level
<bean class="x.class" ignore-annotations="true">
<class ignore-annotations="false" >
<constraint annotation="org.hibernate.validator.constraints.ScriptAssert">
<message>T1PONumber value is Mandatory</message>
<element name="lang">javascript</element>
<element name="script" >
<value>_this.OBJSTATE != 'CANCELLED'</value>
</element>
</constraint>
</class>
<field name="OBJSTATE">
<constraint annotation="javax.validation.constraints.Pattern">
<message>Value should be CANCELLED/RELEASED</message>
<element name="regexp">^(CANCELLED)$|^(RELEASED)$</element>
</constraint>
<constraint annotation="javax.validation.constraints.NotNull">
<message>Field is Mandatory</message>
</constraint>
<constraint annotation="org.hibernate.validator.constraints.NotBlank">
<message>Value is Mandatory</message>
</constraint>
</field>
<field name="T1PONumber">
</field>
</bean>
Related
For example, there are some business process. The user is prompted to reject or to approve some document.
Part of the workflow content model:
...
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve</value>
<value>Reject</value>
</list>
</parameter>
</constraint>
</constraints>
...
Instead of Approve/ Reject I want to display a different text (national, with spaces, etc.). But in scripts I would like to use the same Approve/ Reject values.
Is it possible?
Have you tried this ?
<constraints>
<constraint type="LIST">
<parameter name="allowedValues">
<list>
<value>Approve|Some Approval label</value>
<value>Reject|Some Rejection label</value>
</list>
</parameter>
</constraint>
</constraints>
Solr Version : 5.0
So I am working on Solr for first time, and really not understand perfectly. Here what I did :-
I have created a core named - search
Then my schema.xml file has follwoing code :
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="simple" version="1.5">
<types>
<fieldtype name='string' class='solr.StrField' />
<fieldtype name='long' class='solr.TrieLongField' />
</types>
<fields>
<field name='id' type='int' required='true' indexed="true"/>
<field name='name' type='text' required='true' indexed="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>fullText</defaultSearchField>
<solrQueryParser defaultOperator='OR' />
</schema>
solrconfig.xml :
<?xml version='1.0' encoding='UTF-8' ?>
<config>
<luceneMatchVersion>5.0.0</luceneMatchVersion>
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<requestHandler name="standard" class="solr.StandardRequestHandler" default='true' />
<requestHandler name="/update" class="solr.UpdateRequestHandler" />
<requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">db-data-config.xml</str>
</lst>
</requestHandler>
<admin>
<defaultQuery>*:*</defaultQuery>
</admin>
</config>
db-data-config.xml :
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/solr"
user="root"
password="" />
<document>
<entity name="users" query="select id,name from users;" />
</document>
</dataConfig>
I have created a database on PHPmyadmin please find below SG :
when I clicked query on solr panel then it shows empty why ?
Can anyone help me on this, as I am new to solr search. What I am doing wrong ?
I dont see a field named "fulltext" in schema.xml but why its defined as the default search
<defaultSearchField>fullText</defaultSearchField>
change it
<defaultSearchField>name</defaultSearchField>
mention the fields in the data config xml
<field column="ID" name="id" />
<field column="NAME" name="name" />
your data-config should look alike
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/solr"
user="root"
password="" />
<document>
<entity name="users" query="select id,name from users">
<field column="ID" name="id" />
<field column="NAME" name="name" />
</entity>
</document>
</dataConfig>
add it as in schema.xml
<types>
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
</types>
<fields>
<field name='id' type='int' required='true' indexed="true" stored="true"/>
<field name='name' type='string' required='true' indexed="true" stored="true"/>
<fields>
Make the changes in your db-data-config.xml similar to what i have done
<entity name="city_masters" pk="city_id" query="SELECT delete_status as
city_masters_delete_status,city_id,country_id,city_name,city_updated from
city_masters>
<field column="city_id" name="id"/>
<field column="city_name" name="city_name" indexed="true" stored="true" />
<field column="country_id" name="country_id" indexed="true" stored="true" />
<field column="city_masters_delete_status" name="city_masters_delete_status"
indexed="true" stored="true" />
</entity>
You missed out the field column part.Add them like i have done for my code and it should work.If still doesnt work let me know
I work with symfony2 and there i use doctrine. As Example i have a simple repository-class in my doctrine xml-file:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="AllgemeinBundle\Entity\ObjektPosition" table="objekt_position" repository-class="AllgemeinBundle\Repository\ObjektPositionRepository">
<indexes>
<index name="id_objekt_subunternehmer_position_fk2_idx" columns="id_subunternehmer"/>
<index name="id_objekt_objektposition_idx" columns="id_objekt"/>
</indexes>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="artikelnummer" type="integer" column="artikelnummer" nullable="false"/>
<field name="preisProEinheit" type="float" column="preis_pro_einheit" precision="10" scale="2" nullable="false"/>
<field name="p1Einheit" type="float" column="p1_einheit" precision="10" scale="2" nullable="false"/>
<field name="p2Einheit" type="float" column="p2_einheit" precision="10" scale="2" nullable="true"/>
<field name="p3Einheit" type="float" column="p3_einheit" precision="10" scale="2" nullable="true"/>
<field name="zusatztext" type="text" column="zusatztext" nullable="true"/>
<field name="position" type="integer" column="position" nullable="false"/>
<many-to-one field="idSubunternehmer" target-entity="Subunternehmer">
<join-columns>
<join-column name="id_subunternehmer" referenced-column-name="subunternehmernummer"/>
</join-columns>
</many-to-one>
<many-to-one field="idObjekt" target-entity="Objekt">
<join-columns>
<join-column name="id_objekt" referenced-column-name="id"/>
</join-columns>
</many-to-one>
when i am generating my entities from the database, then the repository-class would be deleted. Also some other thinks i added to the xml-file.
Is it able to save the customized data in a sperated folder or file, so that i can generate the entities as often as i like and the customized data wouldn't be lost?
If you are using console commands, when generating entities don't mention '--no-backup' at the end of the command. So, you will be able to preserve your entity class. However you entity class will be renamed with adding '~' sign at the start of the file name. Your entity generation code will be like this, (without trailing --no-backup)
php app/console doctrine:generate:entities
Hope this helps,
Cheers!
How do I set a default value for an Aspect property in Alfresco? Would that be a constraint or is there an attribute on the property itself?
This is my property:
<constraint name="ac:Priority_Options" type="LIST">
<parameter name="allowedValues">
<list>
<value>Low</value>
<value>Medium</value>
<value>High</value>
</list>
</parameter>
</constraint>
<property name="ac:propPriority">
<title>Priority</title>
<type>d:text</type>
<multiple>false</multiple>
<constraints>
<constraint ref="ac:Priority_Options" />
</constraints>
</property>
As described in Additional Property Capabilities:
<property name="ac:propPriority">
<title>Priority</title>
<type>d:text</type>
<multiple>false</multiple>
<default>my default value</default> <!-- !! -->
<constraints>
<constraint ref="ac:Priority_Options" />
</constraints>
</property>
Is there a way to assign a list of strings from input variable to invoke input variable?The problem is that there are multiple inputs in my web service so i am not able to copy the wrapping element in input variable to wrapping variable in invoke variable.Will copy the snippet of the code here :
<assign name="Assign1">
<copy>
<from variable="inputVariable" part="payload"
query="/ns2:process/ns2:dsaName"/>
<to variable="Invoke1_processList_InputVariable"
part="parameters" query="/ns1:processList/dsaName"/>
</copy>
<copy>
<from variable="inputVariable" part="payload"
query="/ns2:process/ns2:linesOfData"/>
<to variable="Invoke1_processList_InputVariable"
part="parameters" query="/ns1:processList/linesOfData"/>
</copy>
<copy>
<from variable="inputVariable" part="payload"
query="/ns2:process/ns2:description"/>
<to variable="Invoke1_processList_InputVariable"
part="parameters" query="/ns1:processList/description"/>
</copy>
<copy>
<from variable="inputVariable" part="payload"
query="/ns2:process/ns2:application"/>
<to variable="Invoke1_processList_InputVariable"
part="parameters" query="/ns1:processList/application"/>
</copy>
</assign>
The problem is that only one is of list type all others are of string type.The XML for this is:
<element name="process">
<complexType>
<sequence>
<element name="dsaName" type="string" minOccurs="0"/>
<element name="linesOfData" type="string" minOccurs="0" maxOccurs="unbounded"/>
<element name="description" type="string" minOccurs="0"/>
</sequence>
</complexType>
</element>
<element name="processResponse">
<complexType>
<sequence>
<element name="result" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</schema>
Looking at your schema, you can use doXSLTransform operation where <xsl:for-each> is used to read the list type (here it's linesOfData) and add each of those elements to Invoke1_processList_InputVariable.