UI Automation - Select object based on multiple Identifiers - microsoft-ui-automation

I am new to this. I am using UI Automation to automate my application. Is there a way to identify element based on multiple identifier.
currently the below syntax only able to identify based on one identifier.
AutomationElement okbtn = dialogbox.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "OK"));
I would like to take identify element by both NameProperty and ControlTypeProperty.
Is this possible?

Condition cMenuItem = new AndCondition(
new PropertyCondition(AutomationElement.LocalizedControlTypeProperty,"text"),
new PropertyCondition(AutomationElement.NameProperty,"Appointment"));
AutomationElement aeMenuItem = aeTaskMenu.FindFirst(TreeScope.Descendants, cMenuItem);

Related

Enterprise Architect SynchTaggedValues not working

In Enterprise Architect element.SynchTaggedValues()is not working from an Add-in
but it works from the script inside EA.
Please find the code I used below.
Initially have creating an activity Element.
EA.Element element = package.Elements.AddNew("Activity1", "Activity");
element.Stereotype = "Activity";
element.Update();
Later trying to synch TaggedValues for existing element.
element= repository.GetElementByGuid("{13D2915D-C249-4449-AA3C-8D807C54251C}");
bool ok = element.SynchTaggedValues("BPMN2.0", "Activity");
It returned false. No Sync is done here. How can I do this?
I'd recommend to just create the element correctly in the first place:
EA.Element element = package.Elements.AddNew("Activity1", "BPMN2.0::Activity");

Define multiple possible paths in workflow activiti

I am designing a workflow in activiti so far i have been able to design it like above.
My problem is
i start a work flow.
present user option to execute one of the two possible action(Archive and complete in diagram)
i also need to have authorization on whether he can archive or complete or both.
user can take one of these options.
based on one of the action taken workflow proceeds.
So far to achieve this i introduced user task new before complete and archive and added two form variables named archive and complete as boolean.
Depending on which form variable he chooses to fill i proceed further.
But in this case i can't restrict user based on whether it has permission of archive and complete and all users will be shown both options.
is there any other way to achieve this i am very new to activiti and workflow and bpmn in general.
Any help will be appreciated thanks in advance
1. How to presents possible transitions to user:
Set transitions directly to task and set transition id according this pattern:
<task_id>_<transition_id> that means in this case: newTask_archive and newTask_complete. Then you can read all transitions from task definition and parse the postfix from id and send to user list of possible transitions (complete, archive). Your bussines layer can remove any transition according user permissions.
// Source: http://forums.activiti.org/content/how-get-all-possible-flows-current-activity
public List<String> getPossibleTransitionIds(long processInstanceId, String taskId) {
RepositoryServiceImpl repoServiceImpl = (RepositoryServiceImpl) repositoryService;
List<String> possibleTransitionIds = new ArrayList<String>();
ReadOnlyProcessDefinition processDef = repoServiceImpl.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
PvmActivity activity = processDef.findActivity(taskId);
for (PvmTransition pvmTransition : activity.getOutgoingTransitions()) {
String transitionId = extractTransitionId(pvmTransition);
if (transitionId != null) {
possibleTransitionIds.add(transitionId);
}
}
return possibleTransitionIds;
}
2. How to move process by selected transition:
User selects one of presented transition ids. Bussines layer checks user's permissions and move process. Set selected transition to process variables and resolve task.
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("selectedTransition", selectedTransition);
taskService.resolveTask(taskId, variableMap);
In every transition has to be set a condition expression ${selectedTransition == '<transition_id>'}. In this case ${selectedTransition == 'complete'} and ${selectedTransition == 'archive'}
<sequenceFlow id="newTask_complete" name="Complete" sourceRef="newTask" targetRef="completeTask">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${selectedTransition == 'complete'}]]></conditionExpression>
</sequenceFlow>

How to use Selector query in ZK

I was going through these pages on ZK documentation ID_Space -Selector and looked at following code
comp.query("#ok"); //look for a component whose ID's ok in the same ID space
comp.query("window #ok");
comp.queryAll("window button");
I am wondering how can I use this in my code? I am creating 2 drop downs and adding Id to both these drop downs
Listbox listbox=createListbox(widget, DetailsListRenderer.ORDERSTATUS.class, null,orderStatus);
listbox.setId(ORDER_STATUS_ID);
So when My page is getting refreshed, I am getting exception of Unique Id, I was wondering if these is a way I can query component and see if same component with same Id already exists and in case it exists, I should not add ID to that component, or should not create component at all
Any suggestion?
I tried something like
widget.getFellow( ORDER_STATUS_ID); but getting `org.zkoss.zk.ui.ComponentNotFoundException` exception.
widget.getFellow("#" + ORDER_STATUS_ID);
For widgets that co-exist in the same ID space (a.k.a fellow widgets), one may use any of the following to refernece a fellow from a certain widget:
var fellow = widget.$f('fellowID');
var fellow = widget.$f().fellowID;
var fellow = zk.Widget.$(jq('$fellowID')[0]);

Jira 6: How to assign issue by condition

I creating new workflow and I need to assign issues by condition.
For example:
During create issue if in the dropdown list I select "language_1" issue will be assigned to "translator_1" or if I select "langiage_2", issue will be assigned to "translator_2"
I tried to do this in workflow editor by creating post function, but this functions can't verify conditions. Does Jira have any other method to do it?
Use JIRA components to do this. Create a component named "language_1" with a component lead of your first user. When the issue is created set the component and leave the Assignee at automatic.
I used the Script runner plugin to do something similar by adding a post function to the required transaction. Code example:
from com.atlassian.jira import ComponentManager
customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
userUtil = ComponentManager.getInstance().getUserUtil()
# read field
language = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Language"))
if (language == "language_1") {
issue.setAssignee(userUtil.getUserObject("translator_1"))
} else if (language == "language_2") {
issue.setAssignee(userUtil.getUserObject("translator_2"))
}

Dynamic sqlWorkflowInstanceStore

I have created an application using this
http://msdn.microsoft.com/en-us/magazine/ff646977.aspx
What i need to do is callWorkflow instances store dynamically
i.e before
string message = "";
string result = client.EvaluateMortgage();
I should be able to specify the sqlworkflowinstancestore i.e where the workflow data is
Any help will be appreciated.
I think you can do like this,
SqlWorkflowInstanceStore store = new SqlWorkflowInstanceStore(connectionString);
More info
Here you can find several ways of configuring /using it