How to select a node in Tree based on XML node property? - apache-flex

I have a tree im my mxml that uses a XMLListCollection as dataProvider. It´s XML is like:
<list>
<conta nome="Plano de Contas" id="1">
<conta nome="Creditos" id="2" />
<conta nome="Vendas" id="4" />
<conta nome="Juros" id="5" />
<conta nome="Debitos" id="3" />
</conta>
</list>
How can I make the node for, say, id==4 visible AND selected?
Thank you.

var xml:XML =
<list>
<conta nome="Plano de Contas" id="1">
<conta nome="Creditos" id="2" />
<conta nome="Vendas" id="4" />
<conta nome="Juros" id="5" />
<conta nome="Debitos" id="3" />
</conta>
</list>;
//find node conta with id=4 using xml selectors
var node:XML = xml.descendants("conta").(#id == 4)[0];
tree.selectedItem = node;
You might need to open node parents if they are not, mx:Tree might not do this automatically.

For selection you can use, this.myTree.selectedIndex=4, that done, it should become visible automatically.

Related

Visual Studio Extension with custom command and subcommands

I'm trying to create a simple Visual Studio Extension using Visual Studio 2017 that adds commands to the project context menu in the Solution Explorer. I'd like to add my commands grouped together in a main option and then from that main option I would like my commands to be accessible, just like how the Add->New item, Add->Existing item, Add->Class etc. works for in the context menu of the project.
After going through the documentation here's what I have come up with so far for my vsct file:
<Commands package="guidMainItemPackage">
<Groups>
<Group guid="guidMainItemPackageCmdSet" id="MyMenuGroup" priority="0x0600" />
<Group guid="guidMainItemPackageCmdSet" id="SubMenuGroup" priority="0x0601" />
</Groups>
<Buttons>
<Button guid="guidMainItemPackageCmdSet" id="MainItemId" priority="0x0100" type="Button">
<Parent guid="guidMainItemPackageCmdSet" id="MyMenuGroup" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<ButtonText>Invoke MainItem</ButtonText>
</Strings>
</Button>
<Button guid="guidMainItemPackageCmdSet" id="cmdidSubItem" priority="0x0101" type="Button">
<Parent guid="guidMainItemPackageCmdSet" id="SubMenuGroup" />
<Icon guid="guidImages1" id="bmpPic1" />
<Strings>
<ButtonText>Invoke SubItem</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
<Bitmap guid="guidImages" href="Resources\MainItem.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough" />
<Bitmap guid="guidImages1" href="Resources\SubItem.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough" />
</Bitmaps>
</Commands>
<CommandPlacements>
<CommandPlacement guid="guidMainItemPackageCmdSet" id="MyMenuGroup" priority="0xFFFF">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_PROJNODE" />
</CommandPlacement>
<CommandPlacement guid="guidMainItemPackageCmdSet" id="SubMenuGroup" priority="0xFFFE">
<Parent guid="guidMainItemPackageCmdSet" id="MyMenuGroup" />
</CommandPlacement>
</CommandPlacements>
<Symbols>
<GuidSymbol name="guidMainItemPackage" value="{30f66380-eeeb-48bf-8554-0d63d87194af}" />
<GuidSymbol name="guidMainItemPackageCmdSet" value="{98ee7e8f-c421-4f0e-a9e9-86eab5141563}">
<IDSymbol name="MyMenuGroup" value="0x1020" />
<IDSymbol name="SubMenuGroup" value="0x1028" />
<IDSymbol name="MainItemId" value="0x0100" />
<IDSymbol value="4129" name="cmdidSubItem" />
</GuidSymbol>
<GuidSymbol name="guidImages" value="{b3c2dfad-df35-4e6b-880e-8018ce6c3d0f}">
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>
<GuidSymbol value="{93d3ad22-fe33-40da-b85f-a926952e3914}" name="guidImages1">
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
<IDSymbol name="bmpPicStrikethrough" value="6" />
</GuidSymbol>
</Symbols>
So basically I have created added two Custom commands to my project, a button for each of the commands, a group for each of the buttons and a commandplacement for each of the groups (everything else is just the default generated vsct template).
My problem is that using the code above, on the first command is displayed and it has no subitems. What would be the correct vsct content to achieve the desired layout?
After some more trial and error (mostly error), I decided to go through the command definitions of Visual Studio itself to find a similar group of commands, and I've finally came up with the answer. Here's the steps you need to take to realize this structure:
Create a group and set the parent of this group to the Visual Studio projects context menu.
Create a menu, whose parent is the group created in step 1.
Create a second group, whose parent is the menu created in step 2.
Create buttons for only the subitems.
Create commandplacements for the subitems created in step 4 where you place each button in the group created in step 3.

How to edit template-instance of start workflow page in Alfresco Share?

I want to add a upload button the start-workflow page and for that i need to add upload component xml tags as follows in template instance:
<component>
<region-id>html-upload</region-id>
<url>/components/upload/html-upload</url>
</component>
<component>
<region-id>flash-upload</region-id>
<url>/components/upload/flash-upload</url>
</component>
<component>
<region-id>file-upload</region-id>
<url>/components/upload/file-upload</url>
</component>
<component>
<region-id>dnd-upload</region-id>
<url>/components/upload/dnd-upload</url>
</component>
<component>
<region-id>archive-and-download</region-id>
<url>/components/download/archive</url>
</component>
Why you wanted to add a upload button to the start-workflow page alfresco OOTB provides the workflow package you can attach your documents here.
You just need to define it in share config
<config evaluator="string-compare" condition="activiti$submitDocument">
<forms>
<form>
<field-visibility>
<show id="packageItems" />
</field-visibility>
<appearance>
<set id="general" appearance="title" label-id="workflow.set.other" />
<field id="packageItems" set="general" label="Purchase request document">
<control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl">
</control>
</field>
</appearance>
</form>
</forms>
</config>
and you can get all the attached document using javascript
var documents = bpm_package.children;
It was as simple and obvious as it could have been. All you need to do is create a file named start-workflow.xml in the directory src/main/resources/alfresco/web-extension/site-data/template-instances. Then just copy paste the original file and add your components. This isn't enough in itself. You also have to add regions of these components to the template of start-workflow. Again, a simple process. Create a file start-workflow.ftl in the directory src/main/resources/alfresco/web-extension/site-data/templates/org/alfresco. Once again copy paste the original file and add your regions. In my case it was :
<#region id="html-upload" scope="template"/>
<#region id="flash-upload" scope="template"/>
<#region id="file-upload" scope="template"/>
<#region id="dnd-upload" scope="template"/>
<#region id="archive-and-download" scope="template"/>

Spring webflow Value of second parameter is not passed to subflow

Hi, I am using spring webflow2.4.4 with spring4.1.3.
I am trying to pass values between two flows as below.
sending value from flow first xml
<action-state id="submit">
<evaluate expression="someMethod(form)" result="flowScope.saveStatus" />
<set name="flowScope.value1" value="form.value1" />
<set name="flowScope.value2" value="form.value2" />
<transition on="success" to="view" />
</action-state>
<subflow-state id="view" subflow="flow/path/view">
<input name="value1" value="value1" />
<input name="value2" value="value2" />
...
</subflow-state>
reeving data in flow second view xml
<input name="value1" type="string" />
<input name="value2" type="string" />
now in view xml I am able to receive value for "value1" what I passed from first flow but getting value for 'value2' is null.
I tried switching the position in first flow as below
<action-state id="submit">
<evaluate expression="someMethod(form)" result="flowScope.saveStatus" />
<set name="flowScope.value2" value="form.value2" />
<set name="flowScope.value1" value="form.value1" />
<transition on="success" to="view" />
</action-state>
<subflow-state id="view" subflow="flow/path/view">
<input name="value2" value="value2" />
<input name="value1" value="value1" />
...
</subflow-state>
Now I am able to see value of 'value2' but value for 'value1' receiving is null.
What is wrong here? see below debug logs for both example
1st trial
DEBUG SubflowState - Calling subflow 'flow/path/view' with input map['value1' -> 'ABCDF', 'value2' -> [null]]
2nd trial
DEBUG SubflowState - Calling subflow 'flow/path/view' with input map['value2' -> 'ABCDF', 'value1' -> [null]]
I want to pass both thew values to second flow but it second parameter is getting skipped somehow.
this is a very common mistake. the action state is transitioning when it gets a success and stops evaluating the rest of the commands.
you need to use <on-entry> to separate the two:
the commands you want to set or evaluate (value1 & value2)
the command that will be evaluated for the transition, here someMethod(form))
use this instead:
<action-state id="submit">
<on-entry>
<set name="flowScope.value2" value="form.value2" />
<set name="flowScope.value1" value="form.value1" />
</on-entry>
<evaluate expression="someMethod(form)" result="flowScope.saveStatus" />
<transition on="success" to="view" />
</action-state>
Thanks rptmat57, below code worked for me.
<action-state id="submit">
<evaluate expression="someMethod(form)" result="flowScope.saveStatus" />
<transition on="success" to="view" >
<set name="flowScope.value2" value="form.value2" />
<set name="flowScope.value1" value="form.value1" />
</transition>
</action-state>

Dynamic Component Template no longer going to broker db

I have made an adjustment to my blueprinting structure, so that what was previously a publishable web publication has now been turned into a non publishable web publication at a parent level. A new child web publication has been created to take it's place.
As such, this has created a new publication ID. I've updated all configurations with this new ID, and been able to successfully publish content to the presentation servers on the file system. Dynamic component presentations are also being published into the broker database using the new ID.
However, recently one of my dynamic component templates has stopped publishing to the broker. It publishes to the file system, but no record of the component appears in the LINK_INFO table of the broker. This means dynamic linking for content using this template is failing on the website.
Could anyone possible tell me if they know why this is occurring?
UPDATE 2: Found something interesting.....dynamic linking is actually working but only for some component templates. I discovered this by using the ComponentLink.GetLink(string) method to see if it would return a link...for some content types it does, but for others which previously had links, it now doesn't, even after republishing these templates :s
UPDATE: cd_storage.xml
<Configuration Version="6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_storage_conf.xsd">
<Global>
<ObjectCache Enabled="false">
<Policy Type="LRU" Class="com.tridion.cache.LRUPolicy">
<Param Name="MemSize" Value="16mb"/>
</Policy>
<Features>
<Feature Type="DependencyTracker" Class="com.tridion.cache.DependencyTracker"/>
</Features>
</ObjectCache>
<Storages>
<StorageBindings>
<Bundle src="AudienceManagerDAOBundle.xml" />
</StorageBindings>
<Storage Type="persistence" Id="defaultdb" dialect="MSSQL"
Class="com.tridion.storage.persistence.JPADAOFactory">
<Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120"
CheckoutTimeout="120" />
<DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
<Property Name="serverName" Value="lon1udb01.int.rroom.net" />
<Property Name="portNumber" Value="1433" />
<Property Name="databaseName" Value="uat_mal_Tridion_Broker_2" />
<Property Name="user" Value="uat_mal" />
<Property Name="password" Value="mj][zdvd=h" />
</DataSource>
</Storage>
<Storage Type="persistence" Id="profiledb" dialect="MSSQL"
Class="com.tridion.storage.persistence.JPADAOFactory"
defaultStorage="false">
<Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120"
CheckoutTimeout="120" />
<DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
<Property Name="serverName" Value="lon1udb01.int.rroom.net" />
<Property Name="portNumber" Value="1433" />
<Property Name="databaseName" Value="uat_mal_Tridion_submgmt" />
<Property Name="user" Value="uat_mal" />
<Property Name="password" Value="mj][zdvd=h" />
</DataSource>
</Storage>
<Storage Type="persistence" Id="trackingdb" dialect="MSSQL"
Class="com.tridion.storage.persistence.JPADAOFactory"
defaultStorage="false">
<Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120"
CheckoutTimeout="120" />
<DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
<Property Name="serverName" Value="lon1udb01.int.rroom.net" />
<Property Name="portNumber" Value="1433" />
<Property Name="databaseName" Value="uat_mal_Tridion_tracking" />
<Property Name="user" Value="uat_mal" />
<Property Name="password" Value="mj][zdvd=h" />
</DataSource>
</Storage>
<Storage Type="filesystem" Id="defaultFile"
Class="com.tridion.storage.filesystem.FSDAOFactory"
defaultFilesystem="false"
defaultStorage="false">
<Root Path="c:\websites\live" />
</Storage>
<Storage Type="filesystem" Id="defaultFileAssets"
Class="com.tridion.storage.filesystem.FSDAOFactory"
defaultFilesystem="false"
defaultStorage="true">
<Root Path="c:\websites\live\malvern.com.en\Assets" />
</Storage>
<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory"
Id="malenctrls" defaultFilesystem="false" defaultStorage="false">
<Root Path="c:\websites\live\malvern.com.en\usercontrols" />
</Storage>
<Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory"
Id="malcnctrls" defaultFilesystem="false" defaultStorage="false">
<Root Path="c:\websites\live\malvern.com.cn\usercontrols" />
</Storage>
<SearchFilter Name="SearchFilter"
Class="com.tridion.broker.components.meta.MsSqlSearchFilterHome"
defaultStorageId="defaultdb"/>
</Storages>
<Transaction Timeout="60000" MonitorInterval="5000"/>
</Global>
<ItemTypes defaultStorageId="defaultdb" cached="false">
<Item storageId="profiledb" typeMapping="AudienceManagerProfile" cached="false"/>
<Item storageId="trackingdb" typeMapping="AudienceManagerTracking" cached="false" />
<!-- GLOBAL MASTER -->
<Publication Id="22" defaultStorageId="defaultdb" cached="false">
<Item storageId="defaultFile" typeMapping="Page" cached="false" />
<Item storageId="defaultFile" typeMapping="Binary" cached="false" />
<Item storageId="malenctrls" typeMapping="ComponentPresentation"
itemExtension=".ascx" cached="false" />
</Publication>
<!-- CHINESE WEB -->
<Publication Id="15" defaultStorageId="defaultdb" cached="false">
<Item storageId="defaultFile" typeMapping="Page" cached="false" />
<Item storageId="defaultFile" typeMapping="Binary" cached="false" />
<Item storageId="malcnctrls" typeMapping="ComponentPresentation"
itemExtension=".ascx" cached="false" />
</Publication>
</ItemTypes>
<License Location="c:/tridion/config/cd_licenses.xml"/>
You have
<Storage Type="filesystem" Id="defaultFileAssets"
Class="com.tridion.storage.filesystem.FSDAOFactory" defaultFilesystem="false"
defaultStorage="true">
and no TypeMappings definition anywhere in your cd_storage_conf.xml. This makes the "defaultFileAssets" the storage location of choice for the deployer.
I would normally expect something like this
<ItemTypes defaultStorageId="defaultdb" cached="false">
<Item typeMapping="Page" cached="false" storageId="defaultFile"/>
<Item typeMapping="Binary" storageId="defaultFile" cached="false"/>
</ItemTypes>
in your Configuration node.
It would also be very helpful to ensure that the configuration you have posted is actually being used; you can view this in the logfiles generated by Tridion (with debug logging enables) as it logs which config file it is using; there has been more than one occasion where I was puzzled with issues simply because I was looking at the wrong configuration file...
I've removed a lot of unhelpful comments from the storage configuration in the question. Now it's easy to see that as Quirijn suspected, there are publication-specific configurations in play. If your web publication id was previously 15 or 22, and this has changed, that would explain your problem.
I think the issue may be being caused by an expired cd_licence file but i can't confirm it, have asked SDL support to tell me if it's so

Spring Webflow : how do I pass an attribute from one flow to another during a transition?

I have an action-state that evaluates an expression and then transitions to various other states depending on the result. One of the result states is a subflow-state that hands control to another flow, example;
<action-state id="doWork">
<evaluate expression="someAction.doWork(someInput)" />
<transition on="WORKSUCCESS" to="workSuccess" />
<transition on="WORKFAIL" to="fixFail" />
</action-state>
<subflow-state id="fixFail" subflow="someOtherPlace/someOtherWorkToFixFail">
<input name="someNumber" value="1" type="java.lang.Integer" />
<transition on="finish" to="workSuccess" />
</subflow-state>
As you can see I can pass an input into the subflow via the input tag but my question is how can I specify and pass additional inputs that I want present if and only if the subflow-state is being called from the transition WORKFAIL? Assume the subflow-state "fixFail" can be called from other action-states.
I've tried things similar to the following with no effect;
<action-state id="doWork">
<evaluate expression="someAction.doWork(someInput)" />
<transition on="WORKSUCCESS" to="workSuccess" />
<transition on="WORKFAIL" to="fixFail">
<attribute name="newInput" value="3000" type="java.lang.Integer" />
</transition>
</action-state>
<subflow-state id="fixFail" subflow="someOtherPlace/someOtherWorkToFixFail">
<input name="someNumber" value="1" type="java.lang.Integer" />
<input name="someNumber2" value="flowScope.newInput" type="java.lang.Integer" />
<transition on="finish" to="workSuccess" />
</subflow-state>
There are three ways you can do this. You can do it through the conversation, session or as attributes passed in.
ConversationScope: If a field is in the conversationScope the field is visible anywhere in that specific flow as well as that flow's subflows (and their transitions)
SessionScope: (Probably not what you
want) Is visible to all flows and
their subflows
Finally you can pass the field as an attribute into the subflow state for example
<subflow-state id="fixFail" subflow="someOtherPlace/someOtherWorkToFixFail">
<input name="someNumber" value="1" type="java.lang.Integer" />
<input name="someNumber2" value="flowScope.newInput" type="java.lang.Integer" />
<transition on="finish" to="workSuccess" />
</subflow-state>
In your subflow's xml
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<input name="someNumber"/>
<input name="someNumber2"/>
...
</flow>
In this example someNumber and someNumber two are passed in as attributes to your subflow. In which you can evaluate them as ${someNumber}
Edit:
This is to address your comment question. If you wanted to set a variable in the conversation scope on a specific transition you can do:
<transition on="WORKFAIL" to="fixFail" >
<set name="conversationScope.someVariable" value="Hello World"/>
</transition>
Then in your jsp
${someVariable} <!-- This will print out 'Hello World' -->

Resources