X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FBasicLibrary.java;h=8b72f19b3a92ad1c1d7ada09d915440596330ee2;hp=78f0f6208d098dcaf410e85c631dc3808330a2bd;hb=acbec0d232186ddf5431b696ee74a791ae5e828f;hpb=599b05c7917edbe2fe4d6449628f2b261eae2f5e diff --git a/src/be/nikiroo/fanfix/library/BasicLibrary.java b/src/be/nikiroo/fanfix/library/BasicLibrary.java index 78f0f62..8b72f19 100644 --- a/src/be/nikiroo/fanfix/library/BasicLibrary.java +++ b/src/be/nikiroo/fanfix/library/BasicLibrary.java @@ -41,11 +41,11 @@ abstract public class BasicLibrary { READ_WRITE, /** The library is ready, but read-only. */ READ_ONLY, - /** The library is invalid (not correctly set up). */ - INVALID, /** You are not allowed to access this library. */ UNAUTHORIZED, - /** The library is currently out of commission. */ + /** The library is invalid, and will never work as is. */ + INVALID, + /** The library is currently out of commission, but may work later. */ UNAVAILABLE; /** @@ -311,7 +311,7 @@ abstract public class BasicLibrary { * * @return the next luid */ - protected abstract int getNextId(); + protected abstract String getNextId(); /** * Delete the target {@link Story}. @@ -595,6 +595,28 @@ abstract public class BasicLibrary { * in case of I/O error */ public MetaData imprt(URL url, Progress pg) throws IOException { + return imprt(url, null, pg); + } + + /** + * Import the {@link Story} at the given {@link URL} into the + * {@link BasicLibrary}. + * + * @param url + * the {@link URL} to import + * @param luid + * the LUID to use + * @param pg + * the optional progress reporter + * + * @return the imported Story {@link MetaData} + * + * @throws UnknownHostException + * if the host is not supported + * @throws IOException + * in case of I/O error + */ + MetaData imprt(URL url, String luid, Progress pg) throws IOException { if (pg == null) pg = new Progress(); @@ -609,7 +631,7 @@ abstract public class BasicLibrary { throw new UnknownHostException("" + url); } - Story story = save(support.process(pgProcess), pgSave); + Story story = save(support.process(pgProcess), luid, pgSave); pg.done(); return story.getMeta(); @@ -741,7 +763,7 @@ abstract public class BasicLibrary { pg.setName("Saving story"); if (luid == null || luid.isEmpty()) { - meta.setLuid(String.format("%03d", getNextId())); + meta.setLuid(getNextId()); } else { meta.setLuid(luid); }