read categories information from the configuration
[pnews.git] / war / src / main / java / pnews / Category.java
index 6d1978a..ab63a05 100644 (file)
@@ -1,29 +1,36 @@
 package pnews;
 
-public enum Category {
-        TOP("top", "Les actualités à la une"),
-        FRANCE("france", "France"),
-        SPORT("sport", "Sport"),
-        EUROPE("europe", "Europe"),
-        MONDE("monde", "Monde"),
-        ECO("eco", "Economie"),
-        ESSONNE("essonne", "Essone"),
-        TECHNOLOGIE("technologie", "Technologie"),
-        PEOPLE("people", "People");
-        
+public class Category {
         private final String id;
+        private final String label;
         private final String title;
-                
-        private Category(String id, String title) {
+        private final String language;
+
+        public Category(String id, String label, String title, String language) {
                 this.id = id;
+                this.label = label;
                 this.title = title;
+                this.language = language;
+        }
+                
+        public String getTitle() {
+                return title;
+        }
+        
+        public String getURL() {
+                return "/" + language + "/" + id.toLowerCase();
         }
         
+        public String getLabel() {
+                return label;
+        }        
+        
         public String getId() {
                 return id;
         }
         
-        public String getTitle() {
-                return title;
+        @Override
+        public String toString() {
+                return getLabel();
         }
 }