From: Vásáry Dániel Date: Fri, 26 Oct 2018 09:34:27 +0000 (+0000) Subject: Bug #96 Octopus tükör listázó felület story sorrend hibás X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=e7588245cb5dee96cced92d2d4c9f6c5951738eb;p=mediacube.git Bug #96 Octopus tükör listázó felület story sorrend hibás git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31334 --- diff --git a/client/MaestroShared/Targets/UNCTargetProcessor.cs b/client/MaestroShared/Targets/UNCTargetProcessor.cs index fd0a4953..c30e2835 100644 --- a/client/MaestroShared/Targets/UNCTargetProcessor.cs +++ b/client/MaestroShared/Targets/UNCTargetProcessor.cs @@ -1,13 +1,13 @@ -using NLog; -using System; -using System.IO; -using System.Windows.Forms; -using System.Text; +using MaestroShared.Commons; using MaestroShared.Configuration; -using MaestroShared.Target; using MaestroShared.Metadata; -using MaestroShared.Commons; using MaestroShared.Model; +using MaestroShared.Target; +using NLog; +using System; +using System.IO; +using System.Text; +using System.Windows.Forms; namespace MaestroShared.Targets { @@ -97,16 +97,16 @@ namespace MaestroShared.Targets { DeleteAfterCopy(); ExecuteCompleted(); - } - catch (Exception e) { + workFlowAction.successful = true; + } catch (Exception e) { Status = ERROR; Message = e.Message; workFlowAction.description = Message; + workFlowAction.successful = false; logger.Error(e); - if (Parameters.TargetConfig.SendEmailOnError && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailPattern)) + if (Parameters.TargetConfig.SendEmailOnError && !string.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(Parameters.TargetConfig.ErrorEmailPattern)) SendEmail(Parameters.TargetConfig.ErrorEmailRecipient, Parameters.TargetConfig.ErrorEmailPattern); - } - finally { + } finally { AfterExecute(); } logger.Info(PROCESSING_COMPLETED, InputName); @@ -137,10 +137,9 @@ namespace MaestroShared.Targets { Message = "A célállomány már létezik és el van fogadva, felülírása nem lehetséges."; Status = SKIPPED; return false; - } else + } else DeleteFile(currentFile); - } - else { + } else { Message = "A célállomány létezik, felülírása a konfiuráció alapján nem lehetséges."; Status = SKIPPED; return false; @@ -181,7 +180,6 @@ namespace MaestroShared.Targets { logger.Trace(Strings.ENTRY); workFlowAction.description = SUCCESS; base.ExecuteCompleted(); - workFlowAction.successful = true; if (Parameters.TargetConfig.NexioServer) UploadNexioMetadata(); else { @@ -257,8 +255,7 @@ namespace MaestroShared.Targets { try { string message = GetDynamicText(messagePattern); Parameters.MediaCubeApi.Notify(to, message); - } - catch (Exception e) { + } catch (Exception e) { MessageBox.Show(parent, e.Message); } logger.Trace(Strings.EXIT); @@ -292,8 +289,7 @@ namespace MaestroShared.Targets { try { Parameters?.MediaCubeApi?.Create(workFlowAction); - } - catch (Exception e) { + } catch (Exception e) { logger.Error(e); MessageBox.Show(parent, e.Message); } diff --git a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java index d77ef208..cefb2483 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/octopus/OctopusAPI.java @@ -219,6 +219,7 @@ public class OctopusAPI implements IOctopusAPI { .sort(new BasicDBObject("name", 1)); if (find.hasNext()) result = find.toArray(); + return result; } @@ -226,10 +227,32 @@ public class OctopusAPI implements IOctopusAPI { public List getRundownStories(long id, BasicDBObject fields) { List result = null; DBCollection collection = db.getCollection(STORY_COLLECTION); - DBCursor find = collection.find(new BasicDBObject(REF_RUNDOWN, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, id))), fields) + DBCursor find = collection.find(new BasicDBObject(REF_RUNDOWN, new BasicDBObject($ELEMMATCH, new BasicDBObject(ID, id)))) .sort(new BasicDBObject("name", 1)); if (find.hasNext()) result = find.toArray(); + + if (result != null) { + result.forEach(o -> { + List rds = NoSQLUtils.asList((BasicDBObject) o, REF_RUNDOWN); + if (rds != null) { + for (BasicDBObject rd : rds) { + long rundownID = NoSQLUtils.asLong(rd, ID); + if (rundownID == id) { + long position = NoSQLUtils.asLong(rd, POSITION); + o.put(POSITION, position); + break; + } + } + } + }); + } + + Collections.sort(result, (o1, o2) -> { + long pos1 = NoSQLUtils.asLong((BasicDBObject) o1, POSITION); + long pos2 = NoSQLUtils.asLong((BasicDBObject) o2, POSITION); + return (pos1 < pos2 ? -1 : (pos1 == pos2 ? 0 : 1)); + }); return result; } diff --git a/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java b/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java index d8e19993..95c4b302 100644 --- a/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java +++ b/server/user.jobengine.osgi.services/src/user/jobengine/osgi/rest/octopus/OctopusRESTService.java @@ -3,6 +3,7 @@ package user.jobengine.osgi.rest.octopus; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.TimeZone; import javax.ws.rs.Consumes; import javax.ws.rs.GET; @@ -62,7 +63,8 @@ public class OctopusRESTService { StringBuilder sb = new StringBuilder(); List rundowns = ListUtils.cast(octopusService.getRundowns(null)); - SimpleDateFormat sdt = new SimpleDateFormat("yyyy.MM.dd hh:mm"); + SimpleDateFormat sdt = new SimpleDateFormat("yyyy.MM.dd HH:mm"); + sdt.setTimeZone(TimeZone.getTimeZone("Europe/Prague")); for (BasicDBObject rundown : rundowns) { String name = rundown.getString(IOctopusAPI.NAME); @@ -79,6 +81,9 @@ public class OctopusRESTService { } result = Response.ok(sb.toString()).build(); + // String a = TimeZone.getDefault().getDisplayName(); + // String b = TimeZone.getDefault().getID(); + // result = Response.ok(b + " " + a).build(); } catch (Exception e) { result = createErrorResponse(e); }