Skip to content

Commit

Permalink
コメントでも検索 #6
Browse files Browse the repository at this point in the history
組み込みDB以外にも対応 #9
インデックスの再構築 #26
  • Loading branch information
koda-masaru committed Apr 18, 2015
1 parent 1f92cf4 commit 08e212b
Show file tree
Hide file tree
Showing 82 changed files with 2,428 additions and 239 deletions.
40 changes: 20 additions & 20 deletions document/database/knowledge.a5er
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PName=NOTIFY_QUEUES
LName=通知待ちキュー
Comment=
TableOption=
Page=Main
Page=MAIN
Left=120
Top=1700
Field="HASH","HASH","@VARCHAR(32)","NOT NULL",0,"","",$FFFFFFFF,""
Expand All @@ -61,7 +61,7 @@ EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150331055404
Position="Main",120,1700
Position="MAIN",120,1700

[Relation]
Entity1=USERS
Expand Down Expand Up @@ -156,18 +156,18 @@ TableOption=
Page=MAIN
Left=1010
Top=900
Field="IMAGE_ID","IMAGE_ID","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="IMAGE_ID","IMAGE_ID","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ユーザID","USER_ID","@INT",,,"","",$FFFFFFFF,""
Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,""
Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,""
Field="バイナリ","FILE_BINARY","blob",,,"","",$FFFFFFFF,""
Field="バイナリ","FILE_BINARY","BYTEA",,,"","",$FFFFFFFF,""
Field="拡張子","EXTENSION","@VARCHAR(256)",,,"","",$FFFFFFFF,""
Field="CONTENT_TYPE","CONTENT_TYPE","@VARCHAR(256)",,,"","",$FFFFFFFF,""
Index=IDX_ACCOUNT_IMAGES_USER_ID=1,USER_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150102014151
ModifiedDateTime=20150416234339
Position="MAIN",1010,900

[Relation]
Expand Down Expand Up @@ -198,13 +198,13 @@ TableOption=
Page=MAIN
Left=580
Top=1470
Field="NO","NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="NO","NO","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,""
Index=IDX_LIKES_KNOWLEDGE_ID=0,KNOWLEDGE_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150102013522
ModifiedDateTime=20150416233511
Position="MAIN",580,1470

[Relation]
Expand Down Expand Up @@ -236,14 +236,14 @@ TableOption=
Page=MAIN
Left=1890
Top=1540
Field="コメント番号","COMMENT_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="コメント番号","COMMENT_NO","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,""
Field="コメント","COMMENT","text",,,"","",$FFFFFFFF,""
Index=IDX_COMMENTS_KNOWLEDGE_ID=0,KNOWLEDGE_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150102013923
ModifiedDateTime=20150416233710
Position="MAIN",1890,1540

[Relation]
Expand Down Expand Up @@ -274,14 +274,14 @@ TableOption=
Page=MAIN
Left=1890
Top=1390
Field="VOTE_NO","VOTE_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="VOTE_NO","VOTE_NO","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,""
Field="投票区分","VOTE_KIND","@INT","NOT NULL",,"","",$FFFFFFFF,""
Index=IDX_VOTES_KNOWLEDGE_ID=0,KNOWLEDGE_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150102013835
ModifiedDateTime=20150416233659
Position="MAIN",1890,1390,435,89

[Relation]
Expand Down Expand Up @@ -313,14 +313,14 @@ TableOption=
Page=MAIN
Left=1890
Top=840
Field="HISTORY_NO","HISTORY_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="HISTORY_NO","HISTORY_NO","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,""
Field="日時","VIEW_DATE_TIME","@DATETIME","NOT NULL",,"","",$FFFFFFFF,""
Index=IDX_VIEW_HISTORIES_KNOWLEDGE_ID=0,KNOWLEDGE_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150102013703
ModifiedDateTime=20150416233623
Position="MAIN",1890,840

[Relation]
Expand Down Expand Up @@ -497,12 +497,12 @@ TableOption=
Page=MAIN
Left=70
Top=1310
Field="タグ_ID","TAG_ID","@INT","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="タグ_ID","TAG_ID","SERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="タグ名称","TAG_NAME","@VARCHAR(128)","NOT NULL",,"","",$FFFFFFFF,""
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20141120205901
ModifiedDateTime=20150416233544
Position="MAIN",70,1310

[Relation]
Expand Down Expand Up @@ -534,18 +534,18 @@ TableOption=
Page=MAIN
Left=1140
Top=1520
Field="添付ファイル番号","FILE_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="添付ファイル番号","FILE_NO","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="ナレッジID","KNOWLEDGE_ID","bigint",,,"","",$FFFFFFFF,""
Field="コメント番号","COMMENT_NO","bigint",,,"","",$FFFFFFFF,""
Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,""
Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,""
Field="バイナリ","FILE_BINARY","blob",,,"","",$FFFFFFFF,""
Field="バイナリ","FILE_BINARY","BYTEA",,,"","",$FFFFFFFF,""
Field="パース結果","PARSE_STATUS","@INT","NOT NULL",,"","",$FFFFFFFF,""
Index=IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID=0,KNOWLEDGE_ID
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150328055544
ModifiedDateTime=20150416234328
Position="MAIN",1140,1520

[Entity]
Expand All @@ -556,7 +556,7 @@ TableOption=
Page=MAIN
Left=1160
Top=1150
Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT"
Field="ナレッジID","KNOWLEDGE_ID","BIGSERIAL","NOT NULL",0,"","",$FFFFFFFF,""
Field="タイトル","TITLE","@VARCHAR(1024)","NOT NULL",,"","",$FFFFFFFF,""
Field="内容","CONTENT","text",,,"","",$FFFFFFFF,""
Field="公開区分","PUBLIC_FLAG","@INT",,,"","",$FFFFFFFF,""
Expand All @@ -567,7 +567,7 @@ Field="コメント件数","COMMENT_COUNT","@INT",,,"","",$FFFFFFFF,""
EffectMode=None
Color=$000000
BkColor=$FFFFFF
ModifiedDateTime=20150219042038
ModifiedDateTime=20150416233526
Position="MAIN",1160,1150

[Comment]
Expand Down
Binary file added document/images/startup-594090_1280.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added document/images/startup-594090_1920.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added document/images/startup-594090_640.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions document/memo/connection_memo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
<name>connection</name>
<driverClass>org.h2.Driver</driverClass>
<URL>jdbc:h2:tcp://localhost/./knowledge_db</URL>
<user>sa</user>
<password></password>
<schema>public</schema>
<maxConn>5</maxConn>
<autocommit>false</autocommit>

<name>connection</name>
<driverClass>org.postgresql.Driver</driverClass>
<URL>jdbc:postgresql://localhost:5432/ek003024</URL>
<user>ek003024</user>
<password></password>
<schema>public</schema>
<maxConn>5</maxConn>
<autocommit>false</autocommit>


-->
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<dependencies>
<dependency>
<groupId>org.support-project</groupId>
Expand Down Expand Up @@ -87,6 +86,12 @@
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1103-jdbc41</version>
</dependency>

</dependencies>

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/support/project/knowledge/bat/AbstractBat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.support.project.knowledge.bat;

import org.support.project.web.logic.DBConnenctionLogic;

public abstract class AbstractBat {
/**
* コネクションの接続先がカスタマイズされていたら、バッチでもカスタマイズ先を参照する
*/
public void dbInit() {
DBConnenctionLogic.get().connectCustomConnection();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package org.support.project.knowledge.bat;

import org.h2.tools.Server;
import org.support.project.common.config.ConfigLoader;
import org.support.project.common.log.Log;
import org.support.project.common.log.LogFactory;
import org.support.project.knowledge.logic.DataTransferLogic;
import org.support.project.ormapping.config.ConnectionConfig;
import org.support.project.web.config.AppConfig;
import org.support.project.web.logic.DBConnenctionLogic;

public class DataTransferBat extends AbstractBat implements Runnable {
/** ログ */
private static Log LOG = LogFactory.getLog(DataTransferBat.class);

private boolean runing = false;
private boolean serverStarted = false;

public static void main(String[] args) throws Exception {
LOG.trace("start");
DataTransferBat bat = new DataTransferBat();
bat.start();
}

@Override
public void run() {
// データ取得元の組み込みDBを起動(既に起動している場合起動しない)
runing = true;
try {
AppConfig appConfig = ConfigLoader.load(AppConfig.APP_CONFIG, AppConfig.class);
String[] parms = { "-tcp", "-baseDir", appConfig.getDatabasePath() };

Server server = Server.createTcpServer(parms);
server.start();

//System.out.println("Database start...");
serverStarted = true;
while (runing) {
Thread.sleep(1000);
}
server.stop();
} catch (Exception e) {
LOG.error(e);
}
System.out.println("Database stop.");
}

/**
*
* @throws Exception
*/
private void start() throws Exception {
// 多重起動チェック
if (DataTransferLogic.get().isTransferStarted()) {
LOG.info("ALL Ready started.");
return;
}
// DBを起動
Thread thread = new Thread(this);
thread.start();
try {
// サーバーが起動するまで待機
while(!serverStarted) {
Thread.sleep(1000);
}
// コネクションの設定を読み込み
ConnectionConfig defaultConnection = DBConnenctionLogic.get().getDefaultConnectionConfig();
ConnectionConfig customConnection = DBConnenctionLogic.get().getCustomConnectionConfig();
// データ移行を実行(すごく時間がかかる可能性あり)
DataTransferLogic.get().transferData(defaultConnection, customConnection);
} catch (Exception e) {
LOG.error("ERROR", e);
} finally {
// データ移行終了
DataTransferLogic.get().finishTransfer();
// DBを停止
runing = false;
thread.join();
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.support.project.knowledge.parser.ParserFactory;
import org.support.project.knowledge.vo.ParseResult;

public class FileParseBat {
public class FileParseBat extends AbstractBat {
/** ログ */
private static Log LOG = LogFactory.getLog(FileParseBat.class);

Expand All @@ -46,6 +46,7 @@ public class FileParseBat {

public static void main(String[] args) throws Exception {
FileParseBat bat = new FileParseBat();
bat.dbInit();
bat.start();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
import org.support.project.common.log.LogFactory;
import org.support.project.knowledge.dao.KnowledgeFilesDao;

public class KnowledgeFileClearBat {
public class KnowledgeFileClearBat extends AbstractBat {

/** ログ */
private static Log LOG = LogFactory.getLog(KnowledgeFileClearBat.class);

public static void main(String[] args) {
LOG.trace("start");

KnowledgeFileClearBat bat = new KnowledgeFileClearBat();
bat.dbInit();
bat.start();
}

private void start() {
KnowledgeFilesDao filesDao = KnowledgeFilesDao.get();
int count = filesDao.deleteNotConnectFiles();
if (count > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @author Koda
*
*/
public class MailSendBat {
public class MailSendBat extends AbstractBat {
/** ログ */
private static Log LOG = LogFactory.getLog(MailSendBat.class);

Expand All @@ -51,8 +51,8 @@ public class MailSendBat {

public static void main(String[] args) throws Exception {
MailSendBat bat = new MailSendBat();
bat.dbInit();
bat.start();

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.support.project.web.entity.SystemConfigsEntity;
import org.support.project.web.entity.UsersEntity;

public class NotifyMailBat {
public class NotifyMailBat extends AbstractBat {
/** ログ */
private static Log LOG = LogFactory.getLog(MailSendBat.class);

Expand All @@ -52,6 +52,7 @@ public class NotifyMailBat {

public static void main(String[] args) throws Exception {
NotifyMailBat bat = new NotifyMailBat();
bat.dbInit();
bat.start();
}

Expand Down
Loading

0 comments on commit 08e212b

Please sign in to comment.