use of org.mycore.iview2.services.MCRTileJob in project mycore by MyCoRe-Org.
the class MCRIView2Commands method tileImage.
/**
* Tiles this {@link MCRPath}
*/
public static void tileImage(MCRPath file) throws IOException {
if (MCRIView2Tools.isFileSupported(file)) {
MCRTileJob job = new MCRTileJob();
job.setDerivate(file.getOwner());
job.setPath(file.getOwnerRelativePath());
MCRTilingQueue.getInstance().offer(job);
LOGGER.info("Added to TilingQueue: {}", file);
startMasterTilingThread();
}
}
use of org.mycore.iview2.services.MCRTileJob in project mycore by MyCoRe-Org.
the class MCRIView2Commands method tileImage.
/**
* Tiles this image.
* @param derivate derivate ID
* @param absoluteImagePath absolute path to image file
*/
@MCRCommand(syntax = TILE_IMAGE_COMMAND_SYNTAX, help = "tiles a specific file identified by its derivate {0} and absolute path {1}", order = 70)
public static void tileImage(String derivate, String absoluteImagePath) {
MCRTileJob job = new MCRTileJob();
job.setDerivate(derivate);
job.setPath(absoluteImagePath);
MCRTilingQueue.getInstance().offer(job);
startMasterTilingThread();
}
use of org.mycore.iview2.services.MCRTileJob in project mycore by MyCoRe-Org.
the class MCRIView2Commands method fixDeadEntries.
@MCRCommand(syntax = "fix dead tile jobs", help = "Deletes entries for files which dont exist anymore!")
public static void fixDeadEntries() {
EntityManager em = MCREntityManagerProvider.getCurrentEntityManager();
TypedQuery<MCRTileJob> allTileJobQuery = em.createNamedQuery("MCRTileJob.all", MCRTileJob.class);
List<MCRTileJob> tiles = allTileJobQuery.getResultList();
tiles.stream().filter(tj -> {
MCRPath path = MCRPath.getPath(tj.getDerivate(), tj.getPath());
return !Files.exists(path);
}).peek(tj -> LOGGER.info("Delete TileJob {}:{}", tj.getDerivate(), tj.getPath())).forEach(em::remove);
}
use of org.mycore.iview2.services.MCRTileJob in project mycore by MyCoRe-Org.
the class MCRMigrationCommands method fixMCR1717.
@MCRCommand(syntax = "fix MCR-1717", help = "Fixes wrong entries in tile job table (see MCR-1717 comments)")
public static void fixMCR1717() {
EntityManager em = MCREntityManagerProvider.getCurrentEntityManager();
TypedQuery<MCRTileJob> allTileJobQuery = em.createNamedQuery("MCRTileJob.all", MCRTileJob.class);
List<MCRTileJob> tiles = allTileJobQuery.getResultList();
tiles.stream().filter(tj -> !tj.getPath().startsWith("/")).peek(tj -> LOGGER.info("Fixing TileJob {}:{}", tj.getDerivate(), tj.getPath())).forEach(tj -> {
String newPath = "/" + tj.getPath();
tj.setPath(newPath);
});
}
Aggregations