From 9223e46adddff8dcddaa1b9b0c8d8af6497e0d6a Mon Sep 17 00:00:00 2001 From: koda Date: Mon, 5 Jan 2015 03:01:47 +0900 Subject: [PATCH] =?UTF-8?q?0.3.0=20=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bower.json | 3 +- document/database/knowledge.a5er | 73 +++- pom.xml | 10 +- .../redcomet/knowledge/config/IndexType.java | 2 +- .../redcomet/knowledge/control/Control.java | 3 + .../knowledge/control/IndexControl.java | 3 + .../knowledge/control/admin/UsersControl.java | 3 + .../control/open/AccountControl.java | 42 ++ .../knowledge/control/open/FileControl.java | 3 + .../control/open/KnowledgeControl.java | 3 + .../control/open/LicenseControl.java | 3 + .../control/protect/AccountControl.java | 54 ++- .../control/protect/FileControl.java | 3 + .../control/protect/KnowledgeControl.java | 3 + .../knowledge/dao/AccountImagesDao.java | 32 ++ .../dao/gen/GenAccountImagesDao.java | 270 ++++++++++++ .../AccountImagesDao_delete.sql | 4 + .../AccountImagesDao_insert.sql | 28 ++ .../AccountImagesDao_physical_select_all.sql | 1 + ...ccountImagesDao_physical_select_on_key.sql | 4 + .../AccountImagesDao_select_all.sql | 2 + .../AccountImagesDao_select_on_key.sql | 5 + .../AccountImagesDao_update.sql | 16 + .../redcomet/knowledge/deploy/InitDB.java | 42 +- .../deploy/v0_3_0/Migrate_0_3_0.java | 22 + .../knowledge/deploy/v0_3_0/migrate.sql | 56 +++ .../knowledge/deploy/v0_3_0/migrate2.sql | 211 +++++++++ .../knowledge/entity/AccountImagesEntity.java | 51 +++ .../entity/gen/GenAccountImagesEntity.java | 412 ++++++++++++++++++ .../knowledge/logic/AccountLogic.java | 82 ++++ .../knowledge/logic/KnowledgeLogic.java | 2 +- .../searcher/impl/LuceneSearcher.java | 2 +- src/main/resources/appconfig.xml | 1 + src/main/resources/appresource.properties | 1 + .../resources/appresource_ja_JP.properties | 1 + src/main/resources/icon/icon.png | Bin 0 -> 12140 bytes .../redcomet/knowledge/database/ddl.sql | 51 +++ .../views/commons/layout/commonHeader.jsp | 10 +- .../views/commons/layout/commonNavbar.jsp | 2 +- .../views/commons/layout/layoutMain.jsp | 2 +- .../WEB-INF/views/open/knowledge/list.jsp | 10 +- .../WEB-INF/views/open/knowledge/view.jsp | 21 +- .../WEB-INF/views/protect/account/index.jsp | 97 +++-- src/main/webapp/images/icon/107039.png | Bin 76977 -> 0 bytes src/main/webapp/images/icon/110197.png | Bin 62116 -> 0 bytes src/main/webapp/images/icon/112224.png | Bin 27737 -> 0 bytes src/main/webapp/images/icon/icon.png | Bin 0 -> 12140 bytes src/main/webapp/images/loader.gif | Bin 0 -> 673 bytes src/main/webapp/js/account.js | 39 ++ src/main/webapp/js/knowledge-list.js | 5 +- src/main/webapp/js/knowledge-view.js | 1 + .../knowledge/tool/KnowledgeDBGen.java | 4 +- src/test/resources/ormappingtool.xml | 2 +- 53 files changed, 1609 insertions(+), 88 deletions(-) create mode 100644 src/main/java/redcomet/knowledge/control/open/AccountControl.java create mode 100644 src/main/java/redcomet/knowledge/dao/AccountImagesDao.java create mode 100644 src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql create mode 100644 src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql create mode 100644 src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java create mode 100644 src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql create mode 100644 src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql create mode 100644 src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java create mode 100644 src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java create mode 100644 src/main/java/redcomet/knowledge/logic/AccountLogic.java create mode 100644 src/main/resources/icon/icon.png delete mode 100644 src/main/webapp/images/icon/107039.png delete mode 100644 src/main/webapp/images/icon/110197.png delete mode 100644 src/main/webapp/images/icon/112224.png create mode 100644 src/main/webapp/images/icon/icon.png create mode 100644 src/main/webapp/images/loader.gif create mode 100644 src/main/webapp/js/account.js diff --git a/bower.json b/bower.json index 36146c357..efca93ba3 100644 --- a/bower.json +++ b/bower.json @@ -10,7 +10,8 @@ "bootbox": "4.3.0", "bootstrap-tagsinput": "0.4.2", "jquery-file-upload": "9.8.1", - "teambox.free-file-icons": "teambox/Free-file-icons" + "teambox.free-file-icons": "teambox/Free-file-icons", + "echojs": "1.6.0" }, "devDependencies": {} } diff --git a/document/database/knowledge.a5er b/document/database/knowledge.a5er index 90f3679f6..39013df4d 100755 --- a/document/database/knowledge.a5er +++ b/document/database/knowledge.a5er @@ -47,6 +47,48 @@ SqlSeparator=0 ShowTag=1 ShowCommonAttributes=0 +[Relation] +Entity1=USERS +Entity2=ACCOUNT_IMAGES +RelationType1=1 +RelationType2=3 +Fields1=USER_ID +Fields2=USER_ID +Cardinarity1= +Cardinarity2= +Position="MAIN",0,4985,4791,7220,R,R +Dependence=0 +Caption= +PName= +LineMode=0 +Bar1=498 +Bar2=479 +Bar3=722 +TermPos1=R +TermPos2=R + +[Entity] +PName=ACCOUNT_IMAGES +LName=アカウントの画像 +Comment= +TableOption= +Page=Main +Left=550 +Top=850 +Field="IMAGE_ID","IMAGE_ID","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" +Field="ユーザID","USER_ID","@INT",,,"","",$FFFFFFFF,"" +Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,"" +Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,"" +Field="バイナリ","FILE_BINARY","blob",,,"","",$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 +Position="Main",550,850 + [Relation] Entity1=KNOWLEDGES Entity2=LIKES @@ -74,14 +116,15 @@ Comment= TableOption= Page=MAIN Left=100 -Top=900 +Top=1300 Field="NO","NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="ナレッジID","KNOWLEDGE_ID","bigint","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_LIKES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141228073716 -Position="MAIN",100,900 +ModifiedDateTime=20150102013522 +Position="MAIN",100,1300 [Relation] Entity1=KNOWLEDGES @@ -115,10 +158,11 @@ Top=1550 Field="コメント番号","COMMENT_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" 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=20141222160017 +ModifiedDateTime=20150102013923 Position="MAIN",1300,1550 [Relation] @@ -152,10 +196,11 @@ Top=1400 Field="VOTE_NO","VOTE_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" 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=20141222155133 +ModifiedDateTime=20150102013835 Position="MAIN",1250,1400,435,89 [Relation] @@ -190,10 +235,11 @@ Top=850 Field="HISTORY_NO","HISTORY_NO","bigint","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" 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=20141222154942 +ModifiedDateTime=20150102013703 Position="MAIN",1150,850 [Relation] @@ -315,14 +361,14 @@ Fields1=TAG_ID Fields2=TAG_ID Cardinarity1= Cardinarity2= -Position="MAIN",0,4552,5672,4658,R,R +Position="MAIN",0,4552,5672,5143,R,R Dependence=1 Caption= PName= LineMode=0 Bar1=455 Bar2=567 -Bar3=466 +Bar3=514 TermPos1=R TermPos2=R @@ -368,15 +414,15 @@ LName=タグ Comment= TableOption= Page=MAIN -Left=600 -Top=850 +Left=100 +Top=1100 Field="タグ_ID","TAG_ID","@INT","NOT NULL",0,"","",$FFFFFFFF,"AUTO_INCREMENT" Field="タグ名称","TAG_NAME","@VARCHAR(128)","NOT NULL",,"","",$FFFFFFFF,"" EffectMode=None Color=$000000 BkColor=$FFFFFF ModifiedDateTime=20141120205901 -Position="MAIN",600,850 +Position="MAIN",100,1100 [Relation] Entity1=KNOWLEDGES @@ -413,10 +459,11 @@ Field="ファイル名","FILE_NAME","@VARCHAR(256)",,,"","",$FFFFFFFF,"" Field="ファイルサイズ","FILE_SIZE","@DOUBLE",,,"","",$FFFFFFFF,"" Field="バイナリ","FILE_BINARY","blob",,,"","",$FFFFFFFF,"" Field="パース結果","PARSE_STATUS","@INT","NOT NULL",,"","",$FFFFFFFF,"" +Index=IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID=0,KNOWLEDGE_ID EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141226051251 +ModifiedDateTime=20150102013438 Position="MAIN",600,1600 [Entity] @@ -434,7 +481,7 @@ Field="公開区分","PUBLIC_FLAG","@INT",,,"","",$FFFFFFFF,"" EffectMode=None Color=$000000 BkColor=$FFFFFF -ModifiedDateTime=20141222155113 +ModifiedDateTime=20150102012615 Position="MAIN",600,1300 [Comment] diff --git a/pom.xml b/pom.xml index e37bf0c7c..d831b1016 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ redcomet knowledge war - 0.2.4 + 0.3.0 webapp for knowledge https://support-project.org/ @@ -17,7 +17,7 @@ redcomet web - 0.2.2 + 0.3.0 @@ -64,13 +64,17 @@ 4.10.2 - org.apache.tika tika-parsers 1.6 + + javax.mail + mail + 1.4.7 + diff --git a/src/main/java/redcomet/knowledge/config/IndexType.java b/src/main/java/redcomet/knowledge/config/IndexType.java index ae91345fe..e84eac5c6 100644 --- a/src/main/java/redcomet/knowledge/config/IndexType.java +++ b/src/main/java/redcomet/knowledge/config/IndexType.java @@ -1,7 +1,7 @@ package redcomet.knowledge.config; public enum IndexType { - Knoeledge, + knowledge, KnowledgeFile; diff --git a/src/main/java/redcomet/knowledge/control/Control.java b/src/main/java/redcomet/knowledge/control/Control.java index 73aea1483..17271ae49 100644 --- a/src/main/java/redcomet/knowledge/control/Control.java +++ b/src/main/java/redcomet/knowledge/control/Control.java @@ -16,8 +16,11 @@ import redcomet.common.log.LogFactory; import redcomet.common.log.LogLevel; import redcomet.common.util.HtmlUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.web.util.JspUtil; +@DI(instance=Instance.Prototype) public abstract class Control extends redcomet.web.control.Control { /** ログ */ private static Log LOG = LogFactory.getLog(Control.class); diff --git a/src/main/java/redcomet/knowledge/control/IndexControl.java b/src/main/java/redcomet/knowledge/control/IndexControl.java index 86bf08892..dcba8f025 100644 --- a/src/main/java/redcomet/knowledge/control/IndexControl.java +++ b/src/main/java/redcomet/knowledge/control/IndexControl.java @@ -2,10 +2,13 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.web.bean.MessageResult; import redcomet.web.boundary.Boundary; import redcomet.web.config.MessageStatus; +@DI(instance=Instance.Prototype) public class IndexControl extends Control { /** ログ */ private static Log log = LogFactory.getLog(IndexControl.class); diff --git a/src/main/java/redcomet/knowledge/control/admin/UsersControl.java b/src/main/java/redcomet/knowledge/control/admin/UsersControl.java index 419276891..62f9af1e2 100644 --- a/src/main/java/redcomet/knowledge/control/admin/UsersControl.java +++ b/src/main/java/redcomet/knowledge/control/admin/UsersControl.java @@ -8,6 +8,8 @@ import redcomet.common.bean.ValidateError; import redcomet.common.util.PropertyUtil; import redcomet.common.util.StringUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.logic.UserLogic; import redcomet.knowledge.vo.Roles; @@ -20,6 +22,7 @@ import redcomet.web.entity.UsersEntity; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class UsersControl extends Control { public static final int PAGE_LIMIT = 100; diff --git a/src/main/java/redcomet/knowledge/control/open/AccountControl.java b/src/main/java/redcomet/knowledge/control/open/AccountControl.java new file mode 100644 index 000000000..f78474a4a --- /dev/null +++ b/src/main/java/redcomet/knowledge/control/open/AccountControl.java @@ -0,0 +1,42 @@ +package redcomet.knowledge.control.open; + +import java.io.InputStream; + +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.knowledge.control.Control; +import redcomet.knowledge.dao.AccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.web.boundary.Boundary; +import redcomet.web.exception.InvalidParamException; + +@DI(instance=Instance.Prototype) +public class AccountControl extends Control { + /** + * ユーザのアイコン画像を取得 + * @return + * @throws InvalidParamException + */ + public Boundary icon() throws InvalidParamException { + Integer userId = getPathInteger(-1); + + AccountImagesDao dao = AccountImagesDao.get(); + AccountImagesEntity entity = dao.selectOnUserId(userId); + + String fileName = "icon.png"; + String contentType = "image/png"; + InputStream inputStream = null; + long size = 12140; + if (entity != null) { + fileName = entity.getFileName(); + contentType = entity.getContentType(); + size = entity.getFileSize().longValue(); + inputStream = entity.getFileBinary(); + } else { + inputStream = getClass().getResourceAsStream("/icon/icon.png"); + } + return download(fileName, inputStream, size, contentType); + + } + +} diff --git a/src/main/java/redcomet/knowledge/control/open/FileControl.java b/src/main/java/redcomet/knowledge/control/open/FileControl.java index c61a8d056..0250222ac 100644 --- a/src/main/java/redcomet/knowledge/control/open/FileControl.java +++ b/src/main/java/redcomet/knowledge/control/open/FileControl.java @@ -2,12 +2,15 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.entity.KnowledgeFilesEntity; import redcomet.knowledge.logic.UploadedFileLogic; import redcomet.web.boundary.Boundary; import redcomet.web.common.HttpStatus; +@DI(instance=Instance.Prototype) public class FileControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(FileControl.class); diff --git a/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java b/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java index 54887573e..1d09e8362 100644 --- a/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java +++ b/src/main/java/redcomet/knowledge/control/open/KnowledgeControl.java @@ -8,6 +8,8 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; import redcomet.common.util.StringUtils; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.CommentsDao; import redcomet.knowledge.dao.LikesDao; @@ -25,6 +27,7 @@ import redcomet.web.common.HttpStatus; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class KnowledgeControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(KnowledgeControl.class); diff --git a/src/main/java/redcomet/knowledge/control/open/LicenseControl.java b/src/main/java/redcomet/knowledge/control/open/LicenseControl.java index 79ac4749e..5ee77e7aa 100644 --- a/src/main/java/redcomet/knowledge/control/open/LicenseControl.java +++ b/src/main/java/redcomet/knowledge/control/open/LicenseControl.java @@ -1,7 +1,10 @@ package redcomet.knowledge.control.open; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; +@DI(instance=Instance.Prototype) public class LicenseControl extends Control { } diff --git a/src/main/java/redcomet/knowledge/control/protect/AccountControl.java b/src/main/java/redcomet/knowledge/control/protect/AccountControl.java index 56cb9a2ef..e8ad78b6d 100644 --- a/src/main/java/redcomet/knowledge/control/protect/AccountControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/AccountControl.java @@ -1,13 +1,24 @@ package redcomet.knowledge.control.protect; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.commons.fileupload.FileItem; + import redcomet.common.bean.ValidateError; import redcomet.common.util.StringUtils; +import redcomet.common.validate.Validator; +import redcomet.common.validate.ValidatorFactory; import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; +import redcomet.knowledge.logic.AccountLogic; import redcomet.knowledge.logic.UserLogic; +import redcomet.knowledge.vo.UploadFile; +import redcomet.knowledge.vo.UploadResults; import redcomet.web.bean.LoginedUser; import redcomet.web.boundary.Boundary; import redcomet.web.common.HttpStatus; @@ -16,6 +27,7 @@ import redcomet.web.logic.AuthenticationLogic; import redcomet.web.logic.impl.DefaultAuthenticationLogicImpl; +@DI(instance=Instance.Prototype) public class AccountControl extends Control { @Override @@ -108,5 +120,45 @@ public Boundary delete() throws Exception { //return redirect(getRequest().getContextPath()); } - + /** + * アイコン画像をアップロード + * @return + * @throws IOException + */ + public Boundary iconupload() throws IOException { + AccountLogic logic = AccountLogic.get(); + UploadResults results = new UploadResults(); + List files = new ArrayList(); + Object obj = getParam("files[]", Object.class); + if (obj instanceof FileItem) { + FileItem fileItem = (FileItem) obj; + ValidateError error = checkExtension(fileItem.getName()); + if (error != null) { + return send(HttpStatus.SC_400_BAD_REQUEST, error); + } + UploadFile file = logic.saveIconImage(fileItem, getLoginedUser(), getRequest().getContextPath()); + files.add(file); + } else if (obj instanceof List) { + List fileItems = (List) obj; + for (FileItem fileItem : fileItems) { + ValidateError error = checkExtension(fileItem.getName()); + if (error != null) { + return send(HttpStatus.SC_400_BAD_REQUEST, error); + } + UploadFile file = logic.saveIconImage(fileItem, getLoginedUser(), getRequest().getContextPath()); + files.add(file); + } + } + results.setFiles(files); + return send(HttpStatus.SC_200_OK, results); + } + /** + * アイコン画像の拡張子チェック + * @param name + * @return + */ + private ValidateError checkExtension(String name) { + Validator validator = ValidatorFactory.getInstance(Validator.EXTENSION); + return validator.validate(name, "icon", "png", "jpg", "jpeg", "gif"); + } } diff --git a/src/main/java/redcomet/knowledge/control/protect/FileControl.java b/src/main/java/redcomet/knowledge/control/protect/FileControl.java index 4fa87a980..b5a81b285 100644 --- a/src/main/java/redcomet/knowledge/control/protect/FileControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/FileControl.java @@ -7,6 +7,8 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.KnowledgeFilesDao; import redcomet.knowledge.entity.KnowledgeFilesEntity; @@ -17,6 +19,7 @@ import redcomet.web.boundary.JsonBoundary; import redcomet.web.common.HttpStatus; +@DI(instance=Instance.Prototype) public class FileControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(FileControl.class); diff --git a/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java b/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java index 512926b4a..9a53844df 100644 --- a/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java +++ b/src/main/java/redcomet/knowledge/control/protect/KnowledgeControl.java @@ -9,6 +9,8 @@ import redcomet.common.log.LogFactory; import redcomet.common.util.StringUtils; import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; import redcomet.knowledge.control.Control; import redcomet.knowledge.dao.CommentsDao; import redcomet.knowledge.dao.KnowledgesDao; @@ -22,6 +24,7 @@ import redcomet.web.common.HttpStatus; import redcomet.web.exception.InvalidParamException; +@DI(instance=Instance.Prototype) public class KnowledgeControl extends Control { /** ログ */ private static Log LOG = LogFactory.getLog(KnowledgeControl.class); diff --git a/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java b/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java new file mode 100644 index 000000000..b5958eca6 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/AccountImagesDao.java @@ -0,0 +1,32 @@ +package redcomet.knowledge.dao; + +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.knowledge.dao.gen.GenAccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Singleton) +public class AccountImagesDao extends GenAccountImagesDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static AccountImagesDao get() { + return Container.getComp(AccountImagesDao.class); + } + public AccountImagesEntity selectOnUserId(Integer userId) { + String sql = "SELECT * FROM ACCOUNT_IMAGES WHERE USER_ID = ?"; + return executeQuerySingle(sql, AccountImagesEntity.class, userId); + } + + + +} diff --git a/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java b/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java new file mode 100644 index 000000000..33692c55c --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/gen/GenAccountImagesDao.java @@ -0,0 +1,270 @@ +package redcomet.knowledge.dao.gen; + +import java.util.List; + +import java.io.InputStream; +import java.sql.Timestamp; + + +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.ormapping.dao.AbstractDao; +import redcomet.ormapping.exception.ORMappingException; +import redcomet.ormapping.common.SQLManager; +import redcomet.ormapping.common.DBUserPool; +import redcomet.ormapping.common.IDGen; +import redcomet.common.util.PropertyUtil; + +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; +import redcomet.aop.Aspect; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Singleton) +public class GenAccountImagesDao extends AbstractDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenAccountImagesDao get() { + return Container.getComp(GenAccountImagesDao.class); + } + + /** + * 全て取得(削除フラグを無視して取得) + */ + public List physicalSelectAll() { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql"); + return executeQuery(sql, AccountImagesEntity.class); + } + /** + * キーで1件取得(削除フラグを無視して取得) + */ + public AccountImagesEntity physicalSelectOnKey(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql"); + return executeQueryOnKey(sql, AccountImagesEntity.class, imageId); + } + /** + * 全て取得 + */ + public List selectAll() { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql"); + return executeQuery(sql, AccountImagesEntity.class); + } + /** + * キーで1件取得 + */ + public AccountImagesEntity selectOnKey(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql"); + return executeQueryOnKey(sql, AccountImagesEntity.class, imageId); + } + /** + * 登録(データを生で操作) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity physicalInsert(AccountImagesEntity entity) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql"); + Class type = PropertyUtil.getPropertyType(entity, "imageId"); + Object key = executeInsert(sql, type, + entity.getImageId() + , entity.getUserId() + , entity.getFileName() + , entity.getFileSize() + , entity.getFileBinary() + , entity.getExtension() + , entity.getContentType() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + PropertyUtil.setPropertyValue(entity, "imageId", key); + return entity; + } + /** + * 登録(登録ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity insert(Integer user, AccountImagesEntity entity) { + entity.setInsertUser(user); + entity.setInsertDatetime(new Timestamp(new java.util.Date().getTime())); + entity.setUpdateUser(user); + entity.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + entity.setDeleteFlag(0); + return physicalInsert(entity); + } + /** + * 登録 + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity insert(AccountImagesEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return insert(userId, entity); + } + /** + * 更新(データを生で操作) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity physicalUpdate(AccountImagesEntity entity) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql"); + executeUpdate(sql, + entity.getUserId() + , entity.getFileName() + , entity.getFileSize() + , entity.getFileBinary() + , entity.getExtension() + , entity.getContentType() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + , entity.getImageId() + ); + return entity; + } + /** + * 更新(更新ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity update(Integer user, AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + entity.setInsertUser(db.getInsertUser()); + entity.setInsertDatetime(db.getInsertDatetime()); + entity.setDeleteFlag(db.getDeleteFlag()); + entity.setUpdateUser(user); + entity.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + return physicalUpdate(entity); + } + /** + * 更新 + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity update(AccountImagesEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return update(userId, entity); + } + /** + * 保存(ユーザを指定) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity save(Integer user, AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + if (db == null) { + return insert(user, entity); + } else { + return update(user, entity); + } + } + /** + * 保存(存在しなければ登録、存在すれば更新) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public AccountImagesEntity save(AccountImagesEntity entity) { + AccountImagesEntity db = selectOnKey(entity.getImageId()); + if (db == null) { + return insert(entity); + } else { + return update(entity); + } + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void physicalDelete(Long imageId) { + String sql = SQLManager.getInstance().getSql("/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql"); + executeUpdate(sql, imageId); + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void physicalDelete(AccountImagesEntity entity) { + physicalDelete(entity.getImageId()); + + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Integer user, Long imageId) { + AccountImagesEntity db = selectOnKey(imageId); + db.setDeleteFlag(1); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Long imageId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + delete(user, imageId); + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(Integer user, AccountImagesEntity entity) { + delete(user, entity.getImageId()); + + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void delete(AccountImagesEntity entity) { + delete(entity.getImageId()); + + } + /** + 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Integer user, Long imageId) { + AccountImagesEntity db = physicalSelectOnKey(imageId); + db.setDeleteFlag(0); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Long imageId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + activation(user, imageId); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(Integer user, AccountImagesEntity entity) { + activation(user, entity.getImageId()); + + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + public void activation(AccountImagesEntity entity) { + activation(entity.getImageId()); + + } + +} diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql new file mode 100644 index 000000000..04ad7c0b1 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_delete.sql @@ -0,0 +1,4 @@ +DELETE FROM ACCOUNT_IMAGES +WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql new file mode 100644 index 000000000..fa582a620 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_insert.sql @@ -0,0 +1,28 @@ +INSERT INTO ACCOUNT_IMAGES +( +IMAGE_ID + , USER_ID + , FILE_NAME + , FILE_SIZE + , FILE_BINARY + , EXTENSION + , CONTENT_TYPE + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql new file mode 100644 index 000000000..264387c8e --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_all.sql @@ -0,0 +1 @@ +SELECT * FROM ACCOUNT_IMAGES; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql new file mode 100644 index 000000000..00a6b510a --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_physical_select_on_key.sql @@ -0,0 +1,4 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql new file mode 100644 index 000000000..431b8be9d --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_all.sql @@ -0,0 +1,2 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE DELETE_FLAG = 0; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql new file mode 100644 index 000000000..3622e625c --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_select_on_key.sql @@ -0,0 +1,5 @@ +SELECT * FROM ACCOUNT_IMAGES + WHERE +IMAGE_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql new file mode 100644 index 000000000..6e55a6163 --- /dev/null +++ b/src/main/java/redcomet/knowledge/dao/sql/AccountImagesDao/AccountImagesDao_update.sql @@ -0,0 +1,16 @@ +UPDATE ACCOUNT_IMAGES +SET + USER_ID = ? + , FILE_NAME = ? + , FILE_SIZE = ? + , FILE_BINARY = ? + , EXTENSION = ? + , CONTENT_TYPE = ? + , INSERT_USER = ? + , INSERT_DATETIME = ? + , UPDATE_USER = ? + , UPDATE_DATETIME = ? + , DELETE_FLAG = ? +WHERE +IMAGE_ID = ? +; diff --git a/src/main/java/redcomet/knowledge/deploy/InitDB.java b/src/main/java/redcomet/knowledge/deploy/InitDB.java index 3ffe7a536..8e30525ae 100644 --- a/src/main/java/redcomet/knowledge/deploy/InitDB.java +++ b/src/main/java/redcomet/knowledge/deploy/InitDB.java @@ -7,6 +7,7 @@ import redcomet.common.log.Log; import redcomet.common.log.LogFactory; import redcomet.knowledge.deploy.v0_0_1.InitializeSystem; +import redcomet.knowledge.deploy.v0_3_0.Migrate_0_3_0; import redcomet.web.dao.SystemsDao; import redcomet.web.entity.SystemsEntity; @@ -18,11 +19,15 @@ public class InitDB { private static final String SYSTEM_NAME = "knowledge"; private static final Map MAP = new LinkedHashMap<>(); + private static final Migrate INIT = InitializeSystem.get(); + private static final String CURRENT = "0.3.0"; + public InitDB() { super(); // MAP.put("0.0.1", InitializeSystem.get()); // MAP.put("0.1.0", Migrate_0_1_0.get()); - MAP.put("0.2.0", InitializeSystem.get()); //既存データは全てクリア + MAP.put("0.2.0", INIT); // 初期公開バージョン + MAP.put(CURRENT, Migrate_0_3_0.get()); } public static void main(String[] args) throws Exception { @@ -51,14 +56,18 @@ public void start() throws Exception { finded = true; } + if (finded) { + // テーブルが存在しない(初めての起動) + version = CURRENT; + migrate = INIT; + doMigrate(migrate, version); + return; + } + + // バージョンアップ Iterator versions = MAP.keySet().iterator(); while (versions.hasNext()) { String v = (String) versions.next(); - if (finded) { - version = v; - migrate = MAP.get(v); - break; - } if (version.equals(v)) { finded = true; } @@ -69,18 +78,19 @@ public void start() throws Exception { } // Migrate 実行 - boolean result = migrate.doMigrate(); - if (result) { - if (entity == null) { - entity = new SystemsEntity(SYSTEM_NAME); - } - entity.setVersion(version); - LOG.info("Migrate to " + version); - dao.save(entity); - } + doMigrate(migrate, version); } while (migrate != null); } - + private void doMigrate(Migrate migrate, String version) throws Exception { + SystemsDao dao = SystemsDao.get(); + boolean result = migrate.doMigrate(); + if (result) { + SystemsEntity entity = new SystemsEntity(SYSTEM_NAME); + entity.setVersion(version); + LOG.info("Migrate to " + version); + dao.save(entity); + } + } } diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java new file mode 100644 index 000000000..0875c3f71 --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java @@ -0,0 +1,22 @@ +package redcomet.knowledge.deploy.v0_3_0; + +import redcomet.knowledge.deploy.Migrate; +import redcomet.ormapping.tool.dao.InitializeDao; + +public class Migrate_0_3_0 implements Migrate { + + public static Migrate_0_3_0 get() { + return redcomet.di.Container.getComp(Migrate_0_3_0.class); + } + + @Override + public boolean doMigrate() throws Exception { + InitializeDao initializeDao = InitializeDao.get(); + String[] sqlpaths = { + "/redcomet/knowledge/deploy/v0_3_0/migrate.sql" + }; + initializeDao.initializeDatabase(sqlpaths); + return true; + } + +} diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql new file mode 100644 index 000000000..112f5dea9 --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate.sql @@ -0,0 +1,56 @@ +-- アカウントの画像 +drop table if exists ACCOUNT_IMAGES cascade; + +create table ACCOUNT_IMAGES ( + IMAGE_ID bigint not null AUTO_INCREMENT + , USER_ID integer + , FILE_NAME character varying(256) + , FILE_SIZE double precision + , FILE_BINARY blob + , EXTENSION character varying(256) + , CONTENT_TYPE character varying(256) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint ACCOUNT_IMAGES_PKC primary key (IMAGE_ID) +) ; + +create unique index IDX_ACCOUNT_IMAGES_USER_ID + on ACCOUNT_IMAGES(USER_ID); + +create index IDX_LIKES_KNOWLEDGE_ID + on LIKES(KNOWLEDGE_ID); + +create index IDX_COMMENTS_KNOWLEDGE_ID + on COMMENTS(KNOWLEDGE_ID); + +create index IDX_VOTES_KNOWLEDGE_ID + on VOTES(KNOWLEDGE_ID); + +create index IDX_VIEW_HISTORIES_KNOWLEDGE_ID + on VIEW_HISTORIES(KNOWLEDGE_ID); + +create index IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID + on KNOWLEDGE_FILES(KNOWLEDGE_ID); + +ALTER TABLE GROUPS ADD GROUP_CLASS integer; + +comment on table ACCOUNT_IMAGES is 'アカウントの画像'; +comment on column ACCOUNT_IMAGES.IMAGE_ID is 'IMAGE_ID'; +comment on column ACCOUNT_IMAGES.USER_ID is 'ユーザID'; +comment on column ACCOUNT_IMAGES.FILE_NAME is 'ファイル名'; +comment on column ACCOUNT_IMAGES.FILE_SIZE is 'ファイルサイズ'; +comment on column ACCOUNT_IMAGES.FILE_BINARY is 'バイナリ'; +comment on column ACCOUNT_IMAGES.EXTENSION is '拡張子'; +comment on column ACCOUNT_IMAGES.CONTENT_TYPE is 'CONTENT_TYPE'; +comment on column ACCOUNT_IMAGES.INSERT_USER is '登録ユーザ'; +comment on column ACCOUNT_IMAGES.INSERT_DATETIME is '登録日時'; +comment on column ACCOUNT_IMAGES.UPDATE_USER is '更新ユーザ'; +comment on column ACCOUNT_IMAGES.UPDATE_DATETIME is '更新日時'; +comment on column ACCOUNT_IMAGES.DELETE_FLAG is '削除フラグ'; + +comment on column GROUPS.GROUP_CLASS is 'グループの区分'; + + diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql new file mode 100644 index 000000000..6b140d08d --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/migrate2.sql @@ -0,0 +1,211 @@ +-- パスワードリセット +drop table if exists PASSWORD_RESETS cascade; + +create table PASSWORD_RESETS ( + ID character varying(256) not null + , USER_KEY character varying(256) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint PASSWORD_RESETS_PKC primary key (ID) +) ; + +-- 仮登録ユーザ +drop table if exists PROVISIONAL_REGISTRATIONS cascade; + +create table PROVISIONAL_REGISTRATIONS ( + ID character varying(256) not null + , USER_KEY character varying(256) not null + , USER_NAME character varying(256) not null + , PASSWORD character varying(1024) not null + , SALT character varying(1024) not null + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint PROVISIONAL_REGISTRATIONS_PKC primary key (ID) +) ; + +-- ハッシュ生成の設定 +drop table if exists HASH_CONFIGS cascade; + +create table HASH_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , HASH_ITERATIONS integer not null + , HASH_SIZE_BITS integer not null + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint HASH_CONFIGS_PKC primary key (SYSTEM_NAME) +) ; + +-- メール設定 +drop table if exists MAIL_CONFIGS cascade; + +create table MAIL_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , HOST character varying(256) not null + , PORT integer not null + , AUTH_TYPE integer not null + , SMTP_ID character varying(256) + , SMTP_PASSWORD character varying(1048) + , SALT character varying(1048) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint MAIL_CONFIGS_PKC primary key (SYSTEM_NAME) +) ; + +-- コンフィグ +drop table if exists SYSTEM_CONFIGS cascade; + +create table SYSTEM_CONFIGS ( + SYSTEM_NAME character varying(64) not null + , CONFIG_NAME character varying(256) not null + , CONFIG_VALUE character varying(1024) + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint SYSTEM_CONFIGS_PKC primary key (SYSTEM_NAME,CONFIG_NAME) +) ; + +-- メール +drop table if exists MAILS cascade; + +create table MAILS ( + MAIL_ID character varying(64) not null + , STATUS integer not null + , TO_ADDRESS character varying(256) not null + , TO_NAME character varying(256) + , FROM_ADDRESS character varying(256) + , FROM_NAME character varying(256) + , TITLE character varying(256) not null + , CONTENT text + , ROW_ID character varying(64) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint MAILS_PKC primary key (MAIL_ID) +) ; + +create index IDX_MAILS_STATUS + on MAILS(STATUS); + + + +alter table HASH_CONFIGS + add constraint HASH_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + +alter table MAIL_CONFIGS + add constraint MAIL_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + +alter table SYSTEM_CONFIGS + add constraint SYSTEM_CONFIGS_FK1 foreign key (SYSTEM_NAME) references SYSTEMS(SYSTEM_NAME) + on delete cascade + on update cascade; + + +comment on table PASSWORD_RESETS is 'パスワードリセット'; +comment on column PASSWORD_RESETS.ID is 'パスワードリセットID'; +comment on column PASSWORD_RESETS.USER_KEY is 'ユーザKEY'; +comment on column PASSWORD_RESETS.ROW_ID is '行ID'; +comment on column PASSWORD_RESETS.INSERT_USER is '登録ユーザ'; +comment on column PASSWORD_RESETS.INSERT_DATETIME is '登録日時'; +comment on column PASSWORD_RESETS.UPDATE_USER is '更新ユーザ'; +comment on column PASSWORD_RESETS.UPDATE_DATETIME is '更新日時'; +comment on column PASSWORD_RESETS.DELETE_FLAG is '削除フラグ'; + +comment on table PROVISIONAL_REGISTRATIONS is '仮登録ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.ID is '仮発行ID'; +comment on column PROVISIONAL_REGISTRATIONS.USER_KEY is 'ユーザKEY'; +comment on column PROVISIONAL_REGISTRATIONS.USER_NAME is 'ユーザ名'; +comment on column PROVISIONAL_REGISTRATIONS.PASSWORD is 'パスワード'; +comment on column PROVISIONAL_REGISTRATIONS.SALT is 'SALT'; +comment on column PROVISIONAL_REGISTRATIONS.ROW_ID is '行ID'; +comment on column PROVISIONAL_REGISTRATIONS.INSERT_USER is '登録ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.INSERT_DATETIME is '登録日時'; +comment on column PROVISIONAL_REGISTRATIONS.UPDATE_USER is '更新ユーザ'; +comment on column PROVISIONAL_REGISTRATIONS.UPDATE_DATETIME is '更新日時'; +comment on column PROVISIONAL_REGISTRATIONS.DELETE_FLAG is '削除フラグ'; + +comment on table HASH_CONFIGS is 'ハッシュ生成の設定'; +comment on column HASH_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column HASH_CONFIGS.HASH_ITERATIONS is 'HASH_ITERATIONS'; +comment on column HASH_CONFIGS.HASH_SIZE_BITS is 'HASH_SIZE_BITS'; +comment on column HASH_CONFIGS.ROW_ID is '行ID'; +comment on column HASH_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column HASH_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column HASH_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column HASH_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column HASH_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table MAIL_CONFIGS is 'メール設定'; +comment on column MAIL_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column MAIL_CONFIGS.HOST is 'SMTP_HOST'; +comment on column MAIL_CONFIGS.PORT is 'SMTP_PORT'; +comment on column MAIL_CONFIGS.AUTH_TYPE is 'AUTH_TYPE'; +comment on column MAIL_CONFIGS.SMTP_ID is 'SMTP_ID'; +comment on column MAIL_CONFIGS.SMTP_PASSWORD is 'SMTP_PASSWORD 暗号化(可逆)'; +comment on column MAIL_CONFIGS.SALT is 'SALT'; +comment on column MAIL_CONFIGS.ROW_ID is '行ID'; +comment on column MAIL_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column MAIL_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column MAIL_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column MAIL_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column MAIL_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table SYSTEM_CONFIGS is 'コンフィグ'; +comment on column SYSTEM_CONFIGS.SYSTEM_NAME is 'システム名'; +comment on column SYSTEM_CONFIGS.CONFIG_NAME is 'コンフィグ名'; +comment on column SYSTEM_CONFIGS.CONFIG_VALUE is 'コンフィグ値'; +comment on column SYSTEM_CONFIGS.ROW_ID is '行ID'; +comment on column SYSTEM_CONFIGS.INSERT_USER is '登録ユーザ'; +comment on column SYSTEM_CONFIGS.INSERT_DATETIME is '登録日時'; +comment on column SYSTEM_CONFIGS.UPDATE_USER is '更新ユーザ'; +comment on column SYSTEM_CONFIGS.UPDATE_DATETIME is '更新日時'; +comment on column SYSTEM_CONFIGS.DELETE_FLAG is '削除フラグ'; + +comment on table MAILS is 'メール'; +comment on column MAILS.MAIL_ID is 'MAIL_ID'; +comment on column MAILS.STATUS is 'ステータス'; +comment on column MAILS.TO_ADDRESS is '送信先'; +comment on column MAILS.TO_NAME is '送信先名'; +comment on column MAILS.FROM_ADDRESS is '送信元'; +comment on column MAILS.FROM_NAME is '送信元名'; +comment on column MAILS.TITLE is 'タイトル'; +comment on column MAILS.CONTENT is 'メッセージ'; +comment on column MAILS.ROW_ID is '行ID'; +comment on column MAILS.INSERT_USER is '登録ユーザ'; +comment on column MAILS.INSERT_DATETIME is '登録日時'; +comment on column MAILS.UPDATE_USER is '更新ユーザ'; +comment on column MAILS.UPDATE_DATETIME is '更新日時'; +comment on column MAILS.DELETE_FLAG is '削除フラグ'; + + +-- 既存のテーブルへの変更 +ALTER TABLE USERS CHANGE COLUMN PASSWORD PASSWORD character varying(1024) not null; +ALTER TABLE USERS ADD COLUMN SALT character varying(1024); + +comment on column USERS.PASSWORD is 'パスワード ハッシュ(不可逆)'; +comment on column USERS.SALT is 'SALT'; + diff --git a/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java b/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java new file mode 100644 index 000000000..32d192965 --- /dev/null +++ b/src/main/java/redcomet/knowledge/entity/AccountImagesEntity.java @@ -0,0 +1,51 @@ +package redcomet.knowledge.entity; + +import redcomet.knowledge.entity.gen.GenAccountImagesEntity; + +import java.util.List; +import java.util.Map; + +import redcomet.common.bean.ValidateError; +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; + +import java.io.InputStream; +import java.sql.Timestamp; + + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Prototype) +public class AccountImagesEntity extends GenAccountImagesEntity { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static AccountImagesEntity get() { + return Container.getComp(AccountImagesEntity.class); + } + + /** + * コンストラクタ + */ + public AccountImagesEntity() { + super(); + } + + /** + * コンストラクタ + * @param imageId IMAGE_ID + */ + + public AccountImagesEntity(Long imageId) { + super( imageId); + } + +} diff --git a/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java b/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java new file mode 100644 index 000000000..ee9df5316 --- /dev/null +++ b/src/main/java/redcomet/knowledge/entity/gen/GenAccountImagesEntity.java @@ -0,0 +1,412 @@ +package redcomet.knowledge.entity.gen; + +import java.io.Serializable; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import java.io.InputStream; +import java.sql.Timestamp; + + + +import redcomet.common.bean.ValidateError; +import redcomet.common.validate.Validator; +import redcomet.common.validate.ValidatorFactory; +import redcomet.di.Container; +import redcomet.di.DI; +import redcomet.di.Instance; + +/** + * アカウントの画像 + */ +@DI(instance=Instance.Prototype) +public class GenAccountImagesEntity implements Serializable { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenAccountImagesEntity get() { + return Container.getComp(GenAccountImagesEntity.class); + } + + /** + * コンストラクタ + */ + public GenAccountImagesEntity() { + super(); + } + + /** + * コンストラクタ + * @param imageId IMAGE_ID + */ + + public GenAccountImagesEntity(Long imageId) { + super(); + this.imageId = imageId; + } + /** IMAGE_ID */ + private Long imageId; + /** ユーザID */ + private Integer userId; + /** ファイル名 */ + private String fileName; + /** ファイルサイズ */ + private Double fileSize; + /** バイナリ */ + private InputStream fileBinary; + /** 拡張子 */ + private String extension; + /** CONTENT_TYPE */ + private String contentType; + /** 登録ユーザ */ + private Integer insertUser; + /** 登録日時 */ + private Timestamp insertDatetime; + /** 更新ユーザ */ + private Integer updateUser; + /** 更新日時 */ + private Timestamp updateDatetime; + /** 削除フラグ */ + private Integer deleteFlag; + + /** + * IMAGE_ID を取得する + */ + public Long getImageId() { + return this.imageId; + } + /** + * IMAGE_ID を設定する + * @param imageId IMAGE_ID + */ + public GenAccountImagesEntity setImageId(Long imageId) { + this.imageId = imageId; + return this; + } + + /** + * ユーザID を取得する + */ + public Integer getUserId() { + return this.userId; + } + /** + * ユーザID を設定する + * @param userId ユーザID + */ + public GenAccountImagesEntity setUserId(Integer userId) { + this.userId = userId; + return this; + } + + /** + * ファイル名 を取得する + */ + public String getFileName() { + return this.fileName; + } + /** + * ファイル名 を設定する + * @param fileName ファイル名 + */ + public GenAccountImagesEntity setFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * ファイルサイズ を取得する + */ + public Double getFileSize() { + return this.fileSize; + } + /** + * ファイルサイズ を設定する + * @param fileSize ファイルサイズ + */ + public GenAccountImagesEntity setFileSize(Double fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * バイナリ を取得する + */ + public InputStream getFileBinary() { + return this.fileBinary; + } + /** + * バイナリ を設定する + * @param fileBinary バイナリ + */ + public GenAccountImagesEntity setFileBinary(InputStream fileBinary) { + this.fileBinary = fileBinary; + return this; + } + + /** + * 拡張子 を取得する + */ + public String getExtension() { + return this.extension; + } + /** + * 拡張子 を設定する + * @param extension 拡張子 + */ + public GenAccountImagesEntity setExtension(String extension) { + this.extension = extension; + return this; + } + + /** + * CONTENT_TYPE を取得する + */ + public String getContentType() { + return this.contentType; + } + /** + * CONTENT_TYPE を設定する + * @param contentType CONTENT_TYPE + */ + public GenAccountImagesEntity setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * 登録ユーザ を取得する + */ + public Integer getInsertUser() { + return this.insertUser; + } + /** + * 登録ユーザ を設定する + * @param insertUser 登録ユーザ + */ + public GenAccountImagesEntity setInsertUser(Integer insertUser) { + this.insertUser = insertUser; + return this; + } + + /** + * 登録日時 を取得する + */ + public Timestamp getInsertDatetime() { + return this.insertDatetime; + } + /** + * 登録日時 を設定する + * @param insertDatetime 登録日時 + */ + public GenAccountImagesEntity setInsertDatetime(Timestamp insertDatetime) { + this.insertDatetime = insertDatetime; + return this; + } + + /** + * 更新ユーザ を取得する + */ + public Integer getUpdateUser() { + return this.updateUser; + } + /** + * 更新ユーザ を設定する + * @param updateUser 更新ユーザ + */ + public GenAccountImagesEntity setUpdateUser(Integer updateUser) { + this.updateUser = updateUser; + return this; + } + + /** + * 更新日時 を取得する + */ + public Timestamp getUpdateDatetime() { + return this.updateDatetime; + } + /** + * 更新日時 を設定する + * @param updateDatetime 更新日時 + */ + public GenAccountImagesEntity setUpdateDatetime(Timestamp updateDatetime) { + this.updateDatetime = updateDatetime; + return this; + } + + /** + * 削除フラグ を取得する + */ + public Integer getDeleteFlag() { + return this.deleteFlag; + } + /** + * 削除フラグ を設定する + * @param deleteFlag 削除フラグ + */ + public GenAccountImagesEntity setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + return this; + } + + /** + * キーの値を取得 + */ + public Object[] getKeyValues() { + Object[] keyValues = new Object[1]; + keyValues[0] = this.imageId; + return keyValues; + } + /** + * キーの値を設定 + * @param imageId IMAGE_ID + */ + public void setKeyValues(Long imageId) { + this.imageId = imageId; + } + /** + * キーで比較 + */ + public boolean equalsOnKey(GenAccountImagesEntity entity) { + Object[] keyValues1 = getKeyValues(); + Object[] keyValues2 = entity.getKeyValues(); + for (int i = 0; i < keyValues1.length; i++) { + Object val1 = keyValues1[i]; + Object val2 = keyValues2[i]; + if (val1 == null && val2 != null) { + return false; + } + if (val1 != null && val2 == null) { + return false; + } + if (val1 != null && val2 != null) { + if (!val1.equals(val2)) { + return false; + } + } + + } + return true; + } + /** + * ToString + */ + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("imageId = ").append(imageId).append("\n"); + builder.append("userId = ").append(userId).append("\n"); + builder.append("fileName = ").append(fileName).append("\n"); + builder.append("fileSize = ").append(fileSize).append("\n"); + builder.append("fileBinary = ").append(fileBinary).append("\n"); + builder.append("extension = ").append(extension).append("\n"); + builder.append("contentType = ").append(contentType).append("\n"); + builder.append("insertUser = ").append(insertUser).append("\n"); + builder.append("insertDatetime = ").append(insertDatetime).append("\n"); + builder.append("updateUser = ").append(updateUser).append("\n"); + builder.append("updateDatetime = ").append(updateDatetime).append("\n"); + builder.append("deleteFlag = ").append(deleteFlag).append("\n"); + return builder.toString(); + } + /** + * 表示用の名称を変換 + */ + protected String convLabelName(String label) { + return label; + } + /** + * validate + */ + public List validate() { + List errors = new ArrayList<>(); + Validator validator; + ValidateError error; + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.userId, convLabelName("User Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.fileName, convLabelName("File Name"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.extension, convLabelName("Extension"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(this.contentType, convLabelName("Content Type"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.insertUser, convLabelName("Insert User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.updateUser, convLabelName("Update User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.deleteFlag, convLabelName("Delete Flag")); + if (error != null) { + errors.add(error); + } + return errors; + } + /** + * validate + */ + public List validate(Map values) { + List errors = new ArrayList<>(); + Validator validator; + ValidateError error; + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("userId"), convLabelName("User Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("fileName"), convLabelName("File Name"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("extension"), convLabelName("Extension"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAX_LENGTH); + error = validator.validate(values.get("contentType"), convLabelName("Content Type"), 256); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("insertUser"), convLabelName("Insert User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("updateUser"), convLabelName("Update User")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("deleteFlag"), convLabelName("Delete Flag")); + if (error != null) { + errors.add(error); + } + return errors; + } + +} diff --git a/src/main/java/redcomet/knowledge/logic/AccountLogic.java b/src/main/java/redcomet/knowledge/logic/AccountLogic.java new file mode 100644 index 000000000..d9cfb3bd5 --- /dev/null +++ b/src/main/java/redcomet/knowledge/logic/AccountLogic.java @@ -0,0 +1,82 @@ +package redcomet.knowledge.logic; + +import java.io.IOException; +import java.util.Date; + +import org.apache.commons.fileupload.FileItem; + +import redcomet.common.log.Log; +import redcomet.common.log.LogFactory; +import redcomet.common.util.StringUtils; +import redcomet.di.Container; +import redcomet.knowledge.dao.AccountImagesDao; +import redcomet.knowledge.entity.AccountImagesEntity; +import redcomet.knowledge.vo.UploadFile; +import redcomet.web.bean.LoginedUser; + +public class AccountLogic { + /** ログ */ + private static Log LOG = LogFactory.getLog(AccountLogic.class); + + public static AccountLogic get() { + return Container.getComp(AccountLogic.class); + } + + public UploadFile saveIconImage(FileItem fileItem, LoginedUser loginedUser, String context) throws IOException { + LOG.trace("saveFile()"); + AccountImagesDao dao = AccountImagesDao.get(); + AccountImagesEntity entity =dao.selectOnUserId(loginedUser.getUserId()); + if (entity == null) { + entity = new AccountImagesEntity(); + } + + entity.setFileName(fileItem.getName()); + entity.setFileSize(new Double(fileItem.getSize())); + entity.setFileBinary(fileItem.getInputStream()); + entity.setUserId(loginedUser.getUserId()); + + String extension = StringUtils.getExtension(entity.getFileName()); + entity.setExtension(extension); + + String contentType = "application/octet-stream"; + if (StringUtils.isNotEmpty(extension)) { + if (extension.toLowerCase().indexOf("png") != -1) { + contentType = "image/png"; + } else if (extension.toLowerCase().indexOf("jpg") != -1) { + contentType = "image/jpeg"; + } else if (extension.toLowerCase().indexOf("jpeg") != -1) { + contentType = "image/jpeg"; + } else if (extension.toLowerCase().indexOf("gif") != -1) { + contentType = "image/gif"; + } + } + entity.setContentType(contentType); + entity = dao.save(entity); + UploadFile file = convUploadFile(context, entity); + //処理が完了したら、テンポラリのファイルを削除 + fileItem.delete(); + return file; + } + + + /** + * KnowledgeFilesEntity の情報から、画面に戻す UploadFile の情報を生成する + * @param context + * @param entity + * @return + */ + private UploadFile convUploadFile(String context, AccountImagesEntity entity) { + UploadFile file = new UploadFile(); + file.setFileNo(new Long(entity.getUserId())); + file.setUrl(context + "/open.account/icon/" + entity.getUserId()); + file.setThumbnailUrl(context + "/open.account/icon/" + entity.getUserId() + "?t=" + new Date().getTime()); + file.setName(entity.getFileName()); + file.setType("-"); + file.setSize(entity.getFileSize()); + file.setDeleteUrl(context + "/protect.account/delete"); + file.setDeleteType("DELETE"); + return file; + } + + +} diff --git a/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java b/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java index c36b94f61..80a48effc 100644 --- a/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java +++ b/src/main/java/redcomet/knowledge/logic/KnowledgeLogic.java @@ -45,7 +45,7 @@ public class KnowledgeLogic { public static final int PUBLIC_FLAG_PRIVATE = 1; public static final int PUBLIC_FLAG_SELECT_USERS = 2; - public static final int TYPE_KNOWLEDGE = IndexType.Knoeledge.getValue(); + public static final int TYPE_KNOWLEDGE = IndexType.knowledge.getValue(); public static final int TYPE_FILE = IndexType.KnowledgeFile.getValue(); public static KnowledgeLogic get() { diff --git a/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java b/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java index db56e0a0b..ac6313614 100644 --- a/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java +++ b/src/main/java/redcomet/knowledge/searcher/impl/LuceneSearcher.java @@ -167,7 +167,7 @@ private Query structQuery(final SearchingValue value) throws ParseException { container.add(miniContainer, BooleanClause.Occur.MUST); } else { - Query query = NumericRangeQuery.newIntRange(FIELD_LABEL_TYPE, 1, IndexType.Knoeledge.getValue(), IndexType.Knoeledge.getValue(), true, true); + Query query = NumericRangeQuery.newIntRange(FIELD_LABEL_TYPE, 1, IndexType.knowledge.getValue(), IndexType.knowledge.getValue(), true, true); container.add(query, BooleanClause.Occur.MUST); } diff --git a/src/main/resources/appconfig.xml b/src/main/resources/appconfig.xml index e23c1e5a4..f3eda881b 100644 --- a/src/main/resources/appconfig.xml +++ b/src/main/resources/appconfig.xml @@ -5,6 +5,7 @@ {user.home}/.knowledge/tmp/ {user.home}/.knowledge/db/ 5 + 100 diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index 66b7549dd..049b97216 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -23,6 +23,7 @@ errors.url={1} is an invalid url (web address). errors.exist={1} is already registered. errors.noexist={1} is not exist. errors.noauthority=No authority. +errors.extension={0}\u306e\u62e1\u5f35\u5b50\u304c\u4e0d\u6b63\u3067\u3059\u3002{1}\u306e\u307f\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3059\u3002 label.login=Login message.login.error=ID/Password invalid diff --git a/src/main/resources/appresource_ja_JP.properties b/src/main/resources/appresource_ja_JP.properties index 2cc8cb5d6..2771139cd 100644 --- a/src/main/resources/appresource_ja_JP.properties +++ b/src/main/resources/appresource_ja_JP.properties @@ -23,6 +23,7 @@ errors.url={1}\u306fURL\u3068\u3057\u3066\u4e0d\u6b63\u3067\u3059\u3002 errors.exist=\u5165\u529b\u3055\u308c\u305f{1}\u306f\u65e2\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002 errors.noexist=\u5165\u529b\u3055\u308c\u305f{1}\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 errors.noauthority=\u6a29\u9650\u304c\u3042\u308a\u307e\u305b\u3093\u3002 +errors.extension={0}\u306e\u62e1\u5f35\u5b50\u304c\u4e0d\u6b63\u3067\u3059\u3002{1}\u306e\u307f\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3059\u3002 label.login=Login message.login.error=ID/Password\u304c\u9593\u9055\u3063\u3066\u3044\u307e\u3059\u3002 diff --git a/src/main/resources/icon/icon.png b/src/main/resources/icon/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b0caee2ca1aab7d564e56ab7235ba07a28659167 GIT binary patch literal 12140 zcmch7cQ~7E|928AR;XQK-CahhEhshGDr(Q7R8?z6jM^nCXsbf2Xl~g0DxKN)^!sA z0Oa+1fN22$p!JL4G75tpaqEr`0KmxpdjJ6`X*?9-S>GF0zNVfJef=H0od6mSJnuUR z>3BFiax!spco68-<#ZJQko>80UBfJ3V(lGSzg3F$W@USrvgS7=yx;f}P+SVc7jOO+ z2{%$eGCvikDSV-6mhZQr^2^}k>!M1|rV#(eDy`{#|8bcZA%MUplI|)~0G>)E$HICx5H3&Jq)|4t50ORCkNUuJP@{RtLIIq zc@{PRuw9&w=oBqqI6r0~$Vt12wEW}z+VjA+t3)oUscYeu;*#>l4p~>F6Rp-)--(u! zQ2zRoJT!ofK_2a@T-!OOoc)<1?@ezZG4%vghwExC#E<1lvr;bR9hD+oKX2JPf}KGK zv?DL8M|H?7Loq5L)YG$TGDS)C$n8D*mmuBbIJZQXYTZ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1{o*`@N=&=Y43K6C*T*-3yC+c_y?T363UyKMtT$nA%;$kXkMbgqJkX_{ZyIlls3Q@Q>4WW-!%s@!( z<=7krir)8!l-J%nOOcJF$mViGNP#MQu{n@GSw&)s?0D}`)ShL$<2edN9KRe%Wi@3N z0OvKi@$4Lr|%Yx#-IuT8Ygo>1YTFWB*r=2!3;k>%P{ZrLzcTP_R*gK+F zvbH)G8Ud>xC&6w*>>YV|x_}A=Lab1ma2qfHEptA~^v>x*Wfm}tiwjl(QT0051NR>% z-|sWEX!6`?t8CWl_)2BO;)%HD6f|R{hz}eG3_miYXPt5GHlqi)9(%9VesSG@Nj4h| z8OM16R-A4nCN4d9Ob09qQyE>;Dgt}S!R_e*Av!moX+5JNjhfM0Det7Rcf6Qpn^ie6 zFau?s8Oy#qWkQ>jeF<%@{|1mHePuA&iFKwRJ=+Y>cLxPyc(BW%UUg9y$*Nsik^t&kvp8hXnQ~!wo literal 0 HcmV?d00001 diff --git a/src/main/resources/redcomet/knowledge/database/ddl.sql b/src/main/resources/redcomet/knowledge/database/ddl.sql index d43126eb8..f5274e77f 100644 --- a/src/main/resources/redcomet/knowledge/database/ddl.sql +++ b/src/main/resources/redcomet/knowledge/database/ddl.sql @@ -1,3 +1,25 @@ +-- アカウントの画像 +drop table if exists ACCOUNT_IMAGES cascade; + +create table ACCOUNT_IMAGES ( + IMAGE_ID bigint not null AUTO_INCREMENT + , USER_ID integer + , FILE_NAME character varying(256) + , FILE_SIZE double precision + , FILE_BINARY blob + , EXTENSION character varying(256) + , CONTENT_TYPE character varying(256) + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint ACCOUNT_IMAGES_PKC primary key (IMAGE_ID) +) ; + +create unique index IDX_ACCOUNT_IMAGES_USER_ID + on ACCOUNT_IMAGES(USER_ID); + -- いいね drop table if exists LIKES cascade; @@ -12,6 +34,9 @@ create table LIKES ( , constraint LIKES_PKC primary key (NO) ) ; +create index IDX_LIKES_KNOWLEDGE_ID + on LIKES(KNOWLEDGE_ID); + -- コメント drop table if exists COMMENTS cascade; @@ -27,6 +52,9 @@ create table COMMENTS ( , constraint COMMENTS_PKC primary key (COMMENT_NO) ) ; +create index IDX_COMMENTS_KNOWLEDGE_ID + on COMMENTS(KNOWLEDGE_ID); + -- 投票 drop table if exists VOTES cascade; @@ -42,6 +70,9 @@ create table VOTES ( , constraint VOTES_PKC primary key (VOTE_NO) ) ; +create index IDX_VOTES_KNOWLEDGE_ID + on VOTES(KNOWLEDGE_ID); + -- ナレッジの参照履歴 drop table if exists VIEW_HISTORIES cascade; @@ -57,6 +88,9 @@ create table VIEW_HISTORIES ( , constraint VIEW_HISTORIES_PKC primary key (HISTORY_NO) ) ; +create index IDX_VIEW_HISTORIES_KNOWLEDGE_ID + on VIEW_HISTORIES(KNOWLEDGE_ID); + -- ストックしたナレッジ drop table if exists STOCKS cascade; @@ -146,6 +180,9 @@ create table KNOWLEDGE_FILES ( , constraint KNOWLEDGE_FILES_PKC primary key (FILE_NO) ) ; +create index IDX_KNOWLEDGE_FILES_KNOWLEDGE_ID + on KNOWLEDGE_FILES(KNOWLEDGE_ID); + -- ナレッジ drop table if exists KNOWLEDGES cascade; @@ -212,6 +249,20 @@ alter table KNOWLEDGE_FILES on delete cascade on update cascade; +comment on table ACCOUNT_IMAGES is 'アカウントの画像'; +comment on column ACCOUNT_IMAGES.IMAGE_ID is 'IMAGE_ID'; +comment on column ACCOUNT_IMAGES.USER_ID is 'ユーザID'; +comment on column ACCOUNT_IMAGES.FILE_NAME is 'ファイル名'; +comment on column ACCOUNT_IMAGES.FILE_SIZE is 'ファイルサイズ'; +comment on column ACCOUNT_IMAGES.FILE_BINARY is 'バイナリ'; +comment on column ACCOUNT_IMAGES.EXTENSION is '拡張子'; +comment on column ACCOUNT_IMAGES.CONTENT_TYPE is 'CONTENT_TYPE'; +comment on column ACCOUNT_IMAGES.INSERT_USER is '登録ユーザ'; +comment on column ACCOUNT_IMAGES.INSERT_DATETIME is '登録日時'; +comment on column ACCOUNT_IMAGES.UPDATE_USER is '更新ユーザ'; +comment on column ACCOUNT_IMAGES.UPDATE_DATETIME is '更新日時'; +comment on column ACCOUNT_IMAGES.DELETE_FLAG is '削除フラグ'; + comment on table LIKES is 'いいね'; comment on column LIKES.NO is 'NO'; comment on column LIKES.KNOWLEDGE_ID is 'ナレッジID'; diff --git a/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp b/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp index 53a6476e9..461d2ed71 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonHeader.jsp @@ -10,14 +10,14 @@ - - - - - + + + + + diff --git a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp index fcbe42b59..b23ce5b90 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp @@ -57,7 +57,7 @@ <% if (request.getRemoteUser() != null) { %>