I am facing problem in triggering workflow.
I have applied rule on a Folder
Definition of rule :
i) When Item are created on enter this folder
ii) Name End With .xml
iii)Execute Script
Script is
function startWorkflow()
{
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$Excel_initial_service";
workflow.parameters["bpm:workflowDescription"] = "Excel initial service workflow for : " + document.name;
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 1);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
return workflow.execute(document);
}
function main()
{
startWorkflow();
}
main();
and my workflow definition is
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="Excel_initial_service" name="Excel Initial Service" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
.
.
.
.
<serviceTask id="servicetask1" name="Service Task" activiti:class="*"> </serviceTask>
.
.
.
.
The problem i am facing is service task is getting triggered multiple times for single file entered in the folder and its not getting stopped.
<?xml version="1.0" encoding="UTF-8"?>
<process id="***" name="Excel Generation Service" isExecutable="true">
<startEvent id="starteventexcel1" name="Start"></startEvent>
<intermediateCatchEvent id="timerintermediatecatcheventexcel1" name="TimerCatchEvent1">
<timerEventDefinition>
<timeDuration>PT10S</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<serviceTask id="servicetaskexcel1" name="Service Task" activiti:class="***"></serviceTask>
<intermediateCatchEvent id="timerintermediatecatcheventexcel2" name="TimerCatchEvent2">
<timerEventDefinition>
<timeDuration>PT10S</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<endEvent id="endeventexcel1" name="End"></endEvent>
<sequenceFlow id="flowexcel1" sourceRef="starteventexcel1" targetRef="timerintermediatecatcheventexcel1"></sequenceFlow>
<sequenceFlow id="flowexcel2" sourceRef="timerintermediatecatcheventexcel1" targetRef="servicetaskexcel1"></sequenceFlow>
<sequenceFlow id="flowexcel3" sourceRef="servicetaskexcel1" targetRef="timerintermediatecatcheventexcel2"></sequenceFlow>
<sequenceFlow id="flowexcel4" sourceRef="timerintermediatecatcheventexcel2" targetRef="endeventexcel1"></sequenceFlow>
</process>
The first intermediateCatchEvent here will execute your service task every 10 sec. Why using it?
this answer may this will help you.
The class to use is the ClockUtil which changes the internal clock of the engine.
That being said, I checked your test and I saw that you are using the
ProcessEngine eng = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
To get the process engine. That will give you a default engine, with the job executor disabled. The job executor is needed for timer execution. Add following line to building the process engine to make it work:
setJobExecutorActivate(true);
You can refer this question https://community.alfresco.com/thread/219801-problem-with-intermediatecatchevent
you will find some code on github as explained in above referred question https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/event/timer/IntermediateTimerEventTest.java
Related
I have connected my QDBusConnection to a slot and I am sure it is connected because connect functions return True and i can see "connected to slot" log on console.
if ( m_bus.connect("com.mypage.MyService"
, "/MyRadio"
, "org.freedesktop.DBus.Properties"
, "PropertiesChanged"
, this
, SLOT(updateProperties(QString, QMap<QString, QVariant>))
)) {
qWarning() << "connected to slot";
}
But i cannot get any updates from corresponding dbus service. I am watching the service with dbus-monitor and am sure about signal is emitting.
the signal has following type :
<signal name="PropertiesChanged">
<arg type="s" name="interface_name"/>
<arg type="a{sv}" name="changed_properties"/>
<arg type="as" name="invalidated_properties"/>
</signal>
If i add a third argument to Slot like QList<QString> then it cannot connect properly ("connected the slot" sentence cannot be seen).
Any clue about why this is not working properly ?
The problem has solved after adding
qDBusRegisterMetaType<QMap<QString, QVariant>>();
So it was a simple error afterall.
I am trying to use pre and post build in my Visual Studio 2015 (TACO) project. As outlined in PreBuildEvent and PostBuildEvent on Visual Studio 2015 Tools for Apache Cordova I have added <Target> elements to my .jsproj file so that it now ends as shown:
<Import Project="_apacheCordovaProjectSourceItems.Targets" Condition="Exists('_apacheCordovaProjectSourceItems.Targets')" />
<Target Name="BeforeBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** Before Build **)" />
<Exec Command="attrib -R "$(ProjectDir)\platforms\*.*" /S" IgnoreExitCode="true" />
</Target>
<Target Name="AfterBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** After Build **)" />
<Exec Command="if $(ConfigurationName) == Release (xcopy "$(TargetDir)*.*" "$(SolutionDir)..\..\Binaries\$(PlatformName)\*.*" /Y /S /E /F /I)" />
</Target>
</Project>
My problem is that both the BeforeBuild and AfterBuild events fire at the beginning of the build
1>------ Build started: Project: MyProject, Configuration: Release Android ------
1> ** Before Build **
1> ** After Build **
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\android-release-unsigned.apk -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\android-release-unsigned.apk
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\manifest-merger-release-report.txt -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\manifest-merger-release-report.txt
1> 2 File(s) copied
1> Your environment has been set up for using Node.js 0.12.2 (ia32) and npm.
1> ... [Rest of output omitted] ...
Can anybody shed some light on why this is, or how I can get the post build event to run after the build has completed?
After banging my head against a wall for a while I gave up on the Visual Studio AfterBuild event and used a hook for the Cordova after_build one. It fires a bit earlier in the whole build process, but was good enough for my requirements. I'll post the gist of what it entails in case others need to do a similar thing.
Find the config.xml in Solution Explorer, right click on it and select View Code
In the config.xml add a <hook> section as follows
<platform name="android">
<hook type="after_build" src="scripts/afterbuild-copy-to-drop.js" />
</platform>
Here I am hooking into the after_build event for an Android build only.
Now create a scripts folder at the root of the project, ie the same level as the plugins and www folders.
Create a JavaScript file in here with a name that matches the src attribute in the hook definition, ie 'afterbuild-copy-to-drop.js'.
In this script file write the required code. Here is mine
module.exports = function (ctx) {
console.log('Executing custom "' + ctx.hook + '" hook for ' + ctx.opts.platforms);
var path = ctx.requireCordovaModule('path'),
shell = ctx.requireCordovaModule('shelljs');
// make sure we are in a release build
var isRelease = (ctx.cmdLine.indexOf('--configuration Release') >= 0);
var solutionRoot = path.join(ctx.opts.projectRoot, '../..');
var dropRoot = path.join(solutionRoot, '../../Binaries/Release/Apps');
if (isRelease){
if (ctx.opts.platforms == 'android') {
var platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
var apkFileLocation = path.join(platformRoot, 'build/outputs/apk/android-release.apk');
dropRoot = path.join(dropRoot, 'Android');
var dropApkFileLocation = path.join(dropRoot, 'my-app.apk');
console.log('------ Making directory \'' + dropRoot + '\'');
shell.mkdir('-p', dropRoot);
console.log('------ Copying \'' + apkFileLocation + '\' to ' + dropApkFileLocation + '\'');
shell.cp('-f', apkFileLocation, dropApkFileLocation);
}
}
console.log('Finished executing "' + ctx.hook + '" hook for ' + ctx.opts.platforms);
};
Further information on hooks can be found at https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/
I built a web service in C# web application. I'm returning list of objects as a web service result. I need to know how to read that list of items one by one in a loop.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<checkAvailabilityResponse xmlns="http://tempuri.org/">
<checkAvailabilityResult>
<Shedule>
<Sid>int</Sid>
<Fid>int</Fid>
<FromLocation>string</FromLocation>
<FromTime>dateTime</FromTime>
<ToLocation>string</ToLocation>
<ToTime>dateTime</ToTime>
<PriceSeatA>double</PriceSeatA>
<PriceSeatB>double</PriceSeatB>
<PriceSeatC>double</PriceSeatC>
</Shedule>
<Shedule>
<Sid>int</Sid>
<Fid>int</Fid>
<FromLocation>string</FromLocation>
<FromTime>dateTime</FromTime>
<ToLocation>string</ToLocation>
<ToTime>dateTime</ToTime>
<PriceSeatA>double</PriceSeatA>
<PriceSeatB>double</PriceSeatB>
<PriceSeatC>double</PriceSeatC>
</Shedule>
</checkAvailabilityResult>
</checkAvailabilityResponse>
</soap:Body>
</soap:Envelope>
This is the way I tried:
SriLankanWebService.Service1SoapClient air1 = new AgentPortal.SriLankanWebService.Service1SoapClient();
List<Shedule> air1Response = (List<Shedule>)air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
When I tried it says:
Error 1 Cannot implicitly convert type 'AgentPortal.SriLankanWebService.Shedule[]' to 'System.Collections.Generic.List<AgentPortal.Shedule>' D:\DCBSD\AgentPortal\AgentPortal\Home.aspx.cs 32 46 AgentPortal
I need to use it in a loop.
Please update your code in last line from above code from:
List<Shedule> air1Response = (List<Shedule>)air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
to
AgentPortal.SriLankanWebService.Shedule[] = air1.checkAvailability(drpFrom.SelectedValue.ToString(), drpTo.SelectedValue.ToString(), DateTime.Parse(txtDepartOn.Text));
That will fix the issue.
So far, I've been able to create a Windows Service, which I can then get TeamCity to build and pack up and make available for Octopus Deploy.
What I can't seem to do, is have an app.config which has a connection string in it and use that connection string.
The following is my Deploy.ps1:
# These variables should be set via the Octopus web portal:
#
# ServiceName - Name of the Windows service
#
# sc.exe is the Service Control utility in Windows
# Default the service name
if (! $ServiceName)
{
$ServiceName = "OctoService"
}
Write-Host "Service Name:" $ServiceName
# Get the exe name based ont the directory
$contentPath = (Join-Path $OctopusPackageDirectoryPath "content")
$configName = (Get-ChildItem $contentPath\*.config -Name | Select-Object -First 1)
$binPath = (Join-Path $OctopusPackageDirectoryPath "lib\net40")
$exeName = (Get-ChildItem $binPath\*.exe -Name | Select-Object -First 1)
$fullPath = (Join-Path $binPath $exeName)
Write-Host "Service Path:" $fullPath
Write-Host "Config Path:" (Join-Path $contentPath $configName)
Copy-Item (Join-Path $contentPath $configName) $binPath
$service = Get-Service $ServiceName -ErrorAction SilentlyContinue
if (! $service)
{
Write-Host "The service will be installed"
New-Service -Name $ServiceName -BinaryPathName $fullPath -StartupType Automatic
}
else
{
Stop-Service $ServiceName -Force
$fullPath = Resolve-Path $fullPath
& "sc.exe" config "$ServiceName" binPath= $fullPath start= auto | Write-Host
Start-Service $ServiceName
}
Here's my .nuspec file:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<copyright>Copyright 2012</copyright>
</metadata>
<files>
<file src="app.config" target="content" />
<file src="Deploy.ps1" />
</files>
</package>
If I try to access ConfigurationManager.ConnectionStrings["MyConnectionString"], I'll get a null reference.
Any suggestions?
my money is on you needing to name your app.config to exename.exe.config so it is picked up by your service.
App.config is the 'temporary' name used in the ide, it gets renamed as part of the build to whatever the exe name is
I have a xml file which is currently made manually and I have to make a functionality(UI) where user can enter the data and I have to store the data and generate the xml file dynamically in .NET.
Problem is the format of the xml file. I am not able to decide how I am going to store that data and then dynamically generate xml from that.
Please find the some of the extract of the code from the xml file below:
<?xml version="1.0" encoding="UTF-8"?>
<DATA>
<SDACTS>
<SDACT TYPE="Economy" COLOUR="0xff0000"/>
<SDACT TYPE="Environment" COLOUR="0x00ff00"/>
<SDACT TYPE="People" COLOUR="0x0000ff"/>
<SDACT TYPE="Society" COLOUR="0xff00ff"/>
</SDACTS>
<INDUSTRIES>
<INDUSTRY TYPE="Platinum" COLOUR="0x0094B1">
<PRODUCT>Platinum</PRODUCT>
<PRODUCT>Palladium</PRODUCT>
<PRODUCT>Rhodium</PRODUCT>
<PRODUCT>Gold</PRODUCT>
</INDUSTRY>
<INDUSTRY TYPE="Diamonds" COLOUR="0x652382">
<PRODUCT>Diamonds</PRODUCT>
</INDUSTRY>
<INDUSTRY TYPE="Metallurgical Coal" COLOUR="0x999a8f">
<PRODUCT>Metallurgical Coal</PRODUCT>
</INDUSTRY>
</INDUSTRIES>
<LOCATIONS>
<CONTINENT TITLE="South America">
<COUNTRY TITLE="Brazil">
<HEADOFFICE>So Paulo</HEADOFFICE>
<ADDRESS>
Sau, polo, ambikaui
</ADDRESS>
<LATITUDE>-23.571157</LATITUDE>
<LONGITUDE>-46.644146</LONGITUDE>
<BUSINESSUNITS>Nickel; Iron ore and manganese</BUSINESSUNITS>
<DESCRIPTION>Anglo American has been operating in Brazil since 1973. Our core operations are involved in the production of nickel, iron ore and maganese, while our interests in the production of phosphates and niobium at Copebras and Catalo respectively have been identified for divestment. Nickel projects in the pipeline include Barro Alto.</DESCRIPTION>
<EMPLOYEES/>
<NUMBEROFBUSINESS>2</NUMBEROFBUSINESS>
<!--New project added - 12/02/2010 start -->
<PROJECT>
<TYPE>Greenfield</TYPE>
<NAME>Minas Rio expansion</NAME>
<UNITTYPE>Iron Ore and Manganese</UNITTYPE>
<RELATEDOPERATION>Greenfield</RELATEDOPERATION>
<LATITUDE>-18.92814</LATITUDE>
<LONGITUDE>-43.42562</LONGITUDE>
<STATUS>Future unapproved</STATUS>
<DESCRIPTION/>
<FULLPRODUCTIONDATE>TBD</FULLPRODUCTIONDATE>
<PRODUCTIONVOLUME>Up to 53 Mtpa iron ore pellet feed (wet basis)</PRODUCTIONVOLUME>
<!-- <ESTIMATEDCAPEX>TBD</ESTIMATEDCAPEX>-->
<FOOTNOTES>
<![CDATA[1. Capital expenditure shown on 100% basis in nominal terms. Platinum projects reflect approved capex.<br><br>2. Production volume represents 100% of average incremental or replacement production, at full production, unless otherwise stated.]]>
</FOOTNOTES>
</PROJECT>
<SDACTIVITY>
<ID>3.2.4.20</ID>
<TYPE>Society</TYPE>
<BUSINESS>Nickel</BUSINESS>
<RELATEDOPERATION/>
<HEADING>Listening - and acting - in Brazil</HEADING>
<SUBHEADING>SEAT community engagement session in Brazil</SUBHEADING>
<COPY>
local government.
</COPY>
<IMAGE>3.2.4.20.jpg</IMAGE>
<LINKCAPTION>Read more about SEAT in Brazil</LINKCAPTION>
<LINKURL>http://www.angloamerican.co.uk/aa/development/case-studies/society/society01/</LINKURL>
</SDACTIVITY>
</COUNTRY>
</CONTINENT>
</LOCATIONS>
</DATA>
You could just store it directly in the DOM, and serialise when desired.
If I were you I would just store the data in a db and then use an xmltexwriter to write it to where ever.
using (XmlTextWriter writer = new XmlTextWriter(OutputStream, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("DATA");
writer.WriteStartElement("SDACTS");
foreach ( SDACT in SDACTs) {
writer.WriteStartElement("SDACT");
writer.WriteAttributeString("TYPE", SDACT.Type);
writer.WriteAttributeString("COLOUR", SDACT.COLOUR);
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndDocument();
}
You could also take advantage of using .nets XML serialization see http://msdn.microsoft.com/en-us/library/ms950721.aspx