My question is simple, is it possible to have multiple evaluators chained with OR condition on an action?
For example I'd like to have an action defined with some evaluators, but instead of having them chained in AND condition, I would like the final result would be true if eval1 OR activeWorkflows are true.
<action id="mark-as-custom" type="javascript" label="actions.mark-as-custom" icon="custom">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">markDocumentAsCustom</param>
<param name="destination">{node.nodeRef}</param>
<param name="mode">create</param>
<param name="successMessage">actions.mark-as-custom.success</param>
<param name="failureMessage">actions.mark-as-custom.failure</param>
<permissions>
<permission allow="true">Write</permission>
</permissions>
<evaluator>evaluator.doclib.action.IsMySite</evaluator>
<evaluator negate="true">evaluator.doclib.document.eval1</evaluator>
<evaluator negate="true">evaluator.doclib.indicator.activeWorkflows</evaluator>
<evaluator negate="true">evaluator.doclib.action.isLocked</evaluator>
</action>
I know I can write a new java evaluator which can combine the single results with any wanted condition, but I wold like to know if there is a way to obtain that only trough xml configuration.
Thanks
Have you looked at the chainedMatchOne and chainedMatchAll evaluators? The chainedMatchAll would AND all of your evaluators together whereas the chainedMatchOne would OR them. Here's the doc on the out-of-the-box evaluators: https://docs.alfresco.com/5.2/concepts/doclib-predefined-evaluators-reference.html
You can grep the source for examples of ChainedMatchOne to see how it works. Basically you'll just define a new evaluator in XML that specifies ChainedMatchOne as its parent, then you'll list the evaluators you want to be part of the evaluation.
Related
I'm using the message-properties component in mule. I need to set a dynamic key name as this is used to add custom headers to a http-request.
<message-properties-transformer doc:name="Message Properties" scope="session">
<add-message-property key="#[flowVars.name]" value="#[payload.split(":")[1]]"/>
</message-properties-transformer>
When logging the output, it shows that the key has not evaluated the MEL expression contained inside:
SESSION scoped properties: #[flowVars.name]=Basic pokpogytg788t878
Is there any way of setting a dynamic key name for a property in this component?
I have faced similar situation,where I had to set dynamic message properties.
I tried several things to set it with message-properties-transformer , but to no luck.
There is some bug filed for similar issue,below is the link
Cannot use MEL expression as key in Message Properties transformer
After trying for sometime I got that working with some workaround.
You can try working it around with Expression component.
<expression-component doc:name="Expression">
<![CDATA[message.outboundProperties[flowVars.name]=payload.split(':')1];]]>
</expression-component>
Not only you can read dynamic values from payload/variables.But you can also call your custom java/groovy methods in it.
Try below code snippet,and let us know if that works for you.
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/test" doc:name="HTTP" allowedMethods="POST" />
<set-variable variableName="name" value="#["test"]"
doc:name="name" />
<expression-component doc:name="Expression">
<![CDATA[message.outboundProperties[flowVars.name]=payload.split(':')1];]]>
</expression-component>
</flow>
What does it mean when I have a path like the example below in the first forward (then success forward)
<action
type="com.testpackage.servlettest"
path="/ClassHomepage"
scope="request">
<forward
name="success"
path=".class.homepage"
redirect="true" />
<forward
name="failure"
path="/Homepage.do"
module="/"
redirect="false" />
</action>
I understand the failure forward will forward to the page "/Homepage.do" if "failure" is returned
return mapping.findForward("failure");
But what happens if I return
return mapping.findForward("success");
What package will this try to load? How do I find out by looking at web.xml and struct-config.xml files?
You are using tiles, and you need to look in your tiles definition file (usually something like WEB-INF/tiles-defs.xml). Search for a <definition name=".class.homepage"> ... </definition> to find out which view it will direct to.
There are several answered questions detailing how to refer to a single value from web.config file. I'd like to maintain lists of values with which to populate combo boxes in the Views. Should I use some sort of key/value pair structure, with the key identifying the particular combo box to populate?
<add key="CalculationMethod" value="Fixed"/>
<add key="CalculationMethod" value="Cost Plus"/>
<add key="CalculationMethod" value="Formula"/>
I'm not sure how I'd read this, or if that would even work (don't keys have to be unique?). The IntelliSense for web.config doesn't seem to allow much in the appSettings section that looks applicable to a more robust structure like
<list name="CalculationMethod">
<item value="Fixed"/>
<item value="Cost Plus"/>
<item value="Formula"/>
</list>
I see that the root <configuration> has a lot of options for children, but which one to use, if any?
You really should be using a database for something like this but if you must put it in the web.config then you could delimit the values and parse them out at run time.
<add key="CalculationMethod" value="Fixed,Cost Plus,Formula"/>
myComboBox.DataSource = new List<String>(lstrCalcMethodsFromWebConfig.Split(','));
I have been trying to configure Jackrabbit with Oracle. I get an exception while the schema check is performed for the version table in cluster.
While the cluster configuration is being initialized it calls the init() method in the DataBaseJournal class. In there it calls checkLocalRevisionSchema(); That method in turns call CheckSchemaOperation.run() to check whether the LOCAL_REVISIONS table exists if not it creates it. At first time it does not have the table so it tries to create the table with:
create table ${schemaObjectPrefix}JOURNAL (
REVISION_ID number(20,0) NOT NULL,
JOURNAL_ID varchar(255),
PRODUCER_ID varchar(255),
REVISION_DATA blob
)
${tablespace}
Before executing the query the variable ${schemOBjectPrefix} is replaced with PBVP_Journal but the ${tablespace} is not being replaced. I am not sure what I am doing wrong.
My file system and persistence manager configuration looks like:
<Versioning rootPath="${rep.home}/version">
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
<param name="driver" value="javax.naming.InitialContext"/>
<param name="url" value="java:/jcr/repositoryDB"/>
<param name="schemaObjectPrefix" value="PBVP_version_"/>
<param name="schema" value="oracle"/>
</FileSystem>
<PersistenceManager class="org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager">
<param name="driver" value="javax.naming.InitialContext"/>
<param name="url" value="java:/jcr/repositoryDB"/>
<param name="databaseType" value="oracle"/>
<param name="schemaObjectPrefix" value="PBVP_version_"/>
<param name="bundleCacheSize" value="32"/>
<param name="tableSpace" value="default"/>
</PersistenceManager>
</Versioning>
My cluster configuration looks like
<Cluster id="node1" syncDelay="2000">
<Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
<param name="revision" value="${rep.home}/revision.log"/>
<param name="driver" value="javax.naming.InitialContext"/>
<param name="url" value="java:/jcr/repositoryDB"/>
<param name="schemaObjectPrefix" value="PBVP_journal_"/>
<param name="databaseType" value="oracle"/>
<param name="schemaCheckEnabled" value="false"/>
<param name="tablespace" value="default"/>
</Journal>
</Cluster>
Finally now I know what is going on.The Jackrabbit configuration loading mechanism goes through two routes
When jackrabbit is deployed for the first time it executes table creation statements through the class OracleDatabaseJournal which is aware of ${tablespace} so it resolves it.
When it is deployed second time and the first deployment fails it executes through DatabaseJournal class which is base class of OracleDatabaseJournal it does not know about ${tablespace} so it does not resolve it.
When I debugged I was following the second route so I concentrated on why does not it try to resolve the ${tablespace} in the sql statement. It should not take the second route if the first deployment is success. In our case the first deployment failed because of the length of table name. If we change the length of the table name it deploys ok so it should never come to second scenario
I have a table defnition as given below:
License
ClientId
Type
Total
Used
ClientId and Type together uniquely identifies a row. I have a mapping file as given below:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
<class name="Acumen.AAM.Domain.Model.License, Acumen.AAM.Domain" lazy="false" table="License">
<id name="ClientId" access="field" column="ClientID" />
<property name="Total" access="field" column="Total"/>
<property name="Used" access="field" column="Used"/>
<property name="Type" access="field" column="Type"/>
</class>
</hibernate-mapping>
If a client used a license to create a user, I need to update the Used column in the table. As I set ClientId column as the id column for this table in the mapping xml, I am getting TooManyRowsAffectedException.
could you please let me know how to set a composite key at mapping level so that NHibernate can udpate based on ClientId and Type.
Something like: Update License SET Used=Used-1 WHERE ClientId='xxx' AND Type=1
Please help.
Thanks,
Mahesh
You have to use a composite-id
http://nhibernate.info/doc/nh/en/index.html#mapping-declaration-compositeid
If you primary key is composite, your mapping should reflect that, and your class needs to override Equals and GetHashCode.
Also, if ClientId is the primary key of your Client entity, you should map it as many-to-many, not just an Id.
Also, why are you specifying lazy="false"? Are you aware of the implications?
Also, why map everything with access="field"? Do the properties have some special logic?
This is a revised mapping considering everything I just wrote. Feel free to ignore those parts that don't apply :-)
<class name="Acumen.AAM.Domain.Model.License, Acumen.AAM.Domain" table="License">
<composite-id>
<key-many-to-one name="Client" column="ClientID" />
<key-property name="Type" />
</composite-id>
<property name="Total" />
<property name="Used" />
</class>
As the other comrades mentioned above, you have to use a composite-id, which is not a best but acceptable practice.
On the other hand, you can simply write an update interceptor and make sure your Type = 1 within it.
Here are some link about the topic to help you see clear in this.
Elegant code : Implementing NHibernate Interceptors
NHibernate Documentation : Interceptors
Sample NHibernate IInterceptor implementation
Enterprise .NET Community : NHibernate Part 2 (Scroll down to : Interceptors and Persistent Lifecycle)
NHibernate Interceptor Auditing Inserted Object Id (SO question)
The main advantage of using interceptors over a composite key is that it doesn't break your DBRM and provides a definitely more flexible solution, without "polluting" your mapping file which will more precisely represent your model.