/**
* Set the author cover to the given story cover.
*
- * @param source
+ * @param author
* the author to change
* @param luid
* the story LUID
*
* @return the corresponding {@link Story} or NULL if not found
*/
- public synchronized Story getStory(String luid, MetaData meta, Progress pg) {
+ public synchronized Story getStory(String luid,
+ @SuppressWarnings("javadoc") MetaData meta, Progress pg) {
if (pg == null) {
pg = new Progress();
} catch (IOException e) {
// We should not have not-supported files in the
// library
- Instance.getTraceHandler()
- .error(new IOException("Cannot load file from library: "
- + file, e));
+ Instance.getTraceHandler().error(
+ new IOException(String.format(
+ "Cannot load file of type '%s' from library: %s",
+ meta.getType(), file), e));
} finally {
pgProcess.done();
pg.done();
@Override
public synchronized Story getStory(String luid, MetaData meta, Progress pg) {
- String type = cacheLib.getOutputType(meta.isImageDocument());
- MetaData cachedMeta = meta.clone();
- cachedMeta.setType(type);
-
- return super.getStory(luid, cachedMeta, pg);
- }
-
- @Override
- public synchronized File getFile(final String luid, Progress pg) {
if (pg == null) {
pg = new Progress();
}
Progress pgImport = new Progress();
Progress pgGet = new Progress();
- Progress pgRecall = new Progress();
- pg.setMinMax(0, 5);
+ pg.setMinMax(0, 4);
pg.addProgress(pgImport, 3);
pg.addProgress(pgGet, 1);
- pg.addProgress(pgRecall, 1);
if (!isCached(luid)) {
try {
pgGet.done();
}
+ String type = cacheLib.getOutputType(meta.isImageDocument());
+ MetaData cachedMeta = meta.clone();
+ cachedMeta.setType(type);
+
+ return cacheLib.getStory(luid, cachedMeta, pg);
+ }
+
+ @Override
+ public synchronized File getFile(final String luid, Progress pg) {
+ if (pg == null) {
+ pg = new Progress();
+ }
+
+ Progress pgGet = new Progress();
+ Progress pgRecall = new Progress();
+
+ pg.setMinMax(0, 5);
+ pg.addProgress(pgGet, 4);
+ pg.addProgress(pgRecall, 1);
+
+ if (!isCached(luid)) {
+ getStory(luid, pgGet);
+ pgGet.done();
+ }
+
File file = cacheLib.getFile(luid, pgRecall);
pgRecall.done();