Merge with 2ad3c504ee5d73982c0ef23336276dc1fc9e165f
[pithos] / src / gr / ebs / gss / server / domain / FileHeader.java
index 332ace5..d4e1b92 100644 (file)
@@ -56,6 +56,12 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
 public final class FileHeader  implements Serializable{\r
 \r
        /**\r
+        * The path for the resource manipulation subsystem.\r
+        */\r
+       public static final String PATH_FILES = "/files";\r
+       //TODO: Re-evaluate whether this should move in a property file\r
+\r
+       /**\r
         * The persistence ID of the object.\r
         */\r
        @Id\r
@@ -146,7 +152,7 @@ public final class FileHeader  implements Serializable{
         */\r
        @OneToMany(cascade = CascadeType.ALL)\r
        private Set<Permission> permissions = new HashSet<Permission>();\r
-       \r
+\r
        @Column(columnDefinition=" boolean DEFAULT false")\r
        private Boolean shared;\r
        /**\r
@@ -323,6 +329,19 @@ public final class FileHeader  implements Serializable{
        }\r
 \r
        /**\r
+        * Retrieve the file tags as a list of strings.\r
+        *\r
+        * @return the list of file tag strings\r
+        */\r
+       public List<String> getFileTagsAsStrings() {\r
+               List<String> result = new ArrayList<String>();\r
+               for (FileTag ft : fileTags) {\r
+                       result.add(ft.getTag());\r
+               }\r
+               return result;\r
+       }\r
+       \r
+       /**\r
         * Retrieve the file tags.\r
         *\r
         * @return the list of file tags\r
@@ -551,6 +570,17 @@ public final class FileHeader  implements Serializable{
        }\r
        \r
        /**\r
+        * Retrieve the URI for this resource, relative to the REST API root URI.\r
+        * This unique identifier can be used to refer to the resource from\r
+        * various GSS clients.\r
+        *\r
+        * @return the URI\r
+        */\r
+       public String getURI() {\r
+               return owner.getUsername() + PATH_FILES + getPath();\r
+       }\r
+\r
+       /**\r
         * Retrieve the shared.\r
         *\r
         * @return the shared\r
@@ -559,9 +589,9 @@ public final class FileHeader  implements Serializable{
                if(shared==null)\r
                        return false;\r
                return shared;\r
-       }\r
-       \r
-       \r
+    }\r
+
+
        /**\r
         * Modify the shared.\r
         *\r