weblib: full r/w support
[fanfix.git] / src / be / nikiroo / fanfix / library / WebLibraryUrls.java
index c1d1cf21f3621ee4a89c99d2b96508fe3a3d1cea..41f1c82feb17c2312ddc3868f5fd9176f3886c59 100644 (file)
@@ -17,6 +17,8 @@ class WebLibraryUrls {
        static private final String STORY_URL_COVER = STORY_URL_BASE
                        + "{luid}/cover";
        static private final String STORY_URL_JSON = STORY_URL_BASE + "{luid}/json";
+       static private final String STORY_URL_METADATA = STORY_URL_BASE
+                       + "{luid}/metadata";
 
        // GET/SET ("value" param -> set STA to this value)
        static private final String STORY_URL_SOURCE = STORY_URL_BASE
@@ -30,6 +32,12 @@ class WebLibraryUrls {
 
        static public final String LIST_URL_METADATA = LIST_URL_BASE + "metadata";
 
+       // "import" requires param "url" and return an luid, "/{luid}" return
+       // progress status as a JSON Progress or 404 if none (done or failed)
+       static private final String IMPRT_URL_BASE = "/import/";
+       static private final String IMPRT_URL_PROGRESS = IMPRT_URL_BASE + "{luid}";
+       static public final String IMPRT_URL_IMPORT = IMPRT_URL_BASE + "import";
+
        // GET/SET ("luid" param -> set cover to the cover of this story -- not ok
        // for /cover/story/)
        static private final String COVER_URL_BASE = "/cover/";
@@ -80,10 +88,20 @@ class WebLibraryUrls {
                                .replace("{luid}", luid);
        }
 
+       static public String getStoryUrlMetadata(String luid) {
+               return STORY_URL_METADATA //
+                               .replace("{luid}", luid);
+       }
+
+       static public String getImprtProgressUrl(String luid) {
+               return IMPRT_URL_PROGRESS //
+                               .replace("{luid}", luid);
+       }
+
        static public boolean isSupportedUrl(String url) {
                return INDEX_URL.equals(url) || VERSION_URL.equals(url)
                                || LOGOUT_URL.equals(url) || isViewUrl(url) || isStoryUrl(url)
-                               || isListUrl(url) || isCoverUrl(url);
+                               || isListUrl(url) || isCoverUrl(url) || isImprtUrl(url);
        }
 
        static public String getCoverUrlStory(String luid) {
@@ -116,4 +134,8 @@ class WebLibraryUrls {
        static public boolean isCoverUrl(String url) {
                return url != null && url.startsWith(COVER_URL_BASE);
        }
+
+       static public boolean isImprtUrl(String url) {
+               return url != null && url.startsWith(IMPRT_URL_BASE);
+       }
 }