[vlma-devel] commit: Ability to choose the SAP group of a program. (Adrien Grand )

git version control git at videolan.org
Sat Dec 6 18:00:52 CET 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Dec  6 16:05:21 2008 +0100| [8cbe652ea7c310682e30d24b83dfc4adab26959c] | committer: Adrien Grand 

Ability to choose the SAP group of a program.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=8cbe652ea7c310682e30d24b83dfc4adab26959c
---

 .../src/main/java/org/videolan/vlma/DataImpl.java  |   23 -----------------
 .../videolan/vlma/web/media/MediaProgramAdd.java   |   10 +++++++
 .../vlma/web/media/MediaProgramAddController.java  |   27 +++++++++++++++++--
 vlma-webapp/src/main/resources/messages.properties |    1 +
 .../src/main/resources/messages_fr.properties      |    1 +
 .../WEB-INF/jsp/media/mediaprogramadd_right.jsp    |    9 ++++++
 6 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
index 2e1ca1f..fec674f 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/DataImpl.java
@@ -43,14 +43,11 @@ import org.videolan.vlma.daemon.Daemon;
 import org.videolan.vlma.dao.VLMaDao;
 import org.videolan.vlma.exception.NotProgrammedException;
 import org.videolan.vlma.model.Command;
-import org.videolan.vlma.model.DTTChannel;
-import org.videolan.vlma.model.FilesChannel;
 import org.videolan.vlma.model.Media;
 import org.videolan.vlma.model.Program;
 import org.videolan.vlma.model.SatChannel;
 import org.videolan.vlma.model.Satellite;
 import org.videolan.vlma.model.Server;
-import org.videolan.vlma.model.StreamChannel;
 import org.videolan.vlma.model.StreamingStrategy;
 import org.videolan.vlma.order.CommandLogger;
 import org.videolan.vlma.retriever.DataRetriever;
@@ -170,26 +167,6 @@ public class DataImpl implements Data {
                 && media.getProgram().getStreamingStrategy().getProtocol().equals(StreamingStrategy.Protocol.UDP_MULTICAST)) {
             media.getProgram().setIp(ipBank.getIp());
         }
-        // Update sap group
-        if (media.getProgram() != null) {
-            String sapGroupId = null;
-            if (media instanceof FilesChannel) {
-                sapGroupId = "vlma.announcement.sap.files.group";
-            } else if (media instanceof StreamChannel) {
-                sapGroupId = "vlma.announcement.sap.stream.group";
-            } else if (media instanceof DTTChannel) {
-                sapGroupId = "vlma.announcement.sap.dtt.group";
-            } else if (media instanceof SatChannel) {
-                String category = ((SatChannel) m).getCategory();
-                if ("R-DIG".equals(category) || "R-DIG-CRYPT".equals(category)) {
-                    sapGroupId = "vlma.announcement.sap.radio.group";
-                } else {
-                    sapGroupId = "vlma.announcement.sap.satellite.group";
-                }
-            }
-            if (sapGroupId != null)
-                media.getProgram().setSapGroup(configuration.getString(sapGroupId));
-        }
         vlmaDao.update(media);
     }
 
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
index 194f7aa..e90bb60 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAdd.java
@@ -30,7 +30,9 @@ import org.videolan.vlma.model.StreamingStrategy.Announcement;
 
 public class MediaProgramAdd {
 
+    /* SAP name and group */
     private String sap;
+    private String group;
 
     private String priority;
 
@@ -87,6 +89,14 @@ public class MediaProgramAdd {
         this.sap = sap;
     }
 
+    public String getGroup() {
+        return group;
+    }
+
+    public void setGroup(String group) {
+        this.group = group;
+    }
+
     public int getMediaId() {
         return mediaId;
     }
diff --git a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
index a18a99f..2120cf6 100644
--- a/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
+++ b/vlma-webapp/src/main/java/org/videolan/vlma/web/media/MediaProgramAddController.java
@@ -34,6 +34,7 @@ import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.mvc.SimpleFormController;
 import org.springframework.web.servlet.view.RedirectView;
 import org.videolan.vlma.Data;
+import org.videolan.vlma.model.DTTChannel;
 import org.videolan.vlma.model.FilesChannel;
 import org.videolan.vlma.model.Media;
 import org.videolan.vlma.model.Program;
@@ -104,6 +105,7 @@ public class MediaProgramAddController extends SimpleFormController {
         Program program = data.newProgram();
         program.setPriority(Integer.parseInt(mediasProgramAdd.getPriority()));
         program.setSapName(mediasProgramAdd.getSap());
+        program.setSapGroup(mediasProgramAdd.getGroup());
         program.getStreamingStrategy().setType(mediasProgramAdd.getType());
         program.getStreamingStrategy().setProtocol(mediasProgramAdd.getProtocol());
         program.getStreamingStrategy().setEncapsulation(mediasProgramAdd.getMux());
@@ -113,13 +115,13 @@ public class MediaProgramAddController extends SimpleFormController {
 
         // Determine the success view with the media class
         String successView = null;
-        if (media.getClass() == FilesChannel.class) {
+        if (media instanceof FilesChannel) {
             successView = getSuccessViewFile();
         }
-        else if (media.getClass() == StreamChannel.class) {
+        else if (media instanceof StreamChannel) {
             successView = getSuccessViewStream();
         }
-        else if (media.getClass() == SatChannel.class) {
+        else if (media instanceof SatChannel) {
             successView = getSuccessViewSat();
         } else {
             successView = getSuccessViewDTT();
@@ -164,6 +166,25 @@ public class MediaProgramAddController extends SimpleFormController {
                 mediasProgramAdd.setSap(media.getName());
         }
         mediasProgramAdd.setSap(media.getName());
+        String sapGroupId = null;
+        if (media instanceof FilesChannel) {
+            sapGroupId = "vlma.announcement.sap.files.group";
+        } else if (media instanceof StreamChannel) {
+            sapGroupId = "vlma.announcement.sap.stream.group";
+        } else if (media instanceof DTTChannel) {
+            sapGroupId = "vlma.announcement.sap.dtt.group";
+        } else if (media instanceof SatChannel) {
+            String category = ((SatChannel) media).getCategory();
+            if ("R-DIG".equals(category) || "R-DIG-CRYPT".equals(category)) {
+                sapGroupId = "vlma.announcement.sap.radio.group";
+            } else {
+                sapGroupId = "vlma.announcement.sap.satellite.group";
+            }
+        }
+        if (sapGroupId != null)
+            mediasProgramAdd.setGroup(data.getString(sapGroupId));
+        else
+            mediasProgramAdd.setGroup("");
         mediasProgramAdd.setMediaId(mediaId);
         mediasProgramAdd.setType(program.getStreamingStrategy().getType());
         mediasProgramAdd.setProtocol(program.getStreamingStrategy().getProtocol());
diff --git a/vlma-webapp/src/main/resources/messages.properties b/vlma-webapp/src/main/resources/messages.properties
index f6d28a2..d6126db 100644
--- a/vlma-webapp/src/main/resources/messages.properties
+++ b/vlma-webapp/src/main/resources/messages.properties
@@ -231,6 +231,7 @@ medias.list.action.removechannel = Remove this channel
 medias.list.action.editchannel = Modify this channel
 medias.program.adding = Programmation of the media {0}
 medias.program.add.sap = Name to display:
+medias.program.add.group = Group:
 medias.program.add.priority = Priority:
 medias.program.add.type = Type:
 medias.program.add.protocol = Protocol:
diff --git a/vlma-webapp/src/main/resources/messages_fr.properties b/vlma-webapp/src/main/resources/messages_fr.properties
index 55a9d58..953d636 100644
--- a/vlma-webapp/src/main/resources/messages_fr.properties
+++ b/vlma-webapp/src/main/resources/messages_fr.properties
@@ -228,6 +228,7 @@ medias.list.action.removechannel = Supprimer cette chaîne
 medias.list.action.editchannel = Modifier cette chaîne
 medias.program.adding = Programmation du média {0}
 medias.program.add.sap = Nom à afficher :
+medias.program.add.group = Catégorie :
 medias.program.add.priority = Priorité :
 medias.program.add.type = Type :
 medias.program.add.protocol = Protocole :
diff --git a/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp b/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
index a24d3a1..0a76a43 100644
--- a/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
+++ b/vlma-webapp/src/main/webapp/WEB-INF/jsp/media/mediaprogramadd_right.jsp
@@ -19,6 +19,15 @@
         </spring:bind>
     </tr>
     <tr>
+        <td align="right"><fmt:message key="medias.program.add.group" /></td>
+        <spring:bind path="mediaProgramAdd.group">
+            <td><input type="text" name="group" value="<c:out
+                value="${status.value}" />" /></td>
+            <td><span class="error"><c:out
+                value="${status.errorMessage}" /></span></td>
+        </spring:bind>
+    </tr>
+    <tr>
         <td align="right"><fmt:message key="medias.program.add.priority" /></td>
         <spring:bind path="mediaProgramAdd.priority">
             <td><input type="text" name="priority"



More information about the vlma-devel mailing list