protected override IList <OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update) { IList <OutputTO> outputs = new List <OutputTO>(); allErrors = new ErrorResultTO(); var colItr = new WarewolfListIterator(); //get all the possible paths for all the string variables var outputItr = new WarewolfIterator(dataObject.Environment.Eval(OutputPath, update)); colItr.AddVariableToIterateOn(outputItr); var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update)); colItr.AddVariableToIterateOn(unameItr); var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword, update)); colItr.AddVariableToIterateOn(passItr); if (dataObject.IsDebugMode()) { AddDebugInputItem(new DebugEvalResult(OutputPath, "File or Folder", dataObject.Environment, update)); AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite")); AddDebugInputItemUserNamePassword(dataObject.Environment, update); } while (colItr.HasMoreData()) { IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker(); Dev2CRUDOperationTO opTo = new Dev2CRUDOperationTO(Overwrite); try { IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(outputItr), colItr.FetchNextValue(unameItr), colItr.FetchNextValue(passItr), true); IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst); string result = broker.Create(dstEndPoint, opTo, true); outputs.Add(DataListFactory.CreateOutputTO(Result, result)); } catch (Exception e) { outputs.Add(DataListFactory.CreateOutputTO(Result, "Failure")); allErrors.AddError(e.Message); break; } } return(outputs); }
protected override IList <OutputTO> ExecuteConcreteAction(NativeActivityContext context, out ErrorResultTO allErrors) { IList <OutputTO> outputs = new List <OutputTO>(); IDSFDataObject dataObject = context.GetExtension <IDSFDataObject>(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); allErrors = new ErrorResultTO(); ErrorResultTO errors; Guid executionId = dataObject.DataListID; IDev2IteratorCollection colItr = Dev2ValueObjectFactory.CreateIteratorCollection(); //get all the possible paths for all the string variables IBinaryDataListEntry outputPathEntry = compiler.Evaluate(executionId, enActionType.User, OutputPath, false, out errors); allErrors.MergeErrors(errors); IDev2DataListEvaluateIterator outputItr = Dev2ValueObjectFactory.CreateEvaluateIterator(outputPathEntry); colItr.AddIterator(outputItr); IBinaryDataListEntry usernameEntry = compiler.Evaluate(executionId, enActionType.User, Username, false, out errors); allErrors.MergeErrors(errors); IDev2DataListEvaluateIterator unameItr = Dev2ValueObjectFactory.CreateEvaluateIterator(usernameEntry); colItr.AddIterator(unameItr); IBinaryDataListEntry passwordEntry = compiler.Evaluate(executionId, enActionType.User, Password, false, out errors); allErrors.MergeErrors(errors); IDev2DataListEvaluateIterator passItr = Dev2ValueObjectFactory.CreateEvaluateIterator(passwordEntry); colItr.AddIterator(passItr); if (dataObject.IsDebugMode()) { AddDebugInputItem(new DebugItemVariableParams(OutputPath, "File or Folder", outputPathEntry, executionId)); AddDebugInputItem(new DebugItemStaticDataParams(Overwrite.ToString(), "Overwrite")); AddDebugInputItemUserNamePassword(executionId, usernameEntry); } while (colItr.HasMoreData()) { IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker(); Dev2CRUDOperationTO opTo = new Dev2CRUDOperationTO(Overwrite); try { IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(colItr.FetchNextRow(outputItr).TheValue, colItr.FetchNextRow(unameItr).TheValue, colItr.FetchNextRow(passItr).TheValue, true); IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst); string result = broker.Create(dstEndPoint, opTo, true); outputs.Add(DataListFactory.CreateOutputTO(Result, result)); } catch (Exception e) { outputs.Add(DataListFactory.CreateOutputTO(Result, (string)null)); allErrors.AddError(e.Message); break; } } return(outputs); }