How to invoke a "loose Xaml"-defined activity from another "loose Xaml"-defined activity? - workflow

I have two "loose" XAML files, each declarativly defining composite activity which is composed of some custom (compiled) code-activities.
Now, I would like the activity defined in the 1st "loose" Xaml to 'contain' the activity defined in the 2nd "loose" Xaml as of its steps.
However, I have no clue how to 'glue' both activities together such that 1st activity will know to correctly load the activity from the 2nd Xaml.
So when calling:
XamlXmlReader xr = new XamlXmlReader(#"FirstLooseActivity.xaml");
ActivityBuilder ab = (ActivityBuilder)XamlServices.Load(ActivityXamlServices.CreateBuilderReader(xr));
I end up with a XamlObjectWriterException (after I loaded all relevant assemblies to my hosting app):
Cannot create unknown type '{clr-namespace:SecondLooseActivity}MyActivity
Since there is no Xlink support in MS, is there a way to do this at all?
If not, what are my alternatives?

I had the exact same issue and found a solution.
Here's what my XAML looked like this:
<Activity ... xmlns:mylib="clr-namespace:MyProject.ActivityLibrary">
<mylib:MyCustomActivity ... />
</Activity>
The trick that worked for me was to specify the assembly containing my custom activity in the namespace.
Changing the namespace to this made it work:
xmlns:mylib="clr-namespace:MyProject.ActivityLibrary;assembly=MyProject.ActivityLibrary"

Related

Passing an external parameter from a jsp to an xsl (Eclipse)

Setting the scene:
I'm working on a webapp in Eclipse, with a bunch of JSPs and XSLs. And I need to hide some features depending on some users' attributes. This is the third job in the series.
For the previous 2 jobs, I was able to achieve my goals because either the required changes were on JSPs (straightforward) or on XSLs for which the objects existed.
I.e. We have the following sequence:
- searchForm.jsp (a form with some criteria you set up and submit),
- resultsList.jsp (a list of search results - clicking on any result brings the full record for the result),
- displayItem.jsp (the full record),
- record.xsl (the xsl that transforms displayItem.jsp).
Thus for the 2 previous jobs, the features I needed to hide were either on these JSPs themselves or on the xsl, in which case the (relevant) JSPs had:
<c:set target="${item}" property="xsltParameter" value="xxxx=Y"/>
where 'item' is an existing object and 'xxxx' a (usually but not necessarily global) parameter defined in the xsl.
For example:
<xsl:param name="xxxx">N</xsl:param>
Thus, if my changes were on the xsl, I would reuse the 'item' object to pass on my parameter and process it in the XSL(s).
E.g. I'd put on the jsp:
<c:set target="${item}" property="xsltParameter" value="abcd=AAA"/>
and add to the xsl:
<xsl:param name="abcd"></xsl:param>
This way I was able to pass my own parameters to the xsl.
For this last job however:
- The XSL (filters.xsl) is quite short and self-contained.
- It appears on the same page as resultsList.jsp, (therefore after searchForm.jsp) but has no connection I can see with it.
- On the JSPs, there's NO (appropriate) target object I can (re)use.
- I've already tried on a/the JSP the way I know to create variables/parameters:
<c:set var="xyz" value="${abcd}"/>
but this doesn't seem to work (when I create a corresponding xyz global parameter in filters.xsl).
My issues are:
- I'm struggling to create an object (if that's what I need to do).
- I may need to do something else, but I'm not sure what (hence my post).
Plan B
In desperation, with plan B I'm creating as a proof-of-concept, a static xml file (param-val.xml), in the same location as the XSLs, in which I put my external parameter/criterion:
<paramroot>
<paramval>abcd</paramval>
</paramroot>
What I'd like to do is using the document() function, extract this parameter and use it either within filters.xsl if possible or otherwise a go-between prefilters.xsl that filters.xsl would import. And this is where I'd need some help/tips/etc.
<xsl:param name="theXML" select="'prefilters.xml'" />
<xsl:variable name="myDoc" select="document($theXML)" />
I've been reading stuff on the web and tested a few things, but I'm stuck (rusty on some topics and learning others). How can I grab and use the 'abcd' in either filters or prefilters?
Any suggestions on how best to handle this?
Sorry for the lenghty post. Any help would be greatly appreciated.
Many thanks and regards.

Is it possible to create a Karabiner filter for Application Bundle Identifiers

I have looked at the sample code for Karabiner where you can create a filter that applies to a window name, but I would like to apply the filter, when I am creating new emails. Since the window name changes, I would like to filter on the Application Bundle Identifier instead. Does someone have an XML example of filtering on Application Bundle Identifier?
The developer's manual provides both steps to determine the app bundle identifier as well as examples of usage. I have included one of my own below.
You must first determine if the app you're interested in is pre-defined by Karabiner. Check appdef.xml and search that page for your app's identifier.
If it wasn't found in the existing definitions, you will need to define a name for the application that you will use in <item> blocks later. (Neither of these are great examples, as they are both pre-defined in appdef.xml for use under WORD and GOOGLE_CHROME, respectively.)
<?xml version="1.0"?>
<root>
<appdef>
<appname>MWORD</appname>
<equal>com.microsoft.Word</equal>
</appdef>
<appdef>
<appname>CHROME</appname>
<equal>com.google.Chrome</equal>
</appdef>
Instead of using <equal>, which as the name implies only matches exact strings (including case), you can use <prefix> or <suffix> to match against the beginning or end of the app bundle identification string, respectively.
Once you've done this, when you're creating your item, you have a few options on filtering. First is to restrict to just that particular application, which I believe is your goal.
<item>
<identifier>private.fixscrollwheel</identifier>
<name>Always Rotate Scroll Wheel</name>
<only>CHROME</only>
<autogen>
__FlipScrollWheel__
Option::FLIPSCROLLWHEEL_ROTATE,
</autogen>
</item>
Note the <only> tag. This restricts the above item to only working with an app whose bundle identifier is com.google.Chrome, since that's what CHROME corresponds to in the <appdef> tag at the top.
You can define multiple applications to be matched by simply including more appnames in your <only> tag, such as this:
<only>CHROME, MWORD, MAIL</only>
You can also do the inverse, i.e. all applications except those listed, by changing <only> to <not>.

Alfresco: how to change start task name of custom workflow?

I want workflow details page to show a descriptive name for the start task instead of the form id in History table. The name attribute of userTasks works fine, but I can't get it working on my startEvent. As seen below:
<startEvent id="start" name="Início" activiti:initiator="initiatorUserName"
activiti:formKey="workflowdocumentrequest:start">
<userTask id="userTask1" name="Revisão da Requisição de Documento Físico"
activiti:assignee="${workflowdocumentrequest_destination.properties.userName}"
activiti:formKey="workflowdocumentrequest:review">
What do I have to do?
Well, if you're developing a custom advanced workflow in Alfresco using Activiti you should check out this Jeff Pots guide.
Other than that, in order to use a customised string for your start event you should be familiar with content modeling and i18n properties files.
So for your startEvent you should have a specific workflow model declaring the workflowdocumentrequest:start type, something similar to this:
<type name="workflowdocumentrequest:start">
<parent>bpm:startTask</parent>
...
</type>
For that workflow content model you should have a specific i18n file, in messages folder called workflowdocumentrequestWorkflow.properties.
There you should have something like this:
workflowdocumentrequestWorkflow_workflowmodel.type.workflowdocumentrequestWorkflow_start.title=Início
The workflowdocumentrequestWorkflow_workflowmodel part is your namespacePrefixShortname_yourWorkflowModelName (the one you have used at the beginning of your workflow content model xml file <model name="workflowdocumentrequestWorkflow:workflowmodel xmlns="http://www.alfresco.org/model/dictionary/1.0">.
The .type. is obviously your custom type for the start event task.
The workflowdocumentrequestWorkflow_start is your type's name in your xml. Activiti engine and i18n file hase to be written with _ instead of :.
Hope it helps.
Cheers

Orbeon 4.1 custom REST persistence

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.

Creating a working copy for Plone 4 custom content types

I have created a custom Plone content type in my package i.e. my.product.
I am in need of integrating a working copy support: so that a "published" document (in my case, a published content type) stays online while it is being edited. Basically, I want to take advantage of 'Working Copy Support (Iterate)' provided by plone.app.iterate to achieve what is explained here. This will provide me with ability to check-in/check-out my changes.
Is this possible in Plone 4 with custom content types using Archetypes? How would one go about it if yes?
I added the following two files inside my.product/my/product/profiles/default folder and it appears to work:
diff_tool.xml
<?xml version="1.0"?>
<object>
<difftypes>
<type portal_type="MyCustomType">
<field name="any" difftype="Compound Diff for AT types"/>
</type>
</difftypes>
</object>
repositorytool.xml
<?xml version="1.0"?>
<repositorytool>
<policymap>
<type name="MyCustomType">
<policy name="at_edit_autoversion"/>
<policy name="version_on_revert"/>
</type>
</policymap>
</repositorytool>
I have never used plone.app.iterate, but this is the generic approach how to solve the problem.
Actions are installed by plone.app.iterate GenericSetup profile. You can see actions here:
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/profiles/default/actions.xml
Pay note to the line *available_expr* which tells when to show the action or not. It points to helper view with the conditition.
The view is defined here
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/configure.zcml#L7
The checks that are performed for the content item if it's archiveable
https://github.com/plone/plone.app.iterate/blob/master/plone/app/iterate/browser/control.py#L47
Most likely the failure comes from if not interfaces.IIterateAware.providedBy condition. Your custom contennt must declare this interface. However, you can confirm this putting a pdb breakpoint in checkin_allowed(self) and step it though line-by-line and see what happens with your content type.