From: Bellai Ádám Date: Thu, 28 Sep 2017 12:36:56 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=4c618d4431cccd45248483e77584cabfc527be10;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30481 --- diff --git a/client/IntegrationTests/JobEngineIT.cs b/client/IntegrationTests/JobEngineIT.cs index 384d81c2..b7ea6d5c 100644 --- a/client/IntegrationTests/JobEngineIT.cs +++ b/client/IntegrationTests/JobEngineIT.cs @@ -16,7 +16,7 @@ namespace IntegrationTests { [TestMethod] public void TestCreate() { - JobEngineAPI client = new JobEngineAPI("http://localhost:8080/services/rest/jobengine/", null, null, 100); + MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100); WorkflowAction item = new WorkflowAction(); item.description = "description"; @@ -32,7 +32,7 @@ namespace IntegrationTests { [TestMethod] public void TestCreateMany() { - JobEngineAPI client = new JobEngineAPI("http://localhost:8080/services/rest/jobengine/", null, null, 100); + MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100); for (int i = 0; i < 10; i++) { WorkflowAction item = new WorkflowAction(); @@ -63,7 +63,7 @@ namespace IntegrationTests { [TestMethod] public void TestItem() { - JobEngineAPI client = new JobEngineAPI("http://localhost:8080/services/rest/jobengine/", null, null, 100); + MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100); client.Item(); } } diff --git a/client/Maestro/ArchiveMetadata.Designer.cs b/client/Maestro/ArchiveMetadata.Designer.cs index 16e2fda1..737d7eb2 100644 --- a/client/Maestro/ArchiveMetadata.Designer.cs +++ b/client/Maestro/ArchiveMetadata.Designer.cs @@ -26,7 +26,6 @@ this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label_stuffID = new System.Windows.Forms.Label(); - this.label_stuffTitle = new System.Windows.Forms.Label(); this.label_stuffDescription = new System.Windows.Forms.Label(); this.label_mediaID = new System.Windows.Forms.Label(); this.label_mediaTitle = new System.Windows.Forms.Label(); @@ -37,7 +36,12 @@ this.textBox_mediaID = new System.Windows.Forms.TextBox(); this.textBox_mediaTitle = new System.Windows.Forms.TextBox(); this.textBox_mediaDescription = new System.Windows.Forms.TextBox(); + this.label_stuffTitle = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button_cancel = new System.Windows.Forms.Button(); + this.button_ok = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); + this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 @@ -57,7 +61,7 @@ this.tableLayoutPanel1.Controls.Add(this.textBox_mediaTitle, 1, 4); this.tableLayoutPanel1.Controls.Add(this.textBox_mediaDescription, 1, 5); this.tableLayoutPanel1.Controls.Add(this.label_stuffTitle, 0, 1); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 6; @@ -67,7 +71,7 @@ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(318, 330); + this.tableLayoutPanel1.Size = new System.Drawing.Size(324, 330); this.tableLayoutPanel1.TabIndex = 0; // // label_stuffID @@ -76,23 +80,14 @@ this.label_stuffID.Dock = System.Windows.Forms.DockStyle.Top; this.label_stuffID.Location = new System.Drawing.Point(3, 0); this.label_stuffID.Name = "label_stuffID"; - this.label_stuffID.Size = new System.Drawing.Size(87, 13); + this.label_stuffID.Size = new System.Drawing.Size(89, 13); this.label_stuffID.TabIndex = 0; this.label_stuffID.Text = "Anyag azonosító"; // - // label_stuffTitle - // - this.label_stuffTitle.AutoSize = true; - this.label_stuffTitle.Location = new System.Drawing.Point(3, 55); - this.label_stuffTitle.Name = "label_stuffTitle"; - this.label_stuffTitle.Size = new System.Drawing.Size(58, 13); - this.label_stuffTitle.TabIndex = 1; - this.label_stuffTitle.Text = "Anyag cím"; - // // label_stuffDescription // this.label_stuffDescription.AutoSize = true; - this.label_stuffDescription.Location = new System.Drawing.Point(3, 110); + this.label_stuffDescription.Location = new System.Drawing.Point(3, 108); this.label_stuffDescription.Name = "label_stuffDescription"; this.label_stuffDescription.Size = new System.Drawing.Size(66, 13); this.label_stuffDescription.TabIndex = 2; @@ -101,7 +96,7 @@ // label_mediaID // this.label_mediaID.AutoSize = true; - this.label_mediaID.Location = new System.Drawing.Point(3, 165); + this.label_mediaID.Location = new System.Drawing.Point(3, 162); this.label_mediaID.Name = "label_mediaID"; this.label_mediaID.Size = new System.Drawing.Size(86, 13); this.label_mediaID.TabIndex = 3; @@ -110,7 +105,7 @@ // label_mediaTitle // this.label_mediaTitle.AutoSize = true; - this.label_mediaTitle.Location = new System.Drawing.Point(3, 220); + this.label_mediaTitle.Location = new System.Drawing.Point(3, 216); this.label_mediaTitle.Name = "label_mediaTitle"; this.label_mediaTitle.Size = new System.Drawing.Size(57, 13); this.label_mediaTitle.TabIndex = 4; @@ -119,7 +114,7 @@ // label_mediaDescription // this.label_mediaDescription.AutoSize = true; - this.label_mediaDescription.Location = new System.Drawing.Point(3, 275); + this.label_mediaDescription.Location = new System.Drawing.Point(3, 270); this.label_mediaDescription.Name = "label_mediaDescription"; this.label_mediaDescription.Size = new System.Drawing.Size(65, 13); this.label_mediaDescription.TabIndex = 5; @@ -128,61 +123,109 @@ // textBox_stuffID // this.textBox_stuffID.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_stuffID.Location = new System.Drawing.Point(96, 3); + this.textBox_stuffID.Location = new System.Drawing.Point(98, 3); this.textBox_stuffID.Name = "textBox_stuffID"; - this.textBox_stuffID.Size = new System.Drawing.Size(219, 20); + this.textBox_stuffID.Size = new System.Drawing.Size(223, 20); this.textBox_stuffID.TabIndex = 6; // // textBox_stuffTitle // this.textBox_stuffTitle.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_stuffTitle.Location = new System.Drawing.Point(96, 58); + this.textBox_stuffTitle.Location = new System.Drawing.Point(98, 57); this.textBox_stuffTitle.Name = "textBox_stuffTitle"; - this.textBox_stuffTitle.Size = new System.Drawing.Size(219, 20); + this.textBox_stuffTitle.Size = new System.Drawing.Size(223, 20); this.textBox_stuffTitle.TabIndex = 7; // // textBox_stuffDescription // - this.textBox_stuffDescription.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_stuffDescription.Location = new System.Drawing.Point(96, 113); + this.textBox_stuffDescription.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox_stuffDescription.Location = new System.Drawing.Point(98, 111); + this.textBox_stuffDescription.Multiline = true; this.textBox_stuffDescription.Name = "textBox_stuffDescription"; - this.textBox_stuffDescription.Size = new System.Drawing.Size(219, 20); + this.textBox_stuffDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox_stuffDescription.Size = new System.Drawing.Size(223, 48); this.textBox_stuffDescription.TabIndex = 8; // // textBox_mediaID // this.textBox_mediaID.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_mediaID.Location = new System.Drawing.Point(96, 168); + this.textBox_mediaID.Location = new System.Drawing.Point(98, 165); this.textBox_mediaID.Name = "textBox_mediaID"; - this.textBox_mediaID.Size = new System.Drawing.Size(219, 20); + this.textBox_mediaID.Size = new System.Drawing.Size(223, 20); this.textBox_mediaID.TabIndex = 9; // // textBox_mediaTitle // this.textBox_mediaTitle.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_mediaTitle.Location = new System.Drawing.Point(96, 223); + this.textBox_mediaTitle.Location = new System.Drawing.Point(98, 219); this.textBox_mediaTitle.Name = "textBox_mediaTitle"; - this.textBox_mediaTitle.Size = new System.Drawing.Size(219, 20); + this.textBox_mediaTitle.Size = new System.Drawing.Size(223, 20); this.textBox_mediaTitle.TabIndex = 10; // // textBox_mediaDescription // - this.textBox_mediaDescription.Dock = System.Windows.Forms.DockStyle.Top; - this.textBox_mediaDescription.Location = new System.Drawing.Point(96, 278); + this.textBox_mediaDescription.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBox_mediaDescription.Location = new System.Drawing.Point(98, 273); + this.textBox_mediaDescription.Multiline = true; this.textBox_mediaDescription.Name = "textBox_mediaDescription"; - this.textBox_mediaDescription.Size = new System.Drawing.Size(219, 20); + this.textBox_mediaDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox_mediaDescription.Size = new System.Drawing.Size(223, 54); this.textBox_mediaDescription.TabIndex = 11; // + // label_stuffTitle + // + this.label_stuffTitle.AutoSize = true; + this.label_stuffTitle.Location = new System.Drawing.Point(3, 54); + this.label_stuffTitle.Name = "label_stuffTitle"; + this.label_stuffTitle.Size = new System.Drawing.Size(58, 13); + this.label_stuffTitle.TabIndex = 1; + this.label_stuffTitle.Text = "Anyag cím"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.button_cancel); + this.groupBox1.Controls.Add(this.button_ok); + this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox1.Location = new System.Drawing.Point(0, 330); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(324, 58); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + // + // button_cancel + // + this.button_cancel.Dock = System.Windows.Forms.DockStyle.Right; + this.button_cancel.ForeColor = System.Drawing.SystemColors.ControlText; + this.button_cancel.Location = new System.Drawing.Point(171, 16); + this.button_cancel.Name = "button_cancel"; + this.button_cancel.Size = new System.Drawing.Size(75, 39); + this.button_cancel.TabIndex = 0; + this.button_cancel.Text = "Cancel"; + this.button_cancel.UseVisualStyleBackColor = true; + // + // button_ok + // + this.button_ok.Dock = System.Windows.Forms.DockStyle.Right; + this.button_ok.Location = new System.Drawing.Point(246, 16); + this.button_ok.Name = "button_ok"; + this.button_ok.Size = new System.Drawing.Size(75, 39); + this.button_ok.TabIndex = 1; + this.button_ok.Text = "OK"; + this.button_ok.UseVisualStyleBackColor = true; + this.button_ok.Click += new System.EventHandler(this.button_ok_Click); + // // ArchiveMetadata // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(318, 330); + this.ClientSize = new System.Drawing.Size(324, 388); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.tableLayoutPanel1); this.Name = "ArchiveMetadata"; this.Text = "ArchiveMetadata"; this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.groupBox1.ResumeLayout(false); this.ResumeLayout(false); } @@ -202,5 +245,8 @@ private System.Windows.Forms.TextBox textBox_mediaID; private System.Windows.Forms.TextBox textBox_mediaTitle; private System.Windows.Forms.TextBox textBox_mediaDescription; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button_cancel; + private System.Windows.Forms.Button button_ok; } } \ No newline at end of file diff --git a/client/Maestro/ArchiveMetadata.cs b/client/Maestro/ArchiveMetadata.cs index cdf02682..0217f905 100644 --- a/client/Maestro/ArchiveMetadata.cs +++ b/client/Maestro/ArchiveMetadata.cs @@ -8,11 +8,11 @@ namespace Maestro { public ArchiveMetadata(ArchiveMetadataModel model) : this() { this.model = model; + FillTheTextBoxes(); } public ArchiveMetadata() { InitializeComponent(); - FillTheTextBoxes(); } private void FillTheTextBoxes() { @@ -23,5 +23,9 @@ namespace Maestro { textBox_mediaTitle.Text = model.MediaTitle; textBox_mediaDescription.Text = model.MediaDescription; } + + private void button_ok_Click(object sender, System.EventArgs e) { + //todo + } } } diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 33a4b0aa..8c663d81 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -9,11 +9,12 @@ using TrafficClient; using System.Collections.Generic; using System.ComponentModel; using System.Text.RegularExpressions; - +using JobEngineClient; namespace Maestro { public partial class MaestroForm { private MetadataInfo selectedMetadata; private List segments = new List(); + private MediaCubeApi mediaCubeApi; public MetadataInfo SelectedMetadata { get { @@ -28,6 +29,7 @@ namespace Maestro { private void InitializeMetadata() { InitializeOctopusSelector(); InitializeTrafficSelector(); + InitializeMediaCubeApi(); } private void InitializeTrafficSelector() { @@ -56,6 +58,13 @@ namespace Maestro { octopusIDSelector.IDChangedEvent += OnOctopusIDSelected; } + private void InitializeMediaCubeApi() { + MediaCubeMetadata metadata = Configuration.Metadatas.Where(m => { return m is MediaCubeMetadata; }).FirstOrDefault() as MediaCubeMetadata; + if (metadata == null) + return; + mediaCubeApi = new MediaCubeApi(metadata.Server.Address.ToString(), metadata.Server.UserName, metadata.Server.Password, metadata.Server.Timeout); + } + private void OnOctopusIDSelected(string selectedID) { SelectedMetadata = new MetadataInfo() { Kind = MetadataType.OctopusStory, @@ -68,31 +77,53 @@ namespace Maestro { ArchiveMetadata form = null; IDTypes idType = GetTypeOfSelectedMetadata(); ArchiveMetadataModel model = new ArchiveMetadataModel(); + Cursor.Current = Cursors.WaitCursor; if (idType == IDTypes.OctopusID) FillTheModelFromOctopus(model); else if (idType == IDTypes.TrafficID) FillTheModelFromTraffic(model); - //form = new ArchiveMetadata(model); - //form.ShowDialog(); + form = new ArchiveMetadata(model); + form.ShowDialog(); } private void FillTheModelFromTraffic(ArchiveMetadataModel model) { - throw new NotImplementedException(); + string id = selectedMetadata.ID; + TrafficAPI api = trafficIDSelector.trafficAPI; + List result = api.SearchArchiveMetadata(id); ; + ArchiveMatadataWrapper actualResult = result[0]; + model.StuffID = actualResult.ProgID; + model.StuffTitle = actualResult.ProgTitle; + model.StuffDescription = actualResult.ProgDescription; + model.MediaID = actualResult.EpisodeID; + model.MediaTitle = String.IsNullOrEmpty(actualResult.EpisodeTitle) ? actualResult.EpisodeTitle : actualResult.ProgTitle; + model.MediaDescription = actualResult.EpisodeDescription; } private void FillTheModelFromOctopus(ArchiveMetadataModel model) { string id = selectedMetadata.ID; OctopusAPI api = octopusIDSelector.GetClient(); - List stories = api.GetStoriesById(id).ToList(); + IEnumerable storyEnum = api.GetStoriesById(id); + if (storyEnum != null) { + FillModelFromStories(model, storyEnum.ToList(), api); + } else { + //List mosObjectsEnum = api.GetMosObjectsByID(id).ToList(); + //MosObject mosObject = mosObjectsEnum[0]; + List stories = api.GetStoriesByPlaceHolderId(id).ToList(); + FillModelFromStories(model, stories, api); + //todo ha mosObject, mivel töltsem fel a model-t? + } + } + + private void FillModelFromStories(ArchiveMetadataModel model, List stories, OctopusAPI api) { Story story = stories[0]; if (story.StoryFolders != null) { - List storyFolders = api.GetStoryFoldersByStoryID(id).ToList(); - //lehet több mappában is a story? + List storyFolders = api.GetStoryFoldersByStoryID(story.ID).ToList(); StoryFolder folder = storyFolders[0]; model.StuffID = folder.ID; model.StuffTitle = folder.Name; + //leírás a story body a jsonos } else if (story.Rundowns != null) { - List rundowns = api.GetRundownsByStoryID(id).ToList(); + List rundowns = api.GetRundownsByStoryID(story.ID).ToList(); Rundown rundown = rundowns[0]; model.StuffID = rundown.ID; model.StuffTitle = rundown.Name; @@ -101,7 +132,6 @@ namespace Maestro { model.MediaID = story.ID; model.MediaTitle = story.Name; model.MediaDescription = story.Script; - } private IDTypes GetTypeOfSelectedMetadata() { diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 85b168e7..40143ba1 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -46,7 +46,7 @@ namespace Maestro { //ISourceItem actualFile = new FileSourceItem() { FileInfo = new System.IO.FileInfo(actual), }; ISourceItem selectedFile = GetSourceItemFromBindingSource(actual);//bindingSource.Current as ISourceItem; string id = selectedMetadata.ID; - object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments }; + object[] parameters = new object[] { this, Configuration.Source, target, selectedFile.Name, id, segments, mediaCubeApi }; ITargetProcessor processor = (ITargetProcessor)Activator.CreateInstance(type, parameters); processors.Add(processor); } diff --git a/client/Maestro/Resources/configuration-nexio.json b/client/Maestro/Resources/configuration-nexio.json index 17eef4eb..1aa54771 100644 --- a/client/Maestro/Resources/configuration-nexio.json +++ b/client/Maestro/Resources/configuration-nexio.json @@ -41,7 +41,7 @@ { "$type": "MediaCubeMetadata", "server": { - "address": "ftp://localhost:21/out", + "address": "http://localhost:8080/services/rest/jobengine/", "userName": "dani", "password": "dani" } diff --git a/client/Maestro/Resources/configuration-unc.json b/client/Maestro/Resources/configuration-unc.json index 14986520..127416c5 100644 --- a/client/Maestro/Resources/configuration-unc.json +++ b/client/Maestro/Resources/configuration-unc.json @@ -41,7 +41,7 @@ { "$type": "MediaCubeMetadata", "server": { - "address": "ftp://localhost:21/out", + "address": "http://localhost:8080/services/rest/jobengine/", "userName": "dani", "password": "dani" } diff --git a/client/Maestro/Sources/NexioRESTSource.cs b/client/Maestro/Sources/NexioRESTSource.cs index 4fac1aa3..92298b06 100644 --- a/client/Maestro/Sources/NexioRESTSource.cs +++ b/client/Maestro/Sources/NexioRESTSource.cs @@ -28,7 +28,6 @@ namespace Maestro.Sources { public DataGridViewColumn[] Columns { get { DataGridViewColumn[] result = new DataGridViewColumn[] { - //todo DataPropertyName-et is át kell írni? new DataGridViewTextBoxColumn(){ DataPropertyName = "Name", HeaderText = StringResources.NEV, diff --git a/client/Maestro/Targets/FTPTargetProcessor.cs b/client/Maestro/Targets/FTPTargetProcessor.cs index d881d91f..bebdde15 100644 --- a/client/Maestro/Targets/FTPTargetProcessor.cs +++ b/client/Maestro/Targets/FTPTargetProcessor.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using System.Collections.Generic; using TrafficClient; using Model; +using JobEngineClient; namespace Maestro.Targets { @@ -24,10 +25,13 @@ namespace Maestro.Targets { protected FtpClient targetFTP; protected FileInfo inputFile; private string workingDir; + private MediaCubeApi mediaCubeApi; + public WorkflowAction workFlowAction { get; set; } - public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List segments) : base(parent, targetConfig, segments) { + public FTPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List segments, MediaCubeApi mediaCubeApi) : base(parent, targetConfig, segments) { FtpTrace.LogFunctions = false; + this.mediaCubeApi = mediaCubeApi; this.targetConfig = targetConfig; Uri inputUri = new Uri(String.Format("{0}/{1}", sourceConfig.Local.Address.LocalPath, inputFileName)); inputFile = new FileInfo(inputUri.LocalPath); @@ -67,11 +71,20 @@ namespace Maestro.Targets { TerminateClient(targetFTP); Finished = DateTime.Now; workFlowAction.finished = Finished; + SendWorkFlowAction(); } logger.Info(PROCESSING_COMPLETED, inputFile.Name); return result; } + private void SendWorkFlowAction() { + try { + mediaCubeApi.Create(workFlowAction); + } catch (Exception e) { + MessageBox.Show(parent , e.Message); + } + } + private void SetSubFolder(Connection connection) { Uri address = connection.Address; if (targetConfig.CreateSubFolder) diff --git a/client/Maestro/Targets/FXPTargetProcessor.cs b/client/Maestro/Targets/FXPTargetProcessor.cs index 8702450c..5d405dca 100644 --- a/client/Maestro/Targets/FXPTargetProcessor.cs +++ b/client/Maestro/Targets/FXPTargetProcessor.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Windows.Forms; using System.Collections.Generic; using TrafficClient; +using JobEngineClient; namespace Maestro.Targets { @@ -15,8 +16,8 @@ namespace Maestro.Targets { private Logger logger = LogManager.GetCurrentClassLogger(); private Source sourceConfig; - public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List segments) : - base(parent, sourceConfig, targetConfig, inputFileName, id, segments) { + public FXPTargetProcessor(Control parent, Source sourceConfig, Target targetConfig, string inputFileName, string id, List segments, MediaCubeApi mediaCubeApi ) : + base(parent, sourceConfig, targetConfig, inputFileName, id, segments, mediaCubeApi) { this.sourceConfig = sourceConfig; } diff --git a/client/Maestro/Targets/TargetProcessor.cs b/client/Maestro/Targets/TargetProcessor.cs index 14a08904..1488d3c1 100644 --- a/client/Maestro/Targets/TargetProcessor.cs +++ b/client/Maestro/Targets/TargetProcessor.cs @@ -18,8 +18,8 @@ namespace Maestro.Targets { private DateTime finished; private string input; private string output; - private Control parent; private int progress; + protected Control parent; protected Target targetConfig; protected TrafficAPI client; protected List segments; diff --git a/client/MediaCubeClient/JobEngineAPI.cs b/client/MediaCubeClient/MediaCubeApi.cs similarity index 93% rename from client/MediaCubeClient/JobEngineAPI.cs rename to client/MediaCubeClient/MediaCubeApi.cs index 05cfea47..646e4385 100644 --- a/client/MediaCubeClient/JobEngineAPI.cs +++ b/client/MediaCubeClient/MediaCubeApi.cs @@ -10,7 +10,7 @@ using System.Net; using System.Runtime.Serialization; namespace JobEngineClient { - public class JobEngineAPI { + public class MediaCubeApi { private const string DATEFORMAT = "yyyy'-'MM'-'dd'T'HH':'mm':'ssK"; private static Logger logger = LogManager.GetCurrentClassLogger(); private RestClient client; @@ -18,7 +18,7 @@ namespace JobEngineClient { private string user; private string pwd; - public JobEngineAPI(string address, string user, string pwd, int timeout) { + public MediaCubeApi(string address, string user, string pwd, int timeout) { this.user = user; this.pwd = pwd; client = new RestClient(address) { diff --git a/client/MediaCubeClient/MediaCubeClient.csproj b/client/MediaCubeClient/MediaCubeClient.csproj index e85df700..3579d9c7 100644 --- a/client/MediaCubeClient/MediaCubeClient.csproj +++ b/client/MediaCubeClient/MediaCubeClient.csproj @@ -62,7 +62,7 @@ - + diff --git a/client/OctopusClient/OctopusAPI.cs b/client/OctopusClient/OctopusAPI.cs index d4a50db0..f23fda47 100644 --- a/client/OctopusClient/OctopusAPI.cs +++ b/client/OctopusClient/OctopusAPI.cs @@ -336,7 +336,6 @@ namespace OctopusClient { return result; } - public IEnumerable GetMosObjectsByID(String id) { IEnumerable result = null; try { @@ -363,5 +362,90 @@ namespace OctopusClient { catch (Exception e) { } return result; } + + public IEnumerable GetRundownsByPlaceHolderId(string placeHolderID) { + IEnumerable result = null; + try { + var request = new RestRequest("getRundownsByPlaceHolderId/{id}", Method.GET); + request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); + var response = client.Execute(request); + if (response.ContentLength == 0) + return null; + JArray resultObject = JArray.Parse(response.Content); + + result = resultObject.Children().Select(d => { + Rundown r = new Rundown { + ID = d["id"].ToString(), + Name = d["name"].ToString(), + Start = d["scheduledStart"].ToString() + }; + logger.Debug($"{r}"); + return r; + }); + } + catch (Exception e) { + //log e.Message ?? + } + return result; + } + + public IEnumerable GetStoryFoldersByPlaceHolderId(string placeHolderID) { + IEnumerable result = null; + try { + var request = new RestRequest("getStoryFoldersByPlaceHolderId/{id}", Method.GET); + request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); + var response = client.Execute(request); + if (response.ContentLength == 0) + return null; + JArray resultObject = JArray.Parse(response.Content); + + result = resultObject.Children().Select(d => { + StoryFolder r = new StoryFolder { + ID = d["id"].ToString(), + Name = d["name"].ToString() + }; + logger.Debug($"{r}"); + return r; + }); + } + catch (Exception e) { + //log e.Message ?? + } + return result; + } + + public IEnumerable GetStoriesByPlaceHolderId(string placeHolderID) { + IEnumerable result = null; + try { + var request = new RestRequest("getStoriesByPlaceHolderId/{id}", Method.GET); + request.AddParameter("id", placeHolderID, ParameterType.UrlSegment); + var response = client.Execute(request); + if (response.ContentLength == 0) + return null; + JArray resultObject = JArray.Parse(response.Content); + + result = resultObject.Children().Select(d => { + List objs = GetMosObjectsFromStory(d); + Story r = new Story { + ID = d["id"].ToString(), + Name = d["name"].ToString(), + MosObjects = objs.ToArray() + }; + if (d["script"] != null) { + r.Script = d["script"].ToString(); + } + if (d["story_folder"] != null) + r.StoryFolders = GetStoryFolderFromStory(d).ToArray(); + if (d["rundown"] != null) + r.Rundowns = GetRundownFromStory(d).ToArray(); + logger.Debug($"{r}"); + return r; + }).OrderBy(r => { + return r.ID; + }); + } + catch (Exception e) { } + return result; + } } } diff --git a/client/PlanAIRClient/CustomDataGridView.Designer.cs b/client/PlanAIRClient/CustomDataGridView.Designer.cs new file mode 100644 index 00000000..02f57b1c --- /dev/null +++ b/client/PlanAIRClient/CustomDataGridView.Designer.cs @@ -0,0 +1,33 @@ +namespace TrafficClient { + partial class CustomDataGridView { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + components = new System.ComponentModel.Container(); + //this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + + } + + #endregion + } +} diff --git a/client/PlanAIRClient/CustomDataGridView.cs b/client/PlanAIRClient/CustomDataGridView.cs new file mode 100644 index 00000000..271d56b0 --- /dev/null +++ b/client/PlanAIRClient/CustomDataGridView.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TrafficClient { + public partial class CustomDataGridView : DataGridView { + public CustomDataGridView() { + InitializeComponent(); + this.HorizontalScrollBar.Visible = true; + this.HorizontalScrollBar.VisibleChanged += new EventHandler(HorizontalScrollBar_VisibleChanged); + //this.HorizontalScrollBar.SetBounds(this.HorizontalScrollBar.Location.X, this.HorizontalScrollBar.Location.Y, this.VerticalScrollBar.Width, this.Height); + } + + void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e) { + this.VerticalScrollBar.Visible = true; + } + } +} diff --git a/client/PlanAIRClient/Resources.Designer.cs b/client/PlanAIRClient/Resources.Designer.cs index cdd7dcd8..f35d0414 100644 --- a/client/PlanAIRClient/Resources.Designer.cs +++ b/client/PlanAIRClient/Resources.Designer.cs @@ -123,6 +123,15 @@ namespace TrafficClient { } } + /// + /// Looks up a localized string similar to Következő adás időpontja. + /// + internal static string KOVETKEZO_ADASNAP { + get { + return ResourceManager.GetString("KOVETKEZO_ADASNAP", resourceCulture); + } + } + /// /// Looks up a localized string similar to Mégse. /// diff --git a/client/PlanAIRClient/Resources.resx b/client/PlanAIRClient/Resources.resx index ca7578ac..97497eee 100644 --- a/client/PlanAIRClient/Resources.resx +++ b/client/PlanAIRClient/Resources.resx @@ -138,6 +138,9 @@ Keresés eredménye + + Következő adás időpontja + Mégse diff --git a/client/PlanAIRClient/TrafficAPI.cs b/client/PlanAIRClient/TrafficAPI.cs index ecb0c3ff..038f2b62 100644 --- a/client/PlanAIRClient/TrafficAPI.cs +++ b/client/PlanAIRClient/TrafficAPI.cs @@ -18,53 +18,6 @@ namespace TrafficClient { cliFSPReader = new CliFSPReader(); } - //public List DateSearch(DateTime from, DateTime to) - //{ - // List sqlResult = null; - // List result = null; - // SqlConnection connection = new SqlConnection(connectionString); - - // try - // { - // //ez kell? - // if (connection.State != ConnectionState.Open) - // { - // connection.Close(); - // connection.Open(); - // } - - // using (SqlCommand cmd = new SqlCommand("dbo.clIFsp_EC_MAM", connection)) - // { - // cmd.CommandType = CommandType.StoredProcedure; - // cmd.Parameters.AddWithValue("@Operation", 1001); - // cmd.Parameters.AddWithValue("@@@Options", 0); - // cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); - // cmd.Parameters.AddWithValue("@@DateParam1", from.Date); - // cmd.Parameters.AddWithValue("@@DateParam2", to.Date); - // using (SqlDataReader reader = cmd.ExecuteReader()) - // { - // while (reader.Read()) - // { - // if (sqlResult == null) - // sqlResult = new List(); - // clIFsp_EC_MAMResult item = ToclIFsp_MAMResult(reader); - // sqlResult.Add(item); - // } - // } - // } - // result = resultProcess(sqlResult); - // } - // catch (Exception e) - // { - // Debug.WriteLine(e.Message); - // } - // finally - // { - // connection.Close(); - // } - // return result; - //} - public List Search(string strParam, DateTime? from, DateTime? to, bool missingCopia) { List sqlResult = null; List result = null; @@ -118,7 +71,9 @@ namespace TrafficClient { EpisodeTitle = actual.v_EpTitle, Title = actual.v_ProgTitle, EpisodeNumber = actual.v_EpisodeID, - VariantID = actual.v_VariantID.HasValue ? actual.v_VariantID.Value : -1 + VariantID = actual.v_VariantID.HasValue ? actual.v_VariantID.Value : -1, + Episode = actual.v_Episode.HasValue ? actual.v_Episode.Value : (short)-1, + NextBroadcastDate = actual.v_NextBroadcastDate }; result.Add(actualObject); } @@ -268,5 +223,46 @@ namespace TrafficClient { } return result; } + + public List SearchArchiveMetadata(string strParam) { + List sqlResult = null; + List result = null; + try { + TryConnect(); + using (SqlCommand cmd = new SqlCommand("dbo.clIFsp_EC_MAM", connection)) { + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@Operation", 1001); + cmd.Parameters.AddWithValue("@@@Options", 40); + cmd.Parameters.AddWithValue("@@ItemID", DBNull.Value); + cmd.Parameters.AddWithValue("@@StrParam1", strParam); + sqlResult = ExecuteAndRead(cmd); + result = ProcessArchiveResult(sqlResult); + } + } + catch (Exception e) { + logger.Error(e.Message); + throw e; + } + finally { + connection.Close(); + } + return result; + } + + private List ProcessArchiveResult(List sqlResult) { + if (sqlResult == null) + return null; + List result = new List(); + foreach (clIFsp_EC_MAMResult actual in sqlResult) { + ArchiveMatadataWrapper actualObject = new ArchiveMatadataWrapper() { + EpisodeID = actual.v_EpisodeID, + EpisodeTitle = actual.v_EpTitle, + ProgID = actual.v_ProgrammeID.ToString(), + ProgTitle = actual.v_ProgTitle, + }; + result.Add(actualObject); + } + return result; + } } } diff --git a/client/PlanAIRClient/TrafficClient.csproj b/client/PlanAIRClient/TrafficClient.csproj index ad10b1f9..50e66513 100644 --- a/client/PlanAIRClient/TrafficClient.csproj +++ b/client/PlanAIRClient/TrafficClient.csproj @@ -51,6 +51,12 @@ + + Component + + + CustomDataGridView.cs + True diff --git a/client/PlanAIRClient/TrafficIDSelector.Designer.cs b/client/PlanAIRClient/TrafficIDSelector.Designer.cs index 59c06c81..9b3c8441 100644 --- a/client/PlanAIRClient/TrafficIDSelector.Designer.cs +++ b/client/PlanAIRClient/TrafficIDSelector.Designer.cs @@ -29,14 +29,13 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.trafficAPIBindingSource = new System.Windows.Forms.BindingSource(this.components); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker3 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker4 = new System.ComponentModel.BackgroundWorker(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.panel1 = new System.Windows.Forms.Panel(); + this.dataGridView1 = new TrafficClient.CustomDataGridView(); this.scheduledDate = new System.Windows.Forms.DateTimePicker(); this.textBox1 = new System.Windows.Forms.TextBox(); this.searchButton = new System.Windows.Forms.Button(); @@ -48,54 +47,42 @@ this.tableLayoutPanelSearch = new System.Windows.Forms.TableLayoutPanel(); this.panel2 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.trafficAPIBindingSource)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); this.tableLayoutPanelSearch.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); // + // panel1 + // + this.panel1.Controls.Add(this.dataGridView1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 62); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(263, 217); + this.panel1.TabIndex = 11; + // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.AllowUserToResizeRows = false; this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells; - this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; this.dataGridView1.BackgroundColor = System.Drawing.Color.White; this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; this.dataGridView1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.Gainsboro; - dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle1; this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dataGridView1.Location = new System.Drawing.Point(0, 0); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(6); this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersVisible = false; - this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dataGridView1.Size = new System.Drawing.Size(263, 217); - this.dataGridView1.TabIndex = 1; + this.dataGridView1.TabIndex = 0; this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); // - // panel1 - // - this.panel1.Controls.Add(this.dataGridView1); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 62); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(263, 217); - this.panel1.TabIndex = 11; - // // scheduledDate // this.scheduledDate.CustomFormat = " "; @@ -234,8 +221,8 @@ this.Name = "TrafficIDSelector"; this.Size = new System.Drawing.Size(263, 279); ((System.ComponentModel.ISupportInitialize)(this.trafficAPIBindingSource)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); this.tableLayoutPanelSearch.ResumeLayout(false); @@ -253,7 +240,6 @@ private System.ComponentModel.BackgroundWorker backgroundWorker3; private System.ComponentModel.BackgroundWorker backgroundWorker4; private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.DateTimePicker scheduledDate; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button searchButton; @@ -264,5 +250,6 @@ private System.Windows.Forms.RadioButton radioButtonPromo; private System.Windows.Forms.RadioButton radioButtonAD; private System.Windows.Forms.Panel panel2; + private CustomDataGridView dataGridView1; } } diff --git a/client/PlanAIRClient/TrafficIDSelector.cs b/client/PlanAIRClient/TrafficIDSelector.cs index 82def78a..724f73ab 100644 --- a/client/PlanAIRClient/TrafficIDSelector.cs +++ b/client/PlanAIRClient/TrafficIDSelector.cs @@ -1,6 +1,7 @@ using System.Windows.Forms; using System; using System.Drawing; +using System.ComponentModel; namespace TrafficClient { public delegate void OnSelectedIDChanged(string ID, int variantID); @@ -13,8 +14,9 @@ namespace TrafficClient { public TrafficIDSelector() { InitializeComponent(); InitializeTexts(); - test(); + //test(); panel1.Dock = DockStyle.Fill; + } private void test() { @@ -39,19 +41,24 @@ namespace TrafficClient { HeaderText = Resources.TRAFFIC_ID }, new DataGridViewTextBoxColumn() { - AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "Title", HeaderText = Resources.CIM }, new DataGridViewTextBoxColumn() { - AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader, + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "EpisodeTitle", HeaderText = Resources.EPIZOD_CIM }, new DataGridViewTextBoxColumn() { - AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, - DataPropertyName = "EpisodeNumber", + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, + DataPropertyName = "Episode", HeaderText = Resources.EPIZOD + }, + new DataGridViewTextBoxColumn() { + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, + DataPropertyName = "NextBroadcastDate", + HeaderText = Resources.KOVETKEZO_ADASNAP } } ); @@ -82,6 +89,7 @@ namespace TrafficClient { return; } dataGridView1.DataSource = result; + //dataGridView1.Sort(dataGridView1.Columns[5], ListSortDirection.Ascending); } private void textBox1_KeyDown(object sender, KeyEventArgs e) { @@ -127,7 +135,7 @@ namespace TrafficClient { else res.Selected = false; if (checkBoxCell.Value.Equals(true)) { - + IDChangedEvent?.Invoke(res.MediaID, res.VariantID); } else IDChangedEvent?.Invoke(string.Empty, 0); @@ -147,7 +155,18 @@ namespace TrafficClient { public string Title { get; set; } public string EpisodeTitle { get; set; } public string EpisodeNumber { get; set; } - public int VariantID { get; set; } + public short Episode { get; set; } + public DateTime? NextBroadcastDate { get; set; } + } + + public class ArchiveMatadataWrapper { + + public string ProgTitle { get; set; } + public string ProgDescription { get; set; } + public string ProgID { get; set; } + public string EpisodeTitle { get; set; } + public string EpisodeDescription { get; set; } + public string EpisodeID { get; set; } } } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/octopus/IOctopusAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/octopus/IOctopusAPI.java index 55e4e722..542b8b59 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/octopus/IOctopusAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/octopus/IOctopusAPI.java @@ -23,6 +23,8 @@ public interface IOctopusAPI { List getStoryFoldersByPlaceHolderId(String placeHolderID); + List getStoriesByPlaceHolderId(String placeHolderID); + List getStories(); List getStoriesByIDRegex(String id); diff --git a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java index d4587c62..8a36592c 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java @@ -234,4 +234,20 @@ public class OctopusAPI implements IOctopusAPI { } return mosObjectsResult; } + + @Override + public List getStoriesByPlaceHolderId(String placeHolderID) { + List result = new ArrayList<>(); + DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME); + DBCollection rundownCollection = db.getCollection(RUNDOWN_COLLECTION_NAME); + BasicDBObject globalId = new BasicDBObject("id", placeHolderID); + BasicDBObject elemmatch = new BasicDBObject("$elemMatch", globalId); + BasicDBObject mosObjects = new BasicDBObject("mosObjects", elemmatch); + + DBCursor find = storyCollection.find(mosObjects); + if(find.hasNext()) + result.add(find.next()); + //result = getRundownsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); + return result; + } } diff --git a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java index 45b0c526..57a1d438 100644 --- a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java +++ b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java @@ -62,7 +62,16 @@ public class OctopusAPITest { List actual = sut.getStoryFolders(62549297); } - + + @Test + public void getStoriesByPlaceHolderIdTest() throws SQLException { + sut = new OctopusAPI(); + + List actual = sut.getStoriesByPlaceHolderId("1589225"); + + Assert.assertFalse(actual.isEmpty()); + } + @Test public void getStoryFoldersTest() throws SQLException { sut = new OctopusAPI(); diff --git a/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java b/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java index 857e8a27..2db2f3c9 100644 --- a/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java +++ b/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java @@ -173,8 +173,8 @@ public class OctopusRESTService { logger.trace("Entry"); Response result = null; try { - List stories = octopusService.getMosObjectsByID(id); - result = Response.ok(stories).build(); + List mosObjects = octopusService.getMosObjectsByID(id); + result = Response.ok(mosObjects).build(); } catch (Exception e) { result = createErrorResponse(e); } @@ -190,8 +190,8 @@ public class OctopusRESTService { logger.trace("Entry"); Response result = null; try { - List stories = octopusService.getStoryFolders(Long.parseLong(id)); - result = Response.ok(stories).build(); + List storyFolders = octopusService.getStoryFolders(Long.parseLong(id)); + result = Response.ok(storyFolders).build(); } catch (Exception e) { result = createErrorResponse(e); } @@ -207,8 +207,42 @@ public class OctopusRESTService { logger.trace("Entry"); Response result = null; try { - List stories = octopusService.getRundownByStoryID(Long.parseLong(id)); - result = Response.ok(stories).build(); + List rundowns = octopusService.getRundownByStoryID(Long.parseLong(id)); + result = Response.ok(rundowns).build(); + } catch (Exception e) { + result = createErrorResponse(e); + } + logger.trace("Exit"); + return result; + } + + @GET + @Path("/getRundownsByPlaceHolderId/{id}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public Response getRundownsByPlaceHolderId(@PathParam("id") String id) { + logger.trace("Entry"); + Response result = null; + try { + List rundowns = octopusService.getRundownsByPlaceHolderId(id); + result = Response.ok(rundowns).build(); + } catch (Exception e) { + result = createErrorResponse(e); + } + logger.trace("Exit"); + return result; + } + + @GET + @Path("/getStoryFoldersByPlaceHolderId/{id}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public Response getStoryFoldersByPlaceHolderId(@PathParam("id") String id) { + logger.trace("Entry"); + Response result = null; + try { + List storyFolders = octopusService.getStoryFoldersByPlaceHolderId(id); + result = Response.ok(storyFolders).build(); } catch (Exception e) { result = createErrorResponse(e); } @@ -216,4 +250,20 @@ public class OctopusRESTService { return result; } + @GET + @Path("/getStoriesByPlaceHolderId/{id}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public Response getStoriesByPlaceHolderId(@PathParam("id") String id) { + logger.trace("Entry"); + Response result = null; + try { + List stories = octopusService.getStoriesByPlaceHolderId(id); + result = Response.ok(stories).build(); + } catch (Exception e) { + result = createErrorResponse(e); + } + logger.trace("Exit"); + return result; + } } \ No newline at end of file