From 6f0a9968babb0fe5f2dae7e38ebed73f1ecd76e6 Mon Sep 17 00:00:00 2001 From: koda Date: Tue, 9 Jun 2015 07:48:38 +0900 Subject: [PATCH] =?UTF-8?q?#43=20=E5=85=B1=E5=90=8C=E7=B7=A8=E9=9B=86?= =?UTF-8?q?=E8=80=85=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=20=E3=83=88?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=82=B6=E3=82=A4=E3=83=B3=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 - .../project/knowledge/config/AppConfig.java | 16 +- .../control/open/KnowledgeControl.java | 9 +- .../knowledge/control/open/LangControl.java | 67 ---- .../control/protect/GroupControl.java | 2 +- .../control/protect/KnowledgeControl.java | 49 ++- .../control/protect/TargetControl.java | 2 +- .../knowledge/dao/KnowledgeEditGroupsDao.java | 31 ++ .../knowledge/dao/KnowledgeEditUsersDao.java | 31 ++ .../project/knowledge/dao/TargetsDao.java | 12 +- .../dao/gen/GenKnowledgeEditGroupsDao.java | 304 +++++++++++++++++ .../dao/gen/GenKnowledgeEditUsersDao.java | 304 +++++++++++++++++ .../project/knowledge/deploy/InitDB.java | 7 +- .../deploy/v0_5_2pre2/Migrate_0_5_2pre2.java | 23 ++ .../entity/KnowledgeEditGroupsEntity.java | 51 +++ .../entity/KnowledgeEditUsersEntity.java | 51 +++ .../gen/GenKnowledgeEditGroupsEntity.java | 316 +++++++++++++++++ .../gen/GenKnowledgeEditUsersEntity.java | 316 +++++++++++++++++ .../knowledge/logic/DataTransferLogic.java | 6 +- .../project/knowledge/logic/GroupLogic.java | 2 +- .../knowledge/logic/KnowledgeLogic.java | 117 ++++++- .../project/knowledge/logic/TargetLogic.java | 27 +- .../project/knowledge/vo/LabelValue.java | 33 -- src/main/resources/appresource.properties | 53 ++- src/main/resources/appresource_ja.properties | 31 +- .../KnowledgeEditGroupsDao_delete.sql | 5 + .../KnowledgeEditGroupsDao_insert.sql | 18 + ...ledgeEditGroupsDao_physical_select_all.sql | 1 + ...tGroupsDao_physical_select_on_group_id.sql | 5 + ...geEditGroupsDao_physical_select_on_key.sql | 5 + ...upsDao_physical_select_on_knowledge_id.sql | 5 + .../KnowledgeEditGroupsDao_raw_insert.sql | 18 + .../KnowledgeEditGroupsDao_select_all.sql | 2 + ...wledgeEditGroupsDao_select_on_group_id.sql | 5 + .../KnowledgeEditGroupsDao_select_on_key.sql | 6 + ...geEditGroupsDao_select_on_knowledge_id.sql | 5 + .../KnowledgeEditGroupsDao_update.sql | 11 + .../KnowledgeEditUsersDao_delete.sql | 5 + .../KnowledgeEditUsersDao_insert.sql | 18 + ...wledgeEditUsersDao_physical_select_all.sql | 1 + ...dgeEditUsersDao_physical_select_on_key.sql | 5 + ...ersDao_physical_select_on_knowledge_id.sql | 5 + ...ditUsersDao_physical_select_on_user_id.sql | 5 + .../KnowledgeEditUsersDao_raw_insert.sql | 18 + .../KnowledgeEditUsersDao_select_all.sql | 2 + .../KnowledgeEditUsersDao_select_on_key.sql | 6 + ...dgeEditUsersDao_select_on_knowledge_id.sql | 5 + ...nowledgeEditUsersDao_select_on_user_id.sql | 5 + .../KnowledgeEditUsersDao_update.sql | 11 + .../selectEditorGroupsOnKnowledgeId.sql | 4 + .../selectEditorUsersOnKnowledgeId.sql | 4 + .../project/knowledge/database/ddl.sql | 46 +++ .../knowledge/deploy/v0_5_2pre2/migrate.sql | 47 +++ .../views/commons/layout/commonNavbar.jsp | 4 +- .../views/commons/layout/layoutMain.jsp | 1 - .../views/commons/layout/layoutTop.jsp | 73 ++++ src/main/webapp/WEB-INF/views/index/index.jsp | 321 +++++++----------- .../WEB-INF/views/open/knowledge/view.jsp | 3 +- .../views/protect/knowledge/view_add.jsp | 61 ++++ .../views/protect/knowledge/view_edit.jsp | 70 +++- src/main/webapp/WEB-INF/web.xml | 4 +- src/main/webapp/css/top.css | 143 ++++++++ src/main/webapp/js/knowledge-edit.js | 84 ++++- .../knowledge/dao/KnowledgesDaoTest.java | 2 +- .../knowledge/logic/KnowledgeLogicTest.java | 6 +- .../knowledge/tool/AddSampleKnowledge.java | 2 +- 66 files changed, 2517 insertions(+), 400 deletions(-) delete mode 100644 src/main/java/org/support/project/knowledge/control/open/LangControl.java create mode 100644 src/main/java/org/support/project/knowledge/dao/KnowledgeEditGroupsDao.java create mode 100644 src/main/java/org/support/project/knowledge/dao/KnowledgeEditUsersDao.java create mode 100644 src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditGroupsDao.java create mode 100644 src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditUsersDao.java create mode 100644 src/main/java/org/support/project/knowledge/deploy/v0_5_2pre2/Migrate_0_5_2pre2.java create mode 100644 src/main/java/org/support/project/knowledge/entity/KnowledgeEditGroupsEntity.java create mode 100644 src/main/java/org/support/project/knowledge/entity/KnowledgeEditUsersEntity.java create mode 100644 src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditGroupsEntity.java create mode 100644 src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditUsersEntity.java delete mode 100644 src/main/java/org/support/project/knowledge/vo/LabelValue.java create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_delete.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_insert.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_all.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_group_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_key.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_knowledge_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_raw_insert.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_all.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_group_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_key.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_knowledge_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_update.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_delete.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_insert.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_all.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_key.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_knowledge_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_user_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_raw_insert.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_all.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_key.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_knowledge_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_user_id.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_update.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorGroupsOnKnowledgeId.sql create mode 100644 src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorUsersOnKnowledgeId.sql create mode 100644 src/main/resources/org/support/project/knowledge/deploy/v0_5_2pre2/migrate.sql create mode 100644 src/main/webapp/WEB-INF/views/commons/layout/layoutTop.jsp create mode 100644 src/main/webapp/css/top.css diff --git a/pom.xml b/pom.xml index 825a45be8..ec58f0e1e 100644 --- a/pom.xml +++ b/pom.xml @@ -135,15 +135,5 @@ - - - org.support.project-releases - https://support-project.org/nexus/content/repositories/releases/ - - - org.support.project-snapshots - https://support-project.org/nexus/content/repositories/snapshots/ - - diff --git a/src/main/java/org/support/project/knowledge/config/AppConfig.java b/src/main/java/org/support/project/knowledge/config/AppConfig.java index 30c761c33..43322613f 100644 --- a/src/main/java/org/support/project/knowledge/config/AppConfig.java +++ b/src/main/java/org/support/project/knowledge/config/AppConfig.java @@ -5,7 +5,7 @@ import org.support.project.common.config.ConfigLoader; import org.support.project.common.util.StringUtils; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; public class AppConfig extends org.support.project.web.config.AppConfig { @@ -24,7 +24,6 @@ public static AppConfig get() { private boolean convIndexPath = false; - private List languages = new ArrayList<>(); /** @@ -50,18 +49,5 @@ public void setIndexPath(String indexPath) { this.indexPath = indexPath; } - /** - * @return the languages - */ - public List getLanguages() { - return languages; - } - - /** - * @param languages the languages to set - */ - public void setLanguages(List languages) { - this.languages = languages; - } } diff --git a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java index ef5dacf81..e11d7f917 100644 --- a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java +++ b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java @@ -27,9 +27,9 @@ import org.support.project.knowledge.logic.TagLogic; import org.support.project.knowledge.logic.TargetLogic; import org.support.project.knowledge.logic.UploadedFileLogic; -import org.support.project.knowledge.vo.LabelValue; import org.support.project.knowledge.vo.LikeCount; import org.support.project.knowledge.vo.UploadFile; +import org.support.project.web.bean.LabelValue; import org.support.project.web.bean.LoginedUser; import org.support.project.web.boundary.Boundary; import org.support.project.web.common.HttpStatus; @@ -132,6 +132,13 @@ public Boundary view() throws InvalidParamException { List groups = TargetLogic.get().selectTargetsOnKnowledgeId(knowledgeId); setAttribute("groups", groups); + // 編集権限 + List editors = TargetLogic.get().selectEditorsOnKnowledgeId(knowledgeId); + setAttribute("editors", editors); + LoginedUser loginedUser = super.getLoginedUser(); + boolean edit = knowledgeLogic.isEditor(loginedUser, entity, editors); + setAttribute("edit", edit); + return forward("view.jsp"); } diff --git a/src/main/java/org/support/project/knowledge/control/open/LangControl.java b/src/main/java/org/support/project/knowledge/control/open/LangControl.java deleted file mode 100644 index 279ecfbc3..000000000 --- a/src/main/java/org/support/project/knowledge/control/open/LangControl.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.support.project.knowledge.control.open; - -import java.util.Locale; - -import org.support.project.common.util.StringUtils; -import org.support.project.knowledge.control.Control; -import org.support.project.web.bean.LoginedUser; -import org.support.project.web.boundary.Boundary; -import org.support.project.web.common.HttpUtil; -import org.support.project.web.control.service.Get; -import org.support.project.web.exception.InvalidParamException; - -public class LangControl extends Control { - - @Get - public Boundary en() { - Locale locale = Locale.ENGLISH; - HttpUtil.setLocale(super.getRequest(), locale); - this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); - return redirect(getRequest().getContextPath() + "/index"); - } - - - @Get - public Boundary ja() { - Locale locale = Locale.JAPANESE; - HttpUtil.setLocale(super.getRequest(), locale); - this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); - return redirect(getRequest().getContextPath() + "/index"); - } - - private void setLocale(LoginedUser loginedUser, Locale locale) { - if (loginedUser == null) { - return; - } - loginedUser.setLocale(locale); - } - - - @Get - public Boundary select() throws InvalidParamException { - String LocaleID = getPathString(); - if (StringUtils.isEmpty(LocaleID)) { - return en(); - } else if (LocaleID.equals("en")) { - return en(); - } else if (LocaleID.equals("ja")) { - return ja(); - } - Locale locale = Locale.ENGLISH; - if (LocaleID.indexOf("_") == -1) { - locale = new Locale(LocaleID); - } else { - String[] sp = LocaleID.split("_"); - if (sp.length == 2) { - locale = new Locale(sp[0], sp[1]); - } else if (sp.length >= 3) { - locale = new Locale(sp[0], sp[1], sp[2]); - } - } - HttpUtil.setLocale(super.getRequest(), locale); - this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); - return redirect(getRequest().getContextPath() + "/index"); - } - - -} diff --git a/src/main/java/org/support/project/knowledge/control/protect/GroupControl.java b/src/main/java/org/support/project/knowledge/control/protect/GroupControl.java index efcc03998..f84dea752 100644 --- a/src/main/java/org/support/project/knowledge/control/protect/GroupControl.java +++ b/src/main/java/org/support/project/knowledge/control/protect/GroupControl.java @@ -14,7 +14,7 @@ import org.support.project.knowledge.control.Control; import org.support.project.knowledge.logic.GroupLogic; import org.support.project.knowledge.vo.GroupUser; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; import org.support.project.web.bean.LoginedUser; import org.support.project.web.boundary.Boundary; import org.support.project.web.common.HttpStatus; diff --git a/src/main/java/org/support/project/knowledge/control/protect/KnowledgeControl.java b/src/main/java/org/support/project/knowledge/control/protect/KnowledgeControl.java index 24b8f98ab..b83c182e6 100644 --- a/src/main/java/org/support/project/knowledge/control/protect/KnowledgeControl.java +++ b/src/main/java/org/support/project/knowledge/control/protect/KnowledgeControl.java @@ -12,19 +12,24 @@ import org.support.project.di.DI; import org.support.project.di.Instance; import org.support.project.knowledge.control.KnowledgeControlBase; +import org.support.project.knowledge.dao.KnowledgeGroupsDao; import org.support.project.knowledge.dao.KnowledgesDao; +import org.support.project.knowledge.entity.KnowledgeGroupsEntity; +import org.support.project.knowledge.entity.KnowledgeUsersEntity; import org.support.project.knowledge.entity.KnowledgesEntity; import org.support.project.knowledge.entity.TagsEntity; import org.support.project.knowledge.logic.KnowledgeLogic; import org.support.project.knowledge.logic.TargetLogic; import org.support.project.knowledge.logic.UploadedFileLogic; -import org.support.project.knowledge.vo.LabelValue; import org.support.project.knowledge.vo.UploadFile; +import org.support.project.web.bean.LabelValue; +import org.support.project.web.bean.LoginedUser; import org.support.project.web.boundary.Boundary; import org.support.project.web.common.HttpStatus; import org.support.project.web.config.HttpMethod; import org.support.project.web.control.service.Get; import org.support.project.web.control.service.Post; +import org.support.project.web.entity.GroupsEntity; import org.support.project.web.exception.InvalidParamException; @DI(instance=Instance.Prototype) @@ -80,13 +85,20 @@ public Boundary view_edit() throws InvalidParamException { setAttribute("files", files); // 表示するグループを取得 - //List groups = GroupLogic.get().selectGroupsOnKnowledgeId(knowledgeId); List groups = TargetLogic.get().selectTargetsOnKnowledgeId(knowledgeId); setAttribute("groups", groups); - if (!super.getLoginedUser().isAdmin() && entity.getInsertUser().intValue() != super.getLoginUserId().intValue()) { + // 共同編集者 + List editors = TargetLogic.get().selectEditorsOnKnowledgeId(knowledgeId); + setAttribute("editors", editors); + // 編集権限チェック + LoginedUser loginedUser = super.getLoginedUser(); + boolean edit = knowledgeLogic.isEditor(loginedUser, entity, editors); + if (!edit) { + setAttribute("edit", false); addMsgWarn("knowledge.edit.noaccess"); - return forward("/open/knowledge/view.jsp"); + //return forward("/open/knowledge/view.jsp"); + return devolution(HttpMethod.get, "open.knowledge/view", String.valueOf(knowledgeId)); } return forward("view_edit.jsp"); @@ -107,6 +119,11 @@ public Boundary add(KnowledgesEntity entity) throws Exception { //List groups = GroupLogic.get().selectGroups(targets); List groups = TargetLogic.get().selectTargets(targets); setAttribute("groups", groups); + + String editorsstr = super.getParam("editors"); + String[] editordids = editorsstr.split(","); + List editors = TargetLogic.get().selectTargets(editordids); + setAttribute("editors", editors); List fileNos = new ArrayList(); Object obj = getParam("files", Object.class); @@ -150,7 +167,7 @@ public Boundary add(KnowledgesEntity entity) throws Exception { String tags = super.getParam("tagNames"); List tagList = knowledgeLogic.manegeTags(tags); - entity = knowledgeLogic.insert(entity, tagList, fileNos, groups, super.getLoginedUser()); + entity = knowledgeLogic.insert(entity, tagList, fileNos, groups, editors, super.getLoginedUser()); setAttributeOnProperty(entity); List files = fileLogic.selectOnKnowledgeId(entity.getKnowledgeId(), getRequest().getContextPath()); @@ -172,10 +189,14 @@ public Boundary update(KnowledgesEntity entity) throws Exception { String groupsstr = super.getParam("groups"); String[] targets = groupsstr.split(","); -// List groups = GroupLogic.get().selectGroups(targets); List groups = TargetLogic.get().selectTargets(targets); setAttribute("groups", groups); + String editorsstr = super.getParam("editors"); + String[] editordids = editorsstr.split(","); + List editors = TargetLogic.get().selectTargets(editordids); + setAttribute("editors", editors); + List fileNos = new ArrayList(); Object obj = getParam("files", Object.class); if (obj != null) { @@ -222,16 +243,19 @@ public Boundary update(KnowledgesEntity entity) throws Exception { if (check == null) { return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT_FOUND"); } - if (!super.getLoginedUser().isAdmin() && check.getInsertUser().intValue() != super.getLoginUserId().intValue()) { + // 編集権限チェック + if (!knowledgeLogic.isEditor(super.getLoginedUser(), check, editors)) { + setAttribute("edit", false); addMsgWarn("knowledge.edit.noaccess"); - return forward("/open/knowledge/view.jsp"); + //return forward("/open/knowledge/view.jsp"); + return devolution(HttpMethod.get, "open.knowledge/view", String.valueOf(entity.getKnowledgeId())); } LOG.trace("save"); String tags = super.getParam("tagNames"); List tagList = knowledgeLogic.manegeTags(tags); - entity = knowledgeLogic.update(entity, tagList, fileNos, groups, super.getLoginedUser()); + entity = knowledgeLogic.update(entity, tagList, fileNos, groups, editors, super.getLoginedUser()); setAttributeOnProperty(entity); addMsgSuccess("message.success.update"); @@ -266,9 +290,12 @@ public Boundary delete() throws Exception { if (check == null) { return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT_FOUND"); } - if (!super.getLoginedUser().isAdmin() && check.getInsertUser().intValue() != super.getLoginUserId().intValue()) { + List editors = TargetLogic.get().selectEditorsOnKnowledgeId(knowledgeId); + if (!knowledgeLogic.isEditor(super.getLoginedUser(), check, editors)) { + setAttribute("edit", false); addMsgWarn("knowledge.edit.noaccess"); - return forward("/open/knowledge/view.jsp"); + //return forward("/open/knowledge/view.jsp"); + return devolution(HttpMethod.get, "open.knowledge/view", String.valueOf(knowledgeId)); } LOG.trace("save"); knowledgeLogic.delete(knowledgeId, getLoginedUser()); diff --git a/src/main/java/org/support/project/knowledge/control/protect/TargetControl.java b/src/main/java/org/support/project/knowledge/control/protect/TargetControl.java index 8fff174b6..03207abd3 100644 --- a/src/main/java/org/support/project/knowledge/control/protect/TargetControl.java +++ b/src/main/java/org/support/project/knowledge/control/protect/TargetControl.java @@ -7,7 +7,7 @@ import org.support.project.common.util.StringUtils; import org.support.project.knowledge.control.Control; import org.support.project.knowledge.logic.TargetLogic; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; import org.support.project.web.boundary.Boundary; import org.support.project.web.control.service.Get; import org.support.project.web.exception.InvalidParamException; diff --git a/src/main/java/org/support/project/knowledge/dao/KnowledgeEditGroupsDao.java b/src/main/java/org/support/project/knowledge/dao/KnowledgeEditGroupsDao.java new file mode 100644 index 000000000..c0ba8cd22 --- /dev/null +++ b/src/main/java/org/support/project/knowledge/dao/KnowledgeEditGroupsDao.java @@ -0,0 +1,31 @@ +package org.support.project.knowledge.dao; + +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; +import org.support.project.knowledge.dao.gen.GenKnowledgeEditGroupsDao; + +/** + * 編集可能なグループ + */ +@DI(instance=Instance.Singleton) +public class KnowledgeEditGroupsDao extends GenKnowledgeEditGroupsDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static KnowledgeEditGroupsDao get() { + return Container.getComp(KnowledgeEditGroupsDao.class); + } + public void deleteOnKnowledgeId(Long knowledgeId) { + String sql = "DELETE FROM KNOWLEDGE_EDIT_GROUPS WHERE KNOWLEDGE_ID = ?"; + super.executeUpdate(sql, knowledgeId); + } + + + +} diff --git a/src/main/java/org/support/project/knowledge/dao/KnowledgeEditUsersDao.java b/src/main/java/org/support/project/knowledge/dao/KnowledgeEditUsersDao.java new file mode 100644 index 000000000..48ddfc376 --- /dev/null +++ b/src/main/java/org/support/project/knowledge/dao/KnowledgeEditUsersDao.java @@ -0,0 +1,31 @@ +package org.support.project.knowledge.dao; + +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; +import org.support.project.knowledge.dao.gen.GenKnowledgeEditUsersDao; + +/** + * 編集可能なユーザ + */ +@DI(instance=Instance.Singleton) +public class KnowledgeEditUsersDao extends GenKnowledgeEditUsersDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static KnowledgeEditUsersDao get() { + return Container.getComp(KnowledgeEditUsersDao.class); + } + public void deleteOnKnowledgeId(Long knowledgeId) { + String sql = "DELETE FROM KNOWLEDGE_EDIT_USERS WHERE KNOWLEDGE_ID = ?"; + super.executeUpdate(sql, knowledgeId); + } + + + +} diff --git a/src/main/java/org/support/project/knowledge/dao/TargetsDao.java b/src/main/java/org/support/project/knowledge/dao/TargetsDao.java index bb142d6d4..1f5467fb2 100644 --- a/src/main/java/org/support/project/knowledge/dao/TargetsDao.java +++ b/src/main/java/org/support/project/knowledge/dao/TargetsDao.java @@ -3,9 +3,9 @@ import java.util.List; import org.support.project.di.Container; -import org.support.project.knowledge.vo.LabelValue; import org.support.project.ormapping.common.SQLManager; import org.support.project.ormapping.dao.AbstractDao; +import org.support.project.web.bean.LabelValue; import org.support.project.web.entity.GroupsEntity; import org.support.project.web.entity.UsersEntity; @@ -55,5 +55,15 @@ public List selectUsersOnKnowledgeId(Long knowledgeId) { return executeQueryList(sql, UsersEntity.class, knowledgeId); } + public List selectEditorGroupsOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorGroupsOnKnowledgeId.sql"); + return executeQueryList(sql, GroupsEntity.class, knowledgeId); + } + + public List selectEditorUsersOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorUsersOnKnowledgeId.sql"); + return executeQueryList(sql, UsersEntity.class, knowledgeId); + } + } diff --git a/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditGroupsDao.java b/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditGroupsDao.java new file mode 100644 index 000000000..615dceb72 --- /dev/null +++ b/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditGroupsDao.java @@ -0,0 +1,304 @@ +package org.support.project.knowledge.dao.gen; + +import java.util.List; + +import java.sql.Timestamp; + + +import org.support.project.knowledge.entity.KnowledgeEditGroupsEntity; +import org.support.project.ormapping.dao.AbstractDao; +import org.support.project.ormapping.exception.ORMappingException; +import org.support.project.ormapping.common.SQLManager; +import org.support.project.ormapping.common.DBUserPool; +import org.support.project.ormapping.common.IDGen; +import org.support.project.ormapping.config.ORMappingParameter; +import org.support.project.ormapping.connection.ConnectionManager; +import org.support.project.common.util.PropertyUtil; + +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; +import org.support.project.aop.Aspect; + +/** + * 編集可能なグループ + */ +@DI(instance=Instance.Singleton) +public class GenKnowledgeEditGroupsDao extends AbstractDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenKnowledgeEditGroupsDao get() { + return Container.getComp(GenKnowledgeEditGroupsDao.class); + } + + /** + * 全て取得(削除フラグを無視して取得) + */ + public List physicalSelectAll() { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_all.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class); + } + /** + * キーで1件取得(削除フラグを無視して取得) + */ + public KnowledgeEditGroupsEntity physicalSelectOnKey(Integer groupId, Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_key.sql"); + return executeQuerySingle(sql, KnowledgeEditGroupsEntity.class, groupId, knowledgeId); + } + /** + * 全て取得 + */ + public List selectAll() { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_all.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class); + } + /** + * キーで1件取得 + */ + public KnowledgeEditGroupsEntity selectOnKey(Integer groupId, Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_key.sql"); + return executeQuerySingle(sql, KnowledgeEditGroupsEntity.class, groupId, knowledgeId); + } + /** + * GROUP_ID でリストを取得 + */ + public List selectOnGroupId(Integer groupId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_group_id.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class, groupId); + } + /** + * KNOWLEDGE_ID でリストを取得 + */ + public List selectOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_knowledge_id.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class, knowledgeId); + } + /** + * GROUP_ID でリストを取得 + */ + public List physicalSelectOnGroupId(Integer groupId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_group_id.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class, groupId); + } + /** + * KNOWLEDGE_ID でリストを取得 + */ + public List physicalSelectOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_knowledge_id.sql"); + return executeQueryList(sql, KnowledgeEditGroupsEntity.class, knowledgeId); + } + /** + * 登録(データを生で操作/DBの採番機能のカラムも自分でセット) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity rawPhysicalInsert(KnowledgeEditGroupsEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_raw_insert.sql"); + executeUpdate(sql, + entity.getGroupId() + , entity.getKnowledgeId() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + return entity; + } + /** + * 登録(データを生で操作) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity physicalInsert(KnowledgeEditGroupsEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_insert.sql"); + executeUpdate(sql, + entity.getGroupId() + , entity.getKnowledgeId() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + return entity; + } + /** + * 登録(登録ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity insert(Integer user, KnowledgeEditGroupsEntity 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=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity insert(KnowledgeEditGroupsEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return insert(userId, entity); + } + /** + * 更新(データを生で操作) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity physicalUpdate(KnowledgeEditGroupsEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_update.sql"); + executeUpdate(sql, + entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + , entity.getGroupId() + , entity.getKnowledgeId() + ); + return entity; + } + /** + * 更新(更新ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity update(Integer user, KnowledgeEditGroupsEntity entity) { + KnowledgeEditGroupsEntity db = selectOnKey(entity.getGroupId(), entity.getKnowledgeId()); + 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=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity update(KnowledgeEditGroupsEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return update(userId, entity); + } + /** + * 保存(ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity save(Integer user, KnowledgeEditGroupsEntity entity) { + KnowledgeEditGroupsEntity db = selectOnKey(entity.getGroupId(), entity.getKnowledgeId()); + if (db == null) { + return insert(user, entity); + } else { + return update(user, entity); + } + } + /** + * 保存(存在しなければ登録、存在すれば更新) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditGroupsEntity save(KnowledgeEditGroupsEntity entity) { + KnowledgeEditGroupsEntity db = selectOnKey(entity.getGroupId(), entity.getKnowledgeId()); + if (db == null) { + return insert(entity); + } else { + return update(entity); + } + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void physicalDelete(Integer groupId, Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_delete.sql"); + executeUpdate(sql, groupId, knowledgeId); + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void physicalDelete(KnowledgeEditGroupsEntity entity) { + physicalDelete(entity.getGroupId(), entity.getKnowledgeId()); + + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Integer user, Integer groupId, Long knowledgeId) { + KnowledgeEditGroupsEntity db = selectOnKey(groupId, knowledgeId); + db.setDeleteFlag(1); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Integer groupId, Long knowledgeId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + delete(user, groupId, knowledgeId); + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Integer user, KnowledgeEditGroupsEntity entity) { + delete(user, entity.getGroupId(), entity.getKnowledgeId()); + + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(KnowledgeEditGroupsEntity entity) { + delete(entity.getGroupId(), entity.getKnowledgeId()); + + } + /** + 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Integer user, Integer groupId, Long knowledgeId) { + KnowledgeEditGroupsEntity db = physicalSelectOnKey(groupId, knowledgeId); + db.setDeleteFlag(0); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Integer groupId, Long knowledgeId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + activation(user, groupId, knowledgeId); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Integer user, KnowledgeEditGroupsEntity entity) { + activation(user, entity.getGroupId(), entity.getKnowledgeId()); + + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(KnowledgeEditGroupsEntity entity) { + activation(entity.getGroupId(), entity.getKnowledgeId()); + + } + +} diff --git a/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditUsersDao.java b/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditUsersDao.java new file mode 100644 index 000000000..9a2a5a359 --- /dev/null +++ b/src/main/java/org/support/project/knowledge/dao/gen/GenKnowledgeEditUsersDao.java @@ -0,0 +1,304 @@ +package org.support.project.knowledge.dao.gen; + +import java.util.List; + +import java.sql.Timestamp; + + +import org.support.project.knowledge.entity.KnowledgeEditUsersEntity; +import org.support.project.ormapping.dao.AbstractDao; +import org.support.project.ormapping.exception.ORMappingException; +import org.support.project.ormapping.common.SQLManager; +import org.support.project.ormapping.common.DBUserPool; +import org.support.project.ormapping.common.IDGen; +import org.support.project.ormapping.config.ORMappingParameter; +import org.support.project.ormapping.connection.ConnectionManager; +import org.support.project.common.util.PropertyUtil; + +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; +import org.support.project.aop.Aspect; + +/** + * 編集可能なユーザ + */ +@DI(instance=Instance.Singleton) +public class GenKnowledgeEditUsersDao extends AbstractDao { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenKnowledgeEditUsersDao get() { + return Container.getComp(GenKnowledgeEditUsersDao.class); + } + + /** + * 全て取得(削除フラグを無視して取得) + */ + public List physicalSelectAll() { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_all.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class); + } + /** + * キーで1件取得(削除フラグを無視して取得) + */ + public KnowledgeEditUsersEntity physicalSelectOnKey(Long knowledgeId, Integer userId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_key.sql"); + return executeQuerySingle(sql, KnowledgeEditUsersEntity.class, knowledgeId, userId); + } + /** + * 全て取得 + */ + public List selectAll() { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_all.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class); + } + /** + * キーで1件取得 + */ + public KnowledgeEditUsersEntity selectOnKey(Long knowledgeId, Integer userId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_key.sql"); + return executeQuerySingle(sql, KnowledgeEditUsersEntity.class, knowledgeId, userId); + } + /** + * KNOWLEDGE_ID でリストを取得 + */ + public List selectOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_knowledge_id.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class, knowledgeId); + } + /** + * USER_ID でリストを取得 + */ + public List selectOnUserId(Integer userId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_user_id.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class, userId); + } + /** + * KNOWLEDGE_ID でリストを取得 + */ + public List physicalSelectOnKnowledgeId(Long knowledgeId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_knowledge_id.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class, knowledgeId); + } + /** + * USER_ID でリストを取得 + */ + public List physicalSelectOnUserId(Integer userId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_user_id.sql"); + return executeQueryList(sql, KnowledgeEditUsersEntity.class, userId); + } + /** + * 登録(データを生で操作/DBの採番機能のカラムも自分でセット) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity rawPhysicalInsert(KnowledgeEditUsersEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_raw_insert.sql"); + executeUpdate(sql, + entity.getKnowledgeId() + , entity.getUserId() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + return entity; + } + /** + * 登録(データを生で操作) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity physicalInsert(KnowledgeEditUsersEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_insert.sql"); + executeUpdate(sql, + entity.getKnowledgeId() + , entity.getUserId() + , entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + ); + return entity; + } + /** + * 登録(登録ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity insert(Integer user, KnowledgeEditUsersEntity 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=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity insert(KnowledgeEditUsersEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return insert(userId, entity); + } + /** + * 更新(データを生で操作) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity physicalUpdate(KnowledgeEditUsersEntity entity) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_update.sql"); + executeUpdate(sql, + entity.getInsertUser() + , entity.getInsertDatetime() + , entity.getUpdateUser() + , entity.getUpdateDatetime() + , entity.getDeleteFlag() + , entity.getKnowledgeId() + , entity.getUserId() + ); + return entity; + } + /** + * 更新(更新ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity update(Integer user, KnowledgeEditUsersEntity entity) { + KnowledgeEditUsersEntity db = selectOnKey(entity.getKnowledgeId(), entity.getUserId()); + 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=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity update(KnowledgeEditUsersEntity entity) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer userId = (Integer) pool.getUser(); + return update(userId, entity); + } + /** + * 保存(ユーザを指定) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity save(Integer user, KnowledgeEditUsersEntity entity) { + KnowledgeEditUsersEntity db = selectOnKey(entity.getKnowledgeId(), entity.getUserId()); + if (db == null) { + return insert(user, entity); + } else { + return update(user, entity); + } + } + /** + * 保存(存在しなければ登録、存在すれば更新) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public KnowledgeEditUsersEntity save(KnowledgeEditUsersEntity entity) { + KnowledgeEditUsersEntity db = selectOnKey(entity.getKnowledgeId(), entity.getUserId()); + if (db == null) { + return insert(entity); + } else { + return update(entity); + } + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void physicalDelete(Long knowledgeId, Integer userId) { + String sql = SQLManager.getInstance().getSql("/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_delete.sql"); + executeUpdate(sql, knowledgeId, userId); + } + /** + * 削除(データを生で操作/物理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void physicalDelete(KnowledgeEditUsersEntity entity) { + physicalDelete(entity.getKnowledgeId(), entity.getUserId()); + + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Integer user, Long knowledgeId, Integer userId) { + KnowledgeEditUsersEntity db = selectOnKey(knowledgeId, userId); + db.setDeleteFlag(1); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Long knowledgeId, Integer userId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + delete(user, knowledgeId, userId); + } + /** + * 削除(削除ユーザを指定/論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(Integer user, KnowledgeEditUsersEntity entity) { + delete(user, entity.getKnowledgeId(), entity.getUserId()); + + } + /** + * 削除(論理削除があれば論理削除) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void delete(KnowledgeEditUsersEntity entity) { + delete(entity.getKnowledgeId(), entity.getUserId()); + + } + /** + 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Integer user, Long knowledgeId, Integer userId) { + KnowledgeEditUsersEntity db = physicalSelectOnKey(knowledgeId, userId); + db.setDeleteFlag(0); + db.setUpdateUser(user); + db.setUpdateDatetime(new Timestamp(new java.util.Date().getTime())); + physicalUpdate(db); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Long knowledgeId, Integer userId) { + DBUserPool pool = Container.getComp(DBUserPool.class); + Integer user = (Integer) pool.getUser(); + activation(user, knowledgeId, userId); + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(Integer user, KnowledgeEditUsersEntity entity) { + activation(user, entity.getKnowledgeId(), entity.getUserId()); + + } + /** + * 復元(論理削除されていたものを有効化) + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public void activation(KnowledgeEditUsersEntity entity) { + activation(entity.getKnowledgeId(), entity.getUserId()); + + } + +} diff --git a/src/main/java/org/support/project/knowledge/deploy/InitDB.java b/src/main/java/org/support/project/knowledge/deploy/InitDB.java index 0dd391a6a..e2a555104 100644 --- a/src/main/java/org/support/project/knowledge/deploy/InitDB.java +++ b/src/main/java/org/support/project/knowledge/deploy/InitDB.java @@ -11,6 +11,7 @@ import org.support.project.knowledge.deploy.v0_4_4.Migrate_0_4_4; import org.support.project.knowledge.deploy.v0_5_0.Migrate_0_5_0; import org.support.project.knowledge.deploy.v0_5_1.Migrate_0_5_1; +import org.support.project.knowledge.deploy.v0_5_2pre2.Migrate_0_5_2pre2; import org.support.project.web.dao.SystemsDao; import org.support.project.web.entity.SystemsEntity; @@ -23,14 +24,16 @@ public class InitDB { private static final Map MAP = new LinkedHashMap<>(); private static final Migrate INIT = InitializeSystem.get(); - public static final String CURRENT = "0.5.1"; + public static final String CURRENT = "0.5.2.pre2"; public InitDB() { super(); MAP.put("0.3.1", INIT); // 初期公開バージョン MAP.put("0.4.4", Migrate_0_4_4.get()); // ナレッジ一覧の付加情報をナレッジテーブルに持つ MAP.put("0.5.0", Migrate_0_5_0.get()); // 通知設定 - MAP.put(CURRENT, Migrate_0_5_1.get()); // ナレッジの更新履歴 + MAP.put("0.5.1", Migrate_0_5_1.get()); // ナレッジの更新履歴 + MAP.put(CURRENT, Migrate_0_5_2pre2.get()); // 共同編集 + } public static void main(String[] args) throws Exception { diff --git a/src/main/java/org/support/project/knowledge/deploy/v0_5_2pre2/Migrate_0_5_2pre2.java b/src/main/java/org/support/project/knowledge/deploy/v0_5_2pre2/Migrate_0_5_2pre2.java new file mode 100644 index 000000000..4d13981cb --- /dev/null +++ b/src/main/java/org/support/project/knowledge/deploy/v0_5_2pre2/Migrate_0_5_2pre2.java @@ -0,0 +1,23 @@ +package org.support.project.knowledge.deploy.v0_5_2pre2; + +import org.support.project.knowledge.deploy.Migrate; +import org.support.project.ormapping.tool.dao.InitializeDao; + +public class Migrate_0_5_2pre2 implements Migrate { + + public static Migrate_0_5_2pre2 get() { + return org.support.project.di.Container.getComp(Migrate_0_5_2pre2.class); + } + + @Override + public boolean doMigrate() throws Exception { + InitializeDao initializeDao = InitializeDao.get(); + String[] sqlpaths = { + "/org/support/project/knowledge/deploy/v0_5_2pre2/migrate.sql" + }; + initializeDao.initializeDatabase(sqlpaths); + return true; + } + + +} diff --git a/src/main/java/org/support/project/knowledge/entity/KnowledgeEditGroupsEntity.java b/src/main/java/org/support/project/knowledge/entity/KnowledgeEditGroupsEntity.java new file mode 100644 index 000000000..1e670a241 --- /dev/null +++ b/src/main/java/org/support/project/knowledge/entity/KnowledgeEditGroupsEntity.java @@ -0,0 +1,51 @@ +package org.support.project.knowledge.entity; + +import org.support.project.knowledge.entity.gen.GenKnowledgeEditGroupsEntity; + +import java.util.List; +import java.util.Map; + +import org.support.project.common.bean.ValidateError; +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; + +import java.sql.Timestamp; + + +/** + * 編集可能なグループ + */ +@DI(instance=Instance.Prototype) +public class KnowledgeEditGroupsEntity extends GenKnowledgeEditGroupsEntity { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static KnowledgeEditGroupsEntity get() { + return Container.getComp(KnowledgeEditGroupsEntity.class); + } + + /** + * コンストラクタ + */ + public KnowledgeEditGroupsEntity() { + super(); + } + + /** + * コンストラクタ + * @param groupId GROUP_ID + * @param knowledgeId ナレッジID + */ + + public KnowledgeEditGroupsEntity(Integer groupId, Long knowledgeId) { + super( groupId, knowledgeId); + } + +} diff --git a/src/main/java/org/support/project/knowledge/entity/KnowledgeEditUsersEntity.java b/src/main/java/org/support/project/knowledge/entity/KnowledgeEditUsersEntity.java new file mode 100644 index 000000000..a8029545a --- /dev/null +++ b/src/main/java/org/support/project/knowledge/entity/KnowledgeEditUsersEntity.java @@ -0,0 +1,51 @@ +package org.support.project.knowledge.entity; + +import org.support.project.knowledge.entity.gen.GenKnowledgeEditUsersEntity; + +import java.util.List; +import java.util.Map; + +import org.support.project.common.bean.ValidateError; +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; + +import java.sql.Timestamp; + + +/** + * 編集可能なユーザ + */ +@DI(instance=Instance.Prototype) +public class KnowledgeEditUsersEntity extends GenKnowledgeEditUsersEntity { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static KnowledgeEditUsersEntity get() { + return Container.getComp(KnowledgeEditUsersEntity.class); + } + + /** + * コンストラクタ + */ + public KnowledgeEditUsersEntity() { + super(); + } + + /** + * コンストラクタ + * @param knowledgeId ナレッジID + * @param userId USER_ID + */ + + public KnowledgeEditUsersEntity(Long knowledgeId, Integer userId) { + super( knowledgeId, userId); + } + +} diff --git a/src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditGroupsEntity.java b/src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditGroupsEntity.java new file mode 100644 index 000000000..3d69967dc --- /dev/null +++ b/src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditGroupsEntity.java @@ -0,0 +1,316 @@ +package org.support.project.knowledge.entity.gen; + +import java.io.Serializable; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import java.sql.Timestamp; + + + +import org.support.project.common.bean.ValidateError; +import org.support.project.common.validate.Validator; +import org.support.project.common.validate.ValidatorFactory; +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; + +/** + * 編集可能なグループ + */ +@DI(instance=Instance.Prototype) +public class GenKnowledgeEditGroupsEntity implements Serializable { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenKnowledgeEditGroupsEntity get() { + return Container.getComp(GenKnowledgeEditGroupsEntity.class); + } + + /** + * コンストラクタ + */ + public GenKnowledgeEditGroupsEntity() { + super(); + } + + /** + * コンストラクタ + * @param groupId GROUP_ID + * @param knowledgeId ナレッジID + */ + + public GenKnowledgeEditGroupsEntity(Integer groupId, Long knowledgeId) { + super(); + this.groupId = groupId; + this.knowledgeId = knowledgeId; + } + /** ナレッジID */ + private Long knowledgeId; + /** GROUP_ID */ + private Integer groupId; + /** 登録ユーザ */ + private Integer insertUser; + /** 登録日時 */ + private Timestamp insertDatetime; + /** 更新ユーザ */ + private Integer updateUser; + /** 更新日時 */ + private Timestamp updateDatetime; + /** 削除フラグ */ + private Integer deleteFlag; + + /** + * ナレッジID を取得する + */ + public Long getKnowledgeId() { + return this.knowledgeId; + } + /** + * ナレッジID を設定する + * @param knowledgeId ナレッジID + */ + public GenKnowledgeEditGroupsEntity setKnowledgeId(Long knowledgeId) { + this.knowledgeId = knowledgeId; + return this; + } + + /** + * GROUP_ID を取得する + */ + public Integer getGroupId() { + return this.groupId; + } + /** + * GROUP_ID を設定する + * @param groupId GROUP_ID + */ + public GenKnowledgeEditGroupsEntity setGroupId(Integer groupId) { + this.groupId = groupId; + return this; + } + + /** + * 登録ユーザ を取得する + */ + public Integer getInsertUser() { + return this.insertUser; + } + /** + * 登録ユーザ を設定する + * @param insertUser 登録ユーザ + */ + public GenKnowledgeEditGroupsEntity setInsertUser(Integer insertUser) { + this.insertUser = insertUser; + return this; + } + + /** + * 登録日時 を取得する + */ + public Timestamp getInsertDatetime() { + return this.insertDatetime; + } + /** + * 登録日時 を設定する + * @param insertDatetime 登録日時 + */ + public GenKnowledgeEditGroupsEntity setInsertDatetime(Timestamp insertDatetime) { + this.insertDatetime = insertDatetime; + return this; + } + + /** + * 更新ユーザ を取得する + */ + public Integer getUpdateUser() { + return this.updateUser; + } + /** + * 更新ユーザ を設定する + * @param updateUser 更新ユーザ + */ + public GenKnowledgeEditGroupsEntity setUpdateUser(Integer updateUser) { + this.updateUser = updateUser; + return this; + } + + /** + * 更新日時 を取得する + */ + public Timestamp getUpdateDatetime() { + return this.updateDatetime; + } + /** + * 更新日時 を設定する + * @param updateDatetime 更新日時 + */ + public GenKnowledgeEditGroupsEntity setUpdateDatetime(Timestamp updateDatetime) { + this.updateDatetime = updateDatetime; + return this; + } + + /** + * 削除フラグ を取得する + */ + public Integer getDeleteFlag() { + return this.deleteFlag; + } + /** + * 削除フラグ を設定する + * @param deleteFlag 削除フラグ + */ + public GenKnowledgeEditGroupsEntity setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + return this; + } + + /** + * キーの値を取得 + */ + public Object[] getKeyValues() { + Object[] keyValues = new Object[2]; + keyValues[0] = this.groupId; + keyValues[1] = this.knowledgeId; + return keyValues; + } + /** + * キーの値を設定 + * @param groupId GROUP_ID + * @param knowledgeId ナレッジID + */ + public void setKeyValues(Integer groupId, Long knowledgeId) { + this.groupId = groupId; + this.knowledgeId = knowledgeId; + } + /** + * キーで比較 + */ + public boolean equalsOnKey(GenKnowledgeEditGroupsEntity 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("groupId = ").append(groupId).append("\n"); + builder.append("knowledgeId = ").append(knowledgeId).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.REQUIRED); + error = validator.validate(this.knowledgeId, convLabelName("Knowledge Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.REQUIRED); + error = validator.validate(this.groupId, convLabelName("Group Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.groupId, convLabelName("Group Id")); + 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.REQUIRED); + error = validator.validate(values.get("knowledgeId"), convLabelName("Knowledge Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.REQUIRED); + error = validator.validate(values.get("groupId"), convLabelName("Group Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(values.get("groupId"), convLabelName("Group Id")); + 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/org/support/project/knowledge/entity/gen/GenKnowledgeEditUsersEntity.java b/src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditUsersEntity.java new file mode 100644 index 000000000..317f3db0c --- /dev/null +++ b/src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditUsersEntity.java @@ -0,0 +1,316 @@ +package org.support.project.knowledge.entity.gen; + +import java.io.Serializable; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; + +import java.sql.Timestamp; + + + +import org.support.project.common.bean.ValidateError; +import org.support.project.common.validate.Validator; +import org.support.project.common.validate.ValidatorFactory; +import org.support.project.di.Container; +import org.support.project.di.DI; +import org.support.project.di.Instance; + +/** + * 編集可能なユーザ + */ +@DI(instance=Instance.Prototype) +public class GenKnowledgeEditUsersEntity implements Serializable { + + /** SerialVersion */ + private static final long serialVersionUID = 1L; + + /** + * インスタンス取得 + * AOPに対応 + * @return インスタンス + */ + public static GenKnowledgeEditUsersEntity get() { + return Container.getComp(GenKnowledgeEditUsersEntity.class); + } + + /** + * コンストラクタ + */ + public GenKnowledgeEditUsersEntity() { + super(); + } + + /** + * コンストラクタ + * @param knowledgeId ナレッジID + * @param userId USER_ID + */ + + public GenKnowledgeEditUsersEntity(Long knowledgeId, Integer userId) { + super(); + this.knowledgeId = knowledgeId; + this.userId = userId; + } + /** ナレッジID */ + private Long knowledgeId; + /** USER_ID */ + private Integer userId; + /** 登録ユーザ */ + private Integer insertUser; + /** 登録日時 */ + private Timestamp insertDatetime; + /** 更新ユーザ */ + private Integer updateUser; + /** 更新日時 */ + private Timestamp updateDatetime; + /** 削除フラグ */ + private Integer deleteFlag; + + /** + * ナレッジID を取得する + */ + public Long getKnowledgeId() { + return this.knowledgeId; + } + /** + * ナレッジID を設定する + * @param knowledgeId ナレッジID + */ + public GenKnowledgeEditUsersEntity setKnowledgeId(Long knowledgeId) { + this.knowledgeId = knowledgeId; + return this; + } + + /** + * USER_ID を取得する + */ + public Integer getUserId() { + return this.userId; + } + /** + * USER_ID を設定する + * @param userId USER_ID + */ + public GenKnowledgeEditUsersEntity setUserId(Integer userId) { + this.userId = userId; + return this; + } + + /** + * 登録ユーザ を取得する + */ + public Integer getInsertUser() { + return this.insertUser; + } + /** + * 登録ユーザ を設定する + * @param insertUser 登録ユーザ + */ + public GenKnowledgeEditUsersEntity setInsertUser(Integer insertUser) { + this.insertUser = insertUser; + return this; + } + + /** + * 登録日時 を取得する + */ + public Timestamp getInsertDatetime() { + return this.insertDatetime; + } + /** + * 登録日時 を設定する + * @param insertDatetime 登録日時 + */ + public GenKnowledgeEditUsersEntity setInsertDatetime(Timestamp insertDatetime) { + this.insertDatetime = insertDatetime; + return this; + } + + /** + * 更新ユーザ を取得する + */ + public Integer getUpdateUser() { + return this.updateUser; + } + /** + * 更新ユーザ を設定する + * @param updateUser 更新ユーザ + */ + public GenKnowledgeEditUsersEntity setUpdateUser(Integer updateUser) { + this.updateUser = updateUser; + return this; + } + + /** + * 更新日時 を取得する + */ + public Timestamp getUpdateDatetime() { + return this.updateDatetime; + } + /** + * 更新日時 を設定する + * @param updateDatetime 更新日時 + */ + public GenKnowledgeEditUsersEntity setUpdateDatetime(Timestamp updateDatetime) { + this.updateDatetime = updateDatetime; + return this; + } + + /** + * 削除フラグ を取得する + */ + public Integer getDeleteFlag() { + return this.deleteFlag; + } + /** + * 削除フラグ を設定する + * @param deleteFlag 削除フラグ + */ + public GenKnowledgeEditUsersEntity setDeleteFlag(Integer deleteFlag) { + this.deleteFlag = deleteFlag; + return this; + } + + /** + * キーの値を取得 + */ + public Object[] getKeyValues() { + Object[] keyValues = new Object[2]; + keyValues[0] = this.knowledgeId; + keyValues[1] = this.userId; + return keyValues; + } + /** + * キーの値を設定 + * @param knowledgeId ナレッジID + * @param userId USER_ID + */ + public void setKeyValues(Long knowledgeId, Integer userId) { + this.knowledgeId = knowledgeId; + this.userId = userId; + } + /** + * キーで比較 + */ + public boolean equalsOnKey(GenKnowledgeEditUsersEntity 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("knowledgeId = ").append(knowledgeId).append("\n"); + builder.append("userId = ").append(userId).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.REQUIRED); + error = validator.validate(this.knowledgeId, convLabelName("Knowledge Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.REQUIRED); + error = validator.validate(this.userId, convLabelName("User Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.INTEGER); + error = validator.validate(this.userId, convLabelName("User Id")); + 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.REQUIRED); + error = validator.validate(values.get("knowledgeId"), convLabelName("Knowledge Id")); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.REQUIRED); + error = validator.validate(values.get("userId"), convLabelName("User Id")); + if (error != null) { + errors.add(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.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/org/support/project/knowledge/logic/DataTransferLogic.java b/src/main/java/org/support/project/knowledge/logic/DataTransferLogic.java index 4565b02a3..8c7b41825 100644 --- a/src/main/java/org/support/project/knowledge/logic/DataTransferLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/DataTransferLogic.java @@ -255,8 +255,10 @@ public void finishTransfer() { public void backupAndInitH2() throws IOException { AppConfig appConfig = AppConfig.get(); Path source = Paths.get(appConfig.getDatabasePath()); - Path target = Paths.get(appConfig.getBasePath() + "/db_" + DateUtils.TRANSFER_DATETIME.format(new Date())); - Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); + if (Files.exists(source)) { + Path target = Paths.get(appConfig.getBasePath() + "/db_" + DateUtils.TRANSFER_DATETIME.format(new Date())); + Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); + } } } diff --git a/src/main/java/org/support/project/knowledge/logic/GroupLogic.java b/src/main/java/org/support/project/knowledge/logic/GroupLogic.java index 2600ecc61..812ddcc7f 100644 --- a/src/main/java/org/support/project/knowledge/logic/GroupLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/GroupLogic.java @@ -13,7 +13,7 @@ import org.support.project.knowledge.dao.TargetsDao; import org.support.project.knowledge.entity.KnowledgeGroupsEntity; import org.support.project.knowledge.vo.GroupUser; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; import org.support.project.web.bean.LoginedUser; import org.support.project.web.config.CommonWebParameter; import org.support.project.web.dao.GroupsDao; diff --git a/src/main/java/org/support/project/knowledge/logic/KnowledgeLogic.java b/src/main/java/org/support/project/knowledge/logic/KnowledgeLogic.java index 8c419fe66..4b0f3f4cc 100644 --- a/src/main/java/org/support/project/knowledge/logic/KnowledgeLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/KnowledgeLogic.java @@ -17,6 +17,8 @@ import org.support.project.knowledge.bat.FileParseBat; import org.support.project.knowledge.config.IndexType; import org.support.project.knowledge.dao.CommentsDao; +import org.support.project.knowledge.dao.KnowledgeEditGroupsDao; +import org.support.project.knowledge.dao.KnowledgeEditUsersDao; import org.support.project.knowledge.dao.KnowledgeFilesDao; import org.support.project.knowledge.dao.KnowledgeGroupsDao; import org.support.project.knowledge.dao.KnowledgeHistoriesDao; @@ -27,6 +29,8 @@ import org.support.project.knowledge.dao.TagsDao; import org.support.project.knowledge.dao.ViewHistoriesDao; import org.support.project.knowledge.entity.CommentsEntity; +import org.support.project.knowledge.entity.KnowledgeEditGroupsEntity; +import org.support.project.knowledge.entity.KnowledgeEditUsersEntity; import org.support.project.knowledge.entity.KnowledgeFilesEntity; import org.support.project.knowledge.entity.KnowledgeGroupsEntity; import org.support.project.knowledge.entity.KnowledgeHistoriesEntity; @@ -39,7 +43,7 @@ import org.support.project.knowledge.indexer.IndexingValue; import org.support.project.knowledge.searcher.SearchResultValue; import org.support.project.knowledge.searcher.SearchingValue; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; import org.support.project.web.bean.LoginedUser; import org.support.project.web.entity.GroupsEntity; @@ -107,17 +111,21 @@ public List manegeTags(String tags) { * @param entity * @param tags * @param fileNos + * @param editors * @param groups * @param loginedUser * @return * @throws Exception */ @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) - public KnowledgesEntity insert(KnowledgesEntity entity, List tags, List fileNos, List targets, LoginedUser loginedUser) throws Exception { + public KnowledgesEntity insert(KnowledgesEntity entity, List tags, List fileNos, + List targets, List editors, LoginedUser loginedUser) throws Exception { // ナレッジを登録 entity = knowledgesDao.insert(entity); // アクセス権を登録 saveAccessUser(entity, loginedUser, targets); + // 編集権を登録 + saveEditorsUser(entity, loginedUser, editors); // タグを登録 setTags(entity, tags); @@ -140,16 +148,19 @@ public KnowledgesEntity insert(KnowledgesEntity entity, List tags, L } + /** * ナレッジを更新 * @param entity * @param fileNos + * @param editors * @param loginedUser * @return * @throws Exception */ @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) - public KnowledgesEntity update(KnowledgesEntity entity, List tags, List fileNos, List targets, LoginedUser loginedUser) throws Exception { + public KnowledgesEntity update(KnowledgesEntity entity, List tags, List fileNos, + List targets, List editors, LoginedUser loginedUser) throws Exception { // ナレッッジを更新 entity = knowledgesDao.update(entity); // ユーザのアクセス権を解除 @@ -157,8 +168,17 @@ public KnowledgesEntity update(KnowledgesEntity entity, List tags, L // グループとナレッジのヒモ付を解除 GroupLogic groupLogic = GroupLogic.get(); groupLogic.removeKnowledgeGroup(entity.getKnowledgeId()); + // 編集権限を削除 + KnowledgeEditUsersDao editUsersDao = KnowledgeEditUsersDao.get(); + KnowledgeEditGroupsDao editGroupsDao = KnowledgeEditGroupsDao.get(); + editUsersDao.deleteOnKnowledgeId(entity.getKnowledgeId()); + editGroupsDao.deleteOnKnowledgeId(entity.getKnowledgeId()); + + // アクセス権を登録 saveAccessUser(entity, loginedUser, targets); + // 編集権を登録 + saveEditorsUser(entity, loginedUser, editors); // タグを登録 knowledgeTagsDao.deleteOnKnowledgeId(entity.getKnowledgeId()); @@ -182,6 +202,7 @@ public KnowledgesEntity update(KnowledgesEntity entity, List tags, L return entity; } + /** * ナレッジの更新履歴を登録 * @param entity @@ -212,7 +233,49 @@ private void setTags(KnowledgesEntity entity, List tags) { } } } - + /** + * 編集権限を登録 + * @param entity + * @param loginedUser + * @param editors + */ + private void saveEditorsUser(KnowledgesEntity entity, LoginedUser loginedUser, List editors) { + KnowledgeEditUsersDao editUsersDao = KnowledgeEditUsersDao.get(); + KnowledgeEditGroupsDao editGroupsDao = KnowledgeEditGroupsDao.get(); + + // ナレッジにアクセス可能なユーザに、自分自身をセット + KnowledgeEditUsersEntity editUsersEntity = new KnowledgeEditUsersEntity(); + editUsersEntity.setKnowledgeId(entity.getKnowledgeId()); + editUsersEntity.setUserId(loginedUser.getLoginUser().getUserId()); + editUsersDao.save(editUsersEntity); + + // 編集権限を設定 + if (editors != null && !editors.isEmpty()) { + for (int i = 0; i < editors.size(); i++) { + LabelValue labelValue = editors.get(i); + + Integer id = TargetLogic.get().getGroupId(labelValue.getValue()); + if (id != Integer.MIN_VALUE) { + KnowledgeEditGroupsEntity editGroupsEntity = new KnowledgeEditGroupsEntity(); + editGroupsEntity.setKnowledgeId(entity.getKnowledgeId()); + editGroupsEntity.setGroupId(id); + editGroupsDao.save(editGroupsEntity); + } else { + id = TargetLogic.get().getUserId(labelValue.getValue()); + if (id != Integer.MIN_VALUE + && loginedUser.getUserId().intValue() != id.intValue() + && ALL_USER != id.intValue() + ) { + editUsersEntity = new KnowledgeEditUsersEntity(); + editUsersEntity.setKnowledgeId(entity.getKnowledgeId()); + editUsersEntity.setUserId(id); + editUsersDao.save(editUsersEntity); + } + } + } + } + } + /** * アクセス権を登録 @@ -724,6 +787,7 @@ public void delete(Long knowledgeId, LoginedUser loginedUser) throws Exception { // アクセス権削除 knowledgeUsersDao.deleteOnKnowledgeId(knowledgeId); + // タグを削除 knowledgeTagsDao.deleteOnKnowledgeId(knowledgeId); @@ -733,6 +797,12 @@ public void delete(Long knowledgeId, LoginedUser loginedUser) throws Exception { // ナレッジにアクセス可能なグループ削除 GroupLogic.get().removeKnowledgeGroup(knowledgeId); + // 編集権限を削除 + KnowledgeEditUsersDao editUsersDao = KnowledgeEditUsersDao.get(); + KnowledgeEditGroupsDao editGroupsDao = KnowledgeEditGroupsDao.get(); + editUsersDao.deleteOnKnowledgeId(knowledgeId); + editGroupsDao.deleteOnKnowledgeId(knowledgeId); + //全文検索エンジンから削除 IndexLogic indexLogic = IndexLogic.get(); indexLogic.delete(knowledgeId); @@ -945,4 +1015,43 @@ public void reindexing(KnowledgesEntity knowledgesEntity) throws Exception { } } + /** + * ナレッジに対し編集権限があるかチェック + * @param loginedUser + * @param entity + * @param editors + * @return + */ + public boolean isEditor(LoginedUser loginedUser, KnowledgesEntity entity, List editors) { + if (loginedUser == null) { + // ログインしていないユーザに編集権限は無し + return false; + } + if (loginedUser.isAdmin()) { + return true; + } else { + for (LabelValue labelValue : editors) { + Integer id = TargetLogic.get().getGroupId(labelValue.getValue()); + if (id != Integer.MIN_VALUE) { + List groups = loginedUser.getGroups(); + if (groups != null) { + for (GroupsEntity groupsEntity : groups) { + if (groupsEntity.getGroupId().intValue() == id.intValue()) { + return true; + } + } + } + } else { + id = TargetLogic.get().getUserId(labelValue.getValue()); + if (id != Integer.MIN_VALUE) { + if (id.intValue() == loginedUser.getUserId().intValue()) { + return true; + } + } + } + } + } + return false; + } + } diff --git a/src/main/java/org/support/project/knowledge/logic/TargetLogic.java b/src/main/java/org/support/project/knowledge/logic/TargetLogic.java index 9b1151902..b8abe9da9 100644 --- a/src/main/java/org/support/project/knowledge/logic/TargetLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/TargetLogic.java @@ -8,7 +8,7 @@ import org.support.project.common.util.StringUtils; import org.support.project.di.Container; import org.support.project.knowledge.dao.TargetsDao; -import org.support.project.knowledge.vo.LabelValue; +import org.support.project.web.bean.LabelValue; import org.support.project.web.bean.LoginedUser; import org.support.project.web.dao.GroupsDao; import org.support.project.web.dao.UsersDao; @@ -105,6 +105,30 @@ public List selectTargetsOnKnowledgeId(Long knowledgeId) { return results; } + /** + * ナレッジに指定されている編集可能なグループを取得 + * @param knowledgeId + * @return + */ + public List selectEditorsOnKnowledgeId(Long knowledgeId) { + List results = new ArrayList<>(); + TargetsDao targetsDao = TargetsDao.get(); + List groups = targetsDao.selectEditorGroupsOnKnowledgeId(knowledgeId); + for (GroupsEntity groupsEntity : groups) { + LabelValue labelValue = new LabelValue(); + labelValue.setLabel(NAME_PREFIX_GROUP + groupsEntity.getGroupName()); + labelValue.setValue(ID_PREFIX_GROUP + groupsEntity.getGroupId()); + results.add(labelValue); + } + List users = targetsDao.selectEditorUsersOnKnowledgeId(knowledgeId); + for (UsersEntity usersEntity : users) { + LabelValue labelValue = new LabelValue(); + labelValue.setLabel(NAME_PREFIX_USER + usersEntity.getUserName()); + labelValue.setValue(ID_PREFIX_USER + usersEntity.getUserId()); + results.add(labelValue); + } + return results; + } /** @@ -141,4 +165,5 @@ public Integer getUserId(String str) { return Integer.MIN_VALUE; } + } diff --git a/src/main/java/org/support/project/knowledge/vo/LabelValue.java b/src/main/java/org/support/project/knowledge/vo/LabelValue.java deleted file mode 100644 index e394d94fb..000000000 --- a/src/main/java/org/support/project/knowledge/vo/LabelValue.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.support.project.knowledge.vo; - -public class LabelValue { - /** 表示する値 */ - private String label; - /** 実際の値 */ - private String value; - /** - * @return the label - */ - public String getLabel() { - return label; - } - /** - * @param label the label to set - */ - public void setLabel(String label) { - this.label = label; - } - /** - * @return the value - */ - public String getValue() { - return value; - } - /** - * @param value the value to set - */ - public void setValue(String value) { - this.value = value; - } - -} diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index 7dd07fa04..7fc9db021 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -53,7 +53,7 @@ message.allready.updated=Allready updated. message.allready.started=Allready started. # Common Label -label.version=0.5.2 pre1 +label.version=0.5.2 pre2 label.login=Sign in label.previous = Previous label.next=Next @@ -94,9 +94,9 @@ label.protect.view= [Protection] label.private.view= [Private] # Label -knowledge.header.meta.title=Knowledge - フリーの情報共有サービス -knowledge.header.meta.description=Knowledgeはオープンソースの無料で利用できる情報共有の仕組みです。 -knowledge.title=Knowledge - Free Knowledge Management System +knowledge.header.meta.title=Knowledge - Free knowledge base system +knowledge.header.meta.description=Knowledge - Free knowledge base system +knowledge.title=Knowledge - Free knowledge base system knowledge.navbar.title=Knowledge knowledge.navbar.config=Config knowledge.navbar.config.admin=Admin @@ -146,7 +146,7 @@ knowledge.auth.msg.changed=The password I have been initialized. Please try to s knowledge.auth.label.back.top=Back to Top knowledge.top.description=Knowledge is a free information sharing service of open source -knowledge.top.use.button=Show knowledges +knowledge.top.use.button=Get Started! knowledge.top.features.title=#### Features knowledge.top.features.1=- Information registered in the Markdown syntax knowledge.top.features.2=- I can find the desired information in the full-text search on the title / text of the article @@ -154,6 +154,23 @@ knowledge.top.features.3=- I gives you the flexibility to specify the public ran knowledge.top.features.4=- With a tag that was attached to the information, I can manage the information of the type knowledge.top.features.5=- I can register the attachment knowledge.top.features.6=- I can also search in the contents of the attachments +knowledge.top.about=About Knowledge +knowledge.top.about.title.1=Free +knowledge.top.about.description.1=Service is free. This is open source. +knowledge.top.about.title.2=Easy set up +knowledge.top.about.description.2=Easy setup of just put the downloaded file. +knowledge.top.about.title.3=Mobile +knowledge.top.about.description.3=It is corresponding to the display of the PC and mobile and tablet. +knowledge.top.about.title.4=Nimble editing +knowledge.top.about.description.4=You will edit lightly in Markdown. the registered content, you can specify whether to publish to anyone. +knowledge.top.about.title.5=Find +knowledge.top.about.description.5=Desired information is found in the "Keyword Search" which Tenare.
also you can also grouping by the tag. +knowledge.top.about.title.6=Notification +knowledge.top.about.description.6=Information of registration, to inform you of events such as the evaluation and comments in the "e-mail" or "desktop notifications". +knowledge.top.about.title.7=Attach File +knowledge.top.about.description.7=It will treat the attachment. Since also extract content that is written in the
file, you will be able to search in the contents. +knowledge.top.about.title.8=Social +knowledge.top.about.description.8=Comments of the exchange, it will activate the communication in such registration of evaluation. knowledge.list.title= Knowledge List knowledge.list.empty=Information corresponding to the conditions did not exist. Conditions (search keyword, tag, page switching) Please try to change the. @@ -187,6 +204,8 @@ knowledge.add.label.public.class.protect=Protection (select targets) knowledge.add.label.tags=Tags knowledge.add.label.groups=Targets knowledge.add.label.groups.select=Select Targets +knowledge.add.label.editors=Editors +knowledge.add.label.editors.select=Select Editors knowledge.edit.title=Edit Knowledge knowledge.edit.label.key=No / Date knowledge.edit.label.uploaded=Uploaded. @@ -194,18 +213,18 @@ knowledge.edit.label.fail.upload=Upload failed. knowledge.edit.label.delete.upload=Remove file knowledge.edit.label.fail.delete.upload=Fail remove file knowledge.edit.label.confirm.delete=Are you sure you want to delete? -knowledge.edit.noaccess=It is not possible to edit other than those that have registered their +knowledge.edit.noaccess=You can't edit this knowledge knowledge.delete.none=Knowledge to be deleted is not specified knowledge.likes.title=User list that was me press the "Like" knowledge.likes.list.label.empty=In this page, the user presses the "Like" did not have knowledge.likes.anonymous=Anonymous (not sign in user) -knowledge.histories.title=更新履歴 -knowledge.histories.list.label.empty=データが存在しません。 -knowledge.histories.label.diff=現在との差分 -knowledge.histories.label.history=過去のナレッジの内容 -knowledge.histories.label.now=現在のナレッジの内容 +knowledge.histories.title=History +knowledge.histories.list.label.empty=Empty +knowledge.histories.label.diff=Diff +knowledge.histories.label.history=Old content +knowledge.histories.label.now=Now content knowledge.signup.title=Sign Up knowledge.signup.label.mail=Mail Address (will at the time of signin ID and / There is no published is that) @@ -386,12 +405,12 @@ knowledge.notify.msg.desktop.to.comment=Comment has been posted on knowledge {1} knowledge.notify.msg.desktop.stoke.update=Knowledge {1} that stock has been updated knowledge.notify.msg.desktop.stoke.comment=Comment has been posted on knowledge {1} that stock -knowledge.export.title=データをエクスポート -knowledge.export.msg1=データをエクスポートします。(zip形式でダウンロード) -knowledge.export.msg2=エクスポートデータを作成する処理は、登録されているデータの量により、時間がかかります。 -knowledge.export.msg3=このため、エクスポートを実行した後、ダウンロードまでしばらくお待ちください。 -knowledge.export.msg.start=エクスポートデータを生成しています。 -knowledge.export.msg.end=エクスポートデータの生成が完了しました。 +knowledge.export.title=Export +knowledge.export.msg1=Export(zip) +knowledge.export.msg2=This process will take a long time +knowledge.export.msg3=After the execution, Please wait +knowledge.export.msg.start=We have to generate the export data. +knowledge.export.msg.end=Generation of export data has been completed. diff --git a/src/main/resources/appresource_ja.properties b/src/main/resources/appresource_ja.properties index 04413ba4b..12cc4a244 100644 --- a/src/main/resources/appresource_ja.properties +++ b/src/main/resources/appresource_ja.properties @@ -53,7 +53,7 @@ message.allready.updated=すでに更新されています message.allready.started=すでに開始済です # Common Label -label.version=0.5.2 pre1 +label.version=0.5.2 pre2 label.login=サインイン label.previous = 前へ label.next = 次へ @@ -94,9 +94,9 @@ label.protect.view= [保護] label.private.view= [非公開] # Label -knowledge.header.meta.title=Knowledge - フリーの情報共有サービス -knowledge.header.meta.description=Knowledgeはオープンソースの無料で利用できる情報共有の仕組みです。 -knowledge.title=Knowledge - フリーの情報共有サービス +knowledge.header.meta.title=Knowledge - オープンソースのナレッジベース +knowledge.header.meta.description=Knowledgeはオープンソースのナレッジベースです。無料で利用できます。 +knowledge.title=Knowledge - Free knowledge base system knowledge.navbar.title=Knowledge knowledge.navbar.config=設定 knowledge.navbar.config.admin=管理者設定 @@ -146,7 +146,7 @@ knowledge.auth.msg.changed=パスワードを初期化しました。サイン knowledge.auth.label.back.top=Topへ戻る knowledge.top.description=Knowledgeはオープンソースのフリーな情報共有サービスです -knowledge.top.use.button=Show knowledges +knowledge.top.use.button=Get Started! knowledge.top.features.title=#### 特徴 knowledge.top.features.1=- Markdown記法で情報登録 knowledge.top.features.2=- 検索で目的の情報を探せます @@ -154,6 +154,23 @@ knowledge.top.features.3=- 情報の公開範囲を[自分だけ、チーム、 knowledge.top.features.4=- 情報に付けたタグで、情報の種別の管理を行えます knowledge.top.features.5=- 添付ファイルを登録でき、中身に書かれた内容でも検索出来るようになります knowledge.top.features.6=- 投稿があった場合に通知を送ることもできます +knowledge.top.about=About Knowledge +knowledge.top.about.title.1=完全無料 +knowledge.top.about.description.1=ご利用は無料です。
ソースコードは公開しています。 +knowledge.top.about.title.2=簡単セットアップ +knowledge.top.about.description.2=ダウンロードしたファイルを置くだけの簡単セットアップ。 +knowledge.top.about.title.3=スマフォ対応 +knowledge.top.about.description.3=PC、スマフォ、タブレットでの表示に対応しています。 +knowledge.top.about.title.4=軽快な編集 +knowledge.top.about.description.4=Markdown記法で軽快に編集します。
登録した内容を、誰に公開するか指定可能です。 +knowledge.top.about.title.5=情報が見つかる +knowledge.top.about.description.5=手慣れた「キーワード検索」で欲しい情報が見つかります。
またタグによるグルーピングも出来ます。 +knowledge.top.about.title.6=見逃さない +knowledge.top.about.description.6=情報の登録、評価やコメントなどのイベントを「メール」や「デスクトップ通知」でお知らせします。 +knowledge.top.about.title.7=添付ファイル +knowledge.top.about.description.7=添付ファイルを扱います。
ファイルの中に書いてある内容も抽出するので、中身で検索出来るようになります。 +knowledge.top.about.title.8=ソーシャル +knowledge.top.about.description.8=コメントのやりとり、評価の登録などでコミュニケーションを活性化します。 knowledge.list.title= ナレッジ一覧 knowledge.list.empty=条件に該当する情報は存在しませんでした。条件(検索キーワード、タグ、ページきりかえ)の変更をお試しください。 @@ -187,6 +204,8 @@ knowledge.add.label.public.class.protect=保護(公開先を選択) knowledge.add.label.tags=タグ knowledge.add.label.groups=公開先 knowledge.add.label.groups.select=公開先を選択 +knowledge.add.label.editors=共同で編集する +knowledge.add.label.editors.select=共同編集者を選択 knowledge.edit.title=ナレッジを更新 knowledge.edit.label.key=番号 / 更新日 knowledge.edit.label.uploaded=ファイルをアップロードしました @@ -194,7 +213,7 @@ knowledge.edit.label.fail.upload=アップロードに失敗したファイル knowledge.edit.label.delete.upload=ファイルを削除しました knowledge.edit.label.fail.delete.upload=ファイルの削除に失敗しました knowledge.edit.label.confirm.delete=本当に削除しますか? -knowledge.edit.noaccess=自分で登録したもの以外は編集出来ません +knowledge.edit.noaccess=編集権限がありません knowledge.delete.none=削除するナレッジが指定されていません knowledge.likes.title=参考になったを押してくれたユーザ一覧 diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_delete.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_delete.sql new file mode 100644 index 000000000..de35dc460 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_delete.sql @@ -0,0 +1,5 @@ +DELETE FROM KNOWLEDGE_EDIT_GROUPS +WHERE +GROUP_ID = ? + AND KNOWLEDGE_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_insert.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_insert.sql new file mode 100644 index 000000000..53e4da6aa --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_insert.sql @@ -0,0 +1,18 @@ +INSERT INTO KNOWLEDGE_EDIT_GROUPS +( +GROUP_ID + , KNOWLEDGE_ID + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_all.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_all.sql new file mode 100644 index 000000000..17ab7483a --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_all.sql @@ -0,0 +1 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_group_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_group_id.sql new file mode 100644 index 000000000..280ea63f4 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_group_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +GROUP_ID = ? +; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_key.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_key.sql new file mode 100644 index 000000000..ec8edfd5a --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_key.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +GROUP_ID = ? + AND KNOWLEDGE_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_knowledge_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_knowledge_id.sql new file mode 100644 index 000000000..7c3856ee3 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_physical_select_on_knowledge_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +KNOWLEDGE_ID = ? +; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_raw_insert.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_raw_insert.sql new file mode 100644 index 000000000..53e4da6aa --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_raw_insert.sql @@ -0,0 +1,18 @@ +INSERT INTO KNOWLEDGE_EDIT_GROUPS +( +GROUP_ID + , KNOWLEDGE_ID + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_all.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_all.sql new file mode 100644 index 000000000..22975dda6 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_all.sql @@ -0,0 +1,2 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE DELETE_FLAG = 0; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_group_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_group_id.sql new file mode 100644 index 000000000..f74943871 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_group_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +GROUP_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_key.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_key.sql new file mode 100644 index 000000000..efe6c80a7 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_key.sql @@ -0,0 +1,6 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +GROUP_ID = ? + AND KNOWLEDGE_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_knowledge_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_knowledge_id.sql new file mode 100644 index 000000000..918f89781 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_select_on_knowledge_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_GROUPS + WHERE +KNOWLEDGE_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_update.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_update.sql new file mode 100644 index 000000000..e9f0e5b4b --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditGroupsDao/KnowledgeEditGroupsDao_update.sql @@ -0,0 +1,11 @@ +UPDATE KNOWLEDGE_EDIT_GROUPS +SET + INSERT_USER = ? + , INSERT_DATETIME = ? + , UPDATE_USER = ? + , UPDATE_DATETIME = ? + , DELETE_FLAG = ? +WHERE +GROUP_ID = ? + AND KNOWLEDGE_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_delete.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_delete.sql new file mode 100644 index 000000000..0de36bf1d --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_delete.sql @@ -0,0 +1,5 @@ +DELETE FROM KNOWLEDGE_EDIT_USERS +WHERE +KNOWLEDGE_ID = ? + AND USER_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_insert.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_insert.sql new file mode 100644 index 000000000..d727cbd91 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_insert.sql @@ -0,0 +1,18 @@ +INSERT INTO KNOWLEDGE_EDIT_USERS +( +KNOWLEDGE_ID + , USER_ID + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_all.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_all.sql new file mode 100644 index 000000000..dc25a15eb --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_all.sql @@ -0,0 +1 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_key.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_key.sql new file mode 100644 index 000000000..4afee38c1 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_key.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +KNOWLEDGE_ID = ? + AND USER_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_knowledge_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_knowledge_id.sql new file mode 100644 index 000000000..c7c65809c --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_knowledge_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +KNOWLEDGE_ID = ? +; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_user_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_user_id.sql new file mode 100644 index 000000000..de2daa31e --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_physical_select_on_user_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +USER_ID = ? +; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_raw_insert.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_raw_insert.sql new file mode 100644 index 000000000..d727cbd91 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_raw_insert.sql @@ -0,0 +1,18 @@ +INSERT INTO KNOWLEDGE_EDIT_USERS +( +KNOWLEDGE_ID + , USER_ID + , INSERT_USER + , INSERT_DATETIME + , UPDATE_USER + , UPDATE_DATETIME + , DELETE_FLAG +) VALUES ( +? + , ? + , ? + , ? + , ? + , ? + , ? +); diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_all.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_all.sql new file mode 100644 index 000000000..f5c9a6702 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_all.sql @@ -0,0 +1,2 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE DELETE_FLAG = 0; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_key.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_key.sql new file mode 100644 index 000000000..8d7aa9bcf --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_key.sql @@ -0,0 +1,6 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +KNOWLEDGE_ID = ? + AND USER_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_knowledge_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_knowledge_id.sql new file mode 100644 index 000000000..12775097c --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_knowledge_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +KNOWLEDGE_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_user_id.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_user_id.sql new file mode 100644 index 000000000..7c917adf2 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_select_on_user_id.sql @@ -0,0 +1,5 @@ +SELECT * FROM KNOWLEDGE_EDIT_USERS + WHERE +USER_ID = ? + AND DELETE_FLAG = 0; +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_update.sql b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_update.sql new file mode 100644 index 000000000..f3503a9fc --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/KnowledgeEditUsersDao/KnowledgeEditUsersDao_update.sql @@ -0,0 +1,11 @@ +UPDATE KNOWLEDGE_EDIT_USERS +SET + INSERT_USER = ? + , INSERT_DATETIME = ? + , UPDATE_USER = ? + , UPDATE_DATETIME = ? + , DELETE_FLAG = ? +WHERE +KNOWLEDGE_ID = ? + AND USER_ID = ? +; diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorGroupsOnKnowledgeId.sql b/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorGroupsOnKnowledgeId.sql new file mode 100644 index 000000000..bc71d5c5a --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorGroupsOnKnowledgeId.sql @@ -0,0 +1,4 @@ +SELECT * FROM GROUPS +INNER JOIN KNOWLEDGE_EDIT_GROUPS ON GROUPS.GROUP_ID = KNOWLEDGE_EDIT_GROUPS.GROUP_ID +WHERE KNOWLEDGE_EDIT_GROUPS.KNOWLEDGE_ID = ? +ORDER BY GROUPS.GROUP_ID diff --git a/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorUsersOnKnowledgeId.sql b/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorUsersOnKnowledgeId.sql new file mode 100644 index 000000000..349b65fa2 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/dao/sql/TargetsDao/selectEditorUsersOnKnowledgeId.sql @@ -0,0 +1,4 @@ +SELECT * FROM USERS +INNER JOIN KNOWLEDGE_EDIT_USERS ON USERS.USER_ID = KNOWLEDGE_EDIT_USERS.USER_ID +WHERE KNOWLEDGE_EDIT_USERS.KNOWLEDGE_ID = ? +ORDER BY USERS.USER_ID diff --git a/src/main/resources/org/support/project/knowledge/database/ddl.sql b/src/main/resources/org/support/project/knowledge/database/ddl.sql index 67990285c..90b79a613 100644 --- a/src/main/resources/org/support/project/knowledge/database/ddl.sql +++ b/src/main/resources/org/support/project/knowledge/database/ddl.sql @@ -1,3 +1,31 @@ +-- 編集可能なグループ +drop table if exists KNOWLEDGE_EDIT_GROUPS cascade; + +create table KNOWLEDGE_EDIT_GROUPS ( + KNOWLEDGE_ID bigint not null + , GROUP_ID integer not null + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint KNOWLEDGE_EDIT_GROUPS_PKC primary key (KNOWLEDGE_ID,GROUP_ID) +) ; + +-- 編集可能なユーザ +drop table if exists KNOWLEDGE_EDIT_USERS cascade; + +create table KNOWLEDGE_EDIT_USERS ( + KNOWLEDGE_ID bigint not null + , USER_ID integer not null + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint KNOWLEDGE_EDIT_USERS_PKC primary key (KNOWLEDGE_ID,USER_ID) +) ; + -- ナレッジ更新履歴 drop table if exists KNOWLEDGE_HISTORIES cascade; @@ -263,6 +291,24 @@ create table KNOWLEDGES ( , constraint KNOWLEDGES_PKC primary key (KNOWLEDGE_ID) ) ; +comment on table KNOWLEDGE_EDIT_GROUPS is '編集可能なグループ'; +comment on column KNOWLEDGE_EDIT_GROUPS.KNOWLEDGE_ID is 'ナレッジID'; +comment on column KNOWLEDGE_EDIT_GROUPS.GROUP_ID is 'GROUP_ID'; +comment on column KNOWLEDGE_EDIT_GROUPS.INSERT_USER is '登録ユーザ'; +comment on column KNOWLEDGE_EDIT_GROUPS.INSERT_DATETIME is '登録日時'; +comment on column KNOWLEDGE_EDIT_GROUPS.UPDATE_USER is '更新ユーザ'; +comment on column KNOWLEDGE_EDIT_GROUPS.UPDATE_DATETIME is '更新日時'; +comment on column KNOWLEDGE_EDIT_GROUPS.DELETE_FLAG is '削除フラグ'; + +comment on table KNOWLEDGE_EDIT_USERS is '編集可能なユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.KNOWLEDGE_ID is 'ナレッジID'; +comment on column KNOWLEDGE_EDIT_USERS.USER_ID is 'USER_ID'; +comment on column KNOWLEDGE_EDIT_USERS.INSERT_USER is '登録ユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.INSERT_DATETIME is '登録日時'; +comment on column KNOWLEDGE_EDIT_USERS.UPDATE_USER is '更新ユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.UPDATE_DATETIME is '更新日時'; +comment on column KNOWLEDGE_EDIT_USERS.DELETE_FLAG is '削除フラグ'; + comment on table KNOWLEDGE_HISTORIES is 'ナレッジ更新履歴'; comment on column KNOWLEDGE_HISTORIES.KNOWLEDGE_ID is 'ナレッジID'; comment on column KNOWLEDGE_HISTORIES.HISTORY_NO is '履歴番号'; diff --git a/src/main/resources/org/support/project/knowledge/deploy/v0_5_2pre2/migrate.sql b/src/main/resources/org/support/project/knowledge/deploy/v0_5_2pre2/migrate.sql new file mode 100644 index 000000000..f0377eefc --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/deploy/v0_5_2pre2/migrate.sql @@ -0,0 +1,47 @@ +-- 編集可能なグループ +drop table if exists KNOWLEDGE_EDIT_GROUPS cascade; + +create table KNOWLEDGE_EDIT_GROUPS ( + KNOWLEDGE_ID bigint not null + , GROUP_ID integer not null + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint KNOWLEDGE_EDIT_GROUPS_PKC primary key (KNOWLEDGE_ID,GROUP_ID) +) ; + +-- 編集可能なユーザ +drop table if exists KNOWLEDGE_EDIT_USERS cascade; + +create table KNOWLEDGE_EDIT_USERS ( + KNOWLEDGE_ID bigint not null + , USER_ID integer not null + , INSERT_USER integer + , INSERT_DATETIME timestamp + , UPDATE_USER integer + , UPDATE_DATETIME timestamp + , DELETE_FLAG integer + , constraint KNOWLEDGE_EDIT_USERS_PKC primary key (KNOWLEDGE_ID,USER_ID) +) ; + + +comment on table KNOWLEDGE_EDIT_GROUPS is '編集可能なグループ'; +comment on column KNOWLEDGE_EDIT_GROUPS.KNOWLEDGE_ID is 'ナレッジID'; +comment on column KNOWLEDGE_EDIT_GROUPS.GROUP_ID is 'GROUP_ID'; +comment on column KNOWLEDGE_EDIT_GROUPS.INSERT_USER is '登録ユーザ'; +comment on column KNOWLEDGE_EDIT_GROUPS.INSERT_DATETIME is '登録日時'; +comment on column KNOWLEDGE_EDIT_GROUPS.UPDATE_USER is '更新ユーザ'; +comment on column KNOWLEDGE_EDIT_GROUPS.UPDATE_DATETIME is '更新日時'; +comment on column KNOWLEDGE_EDIT_GROUPS.DELETE_FLAG is '削除フラグ'; + +comment on table KNOWLEDGE_EDIT_USERS is '編集可能なユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.KNOWLEDGE_ID is 'ナレッジID'; +comment on column KNOWLEDGE_EDIT_USERS.USER_ID is 'USER_ID'; +comment on column KNOWLEDGE_EDIT_USERS.INSERT_USER is '登録ユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.INSERT_DATETIME is '登録日時'; +comment on column KNOWLEDGE_EDIT_USERS.UPDATE_USER is '更新ユーザ'; +comment on column KNOWLEDGE_EDIT_USERS.UPDATE_DATETIME is '更新日時'; +comment on column KNOWLEDGE_EDIT_USERS.DELETE_FLAG is '削除フラグ'; + 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 bfa97574a..09cb73842 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp @@ -1,4 +1,4 @@ -<%@page import="org.support.project.knowledge.vo.LabelValue"%> +<%@page import="org.support.project.web.bean.LabelValue"%> <%@page import="java.util.List"%> <%@page import="org.support.project.knowledge.config.AppConfig"%> <%@page import="org.support.project.web.util.JspUtil"%> @@ -82,7 +82,7 @@ for (LabelValue language : languages) { %>
  • - +  <%= language.getLabel() %>
  • diff --git a/src/main/webapp/WEB-INF/views/commons/layout/layoutMain.jsp b/src/main/webapp/WEB-INF/views/commons/layout/layoutMain.jsp index 8108bb1ed..1057eadbf 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/layoutMain.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/layoutMain.jsp @@ -45,7 +45,6 @@
    ${param.PARAM_CONTENT} -<% jspUtil.debug(); %>
    diff --git a/src/main/webapp/WEB-INF/views/commons/layout/layoutTop.jsp b/src/main/webapp/WEB-INF/views/commons/layout/layoutTop.jsp new file mode 100644 index 000000000..c8fb6cc6f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/commons/layout/layoutTop.jsp @@ -0,0 +1,73 @@ +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false" errorPage="/WEB-INF/views/commons/errors/jsp_error.jsp"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + +<%-- 後からヘッダー部に何か追加する場合のパラメータ --%> + + ${param.PARAM_HEAD} + + + +<c:if test="${param.PARAM_PAGE_TITLE != null}"> + ${param.PARAM_PAGE_TITLE} +</c:if> +<c:if test="${param.PARAM_PAGE_TITLE == null}"> + <%= jspUtil.label("knowledge.title") %> +</c:if> + + +" /> + + + + + + + + +${param.PARAM_CONTENT} + + + + + + + + + + +${param.PARAM_SCRIPTS} + + + + + + + diff --git a/src/main/webapp/WEB-INF/views/index/index.jsp b/src/main/webapp/WEB-INF/views/index/index.jsp index 12f7a5d51..986b88aee 100644 --- a/src/main/webapp/WEB-INF/views/index/index.jsp +++ b/src/main/webapp/WEB-INF/views/index/index.jsp @@ -1,4 +1,4 @@ -<%@page import="org.support.project.knowledge.vo.LabelValue"%> +<%@page import="org.support.project.web.bean.LabelValue"%> <%@page import="java.util.List"%> <%@page import="org.support.project.knowledge.config.AppConfig"%> <%@page import="org.support.project.web.util.JspUtil"%> @@ -9,215 +9,126 @@ <% JspUtil jspUtil = new JspUtil(request, pageContext); %> - - - - - - -" /> - -<%=jspUtil.label("knowledge.title")%> - -" /> - - - - - - - - - -
    - -
    -

     Knowledge

    -

    Free Knowledge Base System

    -
    - -  <%=jspUtil.label("knowledge.top.use.button")%> - -

    -

    - - <% - AppConfig appConfig = AppConfig.get(); - List languages = appConfig.getLanguages(); - for (LabelValue language : languages) { - %> - - <%= language.getLabel() %> + + + +" /> + + + + + +
    + - - <%-- -
    -

    <%=jspUtil.label("knowledge.top.description")%>

    -
    - --%> - -
    -
    - -
    -<%=jspUtil.label("knowledge.top.features.title")%> -<%=jspUtil.label("knowledge.top.features.1")%> -<%=jspUtil.label("knowledge.top.features.2")%> -<%=jspUtil.label("knowledge.top.features.3")%> -<%=jspUtil.label("knowledge.top.features.4")%> -<%=jspUtil.label("knowledge.top.features.5")%> -<%=jspUtil.label("knowledge.top.features.6")%> - -[-> More Information](https://support-project.org/knowledge_info/index "-> More Information") -
    - - - -
    - - - +
    +
    +
    +
    + About Knowledge +
    <%=jspUtil.label("knowledge.top.description")%>
    +
    +
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.1")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.1")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.2")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.2")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.3")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.3")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.4")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.4")%>
    +
    +
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.5")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.5")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.6")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.6")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.7")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.7")%>
    +
    +
    +
    + +
    +
    <%=jspUtil.label("knowledge.top.about.title.8")%>
    +
    <%=jspUtil.label("knowledge.top.about.description.8")%>
    +
    +
    + +
    + +
    + + + +
    +
    + - - +
    diff --git a/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp b/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp index 56f6f96fd..14317a7e5 100644 --- a/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp +++ b/src/main/webapp/WEB-INF/views/open/knowledge/view.jsp @@ -113,8 +113,7 @@ var LABEL_LIKE = '<%= jspUtil.label("knowledge.view.like") %>';
    <% if (request.getRemoteUser() != null) { - if (request.isUserInRole("admin") - || jspUtil.out("insertUser").equals(request.getRemoteUser())) { %> + if ((boolean) request.getAttribute("edit")) { %> <%= jspUtil.out("params") %>" class="btn btn-primary" role="button">  <%= jspUtil.label("label.edit") %> diff --git a/src/main/webapp/WEB-INF/views/protect/knowledge/view_add.jsp b/src/main/webapp/WEB-INF/views/protect/knowledge/view_add.jsp index f4927cbc0..f223eb02b 100644 --- a/src/main/webapp/WEB-INF/views/protect/knowledge/view_add.jsp +++ b/src/main/webapp/WEB-INF/views/protect/knowledge/view_add.jsp @@ -36,6 +36,9 @@ var _CONFIRM = '<%= jspUtil.label("knowledge.edit.label.confirm.delete") %>'; selectedGroups.push({label: '<%= jspUtil.out("group.label") %>', value: '<%= jspUtil.out("group.value") %>'}); + +selectedEditors.push({label: '<%= jspUtil.out("editor.label") %>', value: '<%= jspUtil.out("editor.value") %>'}); + @@ -133,6 +136,17 @@ selectedGroups.push({label: '<%= jspUtil.out("group.label") %>', value: '<%= jsp

    + + " /> " /> " /> @@ -153,7 +167,54 @@ selectedGroups.push({label: '<%= jspUtil.out("group.label") %>', value: '<%= jsp

    +<%-- Editors --%> + +<%-- Targets --%>