git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Tue, 19 Dec 2017 14:44:14 +0000 (14:44 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Tue, 19 Dec 2017 14:44:14 +0000 (14:44 +0000)
27 files changed:
client/AudioRecorder/Properties/AssemblyInfo.cs
client/DxPlay/DxPlayer.cs
client/DxPlay/Properties/AssemblyInfo.cs
client/MXFFileParser/MXFFile.cs
client/MXFFileParser/Metadata/B17 MXFTimecodeComponent.cs
client/MXFFileParser/Properties/AssemblyInfo.cs
client/Maestro/Installer/installforge-installer-project.ifp
client/Maestro/Properties/AssemblyInfo.cs
client/MaestroShared/Metadata/Timecode.cs
server/-configuration/deploy-bkup-mediacube-modules.launch [moved from server/-configuration/deploy-mediacube-modules.launch with 88% similarity]
server/-configuration/deploy-cluster-mediacube-modules.launch [new file with mode: 0644]
server/-configuration/run-mediacube-server-bsh.launch
server/-configuration/scheduledjobs.json
server/-modules/pom.xml
server/-product/mediacube.product
server/-product/pom.xml
server/user.jobengine.executors/config/scheduledjobs.json
server/user.jobengine.executors/deploy-steps-to-bsh-bkup.bat [new file with mode: 0644]
server/user.jobengine.executors/deploy-steps-to-bsh-bkup.launch [new file with mode: 0644]
server/user.jobengine.executors/jobtemplates/sync-octopus.xml
server/user.jobengine.executors/src/user/jobengine/server/steps/OctopusDataMiner.java
server/user.jobengine.executors/src/user/jobengine/server/steps/SyncOCTOPUSDataStep.java
server/user.jobengine.osgi.commons/src/user/commons/octopus/IOctopusAPI.java
server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusDataMiner1.java [moved from server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusDataMiner.java with 97% similarity]
server/user.jobengine.osgi.commons/test/user/common/octopus/test/OctopusDataMinerTest.java
server/user.jobengine.osgi.db/sql/cleanup.sql
server/user.jobengine.osgi.server/src/user/jobengine/server/actions/DoneSuspendAction.java

index 9126768115db11b16107b44e1f53e283d91b63ec..5516b1be6b340a36832fecdc7426380aba14d321 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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.6.8")]\r
-[assembly: AssemblyFileVersion("2.0.6.8")]\r
+[assembly: AssemblyVersion("2.0.6.9")]\r
+[assembly: AssemblyFileVersion("2.0.6.9")]\r
index 200bb5e99f254947893c8b4cd279bca03c7a8d81..3d8d3247808ac556d38a408c06d9e21ba1521a76 100644 (file)
@@ -388,7 +388,8 @@ namespace DxPlay {
                 try {\r
                     MXFFile mxf = new MXFFile(MediaDescription.FileName);\r
                     mxf.Inspect();\r
-                    MediaDescription.firstFrame = new Timecode(mxf.FirstSystemItem?.UserDateFullFrameNb, MediaDescription.FrameRate);\r
+                    //MediaDescription.firstFrame = new Timecode(mxf.FirstSystemItem?.UserDateFullFrameNb, MediaDescription.FrameRate);\r
+                    MediaDescription.firstFrame = new Timecode((int) mxf.TimecodeComponent.StartTimecode,(float) mxf.TimecodeComponent.RoundedTimecodeBase);\r
                 }\r
                 catch (Exception ex) {\r
                     MediaDescription.firstFrame = new Timecode();\r
index 177a4f0e70a4b445695af07433a1d6c61e09c543..83b07a225faf697fe125b260d9fa7d5a9c5cd2b8 100644 (file)
@@ -26,7 +26,7 @@ using System.Runtime.CompilerServices;
 // You can specify all the values or you can default the Revision and Build Numbers \r
 // by using the '*' as shown below:\r
 \r
-[assembly: AssemblyVersion("1.0.*")]\r
+[assembly: AssemblyVersion("2.0.6.9")]\r
 \r
 //\r
 // In order to sign your assembly you must specify a key to use. Refer to the \r
@@ -56,3 +56,5 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign(false)]\r
 [assembly: AssemblyKeyFile("")]\r
 [assembly: AssemblyKeyName("")]\r
+[assembly: AssemblyFileVersion("2.0.6.9")]\r
+\r
index b4c146cbb3137b71d91d0e8a0e2e8d6dd8972d93..c1f103db74a3464a99c87e1b927c6dade1255890 100644 (file)
@@ -47,7 +47,12 @@ namespace Myriadbits.MXF {
     /// Name object, represents a complete MXF file\r
     /// </summary>\r
     public class MXFFile : MXFObject {\r
+        public MXFTimecodeComponent TimecodeComponent {\r
+            get; internal set;\r
+        }\r
+\r
         private MXFReader m_reader;\r
+        private List<MXFValidationResult> m_results;\r
 \r
         public string Filename { get; set; }\r
         public long Filesize { get; set; }\r
@@ -55,9 +60,12 @@ namespace Myriadbits.MXF {
         public List<MXFPartition> Partitions { get; set; }\r
         public MXFRIP RIP { get; set; }\r
 \r
+        public List<MXFValidationResult> Results { get { return m_results; } }\r
         public MXFSystemItem FirstSystemItem { get; set; }\r
         public MXFSystemItem LastSystemItem { get; set; }\r
 \r
+        public List<MXFObject> FlatList { get; set; }\r
+\r
         public MXFLogicalObject LogicalBase { get; set; }\r
 \r
 \r
@@ -68,19 +76,96 @@ namespace Myriadbits.MXF {
         public MXFFile(string fileName) {\r
             this.Filename = fileName;\r
             this.Partitions = new List<MXFPartition>();\r
+            this.m_results = new List<MXFValidationResult>();\r
+        }\r
+\r
+        public void Inspect(FileParseOptions options = FileParseOptions.FastStartTC) {\r
+            switch (options) {\r
+                case FileParseOptions.Normal:\r
+                    ParseFull();\r
+                    break;\r
+                case FileParseOptions.Fast:\r
+                    ParsePartial();\r
+                    break;\r
+                case FileParseOptions.FastStartTC:\r
+                    ParsePartial(true);\r
+                    break;\r
+            }\r
         }\r
 \r
-        public void Inspect() {\r
-            ParsePartial(true);\r
+        /// <summary>\r
+        /// Fully Parse an MXF file \r
+        /// </summary>\r
+        protected void ParseFull() {\r
+            Stopwatch sw = Stopwatch.StartNew();\r
+\r
+            MXFKLVFactory klvFactory = new MXFKLVFactory();\r
+\r
+            MXFPartition currentPartition = null;\r
+            Dictionary<UInt16, MXFEntryPrimer> allPrimerKeys = null;\r
+            int[] counters = new int[Enum.GetNames(typeof(KeyType)).Length];\r
+            using (m_reader = new MXFReader(this.Filename)) {\r
+                this.Filesize = m_reader.Size;\r
+                MXFObject partitions = new MXFNamedObject("Partitions", 0);\r
+                this.AddChild(partitions);\r
+\r
+                int partitionNumber = 0; // For easy partition identification\r
+                while (!m_reader.EOF) {\r
+                    MXFKLV klv = klvFactory.CreateObject(m_reader, currentPartition);\r
+\r
+                    // Update overall counters\r
+                    if (klv.Key.Type == KeyType.None)\r
+                        counters[(int)klv.Key.Type]++;\r
+\r
+                    // Process the new KLV\r
+                    ProcessKLVObject(klv, partitions, ref currentPartition, ref partitionNumber, ref allPrimerKeys);\r
+\r
+                    // Next KLV please\r
+                    m_reader.Seek(klv.DataOffset + klv.Length);\r
+                }\r
+            }\r
+            // Progress should now be 90%\r
+\r
+            // Update all type descriptions\r
+            klvFactory.UpdateAllTypeDescriptions(allPrimerKeys);\r
+\r
+            Debug.WriteLine("Finished parsing file '{0}' in {1} ms", this.Filename, sw.ElapsedMilliseconds);\r
+            sw.Restart();\r
+\r
+            // Create a list with all UID keys\r
+            Dictionary<string, MXFObject> allKeys = new Dictionary<string, MXFObject>();\r
+            CreateKeyList(allKeys, this);\r
+\r
+            // Resolve the references\r
+            ResolveReferences(allKeys, this);\r
+            Debug.WriteLine("Finished resolving references in {0} ms", sw.ElapsedMilliseconds);\r
+            sw.Restart();\r
+\r
+            this.FlatList = new List<MXFObject>();\r
+            this.AddToList(this.FlatList);\r
+            Debug.WriteLine("Flatlist created in {0} ms", sw.ElapsedMilliseconds);\r
+            sw.Restart();\r
+\r
+\r
+            // Create the logical tree\r
+            CreateLogicalTree();\r
+            Debug.WriteLine("Logical tree created in {0} ms", sw.ElapsedMilliseconds);\r
+            sw.Restart();\r
+\r
+            // And Execute ALL test\r
+            this.ExecuteValidationTest(true);\r
         }\r
 \r
+\r
         /// <summary>\r
         /// Partially Parse an MXF file, skip all data\r
         /// </summary>\r
         protected void ParsePartial(bool stopOnStartTC = false) {\r
             MXFKLVFactory klvFactory = new MXFKLVFactory();\r
+\r
             MXFPartition currentPartition = null;\r
             Dictionary<UInt16, MXFEntryPrimer> allPrimerKeys = null;\r
+            int[] counters = new int[Enum.GetNames(typeof(KeyType)).Length];\r
             PartialSeekMode seekMode = PartialSeekMode.Unknown;\r
             using (m_reader = new MXFReader(this.Filename)) {\r
                 this.Filesize = m_reader.Size;\r
@@ -98,6 +183,11 @@ namespace Myriadbits.MXF {
                 while (!m_reader.EOF && seekMode != PartialSeekMode.Backwards) // Eof and NOT searching backwards\r
                 {\r
                     MXFKLV klv = klvFactory.CreateObject(m_reader, currentPartition);\r
+                    if (klv is MXFTimecodeComponent && stopOnStartTC) {\r
+                        TimecodeComponent = klv as MXFTimecodeComponent;\r
+                        break;\r
+                    }\r
+\r
 \r
                     // Update overall counters\r
                     //if (klv.Key.Type == KeyType.None)\r
@@ -113,9 +203,9 @@ namespace Myriadbits.MXF {
 \r
                     // Process the new KLV\r
 \r
-                    if (!ProcessKLVObject(klv, partitions, ref currentPartition, ref partitionNumber, ref allPrimerKeys, true))\r
+                    if (!ProcessKLVObjectOrig(klv, partitions, ref currentPartition, ref partitionNumber, ref allPrimerKeys))\r
                         break;\r
-                    Debug.WriteLine("Processed partition {0}/{1} ", currentPartition, partitionNumber);\r
+                    Debug.WriteLine("Processed partition {0}/{1} ", klv.Key.Name, partitionNumber);\r
 \r
 \r
                     // If we found the second partition \r
@@ -190,7 +280,7 @@ namespace Myriadbits.MXF {
                         return false;\r
                 }\r
                 currentPartition.AddChild(klv);\r
-            } \r
+            }\r
 \r
             if (this.FirstSystemItem == null) {\r
                 this.FirstSystemItem = klv as MXFSystemItem;\r
@@ -200,6 +290,92 @@ namespace Myriadbits.MXF {
             return true;\r
         }\r
 \r
+        private bool ProcessKLVObjectOrig(MXFKLV klv, MXFObject partitions, ref MXFPartition currentPartition, ref int partitionNumber, ref Dictionary<UInt16, MXFEntryPrimer> allPrimerKeys) {\r
+            // Is this a header, add to the partitions\r
+            switch (klv.Key.Type) {\r
+                case KeyType.Partition:\r
+                    currentPartition = klv as MXFPartition;\r
+                    currentPartition.File = this;\r
+                    currentPartition.PartitionNumber = partitionNumber;\r
+                    this.Partitions.Add(currentPartition);\r
+                    partitions.AddChild(currentPartition);\r
+                    partitionNumber++;\r
+                    break;\r
+\r
+                case KeyType.PrimerPack:\r
+                    if (currentPartition != null) {\r
+                        MXFPrimerPack primer = klv as MXFPrimerPack;\r
+                        if (primer != null) // Just to be sure\r
+                        {\r
+                            // Let the partition know all primer keys\r
+                            allPrimerKeys = primer.AllKeys;\r
+                            currentPartition.PrimerKeys = primer.AllKeys;\r
+                        }\r
+                        currentPartition.AddChild(klv); // Add the primer \r
+                    }\r
+                    break;\r
+\r
+                case KeyType.RIP:\r
+                    // Only add the RIP when not yet present\r
+                    if (this.RIP == null) {\r
+                        this.AddChild(klv);\r
+                        this.RIP = klv as MXFRIP;\r
+                    }\r
+                    break;\r
+\r
+                case KeyType.SystemItem:\r
+                    if (currentPartition != null) {\r
+                        // Store the first system item for every partition\r
+                        // (required to calculate essence positions)\r
+                        if (currentPartition.FirstSystemItem == null) {\r
+                            currentPartition.FirstSystemItem = klv as MXFSystemItem;\r
+                        }\r
+                        currentPartition.AddChild(klv);\r
+                    } else\r
+                        this.AddChild(klv);\r
+\r
+                    // Store the first and the last system item\r
+                    if (this.FirstSystemItem == null) {\r
+                        this.FirstSystemItem = klv as MXFSystemItem;\r
+                    }\r
+                    this.LastSystemItem = klv as MXFSystemItem;\r
+                    break;\r
+\r
+\r
+                case KeyType.Essence:\r
+                    if (currentPartition != null) {\r
+                        // Store the first system item for every partition\r
+                        // (required to calculate essence positions)\r
+                        MXFEssenceElement ee = klv as MXFEssenceElement;\r
+                        if (ee.IsPicture && currentPartition.FirstPictureEssenceElement == null)\r
+                            currentPartition.FirstPictureEssenceElement = ee;\r
+                        currentPartition.AddChild(klv);\r
+                    } else\r
+                        this.AddChild(klv);\r
+                    break;\r
+\r
+                case KeyType.Preface:\r
+                    this.LogicalBase = new MXFLogicalObject(klv, klv.ToString());\r
+                    // Normal\r
+                    if (currentPartition != null)\r
+                        currentPartition.AddChild(klv);\r
+                    else\r
+                        this.AddChild(klv);\r
+                    break;\r
+\r
+                default:\r
+                    // Normal\r
+                    if (currentPartition != null)\r
+                        currentPartition.AddChild(klv);\r
+                    else\r
+                        this.AddChild(klv);\r
+                    break;\r
+            }\r
+\r
+            return true;\r
+        }\r
+\r
+\r
         /// <summary>\r
         /// Try to locate the RIP\r
         /// </summary>\r
@@ -224,6 +400,91 @@ namespace Myriadbits.MXF {
         }\r
 \r
 \r
+        /// <summary>\r
+        ///  Execute all validation tests\r
+        /// </summary>\r
+        public void ExecuteValidationTest(bool extendedTest) {\r
+            // Reset results\r
+            this.m_results.Clear();\r
+\r
+            // Execute validation tests\r
+            List<MXFValidator> allTest = new List<MXFValidator>();\r
+            allTest.Add(new MXFValidatorInfo());\r
+            allTest.Add(new MXFValidatorPartitions());\r
+            allTest.Add(new MXFValidatorRIP());\r
+            if (extendedTest) {\r
+                allTest.Add(new MXFValidatorIndex());\r
+            }\r
+            foreach (MXFValidator mxfTest in allTest) {\r
+                mxfTest.Initialize(this);\r
+                mxfTest.ExecuteTest(ref m_results);\r
+            }\r
+\r
+            if (!extendedTest) {\r
+                MXFValidationResult valResult = new MXFValidationResult("Index Table");\r
+                this.m_results.Add(valResult);\r
+                valResult.SetWarning("Index table test not executed in partial loading mode (to execute test press the execute all test button).");\r
+                //MXFValidationResult valResult = new MXFValidationResult("Index Tables");                             \r
+                //this.Results.Add(valResult); // And directly add the results\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Create the logical view (starting with the preface)\r
+        /// </summary>\r
+        protected void CreateLogicalTree() {\r
+            if (this.LogicalBase == null)\r
+                return;\r
+\r
+            LogicalAddChilds(this.LogicalBase);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Add all children (recusive)\r
+        /// </summary>\r
+        /// <param name="parent"></param>\r
+        protected MXFLogicalObject LogicalAddChilds(MXFLogicalObject parent) {\r
+            // Check properties for reference\r
+            MXFObject reference = parent.Object;\r
+            if (reference != null) {\r
+                foreach (PropertyInfo propertyInfo in reference.GetType().GetProperties()) {\r
+                    if (propertyInfo.CanRead) {\r
+                        if (propertyInfo.PropertyType == typeof(MXFRefKey)) {\r
+                            // Found one!\r
+                            MXFRefKey refKey = (MXFRefKey)propertyInfo.GetValue(reference, null);\r
+                            if (refKey != null && refKey.Reference != null) {\r
+                                // Add the child\r
+                                MXFLogicalObject lo = new MXFLogicalObject(refKey.Reference, refKey.Reference.ToString());\r
+                                parent.AddChild(lo);\r
+\r
+                                // Add all sub stuff\r
+                                LogicalAddChilds(lo);\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (reference.HasChildren) {\r
+                    foreach (MXFObject child in reference.Children) {\r
+                        if (child.HasChildren) {\r
+                            foreach (MXFObject grandchild in child.Children) {\r
+                                MXFRefKey refKey = grandchild as MXFRefKey;\r
+                                if (refKey != null && refKey.Reference != null) {\r
+                                    MXFLogicalObject lo = new MXFLogicalObject(refKey.Reference, refKey.Reference.ToString());\r
+\r
+                                    // Add the child\r
+                                    parent.AddChild(lo);\r
+\r
+                                    // Add all sub stuff\r
+                                    LogicalAddChilds(lo);\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            return parent;\r
+        }\r
 \r
         /// <summary>\r
         /// Loop through all items, when an item with a reference is found, \r
index dadf6527339452fb949cd6aa782ce276a51be9a2..7a23b67b8bb507b60c09ab1ee1816496c934d98a 100644 (file)
@@ -24,7 +24,7 @@ using System.ComponentModel;
 \r
 namespace Myriadbits.MXF\r
 {\r
-       class MXFTimecodeComponent : MXFStructuralComponent\r
+       public class MXFTimecodeComponent : MXFStructuralComponent\r
        {\r
                [CategoryAttribute("TimecodeComponent"), Description("1501")]\r
                public UInt64? StartTimecode { get; set; }\r
index e5f4f80ce6bc366a2104eacbe91db4891596cfc0..95a916f9e6164393973c71ba2ec55329044fc7ac 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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.2.0.4")]\r
-[assembly: AssemblyFileVersion("2.2.0.4")]\r
+[assembly: AssemblyVersion("2.2.0.5")]\r
+[assembly: AssemblyFileVersion("2.2.0.5")]\r
index 02cc44e2481889d3187072bf28654d92e6685e10..a59de308abf132099858b570da9dccd62ebb5560 100644 (file)
Binary files a/client/Maestro/Installer/installforge-installer-project.ifp and b/client/Maestro/Installer/installforge-installer-project.ifp differ
index d54db5b5b86bfda4d91bfb54e7eb57708de5ea46..571031c3e91f58d1bf684667a27176b97e5bf878 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // 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.6.8")]\r
-[assembly: AssemblyFileVersion("2.0.6.8")]\r
+[assembly: AssemblyVersion("2.0.6.9")]\r
+[assembly: AssemblyFileVersion("2.0.6.9")]\r
index bf29d379d0b29422b0c243200bd95c5cf012d073..254c1517366e1af68715ff63195c1de65de5b413 100644 (file)
@@ -15,6 +15,11 @@ namespace MaestroShared.Metadata {
             Set(frames);\r
         }\r
 \r
+        public Timecode(int frames, float frameRate) {\r
+            this.frameRate = frameRate; \r
+            Set(frames);\r
+        }\r
+\r
         public Timecode(Timecode tc) {\r
             if (tc == null)\r
                 return;\r
similarity index 88%
rename from server/-configuration/deploy-mediacube-modules.launch
rename to server/-configuration/deploy-bkup-mediacube-modules.launch
index b74846aaa1084d50cf558a059bb666538401001a..1388508fa5b6facb5fb3be0e4b6621db0f5a5192 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
 <launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
 <booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
-<stringAttribute key="M2_GOALS" value="clean deploy"/>\r
+<stringAttribute key="M2_GOALS" value="clean deploy -Dremote.address=scp://root:password@10.10.1.29"/>\r
 <booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
 <booleanAttribute key="M2_OFFLINE" value="false"/>\r
 <stringAttribute key="M2_PROFILES" value=""/>\r
diff --git a/server/-configuration/deploy-cluster-mediacube-modules.launch b/server/-configuration/deploy-cluster-mediacube-modules.launch
new file mode 100644 (file)
index 0000000..2203745
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">\r
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>\r
+<stringAttribute key="M2_GOALS" value="clean deploy -Dremote.address=scp://root:password@10.10.1.27"/>\r
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>\r
+<booleanAttribute key="M2_OFFLINE" value="false"/>\r
+<stringAttribute key="M2_PROFILES" value=""/>\r
+<listAttribute key="M2_PROPERTIES"/>\r
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>\r
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>\r
+<intAttribute key="M2_THREADS" value="1"/>\r
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>\r
+<stringAttribute key="M2_USER_SETTINGS" value=""/>\r
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>\r
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">\r
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>\r
+</listAttribute>\r
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}/-modules"/>\r
+</launchConfiguration>\r
index 5b9bf249253992d4184acbbccec817cf7904dbf0..9a02b73714de397b081e5bef44f87d5483029eb0 100644 (file)
@@ -19,7 +19,7 @@
 <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console"/>\r
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>\r
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory&#13;&#10;-Dorg.eclipse.epp.logging.aeri.skipReports=true &#13;&#10;-Declipse.ignoreApp=true &#13;&#10;-Dosgi.noShutdown=true&#13;&#10;-Djobengine.jobsteps.root=&quot;${workspace_loc}/user.jobengine.executors/config&quot;&#13;&#10;-Djobengine.jobtemplates.root=&quot;${workspace_loc}/user.jobengine.executors/jobtemplates&quot;&#13;&#10;-Djobengine.db.url=jdbc:db2://10.10.1.27:50000/mc:retrieveMessagesFromServerOnGetMessage=true;&#13;&#10;-Djobengine.db.user=db2admin&#13;&#10;-Djobengine.db.password=password&#13;&#10;-Djobengine.loglevel=INFO&#13;&#10;-Dlog4j.configurationFile=&quot;${workspace_loc}/-configuration/log4j2.xml&quot;&#13;&#10;-Djobengine.jobsteps.alternate.root=&quot;${workspace_loc}/user.jobengine.executors/bin/user/jobengine/server/steps&quot;&#13;&#10;-Djetty.home=&quot;${workspace_loc:}/-configuration/jetty&quot;&#13;&#10;-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&#13;&#10;-Djobengine.octopus.api.address=http://10.10.1.11/api/v1&#13;&#10;-Djobengine.octopus.api.user=mam&#13;&#10;-Djobengine.octopus.api.password=napocska&#13;&#10;-Djobengine.nosql.db.url=jdbc:db2://10.10.1.27:50000/mc:retrieveMessagesFromServerOnGetMessage=true;&#13;&#10;-Djobengine.nosql.db.user=db2admin&#13;&#10;-Djobengine.nosql.db.password=password&#13;&#10;-Djobengine.nosql.db.schema=test&#13;&#10;-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl&#13;&#10;-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC.zenium&#13;&#10;-Djobengine.jobscheduling.config=&quot;${workspace_loc}/-configuration/scheduledjobs.json&quot;&#13;&#10;-Dnexio.host=10.10.1.55&#13;&#10;-Dnexio.disable=true"/>\r
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djavax.ws.rs.ext.RuntimeDelegate=org.jboss.resteasy.spi.ResteasyProviderFactory&#13;&#10;-Dorg.eclipse.epp.logging.aeri.skipReports=true &#13;&#10;-Declipse.ignoreApp=true &#13;&#10;-Dosgi.noShutdown=true&#13;&#10;-Djobengine.jobsteps.root=&quot;${workspace_loc}/user.jobengine.executors/config&quot;&#13;&#10;-Djobengine.jobtemplates.root=&quot;${workspace_loc}/user.jobengine.executors/jobtemplates&quot;&#13;&#10;-Djobengine.db.url=jdbc:db2://10.10.1.27:50000/mc:retrieveMessagesFromServerOnGetMessage=true;&#13;&#10;-Djobengine.db.user=db2admin&#13;&#10;-Djobengine.db.password=password&#13;&#10;-Djobengine.loglevel=INFO&#13;&#10;-Dlog4j.configurationFile=&quot;${workspace_loc}/-configuration/log4j2.xml&quot;&#13;&#10;-Djobengine.jobsteps.alternate.root=&quot;${workspace_loc}/user.jobengine.executors/bin/user/jobengine/server/steps&quot;&#13;&#10;-Djetty.home=&quot;${workspace_loc:}/-configuration/jetty&quot;&#13;&#10;-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&#13;&#10;-Djobengine.octopus.api.address=http://10.10.1.11/api/v1&#13;&#10;-Djobengine.octopus.api.user=mam&#13;&#10;-Djobengine.octopus.api.password=napocska&#13;&#10;-Djobengine.nosql.db.url=jdbc:db2://10.10.1.27:50000/mc:retrieveMessagesFromServerOnGetMessage=true;&#13;&#10;-Djobengine.nosql.db.user=db2admin&#13;&#10;-Djobengine.nosql.db.password=password&#13;&#10;-Djobengine.nosql.db.schema=test&#13;&#10;-Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl&#13;&#10;-Djobengine.selenio.projectfilepath=\\10.10.1.71\Data\Blueprints\MP4_H264_AAC.zenium&#13;&#10;-Djobengine.jobscheduling.config=&quot;${workspace_loc}/-configuration/scheduledjobs.json&quot;&#13;&#10;-Dnexio.host=10.10.1.55&#13;&#10;-Dnexio.disable=true&#13;&#10;-Djobengine.octopus.rundowns.name=test-rundowns&#13;&#10;-Djobengine.octopus.storyfolders.name=test-storyfolders&#13;&#10;-Djobengine.octopus.stories.name=test-stories"/>\r
 <stringAttribute key="pde.version" value="3.3"/>\r
 <booleanAttribute key="show_selected_only" value="false"/>\r
 <stringAttribute key="target_bundles" value="cglib@default:default,com.auth0.java-jwt@default:default,com.fasterxml.jackson.core.jackson-annotations@default:default,com.fasterxml.jackson.core.jackson-core@default:default,com.fasterxml.jackson.core.jackson-databind@default:default,com.fasterxml.jackson.datatype.jackson-datatype-joda@default:default,com.fasterxml.jackson.jaxrs.jackson-jaxrs-base@default:default,com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider@default:default,com.fasterxml.jackson.module.jackson-module-jaxb-annotations@default:default,com.google.guava@default:default,com.ibm.db2jcc4@default:default,com.ibm.nosql@default:default,com.microsoft.sqlserver.sqljdbc@default:default,com.sun.el.javax.el@default:default,commons-logging@default:default,javassist@default:default,javax.annotation-api@default:default,javax.inject@default:default,javax.mail@default:default,javax.servlet-api@default:default,javax.servlet.jsp-api@default:default,javax.validation.api@default:default,javax.ws.rs-api@default:default,jcifs@default:default,joda-time@default:default,org.apache.aries.spifly.dynamic.bundle@default:default,org.apache.aries.util@default:default,org.apache.commons.beanutils@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.digester@default:default,org.apache.commons.io@default:default,org.apache.commons.lang3@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.apache.httpcomponents.httpclient@default:default,org.apache.httpcomponents.httpcore@default:default,org.apache.jasper.glassfish@default:default,org.apache.logging.log4j.api@1:true,org.apache.logging.log4j.core@default:default,org.apache.logging.log4j.slf4j-impl@default:default,org.apache.servicemix.bundles.quartz@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.util@default:default,org.eclipse.jdt.core.compiler.batch@default:default,org.eclipse.jetty.client@default:default,org.eclipse.jetty.deploy@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.jsp@default:default,org.eclipse.jetty.osgi.boot.jsp@default:false,org.eclipse.jetty.osgi.boot@default:true,org.eclipse.jetty.schemas@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jetty.webapp@default:default,org.eclipse.jetty.websocket.api@default:default,org.eclipse.jetty.websocket.client@default:default,org.eclipse.jetty.websocket.common@default:default,org.eclipse.jetty.websocket.server@default:default,org.eclipse.jetty.websocket.servlet@default:default,org.eclipse.jetty.xml@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.jboss.resteasy.client@default:default,org.jboss.resteasy.jaxrs@default:default,org.jmock.junit4@default:default,org.jmock@default:default,org.junit@default:default,org.jvnet.mimepull@default:default,org.objectweb.asm.commons@default:default,org.objectweb.asm.tree@default:default,org.objectweb.asm@default:default,org.reflections@default:default,slf4j.api@default:default,slf4j.simple@default:false"/>\r
index c18a56adcd0cf0bae3d847b11e754af0d0ba6680..47183e21f07527b7ac6126014942e4de12f2af77 100644 (file)
       "executeimmediate": true,\r
       "cronexpression": "0/20 * * * * ?",\r
       "parameters": [\r
-       {"name": "forceFull", "value": false, "type": "java.lang.Boolean"}\r
+       {"name": "includeArchived", "value": false, "type": "java.lang.Boolean"}\r
       ]\r
        },      \r
        {\r
       "active": false,\r
-         "name" : "OCTOPUS adatok teljes szinkronizálása",\r
+         "name" : "OCTOPUS adatok szinkronizálása archivált tükrökkel együtt",\r
       "template": "sync-octopus.xml",\r
       "executeimmediate": true,\r
       "cronexpression": "0/30 * * * * ?",\r
       "parameters": [\r
-       {"name": "forceFull", "value": true, "type": "java.lang.Boolean"}\r
+       {"name": "includeArchived", "value": true, "type": "java.lang.Boolean"}\r
       ]\r
        },      \r
        {\r
index a7da8e11834e3779e50924541041050e1f88eefc..1c58fc6c9b4eff967f958e9e60ba27744a346827 100644 (file)
        </modules>\r
 \r
        <properties>\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
-\r
                <project.version>1.0.0</project.version>\r
                <tycho.version>1.0.0</tycho.version>\r
                <maven.compiler.source>1.8</maven.compiler.source>\r
                <maven.compiler.target>1.8</maven.compiler.target>\r
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>\r
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
-\r
        </properties>\r
 \r
        <repositories>\r
index 02a525951170efba74eecd32274f3d9247146994..3762d6c77c5f284dfaf8dedb9bb1f1c149f75d06 100644 (file)
@@ -42,6 +42,9 @@
 -Djobengine.octopus.api.address=http://10.10.1.11/api/v1\r
 -Djobengine.octopus.api.user=mam\r
 -Djobengine.octopus.api.password=napocska\r
+-Djobengine.octopus.rundowns.name=test-rundowns\r
+-Djobengine.octopus.storyfolders.name=test-storyfolders\r
+-Djobengine.octopus.stories.name=test-stories\r
 \r
 #Selenio\r
 -Djobengine.selenio.address=http://10.10.1.71:44000/TranscodeMgrWS?wsdl\r
@@ -53,6 +56,7 @@
 -Djobengine.nexio.db.password=resolve\r
 -Dnexio.useMOSGateway=true\r
 -Dnexio.host=10.10.1.55\r
+-Dnexio.disable=true\r
       </vmArgsLin>\r
       <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts\r
       </vmArgsMac>\r
index 1343c4a8756f13c8f8d77f17d2beba77d1cdf57b..3ab00a53683eead3c31d809a85f6b03e0df4621d 100644 (file)
                                                        <executable>winscp.com</executable>\r
                                                        <arguments>\r
                                                                <argument>/command</argument>\r
+                                                               <argument>"echo STARTING DEPLOY TO: ${remote.address}"</argument>\r
                                                                <argument>"open ${remote.address} -hostkey=""${remote.hostkey}"""</argument>\r
 <!--                                                           <argument>"call pcs resource disable mediacube_script"</argument> -->\r
 <!--                                                           <argument>"call sleep 5"</argument> -->\r
                                                                <argument>"synchronize remote"</argument>\r
                                                                <argument>"mkdir log"</argument>\r
                                                                <argument>"call chmod +x mediacube"</argument>\r
+                                                               <argument>"call chmod +x start-mediacube.sh"</argument>\r
+                                                               <argument>"call chmod +x stop-mediacube.sh"</argument>\r
 <!--                                                           <argument>"call pcs resource enable mediacube_script"</argument> -->\r
                                                                <argument>"exit"</argument>\r
                                                        </arguments>\r
        </build>\r
        <properties>\r
                <local.location>${project.build.directory}/products/MediaCube/linux/gtk/x86_64</local.location>\r
-               <remote.location>/opt/mediacube</remote.location>\r
+               <remote.location>/opt/mediacube-test</remote.location>\r
        </properties>\r
 </project> \r
index c0c9dff6d43af8f2158593a6cfbe53c620e08c3e..8e3af0f435406525f23a9f72e596649e28b7addd 100644 (file)
@@ -1,16 +1,26 @@
 {"joblist":[\r
        {\r
-      "active": true,\r
+      "active": false,\r
          "name" : "OCTOPUS adatok szinkronizálása",\r
       "template": "sync-octopus.xml",\r
       "executeimmediate": false,\r
       "cronexpression": "0/30 * * * * ?",\r
       "parameters": [\r
-       {"name": "forceFull", "value": true, "type": "java.lang.Boolean"}\r
+       {"name": "includeArchived", "value": false, "type": "java.lang.Boolean"}\r
       ]\r
        },      \r
        {\r
       "active": true,\r
+         "name" : "OCTOPUS adatok szinkronizálása (archivált tükrök is)",\r
+      "template": "sync-octopus.xml",\r
+      "executeimmediate": true,\r
+      "cronexpression": "0/30 * * * * ?",\r
+      "parameters": [\r
+       {"name": "includeArchived", "value": true, "type": "java.lang.Boolean"}\r
+      ]\r
+       },      \r
+       {\r
+      "active": false,\r
       "executeimmediate": false,\r
          "name" : "Archiválás az ISILON/ARCHIVE mappából",\r
       "template": "archive-ondemand.xml",\r
       ]\r
        },\r
        {\r
+      "active": false,\r
+         "name" : "Lejárt ISISLON/ARCHIVE anyagok törlése",\r
+      "template": "delete-materials.xml",\r
+      "executeimmediate": false,\r
+      "cronexpression": "0 0 5 * * ?",\r
+      "parameters": [ \r
+       {"name": "sourcePath", "value": "/mnt/ISILON/ARCHIVE", "type": "java.lang.String"}\r
+      ]\r
+       },      \r
+       {\r
       "active": false,\r
          "name" : "NEXIO anyagok másolása az ISILON/ARCHIVE mappába",\r
       "template": "copyforarchive-nexio-materials.xml",\r
       ]\r
        },      \r
        {\r
-      "active": true,\r
-         "name" : "Lejárt ISISLON/ARCHIVE anyagok törlése",\r
-      "template": "delete-materials.xml",\r
-      "executeimmediate": false,\r
-      "cronexpression": "0 0 5 * * ?",\r
-      "parameters": [ \r
-       {"name": "sourcePath", "value": "/mnt/ISILON/ARCHIVE", "type": "java.lang.String"}\r
-      ]\r
-       },      \r
-       {\r
       "active": false,\r
          "name" : "Archiválás az ISILON/ARCHIVE/ONE mappából",\r
       "template": "archive-ondemand.xml",\r
diff --git a/server/user.jobengine.executors/deploy-steps-to-bsh-bkup.bat b/server/user.jobengine.executors/deploy-steps-to-bsh-bkup.bat
new file mode 100644 (file)
index 0000000..8235a56
--- /dev/null
@@ -0,0 +1,32 @@
+@ECHO OFF\r
+\r
+SET REMOTE_HOST=10.10.1.29\r
+SET REMOTE_LOCATION=/opt/mediacube/configuration/executors\r
+SET REMOTE_SERVER_HOSTKEY=ssh-ed25519 256 ea:ab:67:70:79:63:2f:6a:34:81:48:e2:b9:dd:ca:d4\r
+SET REMOTE_SERVER_ADDRESS=scp://root:password@%REMOTE_HOST%\r
+SET LOCAL_STEPS_LOCATION=bin/user/jobengine/server/steps\r
+SET LOCAL_CONFIG_LOCATION=config\r
\r
+       ECHO *** Begin deploy steps to server %REMOTE_HOST% ***\r
+       ECHO --- Deploying\r
+       \r
+       WinSCP.com /command ^\r
+       "open %REMOTE_SERVER_ADDRESS% -hostkey=""%REMOTE_SERVER_HOSTKEY%"" -timeout=60" ^\r
+       "cd %REMOTE_LOCATION%" ^\r
+       "lcd %LOCAL_STEPS_LOCATION%" ^\r
+       "synchronize remote" ^\r
+       "lcd ..\" ^\r
+       "lcd ..\" ^\r
+       "lcd ..\" ^\r
+       "lcd ..\" ^\r
+       "lcd ..\" ^\r
+       "lcd %LOCAL_CONFIG_LOCATION%" ^\r
+       "synchronize remote -filemask=config.xml" ^\r
+       "cd .." ^\r
+       "synchronize remote -filemask=scheduledjobs.json" ^\r
+       "exit"\r
+       \r
+       ECHO *** Completed ***\r
+@ECHO ON\r
+\r
\r
diff --git a/server/user.jobengine.executors/deploy-steps-to-bsh-bkup.launch b/server/user.jobengine.executors/deploy-steps-to-bsh-bkup.launch
new file mode 100644 (file)
index 0000000..7e5b62e
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">\r
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">\r
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>\r
+</listAttribute>\r
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/user.jobengine.executors/deploy-steps-to-bsh-bkup.bat}"/>\r
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/user.jobengine.executors}"/>\r
+</launchConfiguration>\r
index 63c50a3b69c45ed3c3aa81318ae09773884109b2..58aa09f7ab5c4835dc0af8849bcac783578a072d 100644 (file)
@@ -2,14 +2,14 @@
 <jobtemplate name="OCTOPUS adatok szinkronizálása">\r
        <declarations>\r
                <parameters>\r
-                       <parameter name="forceFull" type="java.lang.Boolean" />\r
+                       <parameter name="includeArchived" type="java.lang.Boolean" />\r
                </parameters>\r
        </declarations>\r
        <commands>\r
                <calljobstep id="id1" type="user.jobengine.server.steps.SyncOCTOPUSDataStep" weight="1">\r
                        <inputs>\r
                                <input>\r
-                                       <parameter name="forceFull" />\r
+                                       <parameter name="includeArchived" />\r
                                </input>\r
                        </inputs>\r
                </calljobstep>\r
index 7bc8223e90b80721d3fd5389f33cfe22a7b394de..cc5aa35e271ce9c21386493e7600235b8d86045b 100644 (file)
@@ -1,5 +1,6 @@
 package user.jobengine.server.steps;\r
 \r
+import java.util.Calendar;\r
 import java.util.Date;\r
 import java.util.HashMap;\r
 import java.util.HashSet;\r
@@ -27,18 +28,19 @@ import com.ibm.nosql.json.api.BasicDBObject;
 import com.ibm.nosql.json.api.DB;\r
 import com.ibm.nosql.json.api.DBCollection;\r
 import com.ibm.nosql.json.api.DBCursor;\r
-import com.ibm.nosql.json.api.DBObject;\r
 import com.ibm.nosql.json.api.QueryBuilder;\r
 import com.ibm.nosql.json.api.WriteResult;\r
 \r
+import user.commons.CalendarUtils;\r
 import user.commons.ListUtils;\r
 import user.commons.nosql.NoSQLUtils;\r
 import user.commons.octopus.IOctopusAPI;\r
-import user.commons.octopus.OctopusAPI;\r
 import user.commons.remotestore.IProgressEventListener;\r
 import user.commons.remotestore.ProgressEvent;\r
 \r
-public class OctopusDataMiner implements Runnable {\r
+public class OctopusDataMiner {\r
+       private static final String ARCHIVED = "archived";\r
+       private static final String FILTER = "filter";\r
        private static final String _TMP = "_tmp";\r
        private static final Logger logger = LogManager.getLogger();\r
        private static final String LINEFEED = "\r\n";\r
@@ -48,8 +50,10 @@ public class OctopusDataMiner implements Runnable {
        //      private static final String CHECKING_RUNDOWN = "Checking Rundown {} ({}/{})";\r
        private static final String FIELDS_STORYFOLDER_STORIES = "stories,Story.modified,Story.name,Story.id,Story.mosObjects,Story.script,Story.type,Story.format,Story.customColumns,CustomColumn.label,CustomColumn.value";\r
        private static final String FIELDS_RUNDOWN_STORIES = "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 FIELDS_RUNDOWN_STORYIDS = "id,name,modified,scheduledStart,channel,Channel.name,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 FIELDS_RUNDOWN = "id,name,modified,scheduledStart,channel,Channel.name,rundownType,RundownType.name";\r
+       private static final String FIELDS_RUNDOWN_STORYIDS = "id,slugs,Slug.storyId,Slug.position";\r
+       private static final String FIELDS_STORYFOLDER = "id,name,modified";\r
+       private static final String FIELDS_STORYFOLDER_STORYIDS = "id,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
@@ -72,16 +76,11 @@ public class OctopusDataMiner implements Runnable {
        private ProgressEvent progressEvent = new ProgressEvent(this, 0);\r
        private Map<Long, BasicDBList> storyRundowns;\r
        private Map<Long, BasicDBList> storyStoryFolders;\r
-       private Map<Long, BasicDBList> storedStoryRundowns;\r
-       private Map<Long, BasicDBList> storedStoryStoryFolders;\r
-       private Map<Long, BasicDBList> storedStoryMosObjects;\r
-       private String RUNDOWN_COLLECTION = IOctopusAPI.RUNDOWN_COLLECTION;\r
-       private String FOLDER_COLLECTION = IOctopusAPI.FOLDER_COLLECTION;\r
-       private String STORY_COLLECTION = IOctopusAPI.STORY_COLLECTION;\r
-\r
-       private Map<Long, BasicDBList> newRundowns = new HashMap<>();\r
-       private Map<Long, BasicDBList> newStoryFolders = new HashMap<>();\r
-       private Map<Long, BasicDBList> newStories = new HashMap<>();\r
+       private String RUNDOWN_COLLECTION;\r
+       private String FOLDER_COLLECTION;\r
+       private String STORY_COLLECTION;\r
+       private boolean includeArchived;\r
+       private Calendar zeroDate = CalendarUtils.createCalendar(2017, 11, 4);\r
 \r
        public OctopusDataMiner() {\r
                db = NoSQLUtils.getNoSQLDB();\r
@@ -105,8 +104,11 @@ public class OctopusDataMiner implements Runnable {
                Map<Long, BasicDBList> result = new HashMap<>();\r
                List<BasicDBObject> storyFolderList = NoSQLUtils.asList(storyFolders);\r
                for (BasicDBObject storyFolder : storyFolderList) {\r
-                       long storyFolderId = storyFolder.getLong(IOctopusAPI.ID);\r
-                       List<BasicDBObject> stories = NoSQLUtils.asList(storyFolder, IOctopusAPI.STORIES);\r
+                       if (storyFolder == null || !storyFolder.containsKey(IOctopusAPI.ID))\r
+                               continue;\r
+                       BasicDBObject storyFolderWithStoryIds = queryStoryFolder(storyFolder, FIELDS_STORYFOLDER_STORYIDS);\r
+                       long storyFolderId = storyFolderWithStoryIds.getLong(IOctopusAPI.ID);\r
+                       List<BasicDBObject> stories = NoSQLUtils.asList(storyFolderWithStoryIds, IOctopusAPI.STORIES);\r
                        if (stories == null)\r
                                continue;\r
                        long position = 1;\r
@@ -127,10 +129,11 @@ public class OctopusDataMiner implements Runnable {
                Map<Long, BasicDBList> result = new HashMap<>();\r
                List<BasicDBObject> rundownsList = NoSQLUtils.asList(rundowns);\r
                for (BasicDBObject rundown : rundownsList) {\r
-                       if (!rundown.containsKey(IOctopusAPI.ID))\r
+                       if (rundown == null || !rundown.containsKey(IOctopusAPI.ID))\r
                                continue;\r
-                       long rundownId = rundown.getLong(IOctopusAPI.ID);\r
-                       List<BasicDBObject> slugs = NoSQLUtils.asList(rundown, IOctopusAPI.SLUGS);\r
+                       BasicDBObject rundownWithStoryids = queryRundown(rundown, FIELDS_RUNDOWN_STORYIDS);\r
+                       long rundownId = rundownWithStoryids.getLong(IOctopusAPI.ID);\r
+                       List<BasicDBObject> slugs = NoSQLUtils.asList(rundownWithStoryids, IOctopusAPI.SLUGS);\r
                        if (slugs == null)\r
                                continue;\r
                        for (BasicDBObject slug : slugs) {\r
@@ -151,44 +154,6 @@ public class OctopusDataMiner implements Runnable {
                return result;\r
        }\r
 \r
-       private void buildStoriesReferences() {\r
-               DBCollection collection = db.getCollection(STORY_COLLECTION);\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(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, 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, IOctopusAPI.MOS_OBJECTS);\r
-                               if (storyMosObjects != null) {\r
-                                       if (storedStoryMosObjects == null)\r
-                                               storedStoryMosObjects = new HashMap<>();\r
-                                       storedStoryMosObjects.put(storyId, storyMosObjects);\r
-                               }\r
-                       }\r
-               } catch (Exception e) {\r
-                       logger.catching(e);\r
-                       throw e;\r
-               } finally {\r
-\r
-               }\r
-       }\r
-\r
        public void clear() {\r
                db.getCollection(RUNDOWN_COLLECTION).remove();\r
                db.getCollection(STORY_COLLECTION).remove();\r
@@ -212,41 +177,14 @@ public class OctopusDataMiner implements Runnable {
                return concatParentsToStoryFolder(parent, newName);\r
        }\r
 \r
-       private void deleteDiff(String oldCollectionName, String newCollectionName, String idFieldName) {\r
-               DBCollection oldCollection = db.getCollection(oldCollectionName);\r
-               DBCollection newCollection = db.getCollection(newCollectionName);\r
-               DBCursor oldCollectionCursor = oldCollection.find(new BasicDBObject(), new BasicDBObject(idFieldName, 1));\r
-               if (!oldCollectionCursor.hasNext()) {\r
-                       logger.error("{} collection is empty", newCollectionName);\r
-                       return;\r
-               }\r
-               List<BasicDBObject> oldItems = ListUtils.cast(oldCollectionCursor.toArray());\r
-\r
-               DBCursor newCollectionCursor = newCollection.find();\r
-               ConcurrentHashMap<Long, BasicDBObject> newItems = null;\r
-               if (newCollectionCursor.hasNext()) {\r
-                       List<BasicDBObject> newList = ListUtils.cast(newCollectionCursor.toArray());\r
-                       newItems = ListUtils.map(newList, item -> item.getLong(IOctopusAPI.ID));\r
-               }\r
-               if (newItems == null)\r
-                       newItems = new ConcurrentHashMap<>();\r
-\r
-               for (BasicDBObject oldItem : oldItems) {\r
-                       if (oldItem == null) {\r
-                               logger.error("Item is null");\r
-                               continue;\r
-                       }\r
-                       if (!oldItem.containsKey(idFieldName)) {\r
-                               logger.error("{} is null", idFieldName);\r
-                               continue;\r
-                       }\r
-                       long id = oldItem.getLong(idFieldName);\r
-                       BasicDBObject newItem = newItems.get(id);\r
-                       if (newItem == null) {\r
-                               //remove\r
-                               logger.info("Deleting {}", oldItem.toPrettyString(null));\r
-                               oldCollection.remove(new BasicDBObject(idFieldName, id));\r
-                       }\r
+       private void deleteOrphanRundowns() {\r
+               try {\r
+                       DBCollection collection = db.getCollection(RUNDOWN_COLLECTION);\r
+                       BasicDBObject query = (BasicDBObject) QueryBuilder.start().put(IOctopusAPI.ID).notIn(storyRundowns.keySet().toArray()).get();\r
+                       WriteResult res = collection.remove(query);\r
+                       logger.trace(String.format("Deleted orphan rundowns: %d", res.getN()));\r
+               } catch (Exception e) {\r
+                       logger.error(e);\r
                }\r
        }\r
 \r
@@ -261,6 +199,17 @@ public class OctopusDataMiner implements Runnable {
                }\r
        }\r
 \r
+       private void deleteOrphanStoryFolders() {\r
+               try {\r
+                       DBCollection collection = db.getCollection(RUNDOWN_COLLECTION);\r
+                       BasicDBObject query = (BasicDBObject) QueryBuilder.start().put(IOctopusAPI.ID).notIn(storyStoryFolders.keySet().toArray()).get();\r
+                       WriteResult res = collection.remove(query);\r
+                       logger.trace(String.format("Deleted orphan rundowns: %d", res.getN()));\r
+               } catch (Exception e) {\r
+                       logger.error(e);\r
+               }\r
+       }\r
+\r
        private void ensureIndexes() {\r
                DBCollection collection = db.getCollection(FOLDER_COLLECTION);\r
                if (collection.count() == 0)\r
@@ -275,26 +224,30 @@ public class OctopusDataMiner implements Runnable {
                        collection.ensureIndex(IOctopusAPI.ID);\r
        }\r
 \r
-       public void execute() throws Exception {\r
+       public void execute(boolean includeArchived) throws Exception {\r
+               this.includeArchived = includeArchived;\r
                logger.trace(STARTING);\r
-               //{"filter" :{ "archived" : true }}\r
-               Response response = query(RUNDOWN, "id,name,modified,scheduledStart,channel,Channel.name,rundownType,RundownType.name")\r
-                               .post(Entity.entity(new BasicDBObject("filter", new BasicDBObject("archived", true)).toPrettyString(null), MediaType.APPLICATION_JSON));\r
-               String json = response.readEntity(String.class);\r
 \r
-               RUNDOWN_COLLECTION = IOctopusAPI.RUNDOWN_COLLECTION + _TMP;\r
-               FOLDER_COLLECTION = IOctopusAPI.FOLDER_COLLECTION + _TMP;\r
-               STORY_COLLECTION = IOctopusAPI.STORY_COLLECTION + _TMP;\r
+               //              String MAIN_RUNDOWN_COLLECTION = IOctopusAPI.RUNDOWN_COLLECTION;\r
+               //              String MAIN_FOLDER_COLLECTION = IOctopusAPI.FOLDER_COLLECTION;\r
+               //              String MAIN_STORY_COLLECTION = IOctopusAPI.STORY_COLLECTION;\r
 \r
-               try {\r
-                       db.getCollection(RUNDOWN_COLLECTION).drop();\r
-                       db.getCollection(FOLDER_COLLECTION).drop();\r
-                       db.getCollection(STORY_COLLECTION).drop();\r
-               } catch (Exception e) {\r
-                       logger.catching(e);\r
-                       throw e;\r
-               }\r
+               //              RUNDOWN_COLLECTION = MAIN_RUNDOWN_COLLECTION + _TMP;\r
+               //              FOLDER_COLLECTION = MAIN_FOLDER_COLLECTION + _TMP;\r
+               //              STORY_COLLECTION = MAIN_STORY_COLLECTION + _TMP;\r
+               //\r
+               //              try {\r
+               //                      db.getCollection(RUNDOWN_COLLECTION).drop();\r
+               //                      db.getCollection(FOLDER_COLLECTION).drop();\r
+               //                      db.getCollection(STORY_COLLECTION).drop();\r
+               //              } catch (Exception e) {\r
+               //                      logger.catching(e);\r
+               //                      throw e;\r
+               //              }\r
 \r
+               RUNDOWN_COLLECTION = IOctopusAPI.RUNDOWN_COLLECTION;\r
+               FOLDER_COLLECTION = IOctopusAPI.FOLDER_COLLECTION;\r
+               STORY_COLLECTION = IOctopusAPI.STORY_COLLECTION;\r
                BasicDBList rundowns = null;\r
                BasicDBList storyFolders = null;\r
 \r
@@ -309,31 +262,42 @@ public class OctopusDataMiner implements Runnable {
                processRundowns(rundowns);\r
                processStoryFolders(storyFolders);\r
 \r
+               deleteOrphanRundowns();\r
+               deleteOrphanStoryFolders();\r
+               deleteOrphanStories();\r
+\r
                //a sorrend fontos !\r
-               updateDiff(IOctopusAPI.STORY_COLLECTION, STORY_COLLECTION, IOctopusAPI.ID);\r
-               updateDiff(IOctopusAPI.RUNDOWN_COLLECTION, RUNDOWN_COLLECTION, IOctopusAPI.ID);\r
-               updateDiff(IOctopusAPI.FOLDER_COLLECTION, FOLDER_COLLECTION, IOctopusAPI.ID);\r
-               deleteDiff(IOctopusAPI.RUNDOWN_COLLECTION, RUNDOWN_COLLECTION, IOctopusAPI.ID);\r
-               //deleteDiff(IOctopusAPI.FOLDER_COLLECTION, FOLDER_COLLECTION, IOctopusAPI.ID);\r
-               deleteDiff(IOctopusAPI.STORY_COLLECTION, STORY_COLLECTION, IOctopusAPI.ID);\r
-\r
-               //setLastUpdateTime(new Date());\r
-               logger.info("Activate");\r
-\r
-               //              db.getCollection(RUNDOWN_COLLECTION).rename(IOctopusAPI.RUNDOWN_COLLECTION, true);\r
-               //              db.getCollection(FOLDER_COLLECTION).rename(IOctopusAPI.FOLDER_COLLECTION, true);\r
-               //              db.getCollection(STORY_COLLECTION).rename(IOctopusAPI.STORY_COLLECTION, true);\r
-               logger.trace(FINISHED);\r
+               //                              updateDiff(MAIN_STORY_COLLECTION, STORY_COLLECTION, IOctopusAPI.ID);\r
+               //                              updateDiff(MAIN_RUNDOWN_COLLECTION, RUNDOWN_COLLECTION, IOctopusAPI.ID);\r
+               //                              updateDiff(MAIN_FOLDER_COLLECTION, FOLDER_COLLECTION, IOctopusAPI.ID);\r
+               //\r
+               //                              updateDeleteDiff(MAIN_RUNDOWN_COLLECTION, RUNDOWN_COLLECTION, IOctopusAPI.ID);\r
+               //                              updateDeleteDiff(MAIN_FOLDER_COLLECTION, FOLDER_COLLECTION, IOctopusAPI.ID);\r
+               //                              updateDeleteDiff(MAIN_STORY_COLLECTION, STORY_COLLECTION, IOctopusAPI.ID);\r
 \r
-       }\r
+               //              try {\r
+               //                      db.getCollection(RUNDOWN_COLLECTION).rename(MAIN_RUNDOWN_COLLECTION, true);\r
+               //                      db.getCollection(FOLDER_COLLECTION).rename(MAIN_FOLDER_COLLECTION, true);\r
+               //                      db.getCollection(STORY_COLLECTION).rename(MAIN_STORY_COLLECTION, true);\r
+               //              } catch (Exception e) {\r
+               //                      logger.catching(e);\r
+               //                      throw e;\r
+               //              }\r
+\r
+               //              logger.info("Activate");\r
 \r
-       public void executetest() {\r
-               //                      ResteasyWebTarget target = webTarget.path(RUNDOWN);\r
-               //                      Builder result = target.request().header(OCTOPUS_DEVICE_ID, apiUser).header(OCTOPUS_DEVICE_NAME, apiPwd);\r
-               //                      Response r = result.get();\r
-               //                      String x = r.readEntity(String.class);\r
-               //                      logger.info(x);\r
-               //                      return;\r
+               //              try {\r
+               //                      long ts = new Date().getTime();\r
+               //                      db.getCollection(RUNDOWN_COLLECTION).exportFile(String.format("/opt/mediacube-test/log/%s-%s.js", RUNDOWN_COLLECTION, ts));\r
+               //                      db.getCollection(FOLDER_COLLECTION).exportFile(String.format("/opt/mediacube-test/log/%s-%s.js", FOLDER_COLLECTION, ts));\r
+               //                      db.getCollection(STORY_COLLECTION).exportFile(String.format("/opt/mediacube-test/log/%s-%s.js", STORY_COLLECTION, ts));\r
+               //              } catch (Exception e) {\r
+               //                      logger.catching(e);\r
+               //                      throw e;\r
+               //              }\r
+\r
+               logger.trace(FINISHED);\r
+               throw new Exception("Mérés");\r
        }\r
 \r
        private String extractContent(BasicDBObject content) {\r
@@ -452,31 +416,6 @@ public class OctopusDataMiner implements Runnable {
                }\r
        }\r
 \r
-       private Date getLastUpdateTime() {\r
-               Date result = null;\r
-               DBCollection collection = db.getCollection(IOctopusAPI.TIME_COLLECTION_NAME);\r
-               DBObject timeObject = collection.findOne();\r
-               if (timeObject != null)\r
-                       result = (Date) timeObject.get(IOctopusAPI.LASTUPDATE_TIME);\r
-               return result;\r
-       }\r
-\r
-       //      private boolean isModified(Date date, BasicDBObject object, String name) {\r
-       //              Date actualModifiedString = toDate(object, name);\r
-       //              if (actualModifiedString == null)\r
-       //                      logger.trace(ACTUAL_MODIFIED_STRING_IS_NULL);\r
-       //              int result = date.compareTo(actualModifiedString);\r
-       //              return result <= 0;\r
-       //      }\r
-\r
-       private boolean isModified(Date date, BasicDBObject object) {\r
-               if (date == null)\r
-                       return true;\r
-               Date modified = (Date) object.get(IOctopusAPI.MODIFIED);\r
-               int result = date.compareTo(modified);\r
-               return result <= 0;\r
-       }\r
-\r
        private void processRundowns(BasicDBList rundowns) throws Exception {\r
                if (rundowns == null || rundowns.size() == 0) {\r
                        progressEvent.setProgress(50);\r
@@ -508,14 +447,6 @@ public class OctopusDataMiner implements Runnable {
        }\r
 \r
        private Builder query(String path, String fields) {\r
-               //logger.info("Class loader {}", getClass().getClassLoader());\r
-               //              try {\r
-               //                      //TODO kell e?\r
-               //                      ResteasyDeployment deployment = new ResteasyDeployment();\r
-               //                      deployment.start();\r
-               //              } catch (Exception e) {\r
-               //                      logger.catching(e);\r
-               //              }\r
                ResteasyWebTarget target = webTarget.path(path).queryParam(FIELDS, fields);\r
                Builder result = target.request().header(OCTOPUS_DEVICE_ID, apiUser).header(OCTOPUS_DEVICE_NAME, apiPwd);\r
                return result;\r
@@ -539,11 +470,11 @@ public class OctopusDataMiner implements Runnable {
                return rundowns;\r
        }\r
 \r
-       private BasicDBObject queryRundown(BasicDBObject rundown) {\r
+       private BasicDBObject queryRundown(BasicDBObject rundown, String fields) {\r
                logger.trace(ENTER);\r
                BasicDBObject result = null;\r
                long id = NoSQLUtils.asLong(rundown, IOctopusAPI.ID);\r
-               Response response = query(String.format("%s/", RUNDOWN) + id, FIELDS_RUNDOWN_STORIES).get();\r
+               Response response = query(String.format("%s/%d", RUNDOWN, id), fields).get();\r
                String json = response.readEntity(String.class);\r
                BasicDBObject resultObject = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
                if (resultObject == null)\r
@@ -557,7 +488,13 @@ public class OctopusDataMiner implements Runnable {
        private BasicDBList queryRundowns() {\r
                logger.trace(ENTER);\r
                BasicDBList result = null;\r
-               Response response = query(RUNDOWN, FIELDS_RUNDOWN_STORYIDS).get();\r
+               Builder query = query(RUNDOWN, FIELDS_RUNDOWN);\r
+               Response response = null;\r
+               if (includeArchived) {\r
+                       response = query.post(Entity.entity(new BasicDBObject(FILTER, new BasicDBObject(ARCHIVED, true)).toString(), MediaType.APPLICATION_JSON));\r
+               } else\r
+                       response = query.get();\r
+\r
                String json = response.readEntity(String.class);\r
                BasicDBObject resultObject = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
                if (resultObject != null)\r
@@ -566,11 +503,11 @@ public class OctopusDataMiner implements Runnable {
                return result;\r
        }\r
 \r
-       private BasicDBObject queryStoryFolder(BasicDBObject storyFolder) {\r
+       private BasicDBObject queryStoryFolder(BasicDBObject storyFolder, String fields) {\r
                logger.trace(ENTER);\r
                BasicDBObject result = null;\r
                long id = NoSQLUtils.asLong(storyFolder, IOctopusAPI.ID);\r
-               Response response = query(String.format("%s/", STORY_FOLDER) + id, FIELDS_STORYFOLDER_STORIES).get();\r
+               Response response = query(String.format("%s/%d", STORY_FOLDER, id), fields).get();\r
                String json = response.readEntity(String.class);\r
                BasicDBObject resultObject = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
                if (resultObject == null)\r
@@ -584,21 +521,21 @@ public class OctopusDataMiner implements Runnable {
        private BasicDBList queryStoryFolders() {\r
                logger.trace(ENTER);\r
                BasicDBList result = null;\r
-               Response response = query(STORY_FOLDER, FIELDS_STORY_FOLDER_LIST).get();\r
+               Response response = query(STORY_FOLDER, FIELDS_STORYFOLDER).get();\r
                String json = response.readEntity(String.class);\r
                BasicDBObject resultObject = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
                if (resultObject != null)\r
                        result = NoSQLUtils.asDBList(resultObject, RESULT);\r
 \r
-               /* teszt */\r
-               List<BasicDBObject> list = NoSQLUtils.asList(result);\r
-               for (BasicDBObject actual : list) {\r
-                       String fullName = concatParentsToStoryFolder(actual, actual.getString(IOctopusAPI.NAME));\r
-                       //logger.info("Checking StoryFolder {}", fullName);\r
-                       actual.remove(IOctopusAPI.NAME);\r
-                       actual.append(IOctopusAPI.NAME, fullName);\r
-               }\r
-\r
+               //              /* teszt */\r
+               //              List<BasicDBObject> list = NoSQLUtils.asList(result);\r
+               //              for (BasicDBObject actual : list) {\r
+               //                      String fullName = concatParentsToStoryFolder(actual, actual.getString(IOctopusAPI.NAME));\r
+               //                      //logger.info("Checking StoryFolder {}", fullName);\r
+               //                      actual.remove(IOctopusAPI.NAME);\r
+               //                      actual.append(IOctopusAPI.NAME, fullName);\r
+               //              }\r
+               //\r
                logger.trace(EXIT);\r
                return result;\r
        }\r
@@ -607,86 +544,31 @@ public class OctopusDataMiner implements Runnable {
                progressListenerList.remove(IProgressEventListener.class, listener);\r
        }\r
 \r
-       @Override\r
-       public void run() {\r
-               logger.trace(STARTING);\r
-               try {\r
-                       ensureIndexes();\r
-                       Date lastUpdateTime = getLastUpdateTime();\r
-\r
-                       buildStoriesReferences();\r
-\r
-                       BasicDBList rundowns = queryRundowns();\r
-                       storyRundowns = buildRundownReferences(rundowns);\r
-                       BasicDBList storyFolders = queryStoryFolders();\r
-                       storyStoryFolders = buildFolderReferences(storyFolders);\r
-\r
-                       if (rundowns == null || rundowns.size() == 0) {\r
-                               progressEvent.setProgress(50);\r
-                               fireProgressEvent(progressEvent);\r
-                       } else {\r
-                               storeRundowns(rundowns, lastUpdateTime);\r
-                       }\r
-\r
-                       if (storyFolders == null || storyFolders.size() == 0) {\r
-                               progressEvent.setProgress(100);\r
-                               fireProgressEvent(progressEvent);\r
-                       } else {\r
-                               storeStoryFolders(storyFolders, lastUpdateTime);\r
-                       }\r
-                       deleteOrphanStories();\r
-                       setLastUpdateTime(new Date());\r
-               } catch (Exception e) {\r
-                       logger.catching(e);\r
-                       throw e;\r
-               }\r
-               logger.trace(FINISHED);\r
-       }\r
-\r
-       public void run(boolean forceFull) {\r
-               if (forceFull) {\r
-                       clear();\r
-               }\r
-               run();\r
-               //              if (forceFull) {\r
-               //                      RUNDOWN_COLLECTION_NAME = "rundowns";\r
-               //                      STORY_COLLECTION_NAME = "stories";\r
-               //                      STORY_FOLDER_COLLECTION_NAME = "storyfolders";\r
-               //                      TIME_COLLECTION_NAME = "octopusSyncTime";\r
-               //                      db.getCollection("rundowns_tmp").rename(RUNDOWN_COLLECTION_NAME, true);\r
-               //                      db.getCollection("stories_tmp").rename(STORY_COLLECTION_NAME, true);\r
-               //                      db.getCollection("storyfolders_tmp").rename(STORY_FOLDER_COLLECTION_NAME, true);\r
-               //                      db.getCollection("octopusSyncTime_tmp").rename(TIME_COLLECTION_NAME, true);\r
-               //                      //clear();\r
-               //              }\r
-\r
-               //TODO reset collection names\r
-       }\r
-\r
-       public void setLastUpdateTime(Date lastUpdateTime) {\r
-               DBCollection collection = db.getCollection(OctopusAPI.TIME_COLLECTION_NAME);\r
-               DBObject timeObject = collection.findOne();\r
-               if (timeObject == null)\r
-                       timeObject = new BasicDBObject();\r
-               timeObject.put(IOctopusAPI.LASTUPDATE_TIME, lastUpdateTime);\r
-\r
-               collection.save(timeObject);\r
+       void setObjectID(DBCollection collection, BasicDBObject objectToSave) {\r
+               BasicDBObject obj = (BasicDBObject) collection.findOne(new BasicDBObject(IOctopusAPI.ID, NoSQLUtils.asLong(objectToSave, IOctopusAPI.ID)));\r
+               if (obj == null)\r
+                       return;\r
+               Object id = obj.getID();\r
+               if (id == null)\r
+                       return;\r
+               objectToSave.put(IOctopusAPI._ID, id);\r
        }\r
 \r
-       private void storeRundown(BasicDBObject rundown, Date lastUpdateTime) {\r
+       private void storeRundown(BasicDBObject rundown) {\r
                logger.trace(ENTER);\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(rundown);\r
+               BasicDBObject rundownWithStories = queryRundown(rundown, FIELDS_RUNDOWN_STORIES);\r
                if (rundownWithStories != null) {\r
-                       BasicDBList stories = NoSQLUtils.asDBList(rundownWithStories, IOctopusAPI.SLUGS);\r
-                       if (stories != null)\r
-                               storeRundownStories(stories, lastUpdateTime);\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(RUNDOWN_COLLECTION);\r
-                       if (lastUpdateTime == null || (lastUpdateTime != null && isModified(lastUpdateTime, rundown))) {\r
-                               //logger.debug(SAVING_RUNDOWN, rundownID, name);\r
+                       Date scheduledStart = toDate(rundown, IOctopusAPI.SCHEDULED_START);\r
+                       if (scheduledStart != null && scheduledStart.after(zeroDate.getTime())) {\r
+                               BasicDBList stories = NoSQLUtils.asDBList(rundownWithStories, IOctopusAPI.SLUGS);\r
+                               if (stories != null)\r
+                                       storeRundownStories(stories);\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(RUNDOWN_COLLECTION);\r
+                               setObjectID(collection, rundown);\r
                                collection.save(rundown);\r
                        }\r
                }\r
@@ -699,7 +581,7 @@ public class OctopusDataMiner implements Runnable {
                int idx = 1;\r
                for (BasicDBObject rundown : rundownsList) {\r
                        //logger.info(CHECKING_RUNDOWN, rundown.getLong(IOctopusAPI.ID), rundownsList.size(), idx);\r
-                       storeRundown(rundown, lastUpdateTime);\r
+                       storeRundown(rundown);\r
                        int progress = idx * 50 / rundownsList.size();\r
                        if (progress - progressEvent.getProgress() > 0) {\r
                                progressEvent.setProgress(progress);\r
@@ -711,17 +593,17 @@ public class OctopusDataMiner implements Runnable {
                logger.trace(EXIT);\r
        }\r
 \r
-       private void storeRundownStories(BasicDBList slugs, Date lastUpdateTime) {\r
+       private void storeRundownStories(BasicDBList slugs) {\r
                logger.trace(ENTER);\r
                List<BasicDBObject> slugsList = NoSQLUtils.asList(slugs);\r
                for (BasicDBObject slug : slugsList) {\r
                        if (slug.containsKey(IOctopusAPI.STORY))\r
-                               storeStory((BasicDBObject) slug.get(IOctopusAPI.STORY), lastUpdateTime);\r
+                               storeStory((BasicDBObject) slug.get(IOctopusAPI.STORY));\r
                }\r
                logger.trace(EXIT);\r
        }\r
 \r
-       private void storeStory(BasicDBObject story, Date lastUpdateTime) {\r
+       private void storeStory(BasicDBObject story) {\r
                logger.trace(ENTER);\r
                if (!story.containsKey(IOctopusAPI.ID)) {\r
                        logger.error("Missing id in story {}", story.toPrettyString(null));\r
@@ -737,40 +619,8 @@ public class OctopusDataMiner implements Runnable {
                BasicDBList storyFolderRef = storyStoryFolders.get(storyID);\r
                BasicDBList modifiedMOS = extractRelevantMOSObjects(story);\r
 \r
-               if (lastUpdateTime != null) {\r
-                       rundownRef = (rundownRef == null) ? new BasicDBList() : rundownRef;\r
-                       storyFolderRef = (storyFolderRef == null) ? new BasicDBList() : storyFolderRef;\r
-                       modifiedMOS = (modifiedMOS == null) ? new BasicDBList() : modifiedMOS;\r
-\r
-                       boolean uptodate = true;\r
-                       if (!isModified(lastUpdateTime, story)) {\r
-                               BasicDBList storedRundownRef = storedStoryRundowns.get(storyID);\r
-                               storedRundownRef = (storedRundownRef == null) ? new BasicDBList() : storedRundownRef;\r
-                               uptodate = storedRundownRef.equals(rundownRef);\r
-\r
-                               if (uptodate) {\r
-                                       BasicDBList storedStoryFolderRef = storedStoryStoryFolders.get(storyID);\r
-                                       storedStoryFolderRef = (storedStoryFolderRef == null) ? new BasicDBList() : storedStoryFolderRef;\r
-                                       uptodate = storedStoryFolderRef.equals(storyFolderRef);\r
-                               }\r
-\r
-                               if (uptodate) {\r
-                                       BasicDBList storedMOS = storedStoryMosObjects.get(storyID);\r
-                                       storedMOS = (storedMOS == null) ? new BasicDBList() : storedMOS;\r
-                                       uptodate = storedMOS.equals(modifiedMOS);\r
-                               }\r
-\r
-                               if (uptodate)\r
-                                       return;\r
-                       }\r
-               }\r
-\r
                DBCollection collection = db.getCollection(STORY_COLLECTION);\r
-               if (lastUpdateTime != null) {\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
+\r
                if (rundownRef != null)\r
                        story.put(IOctopusAPI.REF_RUNDOWN, rundownRef);\r
                if (storyFolderRef != null)\r
@@ -790,24 +640,24 @@ public class OctopusDataMiner implements Runnable {
                } else\r
                        story.append(IOctopusAPI.PARENT_STORY_ID, parentStoryId);\r
                logger.debug(SAVING_STORY_ID, storyID);\r
+               setObjectID(collection, story);\r
                collection.save(story);\r
                logger.trace(EXIT);\r
        }\r
 \r
        private void storeStoryFolder(BasicDBObject storyFolder, Date lastUpdateTime) {\r
                logger.trace(ENTER);\r
-               BasicDBObject storyFoldersWithStories = queryStoryFolder(storyFolder);\r
+               BasicDBObject storyFoldersWithStories = queryStoryFolder(storyFolder, FIELDS_STORYFOLDER_STORIES);\r
                if (storyFoldersWithStories != null) {\r
                        BasicDBList stories = NoSQLUtils.asDBList(storyFoldersWithStories, IOctopusAPI.STORIES);\r
                        if (stories != null)\r
-                               storeStoryFolderStories(stories, lastUpdateTime);\r
+                               storeStoryFolderStories(stories);\r
                        storyFolder.put(IOctopusAPI.MODIFIED, toDate(storyFolder, IOctopusAPI.MODIFIED));\r
                        DBCollection collection = db.getCollection(FOLDER_COLLECTION);\r
-                       if (lastUpdateTime == null || (lastUpdateTime != null && isModified(lastUpdateTime, storyFolder))) {\r
-                               String name = storyFolder.getString(IOctopusAPI.NAME);\r
-                               logger.debug("Storing story folder {}", name);\r
-                               collection.save(storyFolder);\r
-                       }\r
+                       String name = storyFolder.getString(IOctopusAPI.NAME);\r
+                       logger.debug("Storing story folder {}", name);\r
+                       setObjectID(collection, storyFolder);\r
+                       collection.save(storyFolder);\r
                }\r
                logger.trace(EXIT);\r
        }\r
@@ -829,11 +679,11 @@ public class OctopusDataMiner implements Runnable {
                logger.trace(EXIT);\r
        }\r
 \r
-       private void storeStoryFolderStories(BasicDBList stories, Date lastUpdateTime) {\r
+       private void storeStoryFolderStories(BasicDBList stories) {\r
                logger.trace(ENTER);\r
                List<BasicDBObject> list = NoSQLUtils.asList(stories);\r
                for (BasicDBObject story : list)\r
-                       storeStory(story, lastUpdateTime);\r
+                       storeStory(story);\r
                logger.trace(EXIT);\r
        }\r
 \r
@@ -850,6 +700,44 @@ public class OctopusDataMiner implements Runnable {
                return result;\r
        }\r
 \r
+       private void updateDeleteDiff(String oldCollectionName, String newCollectionName, String idFieldName) {\r
+               DBCollection oldCollection = db.getCollection(oldCollectionName);\r
+               DBCollection newCollection = db.getCollection(newCollectionName);\r
+               DBCursor oldCollectionCursor = oldCollection.find(new BasicDBObject(), new BasicDBObject(idFieldName, 1));\r
+               if (!oldCollectionCursor.hasNext()) {\r
+                       logger.error("{} collection is empty", newCollectionName);\r
+                       return;\r
+               }\r
+               List<BasicDBObject> oldItems = ListUtils.cast(oldCollectionCursor.toArray());\r
+\r
+               DBCursor newCollectionCursor = newCollection.find();\r
+               ConcurrentHashMap<Long, BasicDBObject> newItems = null;\r
+               if (newCollectionCursor.hasNext()) {\r
+                       List<BasicDBObject> newList = ListUtils.cast(newCollectionCursor.toArray());\r
+                       newItems = ListUtils.map(newList, item -> item.getLong(IOctopusAPI.ID));\r
+               }\r
+               if (newItems == null)\r
+                       newItems = new ConcurrentHashMap<>();\r
+\r
+               for (BasicDBObject oldItem : oldItems) {\r
+                       if (oldItem == null) {\r
+                               logger.error("Item is null");\r
+                               continue;\r
+                       }\r
+                       if (!oldItem.containsKey(idFieldName)) {\r
+                               logger.error("{} is null", idFieldName);\r
+                               continue;\r
+                       }\r
+                       long id = oldItem.getLong(idFieldName);\r
+                       BasicDBObject newItem = newItems.get(id);\r
+                       if (newItem == null) {\r
+                               //remove\r
+                               logger.info("Deleting {}", oldItem.toPrettyString(null));\r
+                               oldCollection.remove(new BasicDBObject(idFieldName, id));\r
+                       }\r
+               }\r
+       }\r
+\r
        private void updateDiff(String oldCollectionName, String newCollectionName, String idFieldName) {\r
                DBCollection oldCollection = db.getCollection(oldCollectionName);\r
                DBCollection newCollection = db.getCollection(newCollectionName);\r
index 07510c89c9e5931fb6529d44cfb789b3b7df241f..64622951655374b808fc4370de75c779fe6cbce1 100644 (file)
@@ -3,7 +3,6 @@ package user.jobengine.server.steps;
 import org.apache.logging.log4j.LogManager;\r
 import org.apache.logging.log4j.Logger;\r
 \r
-import user.commons.octopus.OctopusDataMiner;\r
 import user.commons.remotestore.IProgressEventListener;\r
 import user.commons.remotestore.ProgressEvent;\r
 import user.jobengine.server.IJobEngine;\r
@@ -24,17 +23,14 @@ public class SyncOCTOPUSDataStep extends JobStep {
        }\r
 \r
        @StepEntry\r
-       public Object[] execute(boolean forceFull, IJobEngine jobEngine, final IJobRuntime jobRuntime) throws Exception {\r
+       public Object[] execute(boolean includeArchived, IJobEngine jobEngine, final IJobRuntime jobRuntime) throws Exception {\r
                OctopusDataMiner dataMiner = null;\r
                try {\r
                        //jobRuntime.incrementProgress(10);\r
                        progressListener = createListener(jobRuntime);\r
                        dataMiner = new OctopusDataMiner();\r
                        dataMiner.addProgressListener(progressListener);\r
-                       if (forceFull)\r
-                               dataMiner.execute();\r
-                       else\r
-                               dataMiner.run();\r
+                       dataMiner.execute(includeArchived);\r
                } catch (Exception e) {\r
                        logger.error(getMarker(), "Általános folyamat hiba. A rendszer hibaüzenete: {}", e.getMessage());\r
                        throw e;\r
index 1dc7b900ce81ef74d505ccd1f856a4bfc210dda7..824d4c054a3acefaad7d4b0698b9128ad41fef5b 100644 (file)
@@ -6,9 +6,9 @@ import java.util.List;
 import com.ibm.nosql.json.api.DBObject;\r
 \r
 public interface IOctopusAPI {\r
-       static final String RUNDOWN_COLLECTION = "rundowns";\r
-       static final String STORY_COLLECTION = "stories";\r
-       static final String FOLDER_COLLECTION = "story_folders";\r
+       static final String RUNDOWN_COLLECTION = System.getProperty("jobengine.octopus.rundowns.name", "rundowns");\r
+       static final String STORY_COLLECTION = System.getProperty("jobengine.octopus.stories.name", "stories");\r
+       static final String FOLDER_COLLECTION = System.getProperty("jobengine.octopus.storyfolders.name", "storyfolders");\r
        static final String TIME_COLLECTION_NAME = "time";\r
        static final String SCRIPT_CONTENT = "script_content";\r
        static final String RUNDOWN_TYPE = "rundownType";\r
similarity index 97%
rename from server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusDataMiner.java
rename to server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusDataMiner1.java
index 73dac323dedfab38ebb3fd5d6079257ce9ca4b08..62ba7b56173f0652bf881033aa80643d131de895 100644 (file)
@@ -36,7 +36,7 @@ import user.commons.nosql.NoSQLUtils;
 import user.commons.remotestore.IProgressEventListener;\r
 import user.commons.remotestore.ProgressEvent;\r
 \r
-public class OctopusDataMiner implements Runnable {\r
+public class OctopusDataMiner1 implements Runnable {\r
        private static final String _TMP = "_tmp";\r
        private static final Logger logger = LogManager.getLogger();\r
        private static final String LINEFEED = "\r\n";\r
@@ -81,7 +81,7 @@ public class OctopusDataMiner implements Runnable {
        private Map<Long, BasicDBList> newStoryFolders = new HashMap<>();\r
        private Map<Long, BasicDBList> newStories = new HashMap<>();\r
 \r
-       public OctopusDataMiner() {\r
+       public OctopusDataMiner1() {\r
                db = NoSQLUtils.getNoSQLDB();\r
 \r
                String apiAddress = System.getProperty("jobengine.octopus.api.address");\r
index 49c3944417b920fe42ef9093f170acc5a03c2283..b2957a2805019a8abc5fbde4b703391779b31e81 100644 (file)
@@ -10,16 +10,22 @@ import java.sql.SQLException;
 import java.util.List;\r
 import java.util.Properties;\r
 \r
+import javax.ws.rs.core.Response;\r
+\r
+import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;\r
+import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;\r
 import org.junit.BeforeClass;\r
 import org.junit.Test;\r
 \r
+import com.ibm.nosql.json.JSONUtil;\r
 import com.ibm.nosql.json.api.BasicDBList;\r
 import com.ibm.nosql.json.api.BasicDBObject;\r
 import com.ibm.nosql.json.api.DBObject;\r
 \r
+import user.commons.nosql.NoSQLUtils;\r
 import user.commons.octopus.IOctopusAPI;\r
 import user.commons.octopus.OctopusAPI;\r
-import user.commons.octopus.OctopusDataMiner;\r
+import user.commons.octopus.OctopusDataMiner1;\r
 \r
 public class OctopusDataMinerTest {\r
 \r
@@ -45,12 +51,12 @@ public class OctopusDataMinerTest {
 \r
        }\r
 \r
-       private OctopusDataMiner sut;\r
+       private OctopusDataMiner1 sut;\r
 \r
        @Test\r
        public void integrationExecute() throws Exception {\r
                // fixture\r
-               sut = new OctopusDataMiner();\r
+               sut = new OctopusDataMiner1();\r
                // Exercise\r
                sut.execute();\r
        }\r
@@ -58,7 +64,7 @@ public class OctopusDataMinerTest {
        @Test\r
        public void integrationTestClear() {\r
                // fixture\r
-               sut = new OctopusDataMiner();\r
+               sut = new OctopusDataMiner1();\r
                // Exercise\r
                sut.clear();\r
        }\r
@@ -66,7 +72,7 @@ public class OctopusDataMinerTest {
        @Test\r
        public void integrationTestWithClear() {\r
                // fixture\r
-               sut = new OctopusDataMiner();\r
+               sut = new OctopusDataMiner1();\r
                sut.clear();\r
 \r
                // Exercise\r
@@ -75,7 +81,7 @@ public class OctopusDataMinerTest {
 \r
        @Test\r
        public void run() {\r
-               sut = new OctopusDataMiner();\r
+               sut = new OctopusDataMiner1();\r
                sut.run();\r
        }\r
 \r
@@ -93,6 +99,34 @@ public class OctopusDataMinerTest {
                }\r
        }\r
 \r
+       @Test\r
+       public void testClient() {\r
+               ResteasyWebTarget webTarget = new ResteasyClientBuilder().build().target("http://10.10.1.29/services/rest/octopus/");\r
+               Response response = null;\r
+               for (int i = 0; i < 10000; i++) {\r
+                       response = webTarget.path("rundowns").request().get();\r
+                       List<BasicDBObject> rundowns = NoSQLUtils.asList((BasicDBList) JSONUtil.jsonToDbObject(response.readEntity(String.class)));\r
+                       System.out.println("Rundowns count: " + rundowns.size());\r
+                       //                      for (BasicDBObject rundown : rundowns) {\r
+                       //                              response = webTarget.path("rundownStories/" + rundown.getLong(IOctopusAPI.ID)).request().get();\r
+                       //                              List<BasicDBObject> stories = NoSQLUtils.asList((BasicDBList) JSONUtil.jsonToDbObject(response.readEntity(String.class)));\r
+                       //                              System.out.println("Rundown '" + rundown.getString(IOctopusAPI.NAME) + "' stories count: " + stories.size());\r
+                       //                      }\r
+\r
+                       response = webTarget.path("storyFolders").request().get();\r
+                       List<BasicDBObject> storyFolders = NoSQLUtils.asList((BasicDBList) JSONUtil.jsonToDbObject(response.readEntity(String.class)));\r
+                       System.out.println("StoryFolders count: " + storyFolders.size());\r
+                       //                      for (BasicDBObject storyFolder : storyFolders) {\r
+                       //                              response = webTarget.path("storyFolderStories/" + storyFolder.getLong(IOctopusAPI.ID)).request().get();\r
+                       //                              List<BasicDBObject> stories = NoSQLUtils.asList((BasicDBList) JSONUtil.jsonToDbObject(response.readEntity(String.class)));\r
+                       //                              System.out.println("StoryFolder '" + storyFolder.getString(IOctopusAPI.NAME) + "' stories count: " + stories.size());\r
+                       //                      }\r
+                       response = webTarget.path("storyFolderStories/1504322").request().get();\r
+                       List<BasicDBObject> stories = NoSQLUtils.asList((BasicDBList) JSONUtil.jsonToDbObject(response.readEntity(String.class)));\r
+                       System.out.println("Híradó stories count: " + stories.size());\r
+               }\r
+       }\r
+\r
        @Test\r
        public void testListEquals() {\r
                BasicDBList list1 = new BasicDBList(new BasicDBObject("x", 1));\r
@@ -119,4 +153,5 @@ public class OctopusDataMinerTest {
                list2.add(new BasicDBObject("z", 3));\r
                assertTrue(list1.equals(list2));\r
        }\r
+\r
 }\r
index 0352c35a06feccda7cb6a423f83a61ac89edecdb..0a7be31c5e1aa768d2cf49e7f9583822962861d4 100644 (file)
@@ -1,23 +1,25 @@
 --MEDIAFILE\r
+select mediaid from vw_mediafiles where mediafilecount = 1\r
+\r
 select * from mediafile f where f.mediaid in (select mediaid from vw_mediafiles where mediafilecount = 1)\r
-delete from mediafile f where f.mediaid in (select mediaid from vw_mediafiles where mediafilecount = 1)\r
+--delete from mediafile f where f.mediaid in (select mediaid from vw_mediafiles where mediafilecount = 1)\r
 select * from mediafile f where f.mediaid in (select id from media where created > '2017-12-08')\r
-delete from mediafile f where f.mediaid in (select id from media where created > '2017-12-08')\r
+--delete from mediafile f where f.mediaid in (select id from media where created > '2017-12-08')\r
 \r
 \r
 --MEDIA\r
 CREATE VIEW vw_mediafiles as select mediaid, count(*) as mediafilecount from mediafile group by (mediaid)\r
-select m.id, m.title, m.created,f.mediafilecount from media m right outer join vw_mediafiles f on (f.mediaid = m.id) where m.created > '2017-12-08'\r
+select m.id, m.title, m.created,f.mediafilecount from media m right outer join vw_mediafiles f on (f.mediaid = m.id) where m.created > '2017-12-14' and f.mediafilecount = 1 \r
 select m.itemid, m.id, m.itemtypeid, m.title, m.created,f.mediafilecount from media m left outer join vw_mediafiles f on (f.mediaid = m.id) where f.mediafilecount is null\r
 select m.itemid, m.id, m.itemtypeid, m.title, m.created,f.mediafilecount from media m left outer join vw_mediafiles f on (f.mediaid = m.id) where f.mediafilecount = 1\r
-delete from media where id in (select m.id from media m left outer join vw_mediafiles f on (f.mediaid = m.id) where f.mediafilecount is null)\r
+--delete from media where id in (select m.id from media m left outer join vw_mediafiles f on (f.mediaid = m.id) where f.mediafilecount is null)\r
 \r
 \r
 \r
 --ITEM\r
 CREATE VIEW vw_medias as select itemid, count(*) as mediacount from media group by (itemid)\r
 select i.id, i.title, i.created, m.mediacount from item i left outer join vw_medias m on (m.itemid = i.id) where m.mediacount is null\r
-delete from item where id in (select i.id from item i left outer join vw_medias m on (m.itemid = i.id) where m.mediacount is null)\r
+--delete from item where id in (select i.id from item i left outer join vw_medias m on (m.itemid = i.id) where m.mediacount is null)\r
 \r
 \r
 \r
index 597e41ce55cbf997965ba41c3244e83ade7a59e4..771082183459848e36537ac503360aa5ee59b2cc 100644 (file)
@@ -1,5 +1,7 @@
 package user.jobengine.server.actions;\r
 \r
+import java.sql.Timestamp;\r
+\r
 import user.commons.JobStatus;\r
 import user.jobengine.server.IJobEngine;\r
 import user.jobengine.server.IJobRuntime;\r
@@ -10,6 +12,7 @@ public class DoneSuspendAction implements IJobStatusAction {
        public void processAction(IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
                jobRuntime.saveStatus();\r
                jobRuntime.setStatus(JobStatus.SUSPENDED);\r
+               jobRuntime.setFinished(new Timestamp(System.currentTimeMillis()));\r
                jobRuntime.NotifyUpdate();\r
                jobRuntime.restoreStack();\r
                jobRuntime.decrementInstructionPointer();\r