read categories information from the configuration
[pnews.git] / war / src / main / java / pnews / Category.java
index 7a8106f..ab63a05 100644 (file)
@@ -1,22 +1,36 @@
 package pnews;
 
-public enum Category {
-        TOP("top"),
-        FRANCE("france"),
-        SPORT("sport"),
-        EUROPE("europe"),
-        ECO("eco"),
-        ESSONNE("essonne"),
-        TECHNOLOGIE("technologie"),
-        PEOPLE("people");
-        
+public class Category {
         private final String id;
-                
-        private Category(String id) {
+        private final String label;
+        private final 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;
         }
+        
+        @Override
+        public String toString() {
+                return getLabel();
+        }
 }