Skip to content

Commit

Permalink
Merge pull request #475 from support-project/fix/issue470_slide
Browse files Browse the repository at this point in the history
#470 Add default image for parse wait status
  • Loading branch information
koda-masaru authored Oct 4, 2016
2 parents f65a33e + 7af642f commit 4f41e54
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/main/java/org/support/project/knowledge/logic/SlideLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,32 @@ public void initSlideDir() throws IOException {
if (!slideDir.exists()) {
slideDir.mkdirs();
}
InputStream inputStream = this.getClass().getResourceAsStream("/org/support/project/knowledge/logic/wait_parsing.png");
OutputStream outputStream = new FileOutputStream(new File(slideDir, "wait_parsing.png"));
try {
FileUtil.copy(inputStream, outputStream);
} finally {
inputStream.close();
outputStream.close();
File waitimg = new File(slideDir, "wait_parsing.png");
if (!waitimg.exists()) {
InputStream inputStream = this.getClass().getResourceAsStream("/org/support/project/knowledge/logic/wait_parsing.png");
OutputStream outputStream = new FileOutputStream(waitimg);
try {
FileUtil.copy(inputStream, outputStream);
} finally {
inputStream.close();
outputStream.close();
}
}

slideDir = new File(dir, String.valueOf(FILE_NO_ERROR_PARED));
if (!slideDir.exists()) {
slideDir.mkdirs();
}
inputStream = this.getClass().getResourceAsStream("/org/support/project/knowledge/logic/error_parsed.png");
outputStream = new FileOutputStream(new File(slideDir, "error_parsed.png"));
try {
FileUtil.copy(inputStream, outputStream);
} finally {
inputStream.close();
outputStream.close();
File errorimg = new File(slideDir, "error_parsed.png");
if (!errorimg.exists()) {
InputStream inputStream = this.getClass().getResourceAsStream("/org/support/project/knowledge/logic/error_parsed.png");
OutputStream outputStream = new FileOutputStream(errorimg);
try {
FileUtil.copy(inputStream, outputStream);
} finally {
inputStream.close();
outputStream.close();
}
}
}

Expand All @@ -96,6 +103,7 @@ public boolean parseSlide(File file, KnowledgeFilesEntity knowledgeFilesEntity)
// スライドだったら画像を抽出
SlideShowParser showParser = SlideShowParserFactory.getParser(knowledgeFilesEntity.getFileName());
if (showParser != null) {
initSlideDir();
String slidePath = AppConfig.get().getSlidePath();
File dir = new File(slidePath);
if (!dir.exists()) {
Expand Down

0 comments on commit 4f41e54

Please sign in to comment.