Skip to content

Commit

Permalink
Merge pull request #507 from support-project/develop
Browse files Browse the repository at this point in the history
Release v1.6.0
  • Loading branch information
koda-masaru authored Oct 31, 2016
2 parents 2c010d9 + 543808b commit 3493456
Show file tree
Hide file tree
Showing 112 changed files with 5,326 additions and 3,254 deletions.
12 changes: 12 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
- License: [Apache License, Version 2.0] http://www.apache.org/licenses/LICENSE-2.0
- project-url: https://hc.apache.org/

- Wrappers PDF View
- License: [Apache License, Version 2.0] http://www.apache.org/licenses/LICENSE-2.0
- project-url: https://mvnrepository.com/artifact/com.kenai.nbpwr/com-sun-pdfview/1.0.5-201003191900




Expand Down Expand Up @@ -160,4 +164,12 @@
- License: [MIT] https://zenorocha.mit-license.org/
- project-url: https://github.com/zenorocha/clipboard.js

- Easy Wizard
- License: [MIT] https://https://opensource.org/licenses/mit-license.php
- project-url: http://st3ph.github.io/jquery.easyWizard/

- MathJax
- License: [Apache License, Version 2.0] https://github.com/mathjax/MathJax/blob/master/LICENSE
- project-url: https://www.mathjax.org/


3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"jquery-oembed-all": "nfl/jquery-oembed-all",
"flag-icon-css": "0.8.5",
"moment": "2.12.0",
"clipboard": "1.5.10"
"clipboard": "1.5.10",
"MathJax": "2.6.1"
},
"devDependencies": {},
"resolutions": {
Expand Down
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.support-project</groupId>
<artifactId>knowledge</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
<packaging>war</packaging>

<name>knowledge</name>
Expand Down Expand Up @@ -59,13 +59,13 @@
<dependency>
<groupId>org.support-project</groupId>
<artifactId>web</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
</dependency>

<dependency>
<groupId>org.support-project</groupId>
<artifactId>markedj</artifactId>
<version>1.5.0</version>
<version>1.6.0-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -123,11 +123,10 @@
<artifactId>lucene-highlighter</artifactId>
<version>4.10.2</version>
</dependency>

<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>1.9</version>
<version>1.13</version>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
Expand Down Expand Up @@ -166,6 +165,13 @@
<version>4.3.1</version>
</dependency>

<dependency>
<groupId>com.kenai.nbpwr</groupId>
<artifactId>com-sun-pdfview</artifactId>
<version>1.0.5-201003191900</version>
<type>nbm</type>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -214,7 +220,7 @@
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.27</version>
<version>1.0</version>
<executions>
<execution>
<id>install node and npm</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.support.project.knowledge.logic.CrawlerLogic;
import org.support.project.knowledge.logic.IndexLogic;
import org.support.project.knowledge.logic.KnowledgeLogic;
import org.support.project.knowledge.logic.SlideLogic;
import org.support.project.knowledge.logic.TargetLogic;
import org.support.project.knowledge.parser.Parser;
import org.support.project.knowledge.parser.ParserFactory;
Expand All @@ -50,6 +51,7 @@ public class FileParseBat extends AbstractBat {
public static final int PARSE_STATUS_PARSING = 1;
public static final int PARSE_STATUS_ERROR_FINISHED = -100;
public static final int PARSE_STATUS_PARSED = 100;
public static final int PARSE_STATUS_SLIDE_PARSED = 101;

public static final int PARSE_STATUS_NO_TARGET = -1;

Expand Down Expand Up @@ -80,6 +82,11 @@ private void start() throws Exception {
crawl();
}


/**
* 情報の種別がBookmarkの場合に、URLに書かれているページのテキストを取得し検索可能にする
* @throws Exception
*/
private void crawl() throws Exception {
KnowledgeItemValuesDao itemValuesDao = KnowledgeItemValuesDao.get();
List<KnowledgeItemValuesEntity> itemValues = itemValuesDao.selectOnTypeIdAndItemNoAndStatus(TemplateMastersDao.TYPE_ID_BOOKMARK,
Expand All @@ -96,6 +103,10 @@ private void crawl() throws Exception {
if (knowledgesEntity == null) {
continue;
}
// パースステータスを処理中に変更
itemValue.setItemStatus(KnowledgeItemValuesEntity.STATUS_DO_PROCESS);
itemValuesDao.update(itemValue);

// タグを取得
List<TagsEntity> tagsEntities = TagsDao.get().selectOnKnowledgeId(knowledgesEntity.getKnowledgeId());
// Webアクセス
Expand Down Expand Up @@ -153,6 +164,13 @@ private void crawl() throws Exception {
}
}

/**
* 添付したファイルの中身を抽出する
* @throws FileNotFoundException
* @throws IOException
* @throws MimeTypeException
* @throws Exception
*/
private void fileParse() throws FileNotFoundException, IOException, MimeTypeException, Exception {
KnowledgeFilesDao filesDao = KnowledgeFilesDao.get();
IndexLogic indexLogic = IndexLogic.get();
Expand Down Expand Up @@ -251,7 +269,11 @@ private void fileParse() throws FileNotFoundException, IOException, MimeTypeExce

// パースステータスをパース完了に変更(もしパースでエラーが発生しても、次回から対象外になる)
filesDao.changeStatus(entity.getFileNo(), PARSE_STATUS_PARSED, UPDATE_USER_ID);

boolean slideParse = SlideLogic.get().parseSlide(tmp, knowledgeFilesEntity);
if (slideParse) {
// スライドのパース済のステータスへ
filesDao.changeStatus(entity.getFileNo(), PARSE_STATUS_SLIDE_PARSED, UPDATE_USER_ID);
}
} catch (Exception e) {
// パースの解析でなんらかのエラー
filesDao.changeStatus(entity.getFileNo(), PARSE_STATUS_ERROR_FINISHED, UPDATE_USER_ID);
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/support/project/knowledge/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public static AppConfig get() {

private boolean convIndexPath = false;

private String slidePath;

private boolean convSlidePath = false;


/**
* @return the indexPath
*/
Expand All @@ -40,5 +45,30 @@ public String getIndexPath() {
public void setIndexPath(String indexPath) {
this.indexPath = indexPath;
}

/**
* Get slidePath
* @return the slidePath
*/
public String getSlidePath() {
if (StringUtils.isEmpty(slidePath)) {
return "";
}

if (!convSlidePath) {
String path = slidePath;
this.slidePath = convPath(path);
convSlidePath = true;
}
return slidePath;
}

/**
* Set slidePath
* @param slidePath the slidePath to set
*/
public void setSlidePath(String slidePath) {
this.slidePath = slidePath;
}

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package org.support.project.knowledge.control.open;

import java.io.FileNotFoundException;

import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.di.DI;
import org.support.project.di.Instance;
import org.support.project.knowledge.control.Control;
import org.support.project.knowledge.entity.KnowledgeFilesEntity;
import org.support.project.knowledge.logic.SlideLogic;
import org.support.project.knowledge.logic.UploadedFileLogic;
import org.support.project.knowledge.vo.SlideInfo;
import org.support.project.web.bean.DownloadInfo;
import org.support.project.web.boundary.Boundary;
import org.support.project.web.common.HttpStatus;
import org.support.project.web.control.service.Get;
import org.support.project.web.exception.InvalidParamException;

@DI(instance = Instance.Prototype)
public class FileControl extends Control {
Expand All @@ -24,11 +30,38 @@ public Boundary download() {

Long fileNo = getParam("fileNo", Long.class);
KnowledgeFilesEntity entity = fileLogic.getFile(fileNo, getLoginedUser());

if (entity == null) {
return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND");
}

return download(entity.getFileName(), entity.getFileBinary(), entity.getFileSize().longValue());
}

@Get
public Boundary slide() throws InvalidParamException, FileNotFoundException {
String[] pathInfos = getPathInfos();
if (pathInfos == null || pathInfos.length == 0) {
return send(HttpStatus.SC_400_BAD_REQUEST);
}
String fileNo = pathInfos[0];
String slideImage = null;
if (pathInfos.length > 1) {
slideImage = pathInfos[1];
}
if (slideImage == null) {
// スライドの情報を取得
SlideInfo slideInfo = SlideLogic.get().getSlideInfo(fileNo, getLoginedUser());
if (slideInfo == null) {
return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND");
}
return send(slideInfo);
} else {
// スライドの画像を取得
DownloadInfo down = SlideLogic.get().getSlideImage(fileNo, slideImage, getLoginedUser());
if (down == null) {
return sendError(HttpStatus.SC_404_NOT_FOUND, "Not Found");
}
return download(down);
}
}

}
Loading

0 comments on commit 3493456

Please sign in to comment.