private void SetAction(PullPrintDocumentProcessActions oldAction, SafeComActivityData newActivitytData) { switch (oldAction) { case PullPrintDocumentProcessActions.PrintSingleDocument: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.Print; break; case PullPrintDocumentProcessActions.PrintAllDocuments: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.PrintAll; break; case PullPrintDocumentProcessActions.PrintKeepSingleDocument: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.PrintRetain; break; case PullPrintDocumentProcessActions.PrintKeepAllDocuments: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.PrintRetainAll; newActivitytData.SelectAll = true; break; case PullPrintDocumentProcessActions.DeleteSingleDocument: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.Delete; break; case PullPrintDocumentProcessActions.DeleteAllDocuments: newActivitytData.DocumentProcessAction = SafeComPullPrintAction.DeleteAll; newActivitytData.SelectAll = true; break; } }
public void Initialize(PluginEnvironment environment) { _activityData = new SafeComActivityData(); assetSelectionControl.Initialize(_deviceAttributes); printingTaskConfigurationControl.Initialize(); SetConfiguration(); }
/// <summary> /// Initializes a new instance of the <see cref="EquitracPullPrintManager"/> class. /// </summary> /// <param name="pluginExecutionData">The plugin execution data.</param> /// <param name="activityData">The activity data.</param> public SafeComPullPrintManager(PluginExecutionData pluginExecutionData, SafeComActivityData activityData) : base(pluginExecutionData) { _activityData = activityData; PullPrintSolution = "Follow-You Printing"; this.LockTimeouts = _activityData.LockTimeouts; this.AuthProvider = _activityData.AuthProvider; }
/// <summary> /// Executes this plugin's workflow using the specified <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionData" />. /// </summary> /// <param name="executionData">The <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionData" /> to use for execution.</param> /// <returns> /// A <see cref="T:HP.ScalableTest.Framework.Plugin.PluginExecutionResult" /> indicating the outcome of the execution. /// </returns> public PluginExecutionResult Execute(PluginExecutionData executionData) { SafeComActivityData data = executionData.GetMetadata <SafeComActivityData>(ConverterProvider.GetMetadataConverters()); if (_documentCollectionIterator == null) { CollectionSelectorMode mode = data.ShuffleDocuments ? CollectionSelectorMode.ShuffledRoundRobin : CollectionSelectorMode.RoundRobin; _documentCollectionIterator = new DocumentCollectionIterator(mode); } SafeComPullPrintManager manager = new SafeComPullPrintManager(executionData, data); manager.StatusUpdate += UpdateStatus; manager.DeviceSelected += UpdateDevice; manager.DocumentActionSelected += UpdateDocumentAction; manager.TimeStatusUpdate += PullPrintManager_TimeStatusUpdate; manager.SessionIdUpdate += UpdateSessionId; if (executionData.PrintQueues.Any() && executionData.Documents.Any()) { try { manager.ExecutePrintJob(_documentCollectionIterator, data.UsePrintServerNotification, data.DelayAfterPrint); } catch (PrintQueueNotAvailableException ex) { //This exception has already been logged in the call to manager.ExecutePrintJob return(new PluginExecutionResult(PluginResult.Failed, ex, "Print Failure.")); } } return(manager.ExecutePullPrintOperation()); }
public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment) { _activityData = configuration.GetMetadata <SafeComActivityData>(ConverterProvider.GetMetadataConverters()); _pluginConfigurationData = configuration; assetSelectionControl.Initialize(_pluginConfigurationData.Assets, _deviceAttributes); printingTaskConfigurationControl.Initialize(_pluginConfigurationData.Documents, _pluginConfigurationData.PrintQueues, _activityData.DelayAfterPrint, _activityData.ShuffleDocuments, _activityData.UsePrintServerNotification); SetConfiguration(); }
/// <summary> /// Validates the given metadata against the SafeCom Activity data. /// </summary> /// <param name="configurationData">The configuration data.</param> /// <returns>true if valid</returns> public bool ValidateMetadata(ref PluginConfigurationData configurationData) { bool validData = true; SafeComActivityData activityData = null; try { activityData = configurationData.GetMetadata <SafeComActivityData>(ConverterProvider.GetMetadataConverters()); } catch { activityData = new SafeComActivityData(); validData = false; } configurationData = new PluginConfigurationData(activityData, SafeComPullPrintingConfigurationControl.Version); return(validData); }
private void ConvertPrintingTask(XNamespace rootNS, XElement xml, SafeComActivityData newActivityData) { XElement prinTaskElement = xml.Element(rootNS + "PrintingTaskData"); XNamespace prinTaskNS = GetNamespace(prinTaskElement); try { // Set native properties newActivityData.ShuffleDocuments = GetBool(prinTaskElement, "ShuffleDocuments"); // Only set if a real value is there. int delayVal = GetInt(prinTaskElement, "DelayAfterPrint"); if (delayVal > 0) { newActivityData.DelayAfterPrint = delayVal; } } catch (ArgumentNullException) { } }
/// <summary> /// Converts the specified XML metadata to the new version. /// </summary> /// <param name="xml">The XML metadata.</param> /// <returns>System.Xml.Linq.XElement.</returns> public XElement Convert(XElement xml) { // Create Proxy object, deserialize what we can. SafeComActivityData1_0 proxyData = Serializer.Deserialize <SafeComActivityData1_0>(xml, Maps); // Get XML root namespace for manual conversion XNamespace rootNS = xml.GetDefaultNamespace(); // Create a new ActivityData SafeComActivityData resultData = new SafeComActivityData() { LockTimeouts = proxyData.LockTimeouts, DeviceMemoryProfilerConfig = proxyData.DeviceMemoryProfilerConfig, SafeComAuthentication = UseSolutionAuth(rootNS, xml) }; // Set the DocumentProcessAction property SetAction(proxyData.DocumentProcessAction, resultData); ConvertPrintingTask(rootNS, xml, resultData); return(Serializer.Serialize(resultData)); }
/// <summary> /// Converts the specified XML metadata to the new version. /// </summary> /// <param name="xml">The XML metadata.</param> /// <returns>System.Xml.Linq.XElement.</returns> public XElement Convert(XElement xml) { // Create Proxy object, serialize what we can SafeComActivityData1_1 proxyData = Serializer.Deserialize <SafeComActivityData1_1>(xml, Maps); // Get XML root namespace for manual conversion XNamespace rootNS = xml.GetDefaultNamespace(); // Create the latest ActivityData SafeComActivityData resultData = new SafeComActivityData() { DocumentProcessAction = proxyData.DocumentProcessAction, LockTimeouts = proxyData.LockTimeouts, DeviceMemoryProfilerConfig = proxyData.DeviceMemoryProfilerConfig, SafeComAuthentication = proxyData.SafeComAuthentication, NumberOfCopies = proxyData.NumberOfCopies, SelectAll = proxyData.SelectAll }; ConvertPrintingTask(rootNS, xml, resultData); return(Serializer.Serialize(resultData)); }