{\r
"title": "Lebony betöltő",\r
- "active": false,\r
+ "active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"player": {\r
/// </summary>\r
private void InitializeComponent() {\r
this.components = new System.ComponentModel.Container();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();\r
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MaestroForm));\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();\r
this.groupSource = new System.Windows.Forms.GroupBox();\r
this.dgSource = new System.Windows.Forms.DataGridView();\r
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.dgSource.BackgroundColor = System.Drawing.Color.White;\r
this.dgSource.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
this.dgSource.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;\r
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
- this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;\r
+ dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;\r
+ this.dgSource.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;\r
this.dgSource.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r
this.dgSource.DataSource = this.bindingSource;\r
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;\r
- dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black;\r
- dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgSource.DefaultCellStyle = dataGridViewCellStyle2;\r
+ dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText;\r
+ dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle12.SelectionForeColor = System.Drawing.Color.Black;\r
+ dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgSource.DefaultCellStyle = dataGridViewCellStyle12;\r
this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgSource.EnableHeadersVisualStyles = false;\r
this.dgSource.Location = new System.Drawing.Point(10, 47);\r
this.dgSource.Name = "dgSource";\r
this.dgSource.RowHeadersVisible = false;\r
- dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle3;\r
+ dataGridViewCellStyle13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle13;\r
this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgSource.Size = new System.Drawing.Size(330, 159);\r
this.textSelectedSource.ReadOnly = true;\r
this.textSelectedSource.Size = new System.Drawing.Size(288, 26);\r
this.textSelectedSource.TabIndex = 10;\r
+ this.textSelectedSource.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textSelectedSource_KeyDown);\r
// \r
// label1\r
// \r
this.textSelectedMetadata.Size = new System.Drawing.Size(288, 26);\r
this.textSelectedMetadata.TabIndex = 12;\r
this.textSelectedMetadata.TextChanged += new System.EventHandler(this.OnMetadataIDChanged);\r
+ this.textSelectedMetadata.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textSelectedMetadata_KeyDown);\r
// \r
// tsMetadata\r
// \r
this.columnOutput,\r
this.columnKillDate});\r
this.dgJobs.DataSource = this.bindingSourceJobs;\r
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;\r
- dataGridViewCellStyle6.NullValue = null;\r
- dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black;\r
- dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgJobs.DefaultCellStyle = dataGridViewCellStyle6;\r
+ dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle16.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle16.ForeColor = System.Drawing.SystemColors.ControlText;\r
+ dataGridViewCellStyle16.NullValue = null;\r
+ dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle16.SelectionForeColor = System.Drawing.Color.Black;\r
+ dataGridViewCellStyle16.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgJobs.DefaultCellStyle = dataGridViewCellStyle16;\r
this.dgJobs.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgJobs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgJobs.EnableHeadersVisualStyles = false;\r
this.dgJobs.Location = new System.Drawing.Point(3, 3);\r
this.dgJobs.Name = "dgJobs";\r
this.dgJobs.RowHeadersVisible = false;\r
- dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle7;\r
+ dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgJobs.RowsDefaultCellStyle = dataGridViewCellStyle17;\r
this.dgJobs.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgJobs.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgJobs.Size = new System.Drawing.Size(988, 90);\r
// \r
this.columnID.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnID.DataPropertyName = "ID";\r
- dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.columnID.DefaultCellStyle = dataGridViewCellStyle4;\r
+ dataGridViewCellStyle14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.columnID.DefaultCellStyle = dataGridViewCellStyle14;\r
this.columnID.HeaderText = "ID";\r
this.columnID.Name = "columnID";\r
this.columnID.Width = 44;\r
// \r
this.columnStatus.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;\r
this.columnStatus.DataPropertyName = "Status";\r
- dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.columnStatus.DefaultCellStyle = dataGridViewCellStyle5;\r
+ dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.columnStatus.DefaultCellStyle = dataGridViewCellStyle15;\r
this.columnStatus.HeaderText = "Status";\r
this.columnStatus.Name = "columnStatus";\r
this.columnStatus.Width = 66;\r
this.dgMessages.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {\r
this.dataGridViewTextBoxColumn1,\r
this.dataGridViewTextBoxColumn2});\r
- dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Red;\r
- dataGridViewCellStyle9.NullValue = null;\r
- dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Red;\r
- dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgMessages.DefaultCellStyle = dataGridViewCellStyle9;\r
+ dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle19.ForeColor = System.Drawing.Color.Red;\r
+ dataGridViewCellStyle19.NullValue = null;\r
+ dataGridViewCellStyle19.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle19.SelectionForeColor = System.Drawing.Color.Red;\r
+ dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgMessages.DefaultCellStyle = dataGridViewCellStyle19;\r
this.dgMessages.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgMessages.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgMessages.EnableHeadersVisualStyles = false;\r
this.dgMessages.Name = "dgMessages";\r
this.dgMessages.ReadOnly = true;\r
this.dgMessages.RowHeadersVisible = false;\r
- dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle10;\r
+ dataGridViewCellStyle20.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dgMessages.RowsDefaultCellStyle = dataGridViewCellStyle20;\r
this.dgMessages.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgMessages.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgMessages.Size = new System.Drawing.Size(988, 90);\r
// \r
this.dataGridViewTextBoxColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;\r
this.dataGridViewTextBoxColumn2.DataPropertyName = "Message";\r
- dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8;\r
+ dataGridViewCellStyle18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle18;\r
this.dataGridViewTextBoxColumn2.HeaderText = "Üzenet";\r
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";\r
this.dataGridViewTextBoxColumn2.ReadOnly = true;\r
IEnumerable<Story> octopusResult = null;\r
switch (metadataType) {\r
case MetadataType.OctopusPlaceHolder:\r
- octopusResult = api.GetStoriesByPlaceHolderId(id);\r
+ octopusResult = api.GetStoriesByPlaceHolderID(id);\r
break;\r
case MetadataType.OctopusStory:\r
- octopusResult = api.GetStoriesByParentStoryId(id);\r
+ octopusResult = api.GetStoriesByParentStoryID(id);\r
break;\r
}\r
- if (octopusResult == null)\r
+ List<Story> stories = octopusResult?.ToList();\r
+ if (stories == null || stories.Count == 0)\r
return null;\r
- List<Story> stories = octopusResult.ToList();\r
- return GetStoryMetadata(stories);\r
+ return GetStoryMetadata(stories[0]);\r
}\r
\r
- private ArchiveMetadata GetStoryMetadata(List<Story> stories) {\r
- if (stories == null || stories.Count == 0)\r
- return null;\r
- Story story = stories[0];\r
+ private ArchiveMetadata GetStoryMetadata(Story story) {\r
ArchiveMetadata result = new ArchiveMetadata();\r
-\r
- OctopusAPI api = octopusIDSelector.GetClient();\r
if (story.Rundowns != null && story.Rundowns.Length > 0) {\r
- IEnumerable<Rundown> rundownsEnum = api.GetRundownsByStoryID(story.ID);\r
- if (rundownsEnum == null)\r
- return null;\r
- List<Rundown> rundowns = rundownsEnum.ToList();\r
- Rundown rundown = rundowns[0];\r
+ Rundown rundown = story.Rundowns[0];\r
result.itemHouseId = rundown.ID;\r
result.itemTitle = rundown.Name;\r
- result.itemDescription = rundown.Start.ToString();\r
+ //result.itemDescription = rundown.Start.ToString();\r
} else if (story.StoryFolders != null && story.StoryFolders.Length > 0) {\r
- IEnumerable<StoryFolder> storyFoldersEnum = api.GetStoryFoldersByStoryID(story.ID);\r
- if (storyFoldersEnum == null)\r
- return null;\r
- List<StoryFolder> storyFolders = storyFoldersEnum.ToList();\r
- StoryFolder folder = storyFolders[0];\r
+ StoryFolder folder = story.StoryFolders[0];\r
result.itemHouseId = folder.ID;\r
result.itemTitle = folder.Name;\r
}\r
- result.mediaHouseId = story.ID;\r
+ result.mediaHouseId = story.ParentStoryID;\r
result.mediaTitle = story.Name;\r
result.mediaDescription = story.ScriptContent;\r
return result;\r
MetadataType metadataType = GuessMetadataType(SelectedMetadata?.ID);\r
btnLookupMetadata.Enabled = metadataType != MetadataType.None && metadataType != MetadataType.MediaCube;\r
}\r
+\r
+ private void textSelectedMetadata_KeyDown(object sender, KeyEventArgs e) {\r
+ if (e.KeyCode != Keys.Return || !btnLookupMetadata.Enabled)\r
+ return;\r
+ Lookup(SelectedMetadata.ID);\r
+ }\r
+\r
}\r
}\r
private string GetPrefix(string name) {\r
if (String.IsNullOrEmpty(name))\r
return null;\r
- string[] byHyphen = name.Replace('_', '-').Replace('.', '-').Split('-');\r
- return byHyphen.Length > 0 ? byHyphen[0] : null;\r
+\r
+ string nameWithoutExtension = name.Contains(".") ? name.Split('.')[0] : name;\r
+ var t = GuessMetadataType(nameWithoutExtension);\r
+ if (t != MetadataType.MediaCube && t != MetadataType.None)\r
+ return nameWithoutExtension;\r
+\r
+ if (nameWithoutExtension.Contains("-")) {\r
+ int start = nameWithoutExtension.Length;\r
+ while (true) {\r
+ int p = nameWithoutExtension.LastIndexOf("-", start);\r
+ if (p < 1)\r
+ break;\r
+ start = p - 1;\r
+ string x = nameWithoutExtension.Substring(0, p);\r
+ var z = GuessMetadataType(x);\r
+ if (z != MetadataType.MediaCube && z != MetadataType.None)\r
+ return x;\r
+ }\r
+ }\r
+ if (nameWithoutExtension.Contains("_")) {\r
+ int start = nameWithoutExtension.Length;\r
+ while (true) {\r
+ int p = nameWithoutExtension.LastIndexOf("_", start);\r
+ if (p < 1)\r
+ break;\r
+ start = p - 1;\r
+ string x = nameWithoutExtension.Substring(0, p);\r
+ var z = GuessMetadataType(x);\r
+ if (z != MetadataType.MediaCube && z != MetadataType.None)\r
+ return x;\r
+ }\r
+ }\r
+\r
+ //string[] byHyphen = name.Replace('_', '-').Replace('.', '-').Split('-');\r
+ //return byHyphen.Length > 0 ? byHyphen[0] : null;\r
+ return null;\r
}\r
\r
private FileInfo GetSelectedSourceFileInfo() {\r
SelectedSource = null;\r
}\r
\r
+ private void textSelectedSource_KeyDown(object sender, KeyEventArgs e) {\r
+ if (e.KeyCode != Keys.Return || !btnLookupBySource.Enabled)\r
+ return;\r
+ Lookup(SelectedSource.Prefix);\r
+ }\r
+\r
private void UpdateLookupBySourceEnabled() {\r
MetadataType metadataType = GuessMetadataType(SelectedSource?.Prefix);\r
btnLookupBySource.Enabled = metadataType != MetadataType.MediaCube && metadataType != MetadataType.None;\r
if (e.Button == MouseButtons.Right)\r
treeFolders.SelectedNode = treeFolders.GetNodeAt(e.X, e.Y);\r
}\r
+\r
+\r
}\r
}\r
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w\r
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0\r
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACU\r
- BwAAAk1TRnQBSQFMAwEBAAFYAQABWAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA\r
+ BwAAAk1TRnQBSQFMAwEBAAFgAQABYAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA\r
AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA\r
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA\r
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm\r
AUADAAEQAwABAQEAAQEFAAGAFwAD/4EACw==\r
</value>\r
</data>\r
+ <metadata name="tsSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+ <value>951, 17</value>\r
+ </metadata>\r
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />\r
<data name="picClearFilter.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">\r
<value>\r
3/jmkprcKEuYE8aOir3NRGolzAnzVFoPuyGPLs5GSj/4XULq1sxx1wAAAABJRU5ErkJggg==\r
</value>\r
</data>\r
- <metadata name="tsSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
- <value>951, 17</value>\r
+ <metadata name="tsMetadata.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+ <value>846, 17</value>\r
</metadata>\r
<metadata name="tsMetadata.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
<value>846, 17</value>\r
// You can specify all the values or you can default the Build and Revision Numbers\r
// by using the '*' as shown below:\r
// [assembly: AssemblyVersion("1.0.*")]\r
-[assembly: AssemblyVersion("2.0.4.0")]\r
-[assembly: AssemblyFileVersion("2.0.4.0")]\r
+[assembly: AssemblyVersion("2.0.4.2")]\r
+[assembly: AssemblyFileVersion("2.0.4.2")]\r
public class OctopusAPI {\r
private static Logger logger = LogManager.GetCurrentClassLogger();\r
public const string UNNAMED = "<üres>";\r
+ private const string ID = "id";\r
private RestClient client;\r
private string user;\r
private string pwd;\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetRundownStories(string rundownID) {\r
- IEnumerable<Story> result = null;\r
+ public IEnumerable<Rundown> GetRundownsByParentStoryID(String id) {\r
+ IEnumerable<Rundown> result = null;\r
try {\r
- var request = new RestRequest("stories/{rundownID}", Method.GET);\r
- request.AddParameter("rundownID", rundownID, ParameterType.UrlSegment);\r
+ var request = new RestRequest("rundownsByParentStoryID/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
- result = resultObject.Children().Select(d => {\r
- Story r = ToRundownStory(d, rundownID);\r
- //logger.Debug($"{r}");\r
- return r;\r
- }).OrderBy(r => {\r
- return r.ID;\r
- });\r
+ result = resultObject.Children().Select(d => ToRundown(d));\r
}\r
catch (Exception e) {\r
OnError(e);\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetStoryFolderStories(string storyFolderID) {\r
- IEnumerable<Story> result = null;\r
+ public IEnumerable<Rundown> GetRundownsByPlaceHolderId(string id) {\r
+ IEnumerable<Rundown> result = null;\r
try {\r
- var request = new RestRequest("storiesByStoryFolderID/{storyFolderID}", Method.GET);\r
- request.AddParameter("storyFolderID", storyFolderID, ParameterType.UrlSegment);\r
+ var request = new RestRequest("rundownsByPlaceHolderID/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
- result = resultObject.Children().Select(d => {\r
- Story r = ToStoryFolderStory(d, storyFolderID);\r
- logger.Debug($"{r}");\r
- return r;\r
- }).OrderBy(r => {\r
- return r.ID;\r
- });\r
+ result = resultObject.Children().Select(d => ToRundown(d));\r
}\r
catch (Exception e) {\r
OnError(e);\r
return result;\r
}\r
\r
- public IEnumerable<StoryFolder> getStoryFolders() {\r
- IEnumerable<StoryFolder> result = null;\r
+ public IEnumerable<Story> GetRundownStories(string id) {\r
+ IEnumerable<Story> result = null;\r
try {\r
- var request = new RestRequest("storyfolders", Method.GET);\r
+ var request = new RestRequest("rundownStories/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- StoryFolder r = ToStoryFolder(d);\r
+ Story r = ToRundownStory(d, id);\r
//logger.Debug($"{r}");\r
return r;\r
+ }).OrderBy(r => {\r
+ return r.ID;\r
});\r
}\r
catch (Exception e) {\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetStories() {\r
+ public IEnumerable<Story> GetStoriesByID(string id) {\r
IEnumerable<Story> result = null;\r
try {\r
- var request = new RestRequest("stories", Method.GET);\r
+ var request = new RestRequest("rundownStories/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- Story r = ToStory(d);\r
- logger.Debug($"{r}");\r
+ Story r = ToRundownStory(d, id);\r
+ //logger.Debug($"{r}");\r
return r;\r
+ }).OrderBy(r => {\r
+ return r.ID;\r
});\r
}\r
catch (Exception e) {\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetStoriesById(String id) {\r
+ public IEnumerable<Story> GetStoriesByParentStoryID(String id) {\r
IEnumerable<Story> result = null;\r
try {\r
- var request = new RestRequest("getStoriesByID/{id}", Method.GET);\r
- request.AddParameter("id", id, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storiesByParentStoryID/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetStoriesByParentStoryId(String id) {\r
+ public IEnumerable<Story> GetStoriesByPlaceHolderID(string placeHolderID) {\r
IEnumerable<Story> result = null;\r
try {\r
- var request = new RestRequest("getStoriesByParentStoryID/{id}", Method.GET);\r
- request.AddParameter("id", id, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storiesByPlaceHolderID/{id}", Method.GET);\r
+ request.AddParameter(ID, placeHolderID, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
Story r = ToStory(d);\r
//logger.Debug($"{r}");\r
return r;\r
+ }).OrderBy(r => {\r
+ return r.ID;\r
});\r
}\r
catch (Exception e) {\r
return result;\r
}\r
\r
- public IEnumerable<StoryFolder> GetStoryFoldersByStoryID(String id) {\r
+ public IEnumerable<StoryFolder> getStoryFolders() {\r
IEnumerable<StoryFolder> result = null;\r
try {\r
- var request = new RestRequest("getStoryFolders/{id}", Method.GET);\r
- request.AddParameter("id", id, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storyFolders", Method.GET);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- StoryFolder r = new StoryFolder {\r
- ID = d["id"].ToString(),\r
- Name = String.IsNullOrEmpty(d["name"].ToString()) ? OctopusAPI.UNNAMED : d["name"].ToString()\r
- };\r
-\r
- logger.Debug($"{r}");\r
+ StoryFolder r = ToStoryFolder(d);\r
+ //logger.Debug($"{r}");\r
return r;\r
});\r
}\r
return result;\r
}\r
\r
- public IEnumerable<Rundown> GetRundownsByStoryID(String id) {\r
- IEnumerable<Rundown> result = null;\r
- try {\r
- var request = new RestRequest("getRundownByStoryID/{id}", Method.GET);\r
- request.AddParameter("id", id, ParameterType.UrlSegment);\r
- var response = client.Execute<JsonArray>(request);\r
- if (!CheckResponse(response))\r
- return null;\r
- JArray resultObject = JArray.Parse(response.Content);\r
- result = resultObject.Children().Select(d => ToRundown(d));\r
- }\r
- catch (Exception e) {\r
- OnError(e);\r
- }\r
- return result;\r
- }\r
-\r
- public IEnumerable<MosObject> GetMosObjectsByID(String id) {\r
- IEnumerable<MosObject> result = null;\r
+ public IEnumerable<StoryFolder> GetStoryFoldersByPlaceHolderID(string id) {\r
+ IEnumerable<StoryFolder> result = null;\r
try {\r
- var request = new RestRequest("getMosObjectsByID/{id}", Method.GET);\r
- request.AddParameter("id", id, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storyFoldersByPlaceHolderID/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- MosObject r = new MosObject {\r
- ID = d["id"].ToString(),\r
- GlobalID = d["globalId"].ToString(),\r
- MosID = d["mosId"].ToString(),\r
- ObjectType = d["objectType"].ToString(),\r
- ObjID = d["objId"].ToString()\r
- };\r
- logger.Debug($"{r}");\r
+ StoryFolder r = ToStoryFolder(d);\r
+ //logger.Debug($"{r}");\r
return r;\r
});\r
}\r
return result;\r
}\r
\r
- public IEnumerable<Rundown> GetRundownsByPlaceHolderId(string placeHolderID) {\r
- IEnumerable<Rundown> result = null;\r
- try {\r
- var request = new RestRequest("getRundownsByPlaceHolderId/{id}", Method.GET);\r
- request.AddParameter("id", placeHolderID, ParameterType.UrlSegment);\r
- var response = client.Execute<JsonArray>(request);\r
- if (!CheckResponse(response))\r
- return null;\r
- JArray resultObject = JArray.Parse(response.Content);\r
- result = resultObject.Children().Select(d => ToRundown(d));\r
- }\r
- catch (Exception e) {\r
- OnError(e);\r
- }\r
- return result;\r
- }\r
-\r
-\r
- public IEnumerable<StoryFolder> GetStoryFoldersByPlaceHolderId(string placeHolderID) {\r
+ public IEnumerable<StoryFolder> GetStoryFoldersByParentStoryID(String id) {\r
IEnumerable<StoryFolder> result = null;\r
try {\r
- var request = new RestRequest("getStoryFoldersByPlaceHolderId/{id}", Method.GET);\r
- request.AddParameter("id", placeHolderID, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storyFoldersByParentStoryID/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- StoryFolder r = ToStoryFolder(d);\r
+ StoryFolder r = new StoryFolder {\r
+ ID = d[ID].ToString(),\r
+ Name = String.IsNullOrEmpty(d["name"].ToString()) ? OctopusAPI.UNNAMED : d["name"].ToString()\r
+ };\r
+\r
//logger.Debug($"{r}");\r
return r;\r
});\r
return result;\r
}\r
\r
- public IEnumerable<Story> GetStoriesByPlaceHolderId(string placeHolderID) {\r
+ public IEnumerable<Story> GetStoryFolderStories(string id) {\r
IEnumerable<Story> result = null;\r
try {\r
- var request = new RestRequest("getStoriesByPlaceHolderId/{id}", Method.GET);\r
- request.AddParameter("id", placeHolderID, ParameterType.UrlSegment);\r
+ var request = new RestRequest("storyFolderStories/{id}", Method.GET);\r
+ request.AddParameter(ID, id, ParameterType.UrlSegment);\r
var response = client.Execute<JsonArray>(request);\r
if (!CheckResponse(response))\r
return null;\r
JArray resultObject = JArray.Parse(response.Content);\r
result = resultObject.Children().Select(d => {\r
- Story r = ToStory(d);\r
+ Story r = ToStoryFolderStory(d, id);\r
//logger.Debug($"{r}");\r
return r;\r
}).OrderBy(r => {\r
return d["mosObjects"]?.Select(t => ToMosObject(t));\r
}\r
\r
- private static IEnumerable<StoryFolder> GetStoryFolderFromStory(JToken d) {\r
+ private static IEnumerable<StoryFolder> GetPartialStoryFolderFromStory(JToken d) {\r
return d["story_folder"]?.Select(t => ToPartialStoryFolder(t));\r
}\r
\r
- private static IEnumerable<Rundown> GetRundownFromStory(JToken d) {\r
+ private static IEnumerable<Rundown> GetPartialRundownFromStory(JToken d) {\r
return d["rundown"]?.Select(t => ToPartialRundown(t));\r
}\r
\r
+ private static IEnumerable<StoryFolder> GetStoryFolderFromStory(JToken d) {\r
+ return d["story_folder"]?.Select(t => ToStoryFolder(t));\r
+ }\r
+\r
+ private static IEnumerable<Rundown> GetRundownFromStory(JToken d) {\r
+ return d["rundown"]?.Select(t => ToRundown(t));\r
+ }\r
+\r
private static StoryFolder ToStoryFolder(JToken d) {\r
return new StoryFolder() {\r
- ID = d.Value<string>("id"),\r
+ ID = d.Value<string>(ID),\r
Name = d.Value<string>("name")\r
};\r
}\r
\r
private static StoryFolder ToPartialStoryFolder(JToken d) {\r
return new StoryFolder() {\r
- ID = d.Value<string>("id"),\r
+ ID = d.Value<string>(ID),\r
StoryPosition = d.Value<int>("position")\r
};\r
}\r
\r
private static Rundown ToPartialRundown(JToken d) {\r
return new Rundown() {\r
- ID = d.Value<string>("id"),\r
+ ID = d.Value<string>(ID),\r
StoryPosition = d.Value<int>("position")\r
};\r
}\r
\r
private static Story ToRundownStory(JToken d, string id) {\r
- Story result = ToStory(d);\r
+ Story result = ToPartialStory(d);\r
result.Position = result.Rundowns.Where(r => id.Equals(r.ID)).FirstOrDefault()?.StoryPosition;\r
return result;\r
}\r
\r
private static Story ToStoryFolderStory(JToken d, string id) {\r
- Story result = ToStory(d);\r
+ Story result = ToPartialStory(d);\r
result.Position = result.StoryFolders.Where(r => id.Equals(r.ID)).FirstOrDefault()?.StoryPosition;\r
return result;\r
}\r
\r
+ private static Story ToPartialStory(JToken d) {\r
+ Story result = new Story {\r
+ ID = d[ID]?.ToString(),\r
+ ParentStoryID = d["parentStoryId"]?.ToString(),\r
+ Name = d["name"]?.ToString() ?? UNNAMED,\r
+ Format = d["format"]?.ToString(),\r
+ Script = d["script"]?.ToString(),\r
+ ScriptContent = d["script_content"]?.ToString(),\r
+ MosObjects = GetMosObjectsFromStory(d)?.ToArray(),\r
+ StoryFolders = GetPartialStoryFolderFromStory(d)?.ToArray(),\r
+ Rundowns = GetPartialRundownFromStory(d)?.ToArray()\r
+ };\r
+\r
+ return result;\r
+ }\r
+\r
private static Story ToStory(JToken d) {\r
Story result = new Story {\r
- ID = d["id"]?.ToString(),\r
+ ID = d[ID]?.ToString(),\r
ParentStoryID = d["parentStoryId"]?.ToString(),\r
Name = d["name"]?.ToString() ?? UNNAMED,\r
Format = d["format"]?.ToString(),\r
StoryFolders = GetStoryFolderFromStory(d)?.ToArray(),\r
Rundowns = GetRundownFromStory(d)?.ToArray()\r
};\r
-\r
return result;\r
}\r
\r
private static Rundown ToRundown(JToken d) {\r
Rundown result = new Rundown {\r
- ID = d["id"].ToString(),\r
+ ID = d[ID].ToString(),\r
Name = d["name"]?.ToString() ?? UNNAMED,\r
Start = DateTime.Parse(d["scheduledStart"]?.ToString()),\r
};\r
private static MosObject ToMosObject(JToken d) {\r
return new MosObject() {\r
GlobalID = d.Value<string>("globalId"),\r
- ID = d.Value<string>("id"),\r
+ ID = d.Value<string>(ID),\r
MosID = d.Value<string>("mosId"),\r
ObjectType = d.Value<string>("objectType"),\r
ObjID = d.Value<string>("objId")\r
treeOctopus.AfterCheck += OnTreeAfterCheck;\r
selectedNode = null;\r
IDChangedEvent?.Invoke(null, null, null);\r
+ txtFilter.Text = null;\r
}\r
\r
private void RefreshPlaceHolderIDS(String ID) {\r
\r
private void treeContent_KeyDown(object sender, KeyEventArgs e) {\r
//this.OnKeyDown(e);\r
+ if (e.KeyCode != Keys.F5)\r
+ return;\r
+ if (String.IsNullOrEmpty(txtFilter.Text))\r
+ RefreshStories();\r
+ else\r
+ Lookup();\r
}\r
\r
private void AddStories(IEnumerable<Story> stories, bool isFolderView = false) {\r
public void LookupByStory(string storyId) {\r
if (String.IsNullOrEmpty(storyId))\r
return;\r
- var rundown = client.GetRundownsByStoryID(storyId)?.FirstOrDefault();\r
+ ClearSelection();\r
+ lookupStoryId = null;\r
+ lookupPlaceHolderId = null;\r
+ var rundown = client.GetRundownsByParentStoryID(storyId)?.FirstOrDefault();\r
if (rundown == null) {\r
- var storyFolder = client.GetStoryFoldersByStoryID(storyId)?.FirstOrDefault();\r
+ var storyFolder = client.GetStoryFoldersByParentStoryID(storyId)?.FirstOrDefault();\r
if (storyFolder != null) {\r
+ refreshDisabled = true;\r
+ bool forceRefresh = rbStoryFolder.Checked;\r
rbStoryFolder.Checked = true;\r
+ refreshDisabled = false;\r
+ RefreshFolders();\r
List<StoryFolder> storyFolders = cbFolders.DataSource as List<StoryFolder>;\r
if (storyFolders != null) {\r
var folderToSelect = storyFolders.Where(f => f.ID.Equals(storyFolder.ID)).FirstOrDefault();\r
} else {\r
refreshDisabled = true;\r
dtScheduled.Value = rundown.Start;\r
- refreshDisabled = false;\r
rbRundown.Checked = true;\r
+ refreshDisabled = false;\r
+ RefreshFolders();\r
List<Rundown> rundowns = cbFolders.DataSource as List<Rundown>;\r
if (rundowns != null) {\r
var rundownToSelect = rundowns.Where(f => f.ID.Equals(rundown.ID)).FirstOrDefault();\r
}\r
}\r
}\r
- txtFilter.Text = lookupStoryId;\r
- lookupStoryId = null;\r
+ txtFilter.Text = storyId;\r
if (selectedNode == null)\r
MessageBox.Show("Nincs találat.");\r
+ else\r
+ treeOctopus.Focus();\r
}\r
\r
public void LookupByPlaceHolder(string placeHolderId) {\r
if (String.IsNullOrEmpty(placeHolderId))\r
return;\r
+ ClearSelection();\r
+ lookupStoryId = null;\r
+ lookupPlaceHolderId = null;\r
var rundown = client.GetRundownsByPlaceHolderId(placeHolderId)?.FirstOrDefault();\r
if (rundown == null) {\r
- var storyFolder = client.GetStoryFoldersByPlaceHolderId(placeHolderId)?.FirstOrDefault();\r
+ var storyFolder = client.GetStoryFoldersByPlaceHolderID(placeHolderId)?.FirstOrDefault();\r
if (storyFolder != null) {\r
+ refreshDisabled = true;\r
+ bool forceRefresh = rbStoryFolder.Checked;\r
rbStoryFolder.Checked = true;\r
+ refreshDisabled = false;\r
+ RefreshFolders();\r
List<StoryFolder> storyFolders = cbFolders.DataSource as List<StoryFolder>;\r
if (storyFolders != null) {\r
var folderToSelect = storyFolders.Where(f => f.ID.Equals(storyFolder.ID)).FirstOrDefault();\r
} else {\r
refreshDisabled = true;\r
dtScheduled.Value = rundown.Start;\r
- refreshDisabled = false;\r
rbRundown.Checked = true;\r
+ refreshDisabled = false;\r
+ RefreshFolders();\r
List<Rundown> rundowns = cbFolders.DataSource as List<Rundown>;\r
if (rundowns != null) {\r
var rundownToSelect = rundowns.Where(f => f.ID.Equals(rundown.ID)).FirstOrDefault();\r
}\r
\r
}\r
- txtFilter.Text = lookupPlaceHolderId;\r
- lookupPlaceHolderId = null;\r
+ txtFilter.Text = placeHolderId;\r
if (selectedNode == null)\r
MessageBox.Show("Nincs találat.");\r
+ else\r
+ treeOctopus.Focus();\r
}\r
\r
private void OnTypeCheckChanged(object sender, EventArgs e) {\r
}\r
\r
private void OnSelectedFolderChanged(object sender, EventArgs e) {\r
+ RefreshStories();\r
+ }\r
+\r
+ private void RefreshStories() {\r
IEnumerable<Story> stories = null;\r
treeOctopus.Nodes.Clear();\r
if (rbRundown.Checked) {\r
}\r
\r
private void OnFilterKeyDown(object sender, KeyEventArgs e) {\r
- if (String.IsNullOrEmpty(txtFilter.Text) || e.KeyCode != Keys.Return)\r
+ if (e.KeyCode != Keys.Return || String.IsNullOrEmpty(txtFilter.Text))\r
return;\r
+ Lookup();\r
+ }\r
+\r
+ private void Lookup() {\r
if (txtFilter.Text.Contains("_"))\r
LookupByPlaceHolder(txtFilter.Text);\r
else\r
private void InitializeComponent()\r
{\r
this.components = new System.ComponentModel.Container();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();\r
this.trafficAPIBindingSource = new System.Windows.Forms.BindingSource(this.components);\r
this.dtScheduled = new System.Windows.Forms.DateTimePicker();\r
this.txtFilter = new System.Windows.Forms.TextBox();\r
this.dgTraffic.BackgroundColor = System.Drawing.Color.White;\r
this.dgTraffic.BorderStyle = System.Windows.Forms.BorderStyle.None;\r
this.dgTraffic.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised;\r
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;\r
- dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
- dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;\r
- dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
- dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
- dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgTraffic.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;\r
+ dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;\r
+ dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
+ dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;\r
+ dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;\r
+ dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;\r
+ dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgTraffic.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;\r
this.dgTraffic.DataSource = this.trafficAPIBindingSource;\r
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
- dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window;\r
- dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);\r
- dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;\r
- dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
- dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black;\r
- dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
- this.dgTraffic.DefaultCellStyle = dataGridViewCellStyle5;\r
+ dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;\r
+ dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;\r
+ dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);\r
+ dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;\r
+ dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro;\r
+ dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black;\r
+ dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;\r
+ this.dgTraffic.DefaultCellStyle = dataGridViewCellStyle2;\r
this.dgTraffic.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgTraffic.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgTraffic.EnableHeadersVisualStyles = false;\r
this.dgTraffic.MultiSelect = false;\r
this.dgTraffic.Name = "dgTraffic";\r
this.dgTraffic.RowHeadersVisible = false;\r
- dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);\r
- this.dgTraffic.RowsDefaultCellStyle = dataGridViewCellStyle6;\r
+ dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);\r
+ this.dgTraffic.RowsDefaultCellStyle = dataGridViewCellStyle3;\r
this.dgTraffic.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F);\r
this.dgTraffic.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
this.dgTraffic.Size = new System.Drawing.Size(300, 322);\r
private void OnDataGridKeyDown(object sender, KeyEventArgs e) {\r
if (e.KeyCode == Keys.Space && dgTraffic.CurrentCell.ColumnIndex != 0)\r
OnSelectionChanged(dgTraffic.SelectedRows[0]);\r
+ if (e.KeyCode == Keys.F5)\r
+ RefreshResults();\r
}\r
\r
private void dtScheduled_ValueChanged(object sender, EventArgs e) {\r
public bool LookupByADID(string id) {\r
return false;\r
}\r
+\r
}\r
\r
public class TrafficItem {\r
<AppenderRef ref="Console" />\r
<AppenderRef ref="MarkeredConsole" />\r
<!-- <AppenderRef ref="RollingFile" /> -->\r
-<!-- <AppenderRef ref="MarkeredMail" /> -->\r
+ <AppenderRef ref="MarkeredMail" />\r
</Root>\r
<Logger name="org.zkoss" level="trace" additivity="false" />\r
<Logger name="org.quartz" level="ERROR" additivity="false" />\r
"name" : "Teszt folyamat",\r
"template": "fake.xml",\r
"executeimmediate": false,\r
- "cronexpression": "0/10 * * ? * *",\r
+ "cronexpression": "* 0/1 * ? * *",\r
"parameters": [ {"name": "itemID", "value": 1, "type": "java.lang.Long"} ]\r
}\r
]}\r
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
\r
<remote.address>scp://root:password@10.10.1.27</remote.address>\r
- <remote.hostkey>ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4</remote.hostkey>\r
+<!-- <remote.hostkey>ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4</remote.hostkey> -->\r
+ <remote.hostkey>ssh-ed25519 256 ea:58:1c:d3:b8:d5:7a:92:4c:a3:a5:8d:e2:7b:07:fd</remote.hostkey>\r
</properties>\r
\r
<repositories>\r
<launcherArgs>\r
<programArgs>-consoleLog -console 5555\r
</programArgs>\r
- <vmArgs>-Xms512m\r
--Xmx1024m\r
--Dfile.encoding=UTF-8\r
--agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888\r
--Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory\r
-\r
-#System\r
--Djetty.home=/opt/mediacube/configuration/jetty\r
--Dlog4j.configurationFile=/opt/mediacube/configuration/log4j2.xml\r
--Djobengine.jobsteps.root=/opt/mediacube/configuration/executors\r
--Djobengine.jobtemplates.root=/opt/mediacube/configuration/jobtemplates\r
--Djobengine.jobscheduling.config=/opt/mediacube/configuration/scheduledjobs.json\r
-\r
--Dorg.eclipse.equinox.http.jetty.http.port=80\r
--Dorg.eclipse.epp.logging.aeri.skipReports=true \r
--Declipse.ignoreApp=true \r
--Dosgi.noShutdown=true\r
--Djobengine.loglevel=INFO\r
--Djetty.etc.config.urls=etc/user-jetty.xml,etc/user-jetty-ssl.xml,etc/user-jetty-ssl-context.xml,etc/user-jetty-http.xml,etc/user-jetty-https.xml\r
- </vmArgs>\r
- <vmArgsLin>#Database
--Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true;
--Djobengine.db.user=db2admin
--Djobengine.db.password=password
--Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true;
--Djobengine.nosql.db.user=db2admin
--Djobengine.nosql.db.password=password
--Djobengine.nosql.db.schema=test
+ <vmArgs>-Xms512m
+-Xmx1024m
+-Dfile.encoding=UTF-8
+-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8888
+-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory
-#Octopus
--Djobengine.octopus.api.address=http://10.10.1.11/api/v1
--Djobengine.octopus.api.user=mam
--Djobengine.octopus.api.password=napocska
-
-#Selenio
--Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl
--Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v4.zenium
+#System
+-Djetty.home=/opt/mediacube/configuration/jetty
+-Dlog4j.configurationFile=/opt/mediacube/configuration/log4j2.xml
+-Djobengine.jobsteps.root=/opt/mediacube/configuration/executors
+-Djobengine.jobtemplates.root=/opt/mediacube/configuration/jobtemplates
+-Djobengine.jobscheduling.config=/opt/mediacube/configuration/scheduledjobs.json
-#Nexio
+-Dorg.eclipse.equinox.http.jetty.http.port=80
+-Dorg.eclipse.epp.logging.aeri.skipReports=true
+-Declipse.ignoreApp=true
+-Dosgi.noShutdown=true
+-Djobengine.loglevel=INFO
+-Djetty.etc.config.urls=etc/user-jetty.xml,etc/user-jetty-ssl.xml,etc/user-jetty-ssl-context.xml,etc/user-jetty-http.xml,etc/user-jetty-https.xml\r
+ </vmArgs>\r
+ <vmArgsLin>#Database\r
+-Djobengine.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true;\r
+-Djobengine.db.user=db2admin\r
+-Djobengine.db.password=password\r
+-Djobengine.nosql.db.url=jdbc:db2://localhost:50000/mc:retrieveMessagesFromServerOnGetMessage=true;\r
+-Djobengine.nosql.db.user=db2admin\r
+-Djobengine.nosql.db.password=password\r
+-Djobengine.nosql.db.schema=test\r
+\r
+#Octopus\r
+-Djobengine.octopus.api.address=http://10.10.1.11/api/v1\r
+-Djobengine.octopus.api.user=mam\r
+-Djobengine.octopus.api.password=napocska\r
+\r
+#Selenio\r
+-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl\r
+-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC_v3.zenium\r
+\r
+#Nexio\r
-Dnexio.host=10.10.1.55\r
</vmArgsLin>\r
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts\r
private static final int DEFAULT_BUFFER_SIZE = 512;
+ private static final ExecutorService executor = Executors.newFixedThreadPool(5);
+
/**
* Create a SmtpAppender.
*
/** The SMTP Manager */
private final SmtpManager manager;
- private final ExecutorService executor = Executors.newFixedThreadPool(5);
-
private HTMLMailAppender(final String name, final Filter filter, final Layout<? extends Serializable> layout, final SmtpManager manager,
final boolean ignoreExceptions) {
super(name, filter, layout, ignoreExceptions);
*/
@Override
public void append(final LogEvent event) {
-
+ //System.out.println("append " + event.getMessage().getFormattedMessage());
+ final LogEvent eventToSend = event.toImmutable();
executor.submit(() -> {
- manager.sendEvents(getLayout(), event);
+ manager.sendEvents(getLayout(), eventToSend);
});
}
// if (filtered) {
// manager.add(event);
// }
+
+ //System.out.println("isFiltered");
return filtered;
}
}
import org.apache.logging.log4j.core.layout.AbstractStringLayout.Serializer;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.apache.logging.log4j.core.net.MimeMessageBuilder;
-import org.apache.logging.log4j.core.util.CyclicBuffer;
import org.apache.logging.log4j.core.util.NameUtil;
import org.apache.logging.log4j.core.util.NetUtils;
import org.apache.logging.log4j.message.ReusableMessage;
private final Session session;
- private final CyclicBuffer<LogEvent> buffer;
+ //private final CyclicBuffer<LogEvent> buffer;
private volatile MimeMessage message;
this.session = session;
this.message = message;
this.data = data;
- this.buffer = new CyclicBuffer<>(LogEvent.class, data.numElements);
+ //this.buffer = new CyclicBuffer<>(LogEvent.class, data.numElements);
}
public void add(LogEvent event) {
} else if (event instanceof MutableLogEvent) {
event = ((MutableLogEvent) event).createMemento();
}
- buffer.add(event);
+ //buffer.add(event);
}
private synchronized void connect(final LogEvent appendEvent) {
message.setRecipient(RecipientType.TO, new InternetAddress(mcm.getTo()));
}
- final LogEvent[] priorEvents = buffer.removeAll();
+ //final LogEvent[] priorEvents = buffer.removeAll();
// LOG4J-310: log appendEvent even if priorEvents is empty
- final byte[] rawBytes = formatContentToBytes(priorEvents, appendEvent, layout);
+ final byte[] rawBytes = formatContentToBytes(null, appendEvent, layout);
final String contentType = layout.getContentType();
final String encoding = getEncoding(rawBytes, contentType);
<executor className="user.jobengine.server.steps.MetadataTransformStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.SyncOCTOPUSDataStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.TranscodeSELENIOStep" maxConcurrent="4"/>\r
- <executor className="user.jobengine.server.steps.TSMBackupStep" maxConcurrent="4"/>\r
+ <executor className="user.jobengine.server.steps.TSMBackupStep" maxConcurrent="1"/>\r
<executor className="user.jobengine.server.steps.TSMRestoreStep" maxConcurrent="4"/>\r
</executors>
\ No newline at end of file
import org.apache.logging.log4j.LogManager;\r
import org.apache.logging.log4j.Logger;\r
\r
-import com.ibm.nosql.json.JSONUtil;\r
-import com.ibm.nosql.json.api.BasicDBObject;\r
-\r
import user.jobengine.server.IJobEngine;\r
import user.jobengine.server.IJobRuntime;\r
\r
@StepEntry\r
public Object[] execute(long itemID, IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
try {\r
- logger.warn("Starting Fake step");\r
- String json = "{ houseID: '111222' }";\r
- BasicDBObject o = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
for (int i = 0; i < count; i++) {\r
if (!canContinue())\r
break;\r
jobRuntime.incrementProgress((i + 1) * count);\r
- Thread.sleep(10000);\r
- // logger.info("Progress {}", jobRuntime.getProgress());\r
+ Thread.sleep(100);\r
+ logger.info(getMarker(), "Log markered");\r
+ logger.info("Progress {}", jobRuntime.getProgress());\r
+ logger.info("Progress {}", jobRuntime.getProgress());\r
+ logger.info("Progress {}", jobRuntime.getProgress());\r
+ logger.info("Progress {}", jobRuntime.getProgress());\r
}\r
} catch (Exception e) {\r
logger.error(e.getMessage());\r
import com.ibm.nosql.json.api.DBObject;\r
\r
public interface IOctopusAPI {\r
+ static final String RUNDOWN_COLLECTION_NAME = "rundowns";\r
+ static final String STORY_COLLECTION_NAME = "stories";\r
+ static final String STORY_FOLDER_COLLECTION_NAME = "story_folders";\r
+ static final String TIME_COLLECTION_NAME = "time";\r
+ static final String LASTUPDATE_TIME = "lastUpdateTime";\r
+ static final String NEXIO_MOS = "NEXIO.MOS";\r
+ static final String PARENT_STORY_ID = "parentStoryId";\r
+ static final String VALUE = "value";\r
+ static final String CUSTOM_COLUMNS = "customColumns";\r
+ static final String MOS_ID = "mosId";\r
+ static final String MOS_OBJECTS = "mosObjects";\r
+ static final String NAME = "name";\r
+ static final String LABEL = "label";\r
+ static final String OBJ_ID = "objId";\r
+ static final String OBJECT = "object";\r
+ static final String MOS = "mos";\r
+ static final String TEXT = "text";\r
+ static final String TYPE = "type";\r
+ static final String CONTENT = "content";\r
+ static final String BODY = "body";\r
+ static final String SCRIPT = "script";\r
+ static final String REF_RUNDOWN = "rundown";\r
+ static final String REF_STORYFOLDER = "story_folder";\r
+ static final String POSITION = "position";\r
+ static final String STORY = "story";\r
+ static final String SCHEDULED_START = "scheduledStart";\r
+ static final String SLUGS = "slugs";\r
+ static final String MODIFIED = "modified";\r
+ static final String STORIES = "stories";\r
+ static final String ID = "id";\r
+ static final String _ID = "_id";\r
+ static final String STORYID = "storyId";\r
+ static final String FORMAT = "format";\r
\r
- List<DBObject> getMosObjectsByID(String id);\r
+ List<DBObject> getRundowns(Date scheduledDate);\r
\r
- List<DBObject> getRundownByStoryID(long storyID);\r
+ List<DBObject> getRundownsByParentStoryID(String storyID);\r
\r
- List<DBObject> getRundowns(Date scheduledDate);\r
+ List<DBObject> getRundownsByPlaceHolderID(String placeHolderID);\r
\r
- List<DBObject> getRundownsByPlaceHolderId(String placeHolderID);\r
+ List<DBObject> getRundownStories(long id);\r
\r
List<DBObject> getStories();\r
\r
- List<DBObject> getStories(long rundownID);\r
-\r
List<DBObject> getStoriesByID(String id);\r
\r
List<DBObject> getStoriesByParentStoryID(String id);\r
\r
- List<DBObject> getStoriesByPlaceHolderId(String placeHolderID);\r
-\r
- List<DBObject> getStoriesByStoryFolderId(long storyFolderID);\r
+ List<DBObject> getStoriesByPlaceHolderID(String placeHolderID);\r
\r
List<DBObject> getStoryFolders();\r
\r
- List<DBObject> getStoryFolders(long storyID);\r
+ List<DBObject> getStoryFoldersByParentStoryID(String id);\r
+\r
+ List<DBObject> getStoryFoldersByPlaceHolderID(String placeHolderID);\r
\r
- List<DBObject> getStoryFoldersByPlaceHolderId(String placeHolderID);\r
+ List<DBObject> getStoryFolderStories(long storyFolderID);\r
}\r
import user.commons.nosql.NoSQLUtils;\r
\r
public class OctopusAPI implements IOctopusAPI {\r
- private static final String _ID = "_id";\r
- private static final String OBJID = "objId";\r
+ //private static final Logger logger = LogManager.getLogger();\r
private static final String $DATE = "$date";\r
- private static final String SCHEDULEDSTART = "scheduledStart";\r
- private static final String STORYID = "storyId";\r
private static final String $ELEMMATCH = "$elemMatch";\r
- //private static final Logger logger = LogManager.getLogger();\r
- private static final String SLUGS = "slugs";\r
- private static final String ID = "id";\r
- private static final String STORY_FOLDER = "story_folder";\r
- private static final String MOSOBJECTS = "mosObjects";\r
- private static final String RUNDOWN = "rundown";\r
- public static final String RUNDOWN_COLLECTION_NAME = "rundowns";\r
- public static final String STORY_COLLECTION_NAME = "stories";\r
- public static final String STORY_FOLDER_COLLECTION_NAME = "story_folders";\r
- public static final String TIME_COLLECTION_NAME = "time";\r
private DB db;\r
\r
public OctopusAPI() throws SQLException {\r
db = NoSQLUtils.getDB();\r
}\r
\r
- private List<Long> getIDsFromReferences(List<DBObject> list, String referenceName) {\r
- List<Long> result = new ArrayList<>();\r
- for (DBObject dbObject : list) {\r
- BasicDBObject object = (BasicDBObject) dbObject;\r
- BasicDBList l = (BasicDBList) object.get(referenceName);\r
- BasicDBObject o = (BasicDBObject) l.get(0);\r
- long id = o.getLong("id");\r
- result.add(id);\r
- }\r
- return result;\r
- }\r
-\r
- @Override\r
- public List<DBObject> getMosObjectsByID(String id) {\r
- List<DBObject> result = null;\r
- List<DBObject> mosObjectsResult = new ArrayList<>();\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- DBCursor find = collection\r
- .find(new BasicDBObject(MOSOBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, id))),\r
- new BasicDBObject(ID, 1).append("name", 1).append("modified", 1).append(STORY_FOLDER, 1).append("type", 1).append("mosObjects", 1))\r
- .sort(new BasicDBObject("name", 1));\r
- if (find.hasNext())\r
- // return the story\r
- result = find.toArray();\r
- for (DBObject actual : result) {\r
- BasicDBList actualList = (BasicDBList) actual.get("mosObjects");\r
- if (!actualList.isEmpty()) {\r
- List<BasicDBObject> mosObjectList = NoSQLUtils.asList(actualList);\r
- for (BasicDBObject actualMosObject : mosObjectList) {\r
- long mosID = actualMosObject.getLong(ID);\r
- if (id.equals(String.format("%d", mosID)))\r
- mosObjectsResult.add(actualMosObject);\r
- }\r
+ private void addReferences(List<DBObject> result) {\r
+ for (DBObject storyObject : result) {\r
+ if (storyObject == null)\r
+ continue;\r
+ BasicDBObject story = (BasicDBObject) storyObject;\r
+ if (story.containsKey(REF_RUNDOWN) && story.get(REF_RUNDOWN) != null) {\r
+ List<DBObject> rundowns = getReferencedObjects(result, RUNDOWN_COLLECTION_NAME, REF_RUNDOWN);\r
+ story.put(REF_RUNDOWN, rundowns);\r
+ }\r
+ if (story.containsKey(REF_STORYFOLDER) && story.get(REF_STORYFOLDER) != null) {\r
+ List<DBObject> storyFolders = getReferencedObjects(result, STORY_FOLDER_COLLECTION_NAME, REF_STORYFOLDER);\r
+ story.put(REF_STORYFOLDER, storyFolders);\r
}\r
}\r
- return mosObjectsResult;\r
- }\r
-\r
- private List<DBObject> getParentsByReferences(List<DBObject> references, DBCollection collection, String referenceName) {\r
- List<DBObject> result = null;\r
- List<Long> rundownIDs = getIDsFromReferences(references, referenceName);\r
- BasicDBObject query = (BasicDBObject) QueryBuilder.start().put(ID).in(rundownIDs).get();\r
- DBCursor find = collection.find(query);\r
- if (find.hasNext())\r
- result = find.toArray();\r
- return result;\r
}\r
\r
private List<DBObject> getReferencedObjects(List<DBObject> stories, String referenceCollectionName, String referenceField) {\r
List<Long> ids = null;\r
for (DBObject story : stories) {\r
+ if (story == null)\r
+ continue;\r
List<BasicDBObject> references = NoSQLUtils.asList((BasicDBObject) story, referenceField);\r
if (references == null)\r
continue;\r
ids.add(id);\r
}\r
}\r
-\r
+ if (ids == null)\r
+ return null;\r
List<DBObject> result = null;\r
DBCollection rundownCollection = db.getCollection(referenceCollectionName);\r
BasicDBObject query = (BasicDBObject) QueryBuilder.start().put(ID).in(ids).get();\r
return result;\r
}\r
\r
- @Override\r
- public List<DBObject> getRundownByStoryID(long storyID) {\r
- List<DBObject> result = null;\r
- DBCollection rundownCollection = db.getCollection(RUNDOWN_COLLECTION_NAME);\r
- DBCursor find = rundownCollection.find(new BasicDBObject(SLUGS, new BasicDBObject($ELEMMATCH, new BasicDBObject(STORYID, storyID))));\r
- if (find.hasNext())\r
- result = find.toArray();\r
- return result;\r
- }\r
-\r
@Override\r
public List<DBObject> getRundowns(Date scheduledDate) {\r
List<DBObject> result = null;\r
if (scheduledDate == null) {\r
query = builder.get();\r
} else {\r
- query = builder.and(QueryBuilder.start(SCHEDULEDSTART).greaterThanEquals(calStart.getTime()).get(),\r
- QueryBuilder.start(SCHEDULEDSTART).lessThan(calStop.getTime()).get()).get();\r
+ query = builder.and(QueryBuilder.start(SCHEDULED_START).greaterThanEquals(calStart.getTime()).get(),\r
+ QueryBuilder.start(SCHEDULED_START).lessThan(calStop.getTime()).get()).get();\r
}\r
\r
//logger.info(query);\r
- DBCursor find = collection.find(query).sort(new BasicDBObject(SCHEDULEDSTART, new BasicDBList(1, $DATE)));\r
+ DBCursor find = collection.find(query).sort(new BasicDBObject(SCHEDULED_START, new BasicDBList(1, $DATE)));\r
if (find.hasNext())\r
result = find.toArray();\r
return result;\r
}\r
\r
@Override\r
- public List<DBObject> getRundownsByPlaceHolderId(String placeHolderID) {\r
+ public List<DBObject> getRundownsByParentStoryID(String id) {\r
DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME);\r
+ DBCursor find = storyCollection.find(new BasicDBObject(PARENT_STORY_ID, id), new BasicDBObject(REF_RUNDOWN, 1));\r
+ if (!find.hasNext())\r
+ return null;\r
+ return getReferencedObjects(find.toArray(), RUNDOWN_COLLECTION_NAME, REF_RUNDOWN);\r
+ }\r
+\r
+ @Override\r
+ public List<DBObject> getRundownsByPlaceHolderID(String id) {\r
//db.testStoryCollection.find({"mosObjects": {$elemMatch: {"globalId": "OCTOPUS-ECHOTV-2429902"}}})\r
- BasicDBObject criteria = new BasicDBObject(MOSOBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(OBJID, placeHolderID)));\r
- BasicDBObject filter = new BasicDBObject(RUNDOWN, 1).append(_ID, 0);\r
- DBCursor find = storyCollection.find(criteria, filter);\r
+ DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME);\r
+ BasicDBObject criteria = new BasicDBObject(MOS_OBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(OBJ_ID, id)));\r
+ DBCursor find = storyCollection.find(criteria, new BasicDBObject(REF_RUNDOWN, 1));\r
if (!find.hasNext())\r
return null;\r
- return getReferencedObjects(find.toArray(), RUNDOWN_COLLECTION_NAME, RUNDOWN);\r
+ return getReferencedObjects(find.toArray(), RUNDOWN_COLLECTION_NAME, REF_RUNDOWN);\r
}\r
\r
@Override\r
- public List<DBObject> getStories() {\r
+ public List<DBObject> getRundownStories(long id) {\r
+ // db.stories.find({ rundown: { $elemMatch: { id: 92950867 } }})\r
+ // { rundown: { $elemMatch: { id: 44622396 } }}\r
List<DBObject> result = null;\r
DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- DBCursor find = collection.find();\r
+ DBCursor find = collection\r
+ .find(new BasicDBObject(REF_RUNDOWN, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, id))), new BasicDBObject(ID, 1)\r
+ .append(PARENT_STORY_ID, 1).append(NAME, 1).append(MODIFIED, 1).append(REF_RUNDOWN, 1).append(FORMAT, 1).append(MOS_OBJECTS, 1))\r
+ .sort(new BasicDBObject("name", 1));\r
if (find.hasNext())\r
result = find.toArray();\r
return result;\r
}\r
\r
@Override\r
- public List<DBObject> getStories(long rundownID) {\r
+ public List<DBObject> getStories() {\r
List<DBObject> result = null;\r
DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- // db.stories.find({ rundown: { $elemMatch: { id: 92950867 } }})\r
-\r
- // { rundown: { $elemMatch: { id: 44622396 } }}\r
- DBCursor find = collection\r
- .find(new BasicDBObject(RUNDOWN, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, rundownID))), new BasicDBObject(ID, 1)\r
- .append("parentStoryId", 1).append("name", 1).append("modified", 1).append(RUNDOWN, 1).append("format", 1).append("mosObjects", 1))\r
- .sort(new BasicDBObject("name", 1));\r
+ DBCursor find = collection.find();\r
if (find.hasNext())\r
result = find.toArray();\r
return result;\r
public List<DBObject> getStoriesByID(String id) {\r
List<DBObject> result = null;\r
DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- //Pattern regex = Pattern.compile(id, Pattern.CASE_INSENSITIVE);\r
- //BasicDBObject query = new BasicDBObject("id", Pattern.compile(id));\r
- DBCursor find = collection.find(new BasicDBObject("id", id));\r
- if (find.hasNext())\r
+ DBCursor find = collection.find(new BasicDBObject(ID, id));\r
+ if (find.hasNext()) {\r
result = find.toArray();\r
+ addReferences(result);\r
+ }\r
return result;\r
}\r
\r
@Override\r
public List<DBObject> getStoriesByParentStoryID(String id) {\r
- List<DBObject> result = null;\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
//Pattern regex = Pattern.compile(id, Pattern.CASE_INSENSITIVE);\r
//BasicDBObject query = new BasicDBObject("id", Pattern.compile(id));\r
- DBCursor find = collection.find(new BasicDBObject("parentStoryId", id));\r
- if (find.hasNext())\r
+ List<DBObject> result = null;\r
+ DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
+ DBCursor find = collection.find(new BasicDBObject(PARENT_STORY_ID, id));\r
+ if (find.hasNext()) {\r
result = find.toArray();\r
+ addReferences(result);\r
+ }\r
return result;\r
}\r
\r
@Override\r
- public List<DBObject> getStoriesByPlaceHolderId(String placeHolderID) {\r
+ public List<DBObject> getStoriesByPlaceHolderID(String id) {\r
List<DBObject> result = new ArrayList<>();\r
DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME);\r
- BasicDBObject globalId = new BasicDBObject(OBJID, placeHolderID);\r
- BasicDBObject elemmatch = new BasicDBObject($ELEMMATCH, globalId);\r
- BasicDBObject mosObjects = new BasicDBObject(MOSOBJECTS, elemmatch);\r
- DBCursor find = storyCollection.find(mosObjects);\r
- if (find.hasNext())\r
- result.add(find.next());\r
- return result;\r
- }\r
-\r
- @Override\r
- public List<DBObject> getStoriesByStoryFolderId(long storyFolderId) {\r
- List<DBObject> result = null;\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- DBCursor find = collection\r
- .find(new BasicDBObject(STORY_FOLDER, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, storyFolderId))), new BasicDBObject(ID, 1)\r
- .append("parentStoryId", 1).append("name", 1).append("modified", 1).append(STORY_FOLDER, 1).append("format", 1).append("mosObjects", 1))\r
- .sort(new BasicDBObject("name", 1));\r
- if (find.hasNext())\r
+ BasicDBObject criteria = new BasicDBObject(MOS_OBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(OBJ_ID, id)));\r
+ DBCursor find = storyCollection.find(criteria);\r
+ if (find.hasNext()) {\r
result = find.toArray();\r
+ addReferences(result);\r
+ }\r
return result;\r
}\r
\r
}\r
\r
@Override\r
- public List<DBObject> getStoryFolders(long storyID) {\r
+ public List<DBObject> getStoryFoldersByParentStoryID(String id) {\r
DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME);\r
- BasicDBObject criteria = new BasicDBObject(ID, storyID);\r
- BasicDBObject filter = new BasicDBObject(STORY_FOLDER, 1).append(_ID, 0);\r
- DBCursor find = storyCollection.find(criteria, filter);\r
+ DBCursor find = storyCollection.find(new BasicDBObject(ID, id), new BasicDBObject(REF_STORYFOLDER, 1));\r
if (!find.hasNext())\r
return null;\r
- return getReferencedObjects(find.toArray(), STORY_FOLDER_COLLECTION_NAME, STORY_FOLDER);\r
+ return getReferencedObjects(find.toArray(), STORY_FOLDER_COLLECTION_NAME, REF_STORYFOLDER);\r
}\r
\r
@Override\r
- public List<DBObject> getStoryFoldersByPlaceHolderId(String placeHolderID) {\r
+ public List<DBObject> getStoryFoldersByPlaceHolderID(String id) {\r
DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME);\r
- BasicDBObject criteria = new BasicDBObject(MOSOBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(OBJID, placeHolderID)));\r
- BasicDBObject filter = new BasicDBObject(STORY_FOLDER, 1).append(_ID, 0);\r
- DBCursor find = storyCollection.find(criteria, filter);\r
+ BasicDBObject criteria = new BasicDBObject(MOS_OBJECTS, new BasicDBObject($ELEMMATCH, new BasicDBObject(OBJ_ID, id)));\r
+ DBCursor find = storyCollection.find(criteria, new BasicDBObject(REF_STORYFOLDER, 1));\r
if (!find.hasNext())\r
return null;\r
- return getReferencedObjects(find.toArray(), STORY_FOLDER_COLLECTION_NAME, STORY_FOLDER);\r
+ return getReferencedObjects(find.toArray(), STORY_FOLDER_COLLECTION_NAME, REF_STORYFOLDER);\r
+ }\r
+\r
+ @Override\r
+ public List<DBObject> getStoryFolderStories(long storyFolderId) {\r
+ List<DBObject> result = null;\r
+ DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
+ DBCursor find = collection\r
+ .find(new BasicDBObject(REF_STORYFOLDER, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, storyFolderId))), new BasicDBObject(ID, 1)\r
+ .append(PARENT_STORY_ID, 1).append(NAME, 1).append(MODIFIED, 1).append(REF_STORYFOLDER, 1).append(FORMAT, 1).append(MOS_OBJECTS, 1))\r
+ .sort(new BasicDBObject(NAME, 1));\r
+ if (find.hasNext())\r
+ result = find.toArray();\r
+ return result;\r
}\r
}\r
import user.commons.remotestore.ProgressEvent;\r
\r
public class OctopusDataMiner implements Runnable {\r
- private static final String PARENT_STORY_ID = "parentStoryId";\r
- private static final String VALUE = "value";\r
- private static final String CUSTOM_COLUMNS = "customColumns";\r
- private static final String MOS_ID = "mosId";\r
- private static final String MOS_OBJECTS = "mosObjects";\r
- private static final String NAME = "name";\r
- private static final String LABEL = "label";\r
- private static final String SIMPLE_LINEFEED = "\n";\r
- private static final String MOSOBJECT = "Bejátszó: ";\r
- private static final String OBJ_ID = "objId";\r
- private static final String OBJECT = "object";\r
+ private static final Logger logger = LogManager.getLogger();\r
private static final String LINEFEED = "\r\n";\r
- private static final String MOS = "mos";\r
- private static final String TEXT = "text";\r
- private static final String TYPE = "type";\r
- private static final String CONTENT = "content";\r
- private static final String BODY = "body";\r
- private static final String SCRIPT = "script";\r
+ private static final String SIMPLE_LINEFEED = "\n";\r
private static final String SCRIPT_CONTENT = "script_content";\r
- private static final Logger logger = LogManager.getLogger();\r
private static final String SAVING_STORY_ID = "Saving story {}";\r
private static final String SAVING_RUNDOWN = "Saving rundown : {} {}";\r
- private static final String REF_RUNDOWN = "rundown";\r
- private static final String REF_STORYFOLDER = "story_folder";\r
- private static final String POSITION = "position";\r
- private static final String STORY = "story";\r
- private static final String SCHEDULED_START = "scheduledStart";\r
- private static final String SLUGS = "slugs";\r
private static final String CHECKING_RUNDOWN = "Checking Rundown {} ({}/{})";\r
private static final String FIELDS_STORIES = "stories,Story.modified,Story.name,Story.id,Story.mosObjects,Story.script,Story.type,Story.format,customColumns,CustomColumn.label,CustomColumn.value";\r
private static final String FIELDS_SLUGS = "slugs,Slug.story,Slug.position,Story.name,Story.id,Story.modified,Story.mosObjects,Story.script,Story.type,Story.format,Story.customColumns,CustomColumn.label,CustomColumn.value";\r
- private static final String RUNDOWN = "Rundown";\r
private static final String FIELDS_RUNDOWN_LIST = "id,name,modified,scheduledStart,rundownType,RundownType.name,slugs,Slug.storyId,Slug.position";\r
private static final String FIELDS_STORY_FOLDER_LIST = "id,name,modified,stories,Story.id";\r
+ private static final String RUNDOWN = "Rundown";\r
private static final String OCTOPUS_DEVICE_NAME = "Octopus-Device-Name";\r
private static final String OCTOPUS_DEVICE_ID = "Octopus-Device-Id";\r
private static final String FIELDS = "fields";\r
- private static final String MODIFIED = "modified";\r
- private static final String STORIES = "stories";\r
- private static final String ID = "id";\r
private static final String CHECKING_STORY_FOLDER = "Checking StoryFolder %s (%d/%d)";\r
private static final String EXIT = "Exit";\r
private static final String RESULT = "result";\r
private static final String ENTER = "Enter";\r
private static final String FINISHED = "Finished";\r
private static final String STARTING = "Starting";\r
- private static final String STORYID = "storyId";\r
-\r
- public static String RUNDOWN_COLLECTION_NAME = "rundowns";\r
- public static String STORY_COLLECTION_NAME = "stories";\r
- public static String STORY_FOLDER_COLLECTION_NAME = "story_folders";\r
- public static String TIME_COLLECTION_NAME = "time";\r
- public static String LASTUPDATE_TIME = "lastUpdateTime";\r
+ private static final String MOSOBJECT = "Bejátszó: ";\r
\r
private DB db;\r
private ResteasyWebTarget webTarget;\r
Map<Long, BasicDBList> result = new HashMap<>();\r
List<BasicDBObject> rundownsList = NoSQLUtils.asList(rundowns);\r
for (BasicDBObject rundown : rundownsList) {\r
- if (!rundown.containsKey(ID))\r
+ if (!rundown.containsKey(IOctopusAPI.ID))\r
continue;\r
- long rundownId = rundown.getLong(ID);\r
- List<BasicDBObject> slugs = NoSQLUtils.asList(rundown, SLUGS);\r
+ long rundownId = rundown.getLong(IOctopusAPI.ID);\r
+ List<BasicDBObject> slugs = NoSQLUtils.asList(rundown, IOctopusAPI.SLUGS);\r
if (slugs == null)\r
continue;\r
for (BasicDBObject slug : slugs) {\r
- if (!slug.containsKey(STORYID))\r
+ if (!slug.containsKey(IOctopusAPI.STORYID))\r
continue;\r
- long storyId = slug.getLong(STORYID);\r
+ long storyId = slug.getLong(IOctopusAPI.STORYID);\r
BasicDBList references = result.get(storyId);\r
if (references == null) {\r
references = new BasicDBList();\r
result.put(storyId, references);\r
}\r
- long position = slug.getLong(POSITION);\r
- if (slug.containsKey(POSITION))\r
- position = slug.getLong(POSITION);\r
- references.add(new BasicDBObject(ID, rundownId).append(POSITION, position));\r
+ long position = slug.getLong(IOctopusAPI.POSITION);\r
+ if (slug.containsKey(IOctopusAPI.POSITION))\r
+ position = slug.getLong(IOctopusAPI.POSITION);\r
+ references.add(new BasicDBObject(IOctopusAPI.ID, rundownId).append(IOctopusAPI.POSITION, position));\r
}\r
}\r
return result;\r
}\r
\r
private void buildStoriesReferences() {\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
- DBCursor cursor = collection.find(null, new BasicDBObject(ID, 1).append(REF_RUNDOWN, 1).append(REF_STORYFOLDER, 1).append(MOS_OBJECTS, 1));\r
+ DBCollection collection = db.getCollection(IOctopusAPI.STORY_COLLECTION_NAME);\r
+ DBCursor cursor = collection.find(null, new BasicDBObject(IOctopusAPI.ID, 1).append(IOctopusAPI.REF_RUNDOWN, 1).append(IOctopusAPI.REF_STORYFOLDER, 1)\r
+ .append(IOctopusAPI.MOS_OBJECTS, 1));\r
//DBCursor find = collection.find(QueryBuilder.start(ID).greaterThan(0).get());\r
try {\r
\r
while (cursor.hasNext()) {\r
BasicDBObject story = (BasicDBObject) cursor.next();\r
- long storyId = story.getLong(ID);\r
- BasicDBList rundownRef = NoSQLUtils.asDBList(story, REF_RUNDOWN);\r
+ long storyId = story.getLong(IOctopusAPI.ID);\r
+ BasicDBList rundownRef = NoSQLUtils.asDBList(story, IOctopusAPI.REF_RUNDOWN);\r
if (rundownRef != null) {\r
if (storedStoryRundowns == null)\r
storedStoryRundowns = new HashMap<>();\r
storedStoryRundowns.put(storyId, rundownRef);\r
}\r
- BasicDBList storyFolderRef = NoSQLUtils.asDBList(story, REF_STORYFOLDER);\r
+ BasicDBList storyFolderRef = NoSQLUtils.asDBList(story, IOctopusAPI.REF_STORYFOLDER);\r
if (storyFolderRef != null) {\r
if (storedStoryStoryFolders == null)\r
storedStoryStoryFolders = new HashMap<>();\r
storedStoryStoryFolders.put(storyId, storyFolderRef);\r
}\r
\r
- BasicDBList storyMosObjects = NoSQLUtils.asDBList(story, MOS_OBJECTS);\r
+ BasicDBList storyMosObjects = NoSQLUtils.asDBList(story, IOctopusAPI.MOS_OBJECTS);\r
if (storyMosObjects != null) {\r
if (storedStoryMosObjects == null)\r
storedStoryMosObjects = new HashMap<>();\r
Map<Long, BasicDBList> result = new HashMap<>();\r
List<BasicDBObject> storyFolderList = NoSQLUtils.asList(storyFolders);\r
for (BasicDBObject storyFolder : storyFolderList) {\r
- long storyFolderId = storyFolder.getLong(ID);\r
- List<BasicDBObject> stories = NoSQLUtils.asList(storyFolder, STORIES);\r
+ long storyFolderId = storyFolder.getLong(IOctopusAPI.ID);\r
+ List<BasicDBObject> stories = NoSQLUtils.asList(storyFolder, IOctopusAPI.STORIES);\r
if (stories == null)\r
continue;\r
long position = 1;\r
for (BasicDBObject story : stories) {\r
- long storyId = story.getLong(ID);\r
+ long storyId = story.getLong(IOctopusAPI.ID);\r
BasicDBList references = result.get(storyId);\r
if (references == null) {\r
references = new BasicDBList();\r
result.put(storyId, references);\r
}\r
- references.add(new BasicDBObject(ID, storyFolderId).append(POSITION, position++));\r
+ references.add(new BasicDBObject(IOctopusAPI.ID, storyFolderId).append(IOctopusAPI.POSITION, position++));\r
}\r
}\r
return result;\r
}\r
\r
public void clear() {\r
- db.getCollection(RUNDOWN_COLLECTION_NAME).remove();\r
- db.getCollection(STORY_COLLECTION_NAME).remove();\r
- db.getCollection(STORY_FOLDER_COLLECTION_NAME).remove();\r
- db.getCollection(TIME_COLLECTION_NAME).remove();\r
+ db.getCollection(IOctopusAPI.RUNDOWN_COLLECTION_NAME).remove();\r
+ db.getCollection(IOctopusAPI.STORY_COLLECTION_NAME).remove();\r
+ db.getCollection(IOctopusAPI.STORY_FOLDER_COLLECTION_NAME).remove();\r
+ db.getCollection(IOctopusAPI.TIME_COLLECTION_NAME).remove();\r
}\r
\r
private String concatParentsToStoryFolder(BasicDBObject actual, String name) {\r
BasicDBObject parent = (BasicDBObject) res.get("parent");\r
if (parent == null || parent.isEmpty())\r
return name;\r
- String parentName = parent.getString(NAME);\r
- String actualName = actual.getString(NAME);\r
+ String parentName = parent.getString(IOctopusAPI.NAME);\r
+ String actualName = actual.getString(IOctopusAPI.NAME);\r
String newName = String.format("%s/%s", parentName, actualName);\r
return concatParentsToStoryFolder(parent, newName);\r
}\r
\r
private void deleteOrphanStories() {\r
try {\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
+ DBCollection collection = db.getCollection(IOctopusAPI.STORY_COLLECTION_NAME);\r
BasicDBObject query = (BasicDBObject) QueryBuilder.start().put("id").notIn(storyIDs.toArray()).get();\r
WriteResult res = collection.remove(query);\r
logger.trace(String.format("Deleted orphan stories: %d", res.getN()));\r
}\r
\r
private void ensureIndexes() {\r
- DBCollection collection = db.getCollection(STORY_FOLDER_COLLECTION_NAME);\r
+ DBCollection collection = db.getCollection(IOctopusAPI.STORY_FOLDER_COLLECTION_NAME);\r
if (collection.count() == 0)\r
- collection.ensureIndex(ID);\r
- collection = db.getCollection(RUNDOWN_COLLECTION_NAME);\r
+ collection.ensureIndex(IOctopusAPI.ID);\r
+ collection = db.getCollection(IOctopusAPI.RUNDOWN_COLLECTION_NAME);\r
if (collection.count() == 0) {\r
- collection.ensureIndex(ID);\r
- collection.ensureIndex(SCHEDULED_START);\r
+ collection.ensureIndex(IOctopusAPI.ID);\r
+ collection.ensureIndex(IOctopusAPI.SCHEDULED_START);\r
}\r
- collection = db.getCollection(STORY_COLLECTION_NAME);\r
+ collection = db.getCollection(IOctopusAPI.STORY_COLLECTION_NAME);\r
if (collection.count() == 0)\r
- collection.ensureIndex(ID);\r
+ collection.ensureIndex(IOctopusAPI.ID);\r
}\r
\r
private void fireProgressEvent(ProgressEvent evt) {\r
\r
private String GetContent(BasicDBObject content) {\r
String scriptContent = "";\r
- if (!content.containsKey(TYPE))\r
+ if (!content.containsKey(IOctopusAPI.TYPE))\r
return scriptContent;\r
- String type = content.getString(TYPE);\r
+ String type = content.getString(IOctopusAPI.TYPE);\r
switch (type) {\r
- case TEXT: {\r
- if (content.containsKey(TEXT)) {\r
- String text = content.getString(TEXT);\r
+ case IOctopusAPI.TEXT: {\r
+ if (content.containsKey(IOctopusAPI.TEXT)) {\r
+ String text = content.getString(IOctopusAPI.TEXT);\r
if (text != null)\r
scriptContent += String.format("%s%s", text.replaceAll(SIMPLE_LINEFEED, LINEFEED), LINEFEED);\r
}\r
break;\r
}\r
- case MOS: {\r
- BasicDBObject mosObject = NoSQLUtils.asDBObject(content, OBJECT);\r
+ case IOctopusAPI.MOS: {\r
+ BasicDBObject mosObject = NoSQLUtils.asDBObject(content, IOctopusAPI.OBJECT);\r
if (mosObject != null && !mosObject.isEmpty()) {\r
- if (mosObject.containsKey(OBJ_ID)) {\r
- String objID = mosObject.getString(OBJ_ID);\r
+ if (mosObject.containsKey(IOctopusAPI.OBJ_ID)) {\r
+ String objID = mosObject.getString(IOctopusAPI.OBJ_ID);\r
scriptContent += String.format("%s %s%s", MOSOBJECT, objID, LINEFEED);\r
}\r
}\r
break;\r
}\r
default: {\r
- if (content.containsKey(CONTENT)) {\r
- List<BasicDBObject> innerContents = NoSQLUtils.asList(content, CONTENT);\r
+ if (content.containsKey(IOctopusAPI.CONTENT)) {\r
+ List<BasicDBObject> innerContents = NoSQLUtils.asList(content, IOctopusAPI.CONTENT);\r
if (innerContents != null) {\r
for (BasicDBObject actualInnerContent : innerContents) {\r
if (actualInnerContent != null && actualInnerContent.isEmpty())\r
// }\r
\r
private String GetCustomColumnValue(String columnName, BasicDBObject story) {\r
- List<BasicDBObject> customColumns = NoSQLUtils.asList(story, CUSTOM_COLUMNS);\r
+ List<BasicDBObject> customColumns = NoSQLUtils.asList(story, IOctopusAPI.CUSTOM_COLUMNS);\r
if (customColumns == null)\r
return null;\r
String result = null;\r
for (BasicDBObject customColumn : customColumns) {\r
- if (!customColumn.containsKey(LABEL))\r
+ if (!customColumn.containsKey(IOctopusAPI.LABEL))\r
continue;\r
- String currentName = customColumn.getString(LABEL);\r
+ String currentName = customColumn.getString(IOctopusAPI.LABEL);\r
if (currentName == null)\r
continue;\r
if (!currentName.toLowerCase().equals(columnName.toLowerCase()))\r
continue;\r
- if (!customColumn.containsKey(VALUE))\r
+ if (!customColumn.containsKey(IOctopusAPI.VALUE))\r
continue;\r
- result = customColumn.getString(VALUE);\r
+ result = customColumn.getString(IOctopusAPI.VALUE);\r
break;\r
}\r
return result;\r
\r
private Date getLastUpdateTime() {\r
Date result = null;\r
- DBCollection collection = db.getCollection(TIME_COLLECTION_NAME);\r
+ DBCollection collection = db.getCollection(IOctopusAPI.TIME_COLLECTION_NAME);\r
DBObject timeObject = collection.findOne();\r
if (timeObject != null)\r
- result = (Date) timeObject.get(LASTUPDATE_TIME);\r
+ result = (Date) timeObject.get(IOctopusAPI.LASTUPDATE_TIME);\r
return result;\r
}\r
\r
private BasicDBList GetRelevantMOSObjects(BasicDBObject story) {\r
- List<BasicDBObject> mosObjects = NoSQLUtils.asList(story, MOS_OBJECTS);\r
+ List<BasicDBObject> mosObjects = NoSQLUtils.asList(story, IOctopusAPI.MOS_OBJECTS);\r
if (mosObjects == null)\r
return null;\r
BasicDBList result = null;\r
for (BasicDBObject mosObject : mosObjects) {\r
- if (!mosObject.containsKey(MOS_ID))\r
+ if (!mosObject.containsKey(IOctopusAPI.MOS_ID))\r
continue;\r
- String mosId = mosObject.getString(MOS_ID);\r
- if (!"NEXIO.MOS".equals(mosId))\r
+ String mosId = mosObject.getString(IOctopusAPI.MOS_ID);\r
+ if (!IOctopusAPI.NEXIO_MOS.equals(mosId))\r
continue;\r
if (result == null)\r
result = new BasicDBList();\r
}\r
\r
private String GetScriptContent(BasicDBObject story) {\r
- BasicDBObject script = NoSQLUtils.asDBObject(story, SCRIPT);\r
+ BasicDBObject script = NoSQLUtils.asDBObject(story, IOctopusAPI.SCRIPT);\r
if (script == null || script.isEmpty())\r
return null;\r
\r
- List<BasicDBObject> body = NoSQLUtils.asList(script, BODY);\r
+ List<BasicDBObject> body = NoSQLUtils.asList(script, IOctopusAPI.BODY);\r
if (body == null || body.size() == 0)\r
return null;\r
\r
StringBuilder sb = new StringBuilder();\r
\r
for (BasicDBObject bodyItem : body) {\r
- if (bodyItem.containsKey(LABEL)) {\r
- sb.append(bodyItem.getString(LABEL));\r
+ if (bodyItem.containsKey(IOctopusAPI.LABEL)) {\r
+ sb.append(bodyItem.getString(IOctopusAPI.LABEL));\r
sb.append(LINEFEED);\r
}\r
- List<BasicDBObject> contents = NoSQLUtils.asList(bodyItem, CONTENT);\r
+ List<BasicDBObject> contents = NoSQLUtils.asList(bodyItem, IOctopusAPI.CONTENT);\r
if (contents == null)\r
continue;\r
for (BasicDBObject content : contents) {\r
private boolean isModified(Date date, BasicDBObject object) {\r
if (date == null)\r
return true;\r
- Date modified = (Date) object.get(MODIFIED);\r
+ Date modified = (Date) object.get(IOctopusAPI.MODIFIED);\r
int result = date.compareTo(modified);\r
return result <= 0;\r
}\r
/* teszt */\r
List<BasicDBObject> list = NoSQLUtils.asList(result);\r
for (BasicDBObject actual : list) {\r
- String fullName = concatParentsToStoryFolder(actual, actual.getString(NAME));\r
+ String fullName = concatParentsToStoryFolder(actual, actual.getString(IOctopusAPI.NAME));\r
//logger.info("Checking StoryFolder {}", fullName);\r
- actual.remove(NAME);\r
- actual.append(NAME, fullName);\r
+ actual.remove(IOctopusAPI.NAME);\r
+ actual.append(IOctopusAPI.NAME, fullName);\r
}\r
\r
logger.trace(EXIT);\r
DBObject timeObject = collection.findOne();\r
if (timeObject == null)\r
timeObject = new BasicDBObject();\r
- timeObject.put(LASTUPDATE_TIME, lastUpdateTime);\r
+ timeObject.put(IOctopusAPI.LASTUPDATE_TIME, lastUpdateTime);\r
\r
collection.save(timeObject);\r
}\r
\r
private void storeRundown(BasicDBObject rundown, Date lastUpdateTime) {\r
logger.trace(ENTER);\r
- long rundownID = rundown.getLong(ID);\r
- String name = rundown.containsKey(NAME) ? rundown.getString(NAME) : null;\r
- logger.debug("Storing rundown {} {}", name, rundown.get(SCHEDULED_START));\r
+ long rundownID = rundown.getLong(IOctopusAPI.ID);\r
+ String name = rundown.containsKey(IOctopusAPI.NAME) ? rundown.getString(IOctopusAPI.NAME) : null;\r
+ logger.debug("Storing rundown {} {}", name, rundown.get(IOctopusAPI.SCHEDULED_START));\r
BasicDBObject rundownWithStories = queryRundown(rundownID);\r
- BasicDBList stories = NoSQLUtils.asDBList(rundownWithStories, SLUGS);\r
+ BasicDBList stories = NoSQLUtils.asDBList(rundownWithStories, IOctopusAPI.SLUGS);\r
if (stories != null)\r
storeRundownStories(stories, lastUpdateTime);\r
- rundown.put(SCHEDULED_START, toDate(rundown, SCHEDULED_START));\r
- rundown.put(MODIFIED, toDate(rundown, MODIFIED));\r
- DBCollection collection = db.getCollection(RUNDOWN_COLLECTION_NAME);\r
+ rundown.put(IOctopusAPI.SCHEDULED_START, toDate(rundown, IOctopusAPI.SCHEDULED_START));\r
+ rundown.put(IOctopusAPI.MODIFIED, toDate(rundown, IOctopusAPI.MODIFIED));\r
+ DBCollection collection = db.getCollection(IOctopusAPI.RUNDOWN_COLLECTION_NAME);\r
if (lastUpdateTime == null || (lastUpdateTime != null && isModified(lastUpdateTime, rundown))) {\r
logger.debug(SAVING_RUNDOWN, rundownID, name);\r
collection.save(rundown);\r
logger.trace(ENTER);\r
List<BasicDBObject> slugsList = NoSQLUtils.asList(slugs);\r
for (BasicDBObject slug : slugsList) {\r
- if (slug.containsKey(STORY))\r
- storeStory((BasicDBObject) slug.get(STORY), lastUpdateTime);\r
+ if (slug.containsKey(IOctopusAPI.STORY))\r
+ storeStory((BasicDBObject) slug.get(IOctopusAPI.STORY), lastUpdateTime);\r
}\r
logger.trace(EXIT);\r
}\r
\r
private void storeStory(BasicDBObject story, Date lastUpdateTime) {\r
logger.trace(ENTER);\r
- long storyID = story.getLong(ID);\r
+ long storyID = story.getLong(IOctopusAPI.ID);\r
boolean isContains = storyIDs.contains(storyID);\r
if (isContains)\r
return;\r
storyIDs.add(storyID);\r
- story.put(MODIFIED, toDate(story, MODIFIED));\r
+ story.put(IOctopusAPI.MODIFIED, toDate(story, IOctopusAPI.MODIFIED));\r
BasicDBList rundownRef = storyRundowns.get(storyID);\r
rundownRef = (rundownRef == null) ? new BasicDBList() : rundownRef;\r
BasicDBList storyFolderRef = storyStoryFolders.get(storyID);\r
return;\r
}\r
\r
- DBCollection collection = db.getCollection(STORY_COLLECTION_NAME);\r
+ DBCollection collection = db.getCollection(IOctopusAPI.STORY_COLLECTION_NAME);\r
if (lastUpdateTime != null) {\r
- BasicDBObject orig = (BasicDBObject) collection.findOne(new BasicDBObject(ID, storyID), new BasicDBObject(ID, 1));\r
+ BasicDBObject orig = (BasicDBObject) collection.findOne(new BasicDBObject(IOctopusAPI.ID, storyID), new BasicDBObject(IOctopusAPI.ID, 1));\r
if (orig != null)\r
story.put("_id", orig.getID());\r
}\r
if (rundownRef != null)\r
- story.put(REF_RUNDOWN, rundownRef);\r
+ story.put(IOctopusAPI.REF_RUNDOWN, rundownRef);\r
if (storyFolderRef != null)\r
- story.put(REF_STORYFOLDER, storyFolderRef);\r
+ story.put(IOctopusAPI.REF_STORYFOLDER, storyFolderRef);\r
String scriptContent = GetScriptContent(story);\r
story.put(SCRIPT_CONTENT, scriptContent);\r
if (modifiedMOS == null || modifiedMOS.isEmpty()) {\r
- if (story.containsKey(MOS_OBJECTS))\r
- story.remove(MOS_OBJECTS);\r
+ if (story.containsKey(IOctopusAPI.MOS_OBJECTS))\r
+ story.remove(IOctopusAPI.MOS_OBJECTS);\r
} else\r
- story.put(MOS_OBJECTS, modifiedMOS);\r
+ story.put(IOctopusAPI.MOS_OBJECTS, modifiedMOS);\r
\r
- String parentSoryId = GetCustomColumnValue(PARENT_STORY_ID, story);\r
+ String parentSoryId = GetCustomColumnValue(IOctopusAPI.PARENT_STORY_ID, story);\r
if (parentSoryId == null)\r
- story.append(PARENT_STORY_ID, storyID);\r
+ story.append(IOctopusAPI.PARENT_STORY_ID, storyID);\r
else\r
- story.append(PARENT_STORY_ID, parentSoryId);\r
+ story.append(IOctopusAPI.PARENT_STORY_ID, parentSoryId);\r
logger.debug(SAVING_STORY_ID, storyID);\r
collection.save(story);\r
logger.trace(EXIT);\r
\r
private void storeStoryFolder(BasicDBObject storyFolder, Date lastUpdateTime) {\r
logger.trace(ENTER);\r
- long storyFolderID = storyFolder.getLong(ID);\r
+ long storyFolderID = storyFolder.getLong(IOctopusAPI.ID);\r
\r
BasicDBObject storyFoldersWithStories = queryStoryFolder(storyFolderID);\r
- BasicDBList stories = NoSQLUtils.asDBList(storyFoldersWithStories, STORIES);\r
+ BasicDBList stories = NoSQLUtils.asDBList(storyFoldersWithStories, IOctopusAPI.STORIES);\r
if (stories != null)\r
storeStoryFolderStories(stories, lastUpdateTime);\r
- storyFolder.put(MODIFIED, toDate(storyFolder, MODIFIED));\r
- DBCollection collection = db.getCollection(STORY_FOLDER_COLLECTION_NAME);\r
+ storyFolder.put(IOctopusAPI.MODIFIED, toDate(storyFolder, IOctopusAPI.MODIFIED));\r
+ DBCollection collection = db.getCollection(IOctopusAPI.STORY_FOLDER_COLLECTION_NAME);\r
if (lastUpdateTime == null || (lastUpdateTime != null && isModified(lastUpdateTime, storyFolder))) {\r
- String name = storyFolder.getString(NAME);\r
+ String name = storyFolder.getString(IOctopusAPI.NAME);\r
logger.debug("Storing story folder {}", name);\r
collection.save(storyFolder);\r
}\r
List<BasicDBObject> storyFolderList = NoSQLUtils.asList(storyFolders);\r
int idx = 1;\r
for (BasicDBObject storyFolder : storyFolderList) {\r
- logger.debug(String.format(CHECKING_STORY_FOLDER, storyFolder.getLong(ID), storyFolderList.size(), idx));\r
+ logger.debug(String.format(CHECKING_STORY_FOLDER, storyFolder.getLong(IOctopusAPI.ID), storyFolderList.size(), idx));\r
storeStoryFolder(storyFolder, lastUpdateTime);\r
int progress = 50 + (idx * 50 / storyFolderList.size());\r
if (progress - progressEvent.getProgress() > 0) {\r
\r
public class OctopusAPITest {\r
\r
- private IOctopusAPI sut;\r
-\r
@BeforeClass\r
public static void initialize() {\r
- System.setProperty("jobengine.nosql.db.url",\r
- "jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;");\r
+ System.setProperty("jobengine.nosql.db.url", "jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;");\r
System.setProperty("jobengine.nosql.db.user", "db2admin");\r
System.setProperty("jobengine.nosql.db.password", "password");\r
System.setProperty("jobengine.nosql.db.schema", "test");\r
System.setProperty("jobengine.octopus.api.password", "demo");\r
}\r
\r
- @Test\r
- public void getRundownsByDate() throws SQLException {\r
- sut = new OctopusAPI();\r
- Calendar calendar = Calendar.getInstance();\r
- calendar.set(2000, 5, 21);\r
- // BasicDBList rundowns = sut.getRundowns(calendar.getTime());\r
- // assertNotNull(rundowns);\r
- // assertTrue(rundowns.size() > 0);\r
- }\r
-\r
- @Test\r
- public void getRundownByStoryID() throws SQLException {\r
- sut = new OctopusAPI();\r
-\r
- List<DBObject> actual = sut.getRundownByStoryID(36421476);\r
-\r
- /*\r
- * long actualID = actual.getLong("id"); Assert.assertEquals(44622396,\r
- * actualID);\r
- */\r
- }\r
-\r
- @Test\r
- public void getStoryFolders() throws SQLException {\r
- sut = new OctopusAPI();\r
-\r
- List<DBObject> actual = sut.getStoryFolders(62549297);\r
- }\r
- \r
- @Test\r
- public void getStoriesByPlaceHolderIdTest() throws SQLException {\r
- sut = new OctopusAPI();\r
- \r
- List<DBObject> actual = sut.getStoriesByPlaceHolderId("1589225");\r
- \r
- Assert.assertFalse(actual.isEmpty());\r
- }\r
- \r
- @Test\r
- public void getStoryFoldersTest() throws SQLException {\r
- sut = new OctopusAPI();\r
-\r
- sut.getStoryFolders();\r
- }\r
+ private IOctopusAPI sut;\r
\r
- @Test\r
- public void getMosObjectsByID() throws SQLException {\r
- //Fixture\r
- final String ID = "1589225";\r
- sut = new OctopusAPI();\r
- \r
- List<DBObject> actual = sut.getMosObjectsByID(ID);\r
- \r
- Assert.assertTrue(!actual.isEmpty());\r
- }\r
- \r
@Test\r
public void getRundownByPlaceHolderIdTest() throws SQLException {\r
// Fixture\r
sut = new OctopusAPI();\r
- DB db = NoSQLClient.getDB("jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;",\r
- "db2admin", "password", "test");\r
+ DB db = NoSQLClient.getDB("jdbc:db2://10.228.198.1:50000/mccache:retrieveMessagesFromServerOnGetMessage=true;", "db2admin", "password", "test");\r
DBCollection testStoryCollection = db.getCollection("testStoryCollection");\r
DBCollection testRundownCollection = db.getCollection("testRundownCollection");\r
long storyID = 1;\r
BasicDBObject obj = new BasicDBObject("id", storyID);\r
String globalID = "OCTOPUS-ECHOTV-2429902";\r
String placeHolderID = "2429902";\r
- BasicDBObject mosObject = new BasicDBObject("mosId", "NEXIO.MOS").append("mosId", "NEXIO.MOS")\r
- .append("objId", "xxxl").append("objectType", "MosObject").append("id", placeHolderID)\r
- .append("globalId", globalID).append("modified", "2017-08-08T11:38:53.000+02:00");\r
+ BasicDBObject mosObject = new BasicDBObject("mosId", "NEXIO.MOS").append("mosId", "NEXIO.MOS").append("objId", "xxxl").append("objectType", "MosObject")\r
+ .append("id", placeHolderID).append("globalId", globalID).append("modified", "2017-08-08T11:38:53.000+02:00");\r
BasicDBList mosObjects = new BasicDBList(mosObject);\r
obj.append("mosObjects", mosObjects);\r
BasicDBObject referenceObject = new BasicDBObject("id", rundownID);\r
\r
// Exercise\r
try {\r
- List<DBObject> actual = sut.getRundownsByPlaceHolderId(placeHolderID);\r
+ List<DBObject> actual = sut.getRundownsByPlaceHolderID(placeHolderID);\r
} catch (Exception e) {\r
System.out.println(e.getMessage());\r
} finally {\r
testStoryCollection.remove();\r
}\r
}\r
+\r
+ @Test\r
+ public void getRundownsByDate() throws SQLException {\r
+ sut = new OctopusAPI();\r
+ Calendar calendar = Calendar.getInstance();\r
+ calendar.set(2000, 5, 21);\r
+ // BasicDBList rundowns = sut.getRundowns(calendar.getTime());\r
+ // assertNotNull(rundowns);\r
+ // assertTrue(rundowns.size() > 0);\r
+ }\r
+\r
+ @Test\r
+ public void getStoriesByPlaceHolderIdTest() throws SQLException {\r
+ sut = new OctopusAPI();\r
+\r
+ List<DBObject> actual = sut.getStoriesByPlaceHolderID("1589225");\r
+\r
+ Assert.assertFalse(actual.isEmpty());\r
+ }\r
+\r
+ @Test\r
+ public void getStoryFoldersTest() throws SQLException {\r
+ sut = new OctopusAPI();\r
+\r
+ sut.getStoryFolders();\r
+ }\r
}\r
@Path("/octopus")
public class OctopusRESTService {
private static final Logger logger = LogManager.getLogger();
+ private static final String ID = "id";
private IOctopusAPI octopusService = ComponentBinder.getOctopusService();
public OctopusRESTService() {
- logger.info("Created");
+ logger.trace("Created");
}
private Response createErrorResponse(Exception e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
}
- @GET
- @Path("/getMosObjectsByID/{id}")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getMosObjectsByID(@PathParam("id") String id) {
- logger.trace("Entry");
- Response result = null;
- try {
- List<DBObject> mosObjects = octopusService.getMosObjectsByID(id);
- result = Response.ok(mosObjects).build();
- } catch (Exception e) {
- result = createErrorResponse(e);
- }
- logger.trace("Exit");
- return result;
- }
-
- @GET
- @Path("/getRundownByStoryID/{id}")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- public Response getRundownByStoryID(@PathParam("id") String id) {
- logger.trace("Entry");
- Response result = null;
- try {
- List<DBObject> rundowns = octopusService.getRundownByStoryID(Long.parseLong(id));
- result = Response.ok(rundowns).build();
- } catch (Exception e) {
- result = createErrorResponse(e);
- }
- logger.trace("Exit");
- return result;
- }
-
@GET
@Path("/rundowns")
@Consumes({ MediaType.APPLICATION_JSON })
}
@GET
- @Path("/getRundownsByPlaceHolderId/{id}")
+ @Path("/rundownsByParentStoryID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getRundownsByPlaceHolderId(@PathParam("id") String id) {
+ public Response getRundownsByParentStoryID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> rundowns = octopusService.getRundownsByPlaceHolderId(id);
+ List<DBObject> rundowns = octopusService.getRundownsByParentStoryID(id);
result = Response.ok(rundowns).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@GET
- @Path("/stories/")
+ @Path("/rundownsByPlaceHolderID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStories() {
+ public Response getRundownsByPlaceHolderID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> stories = octopusService.getStories();
- result = Response.ok(stories).build();
+ List<DBObject> rundowns = octopusService.getRundownsByPlaceHolderID(id);
+ result = Response.ok(rundowns).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
}
@GET
- @Path("/stories/{rundownID}")
+ @Path("/rundownStories/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStories(@PathParam("rundownID") long rundownID) {
+ public Response getRundownStories(@PathParam(ID) long id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> stories = octopusService.getStories(rundownID);
+ List<DBObject> stories = octopusService.getRundownStories(id);
result = Response.ok(stories).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@GET
- @Path("/getStoriesByID/{id}")
+ @Path("/storiesByID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoriesByID(@PathParam("id") String id) {
+ public Response getStoriesByID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
}
@GET
- @Path("/getStoriesByParentStoryID/{id}")
+ @Path("/storiesByParentStoryID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoriesByParentStoryID(@PathParam("id") String id) {
+ public Response getStoriesByParentStoryID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
}
@GET
- @Path("/getStoriesByPlaceHolderId/{id}")
+ @Path("/storiesByPlaceHolderID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoriesByPlaceHolderId(@PathParam("id") String id) {
+ public Response getStoriesByPlaceHolderID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> stories = octopusService.getStoriesByPlaceHolderId(id);
+ List<DBObject> stories = octopusService.getStoriesByPlaceHolderID(id);
result = Response.ok(stories).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@GET
- @Path("/storiesByStoryFolderID/{storyFolderID}")
+ @Path("/storyFolders")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoriesByStoryFolderId(@PathParam("storyFolderID") long storyFolderID) {
+ public Response getStoryFolders() {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> stories = octopusService.getStoriesByStoryFolderId(storyFolderID);
- result = Response.ok(stories).build();
+ List<DBObject> storyFolders = octopusService.getStoryFolders();
+ result = Response.ok(storyFolders).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
}
@GET
- @Path("/storyfolders")
+ @Path("/storyFoldersByPlaceHolderID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoryFolders() {
+ public Response getStoryFoldersByPlaceHolderID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> storyFolders = octopusService.getStoryFolders();
+ List<DBObject> storyFolders = octopusService.getStoryFoldersByPlaceHolderID(id);
result = Response.ok(storyFolders).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@GET
- @Path("/getStoryFoldersByPlaceHolderId/{id}")
+ @Path("/storyFoldersByParentStoryID/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoryFoldersByPlaceHolderId(@PathParam("id") String id) {
+ public Response getStoryFoldersByStoryID(@PathParam(ID) String id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> storyFolders = octopusService.getStoryFoldersByPlaceHolderId(id);
+ List<DBObject> storyFolders = octopusService.getStoryFoldersByParentStoryID(id);
result = Response.ok(storyFolders).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@GET
- @Path("/getStoryFolders/{id}")
+ @Path("/storyFolderStories/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response getStoryFoldersByStoryID(@PathParam("id") String id) {
+ public Response getStoryFolderStories(@PathParam(ID) long id) {
logger.trace("Entry");
Response result = null;
try {
- List<DBObject> storyFolders = octopusService.getStoryFolders(Long.parseLong(id));
- result = Response.ok(storyFolders).build();
+ List<DBObject> stories = octopusService.getStoryFolderStories(id);
+ result = Response.ok(stories).build();
} catch (Exception e) {
result = createErrorResponse(e);
}
@Path("/test/{id}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public Response test(@PathParam("id") Long jobId) {
+ public Response test(@PathParam(ID) Long jobId) {
Response result = null;
try {
String json = "{valami: " + jobId + " }";