From: Bellai Ádám Date: Fri, 29 Sep 2017 12:51:54 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=a062d444767f880984a64665d85897b18dbf0a52;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30486 --- diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index abd0eced..c358517c 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -213,11 +213,8 @@ namespace Maestro { private void dataGridSource_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) return; - ISourceItem item = dataGridSource.Rows[e.RowIndex].DataBoundItem as ISourceItem; - SelectedSource = new SourceInfo() { - FileInfo = (item as FileSourceItem)?.FileInfo, - Name = item.Name - }; + var selectedItem = bindingSource.Current; + SetSourceFromCheckBoxAction(sender, selectedItem); } } } diff --git a/client/Maestro/MaestroForm.Target.cs b/client/Maestro/MaestroForm.Target.cs index 96ac62b0..269b5e0a 100644 --- a/client/Maestro/MaestroForm.Target.cs +++ b/client/Maestro/MaestroForm.Target.cs @@ -141,10 +141,13 @@ namespace Maestro { string id = selectedMetadata.ID; OctopusAPI api = octopusIDSelector.GetClient(); IEnumerable storyEnum = api.GetStoriesById(id); - if (storyEnum != null) + if (storyEnum != null) FillModelFromStories(model, storyEnum.ToList(), api); else { - List stories = api.GetStoriesByPlaceHolderId(id).ToList(); + IEnumerable storiesEnum = api.GetStoriesByPlaceHolderId(id); + if (storiesEnum == null) + return; + List stories = storiesEnum.ToList(); FillModelFromStories(model, stories, api); } } @@ -152,12 +155,18 @@ namespace Maestro { private void FillModelFromStories(ArchiveMetadataModel model, List stories, OctopusAPI api) { Story story = stories[0]; if (story.StoryFolders != null) { - List storyFolders = api.GetStoryFoldersByStoryID(story.ID).ToList(); + IEnumerable storyFoldersEnum = api.GetStoryFoldersByStoryID(story.ID); + if (storyFoldersEnum == null) + return; + List storyFolders = storyFoldersEnum.ToList(); StoryFolder folder = storyFolders[0]; model.StuffID = folder.ID; model.StuffTitle = folder.Name; } else if (story.Rundowns != null) { - List rundowns = api.GetRundownsByStoryID(story.ID).ToList(); + IEnumerable rundownsEnum = api.GetRundownsByStoryID(story.ID); + if (rundownsEnum == null) + return; + List rundowns = rundownsEnum.ToList(); Rundown rundown = rundowns[0]; model.StuffID = rundown.ID; model.StuffTitle = rundown.Name; diff --git a/client/Maestro/MaestroForm.cs b/client/Maestro/MaestroForm.cs index 5ad63c9c..5d354e0c 100644 --- a/client/Maestro/MaestroForm.cs +++ b/client/Maestro/MaestroForm.cs @@ -208,6 +208,8 @@ namespace Maestro { private void SearchMosIDs(OctopusAPI api) { IEnumerable mosIDs = api.GetMosObjectsByID(startingName); + if (mosIDs == null) + return; List list = mosIDs.ToList(); if (list == null || list.Count == 0) { MessageBox.Show(this, StringResources.NINCS_TALALAT); diff --git a/client/PlanAIRClient/TrafficIDSelector.cs b/client/PlanAIRClient/TrafficIDSelector.cs index 9b8f48cf..ef614ff0 100644 --- a/client/PlanAIRClient/TrafficIDSelector.cs +++ b/client/PlanAIRClient/TrafficIDSelector.cs @@ -106,13 +106,8 @@ namespace TrafficClient { } private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - if (e.RowIndex < 0) - return; - - MamResultWrapper res = dataGridView1.Rows[e.RowIndex].DataBoundItem as MamResultWrapper; - if (res == null) - return; - IDChangedEvent?.Invoke(res.MediaID, res.VariantID); + DataGridViewCell checkBoxCell = dataGridView1.Rows[e.RowIndex].Cells[0]; + SetCheckBoxAndInvokeIDChangeEvent(checkBoxCell, e.RowIndex); } private void searchButton_Click(object sender, EventArgs e) { @@ -133,11 +128,15 @@ namespace TrafficClient { return; //nincs multiselect DataGridViewCell checkBoxCell = gridView.SelectedCells[0]; + SetCheckBoxAndInvokeIDChangeEvent(checkBoxCell, e.RowIndex); + } + + private void SetCheckBoxAndInvokeIDChangeEvent(DataGridViewCell checkBoxCell, int rowIndex) { bool selected = checkBoxCell.Value.Equals(false); clearCheckBox?.Invoke(); ClearSelectionSource(); //checkBoxCell.Value = checkBoxCell.Value.Equals(true) ? true : false; - MamResultWrapper res = dataGridView1.Rows[e.RowIndex].DataBoundItem as MamResultWrapper; + MamResultWrapper res = dataGridView1.Rows[rowIndex].DataBoundItem as MamResultWrapper; res.Selected = selected; if (selected) { IDChangedEvent?.Invoke(res.MediaID, res.VariantID); diff --git a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java index 8a36592c..f6e97f83 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java @@ -96,12 +96,12 @@ public class OctopusAPI implements IOctopusAPI { DBCollection storyFolderCollection = db.getCollection(STORY_FOLDER_COLLECTION_NAME); DBCursor find = storyCollection.find(new BasicDBObject("id", storyID), new BasicDBObject(STORY_FOLDER, 1).append("_id", 0)); - result = getRundownsByReferences(find, storyFolderCollection, queryedStory_FoldersFromStoryCollection, + result = getParentsByReferences(find, storyFolderCollection, queryedStory_FoldersFromStoryCollection, STORY_FOLDER); return result; } - private List getRundownsByReferences(DBCursor find, DBCollection collection, + private List getParentsByReferences(DBCursor find, DBCollection collection, List referenceObjects, String referenceName) { List result = null; if (find.hasNext()) @@ -115,6 +115,7 @@ public class OctopusAPI implements IOctopusAPI { } return result; } + private List getIDsFromReferences(List list, String referenceName) { List result = new ArrayList<>(); @@ -136,7 +137,7 @@ public class OctopusAPI implements IOctopusAPI { DBCollection rundownCollection = db.getCollection(RUNDOWN_COLLECTION_NAME); DBCursor find = storyCollection.find(new BasicDBObject("id", storyID), new BasicDBObject(RUNDOWN, 1).append("_id", 0)); - result = getRundownsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); + result = getParentsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); return result; } @@ -146,27 +147,26 @@ public class OctopusAPI implements IOctopusAPI { DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME); DBCollection rundownCollection = db.getCollection(RUNDOWN_COLLECTION_NAME); List queryedRundownsFromStoryCollection = null; - BasicDBObject globalId = new BasicDBObject("globalId", placeHolderID); - BasicDBObject elemmatch = new BasicDBObject("$elemMatch", globalId); + BasicDBObject id = new BasicDBObject("id", placeHolderID); + BasicDBObject elemmatch = new BasicDBObject("$elemMatch", id); BasicDBObject mosObjects = new BasicDBObject("mosObjects", elemmatch); //db.testStoryCollection.find({"mosObjects": {$elemMatch: {"globalId": "OCTOPUS-ECHOTV-2429902"}}}) - DBCursor find = storyCollection.find(mosObjects, new BasicDBObject(RUNDOWN, 1).append("_id", 0)); - result = getRundownsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); + DBCursor find = storyCollection.find(mosObjects); + result = getParentsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); return result; } - //teszteletlen @Override public List getStoryFoldersByPlaceHolderId(String placeHolderID) { List result = null; DBCollection storyCollection = db.getCollection(STORY_COLLECTION_NAME); DBCollection rundownCollection = db.getCollection(STORY_FOLDER_COLLECTION_NAME); List queryedRundownsFromStoryCollection = null; - BasicDBObject globalId = new BasicDBObject("globalId", placeHolderID); + BasicDBObject globalId = new BasicDBObject("id", placeHolderID); BasicDBObject elemmatch = new BasicDBObject("$elemMatch", globalId); BasicDBObject mosObjects = new BasicDBObject("mosObjects", elemmatch); DBCursor find = storyCollection.find(mosObjects, new BasicDBObject(STORY_FOLDER, 1).append("_id", 0)); - result = getRundownsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, STORY_FOLDER); + result = getParentsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, STORY_FOLDER); return result; } @@ -247,7 +247,6 @@ public class OctopusAPI implements IOctopusAPI { DBCursor find = storyCollection.find(mosObjects); if(find.hasNext()) result.add(find.next()); - //result = getRundownsByReferences(find, rundownCollection, queryedRundownsFromStoryCollection, RUNDOWN); return result; } } diff --git a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java index 57a1d438..9109ea04 100644 --- a/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java +++ b/server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusAPITest.java @@ -102,8 +102,9 @@ public class OctopusAPITest { long rundownID = 2; BasicDBObject obj = new BasicDBObject("id", storyID); String globalID = "OCTOPUS-ECHOTV-2429902"; + String placeHolderID = "2429902"; BasicDBObject mosObject = new BasicDBObject("mosId", "NEXIO.MOS").append("mosId", "NEXIO.MOS") - .append("objId", "xxxl").append("objectType", "MosObject").append("id", 2429902) + .append("objId", "xxxl").append("objectType", "MosObject").append("id", placeHolderID) .append("globalId", globalID).append("modified", "2017-08-08T11:38:53.000+02:00"); BasicDBList mosObjects = new BasicDBList(mosObject); obj.append("mosObjects", mosObjects); @@ -116,7 +117,7 @@ public class OctopusAPITest { // Exercise try { - List actual = sut.getRundownsByPlaceHolderId(globalID); + List actual = sut.getRundownsByPlaceHolderId(placeHolderID); } catch (Exception e) { System.out.println(e.getMessage()); } finally {