Skip to content

Commit

Permalink
Merge pull request #722 from support-project/develop
Browse files Browse the repository at this point in the history
Release v1.9.0
  • Loading branch information
koda-masaru authored May 20, 2017
2 parents aa2fd21 + 7778d31 commit 206c135
Show file tree
Hide file tree
Showing 98 changed files with 3,584 additions and 1,067 deletions.
19 changes: 19 additions & 0 deletions Third_party_license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,22 @@
- jstzdetect
- License: [MIT] https://pellepim.bitbucket.io/jstz/
- project-url: https://pellepim.bitbucket.io/jstz/

- bootstrap-table
- License: [MIT] https://github.com/wenzhixin/bootstrap-table/blob/develop/LICENSE
- project-url: http://bootstrap-table.wenzhixin.net.cn/

- tableExport.jquery.plugin
- License: [MIT] https://github.com/hhurz/tableExport.jquery.plugin/blob/master/bower.json
- project-url: https://github.com/hhurz/tableExport.jquery.plugin

- diff2html
- License: [MIT] https://github.com/rtfpessoa/diff2html#license
- project-url: https://diff2html.xyz/

- jsdiff
- License: [BSD License] https://github.com/kpdecker/jsdiff/blob/master/LICENSE
- project-url: https://github.com/kpdecker/jsdiff



10 changes: 8 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
"picEdit": "andyvr/picEdit",
"clockpicker": "0.0.7",
"moment-timezone": "0.5.11",
"jstzdetect": "1.0.6"
"jstzdetect": "1.0.6",
"bootstrap-table": "1.11.1",
"tableExport.jquery.plugin": "1.8.1",
"diff2html": "2.3.0",
"jsdiff": "3.2.0"
},
"devDependencies": {},
"resolutions": {
"jquery": "2.2.3"
"jquery": "2.2.3",
"jspdf": "1.3.2",
"jspdf-autotable": "2.0.17"
}
}
25 changes: 22 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ gulp.task('min', function() {
.pipe(gulp.dest('target/knowledge/WEB-INF/views/'));
});

gulp.task('copy', ['copy:bootswatch', 'copy:highlightjs', 'copy:font-awesome', 'copy:flag-icon-css',
'copy:html5shiv', 'copy:respond', 'copy:MathJax', 'copy:emoji-parser', 'copy:free-file-icons']);
gulp.task('copy', ['copy:bootswatch', 'copy:bootswatch2', 'copy:highlightjs', 'copy:font-awesome', 'copy:flag-icon-css',
'copy:html5shiv', 'copy:respond', 'copy:MathJax', 'copy:emoji-parser', 'copy:free-file-icons',
'copy:diff2html', 'copy:jsdiff']);

gulp.task('copy:bootswatch', function() {
return gulp.src([
'src/main/webapp/bower/bootswatch/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/bootswatch'));
});
gulp.task('copy:bootswatch2', function() {
return gulp.src([
'src/main/webapp/bower/bootswatch/**/*.css'
])
.pipe(replace(/^@import url\("https:\/\/fonts.googleapis.com\/css.*\)\;/, ''))
.pipe(gulp.dest('target/knowledge/bower/bootswatch'));
});
Expand Down Expand Up @@ -79,6 +87,17 @@ gulp.task('copy:free-file-icons', function() {
])
.pipe(gulp.dest('target/knowledge/bower/teambox.free-file-icons'));
});

gulp.task('copy:diff2html', function() {
return gulp.src([
'src/main/webapp/bower/diff2html/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/diff2html'));
});
gulp.task('copy:jsdiff', function() {
return gulp.src([
'src/main/webapp/bower/jsdiff/**/*'
])
.pipe(gulp.dest('target/knowledge/bower/jsdiff'));
});

gulp.task('default', ['min', 'copy']);
4 changes: 2 additions & 2 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.8.1</version>
<version>1.9.0</version>
<packaging>war</packaging>

<name>knowledge</name>
Expand Down Expand Up @@ -59,7 +59,7 @@
<dependency>
<groupId>org.support-project</groupId>
<artifactId>web</artifactId>
<version>1.8.0</version>
<version>1.9.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ public static void main(String[] args) throws Exception {
try {
initLogName("DataTransferBat.log");
configInit(ClassUtils.getShortClassName(DataTransferBat.class));

DataTransferLogic.get().requestTransfer();
DataTransferBat bat = new DataTransferBat();
bat.dbInit();
bat.start();

} catch (Exception e) {
LOG.error("any error", e);
throw e;
Expand All @@ -38,10 +39,10 @@ public void run() {
try {
AppConfig appConfig = ConfigLoader.load(AppConfig.APP_CONFIG, AppConfig.class);
String[] parms = { "-tcp", "-baseDir", appConfig.getDatabasePath() };


LOG.info("start h2 database");
Server server = Server.createTcpServer(parms);
server.start();

// System.out.println("Database start...");
serverStarted = true;
while (runing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ public class TemplateControl extends Control {
* テンプレートの一覧を表示
*
* @return
* @throws InvalidParamException
*/
@Get(publishToken = "admin")
@Auth(roles = "admin")
public Boundary list() {
public Boundary list() throws InvalidParamException {
// テンプレートの個数はあまり多く出来ないようにする(でないと登録の画面が微妙)
List<TemplateMastersEntity> templates = TemplateLogic.get().selectAll();
setAttribute("templates", templates);
Expand All @@ -54,7 +55,7 @@ public Boundary edit() throws InvalidParamException {
}

/**
* 編集画面を表示する
* 保存されているデータを取得
*
* @return
* @throws InvalidParamException
Expand All @@ -65,7 +66,7 @@ public Boundary load() throws InvalidParamException {
Integer id = super.getPathInteger(-1);
TemplateMastersEntity entity = TemplateLogic.get().loadTemplate(id);
if (entity == null) {
sendError(404, null);
return sendError(404, null);
}
return send(entity);
}
Expand All @@ -81,7 +82,7 @@ public Boundary load() throws InvalidParamException {
* @throws IllegalAccessException
* @throws InstantiationException
*/
private TemplateMastersEntity loadParams(List<ValidateError> errors)
protected TemplateMastersEntity loadParams(List<ValidateError> errors)
throws InstantiationException, IllegalAccessException, JSONException, IOException, InvalidParamException {
TemplateMastersEntity template = new TemplateMastersEntity();
Map<String, String> values = getParams();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.support.project.knowledge.control.open;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.HttpStatus;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.common.util.StringUtils;
import org.support.project.di.DI;
import org.support.project.di.Instance;
Expand All @@ -16,6 +21,7 @@
import org.support.project.knowledge.entity.AccountImagesEntity;
import org.support.project.knowledge.entity.KnowledgesEntity;
import org.support.project.knowledge.entity.TemplateMastersEntity;
import org.support.project.knowledge.logic.IdenticonLogic;
import org.support.project.knowledge.logic.KnowledgeLogic;
import org.support.project.knowledge.vo.AccountInfo;
import org.support.project.knowledge.vo.StockKnowledge;
Expand All @@ -25,8 +31,10 @@

@DI(instance = Instance.Prototype)
public class AccountControl extends Control {
/** ログ */
private static final Log LOG = LogFactory.getLog(AccountControl.class);

public static final int PAGE_LIMIT = 50;

/**
* ユーザのアイコン画像を取得
*
Expand All @@ -35,22 +43,33 @@ public class AccountControl extends Control {
*/
@Get
public Boundary icon() throws InvalidParamException {
Integer userId = getPathInteger(-1);

AccountImagesDao dao = AccountImagesDao.get();
AccountImagesEntity entity = dao.selectOnUserId(userId);

long size = 12140;
String fileName = "icon.png";
String contentType = "image/png";
InputStream inputStream;
long size = 12140;
if (entity != null) {
fileName = entity.getFileName();
contentType = entity.getContentType();
size = entity.getFileSize().longValue();
inputStream = entity.getFileBinary();
} else {

Integer userId = getPathInteger(-1);
if (userId.intValue() == -1) {
inputStream = getClass().getResourceAsStream("/icon/icon.png");
} else {
AccountImagesDao dao = AccountImagesDao.get();
AccountImagesEntity entity = dao.selectOnUserId(userId);

if (entity != null) {
fileName = entity.getFileName();
contentType = entity.getContentType();
size = entity.getFileSize().longValue();
inputStream = entity.getFileBinary();
} else {
try {
byte[] bytes = IdenticonLogic.get().generate(String.valueOf(userId));
size = bytes.length;
inputStream = new ByteArrayInputStream(bytes);
} catch (NoSuchAlgorithmException | IOException e) {
LOG.warn("generate icon error.", e);
inputStream = getClass().getResourceAsStream("/icon/icon.png");
}
}
}
return download(fileName, inputStream, size, contentType);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.support.project.knowledge.control.open;

import org.support.project.di.DI;
import org.support.project.di.Instance;
import org.support.project.knowledge.control.Control;
import org.support.project.web.bean.Msg;
import org.support.project.web.boundary.Boundary;
import org.support.project.web.control.service.Get;
import org.support.project.web.exception.InvalidParamException;

@DI(instance = Instance.Prototype)
public class IntervalControl extends Control {

@Get
public Boundary access() throws InvalidParamException {
return send(new Msg("OK"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Map;

import org.support.project.common.bean.ValidateError;
import org.support.project.common.config.INT_FLAG;
import org.support.project.common.exception.ParseException;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
Expand Down Expand Up @@ -276,15 +277,25 @@ private Boundary update(KnowledgesEntity entity) throws Exception {
errors.add(new ValidateError("knowledge.edit.noaccess"));
return sendValidateError(errors);
}

if (!StringUtils.isEmpty(getParam("updateContent")) && getParam("updateContent").toLowerCase().equals("true")) {
data.setUpdateContent(true);
LOG.debug("コンテンツを更新した");
} else {
// メタデータのみ更新
data.setUpdateContent(false);
LOG.debug("メタデータのみ更新");
if (check.getNotifyStatus() == null || check.getNotifyStatus().intValue() == INT_FLAG.OFF.getValue()) {
if (check.getPublicFlag().intValue() == KnowledgeLogic.PUBLIC_FLAG_PRIVATE &&
check.getPublicFlag().intValue() != data.getKnowledge().getPublicFlag().intValue()) {
// まだ通知を一度も出しておらず、かつ、「非公開」になっていたものを、それ以外の区分に変更した場合は、通知を出す
data.setUpdateContent(true);
LOG.debug("メタデータのみ更新であったが、非公開から公開などへ変更した");
}
}
}


KnowledgesEntity updatedEntity = knowledgeLogic.update(data, super.getLoginedUser());

if (data.isUpdateContent()) {
Expand All @@ -302,10 +313,10 @@ private Boundary update(KnowledgesEntity entity) throws Exception {
* @return Boundary
* @throws Exception Exception
*/
@Post(subscribeToken = "knowledge")
@Post(subscribeToken = "knowledge", checkReqToken = true)
public Boundary save(KnowledgesEntity entity) throws Exception {
try {
if (entity.getKnowledgeId() != null && entity.getKnowledgeId() > 1) {
if (entity.getKnowledgeId() != null && entity.getKnowledgeId() >= 1) {
return update(entity);
} else {
return add(entity);
Expand All @@ -321,7 +332,7 @@ public Boundary save(KnowledgesEntity entity) throws Exception {
* @return Boundary
* @throws Exception Exception
*/
@Post(subscribeToken = "knowledge")
@Post(subscribeToken = "knowledge", checkReqToken = true)
public Boundary draft() throws Exception {
DraftKnowledgesEntity draft = getParamOnProperty(DraftKnowledgesEntity.class);
draft.setAccesses(super.getParam("groups"));
Expand Down Expand Up @@ -356,7 +367,7 @@ public Boundary draft() throws Exception {
* @return
* @throws Exception
*/
@Post(subscribeToken = "knowledge")
@Post(subscribeToken = "knowledge", checkReqToken = true)
public Boundary delete() throws Exception {
// 共通処理呼の表示条件の保持の呼び出し
setViewParam();
Expand Down
Loading

0 comments on commit 206c135

Please sign in to comment.