When a user submits a file from their workarea I want to do a get latest on all other workareas. I know that this is not recommended because you wouldn't ordinarily want to overwrite a file that some other user is working on in some other workarea. In our environment files may only be edited one-at-a-time. When userA opens fileA all other users are locked out. So.. we want to publish the file to all workareas during workflow. Our workflow is done in .NET (C#) - leaving me to be a bit of a PERL dummy. I am running some test to see if the same process would be faster outside of .NET and obviously want to identically recreate the workflow behavior in Perl.
I believe that I would add the code to do this in myWorkflow.wft. I am pretty sure that I do this with the CLT - iwupdate.exe. That is where what I know ends. If somebody has a sample pm that loops through all workareas in a specified (or current) branch and performs iwupdate - I would really appreciate it. (Thank you in advance Smitty :-) )
Our C# code:
foreach( string workarea in Directory.GetDirectories( jobTask.IWMOUNT + jobTask.Workarea.Branch + "\\WORKAREA" ))
{
string dirName = Regex.Replace( workarea,
@^.*WORKAREA[\\/], "" );
if ( dirName.ToLower() != jobTask.Workarea.Name.ToLower())
{
jobTask.ProcessLog.AppendFormat( "{0} !=\r\n{1}", dirName.ToLower(), jobTask.Workarea.Name.ToLower());
foreach( IWFile iwFile in jobTask.IWFiles )
{
string staging = jobTask.IWMOUNT + jobTask.Workarea.Branch + "\\STAGING\\" + iwFile.AreaRelativeFile;
if ( File.Exists( staging ))
{
CommandLineTool clt = new CommandLineTool( Util.DetermineConfigurable( Configurable.IWHOME ) + "\\bin\\iwupdate",
"-w",
jobTask.IWMOUNT + jobTask.Workarea.Branch + "\\STAGING\\" + iwFile.AreaRelativeFile,
jobTask.IWMOUNT + jobTask.Workarea.Branch + "\\WORKAREA\\" + dirName );
if (( clt.Execute() != 0 || clt.MixedOutput != "" ) && clt.MixedOutput.IndexOf( "same as the other version" ) < 0 )
return( jobTask.ErrorCallBack( clt.FullErrorMessage ));
}
else
{
new IWFile( new Workarea( jobTask.Workarea.Branch + "\\WORKAREA\\" + dirName ), iwFile.AreaRelativeFile ).Delete();
}
}
}
}
Robert Joseph
Senior Web Engineer
CNF Inc.