diff --git a/dbflute_fess/freegen/ControlFreeGen.vm b/dbflute_fess/freegen/ControlFreeGen.vm index ce32af659..f2ec8a592 100644 --- a/dbflute_fess/freegen/ControlFreeGen.vm +++ b/dbflute_fess/freegen/ControlFreeGen.vm @@ -44,6 +44,7 @@ $manager.makeDirectory($request.generateDirPath) #end #end #elseif ($request.isResourceTypeElasticsearch()) +#set ($arrayColumnNames = ["groups", "roles"]) #if ($request.requestName.startsWith("Elasticsearch")) ## ## <<< Elasticsearch Schema Gen >>> diff --git a/dbflute_fess/freegen/elasticsearch/AbstractBehavior.vm b/dbflute_fess/freegen/elasticsearch/AbstractBehavior.vm index 6af591915..c9ab942c9 100644 --- a/dbflute_fess/freegen/elasticsearch/AbstractBehavior.vm +++ b/dbflute_fess/freegen/elasticsearch/AbstractBehavior.vm @@ -25,6 +25,7 @@ import org.dbflute.cbean.ConditionBean; import org.dbflute.cbean.coption.CursorSelectOption; import org.dbflute.cbean.result.ListResultBean; import org.dbflute.exception.IllegalBehaviorStateException; +import org.dbflute.util.DfTypeUtil; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -346,6 +347,19 @@ public abstract class AbstractBehavior) value).stream().map(v -> v.toString()).toArray(n -> new String[n]); + } + String str = DfTypeUtil.toString(value); + if (str == null) { + return null; + } + return new String[] { str }; + } + public static class BulkList implements List { private final List parent; diff --git a/dbflute_fess/freegen/elasticsearch/BsBehavior.vm b/dbflute_fess/freegen/elasticsearch/BsBehavior.vm index d387db3ab..35052fac0 100644 --- a/dbflute_fess/freegen/elasticsearch/BsBehavior.vm +++ b/dbflute_fess/freegen/elasticsearch/BsBehavior.vm @@ -58,8 +58,12 @@ public abstract class Bs${table.camelizedName}Bhv extends AbstractBehavior<${tab #foreach ($column in $table.columnList) #if ($column.isNormalColumn) #set ($javaNative = ${column.type}) +#if ($arrayColumnNames.contains($column.name)) + result.set${column.capCamelName}(to${javaNative}Array(source.get("${column.name}"))); +#else result.set${column.capCamelName}(DfTypeUtil.to$javaNative(source.get("${column.name}"))); #end +#end #end return result; } catch (InstantiationException | IllegalAccessException e) { diff --git a/dbflute_fess/freegen/elasticsearch/BsEntity.vm b/dbflute_fess/freegen/elasticsearch/BsEntity.vm index 37001d1f6..3a7fd9910 100644 --- a/dbflute_fess/freegen/elasticsearch/BsEntity.vm +++ b/dbflute_fess/freegen/elasticsearch/BsEntity.vm @@ -39,9 +39,10 @@ public class Bs${table.camelizedName} extends AbstractEntity { #elseif ($column.isRefColumn) #set ($javaNative = ${column.camelizedName}) #end +#if ($arrayColumnNames.contains($column.name))#set($arrayType = "[]")#else#set($arrayType = "")#end #if ($column.name != $idColumn) /** ${column.name} */ - protected ${javaNative} ${column.uncapCamelName}; + protected ${javaNative}${arrayType} ${column.uncapCamelName}; #end #end @@ -59,6 +60,7 @@ public class Bs${table.camelizedName} extends AbstractEntity { #elseif ($column.isRefColumn) #set ($javaNative = ${column.camelizedName}) #end +#if ($arrayColumnNames.contains($column.name))#set($arrayType = "[]")#else#set($arrayType = "")#end #if ($column.name != $idColumn) #if ($javaNative == "boolean") public ${javaNative} is${column.capCamelName}() { @@ -66,13 +68,13 @@ public class Bs${table.camelizedName} extends AbstractEntity { return ${column.uncapCamelName}; } #else - public ${javaNative} get${column.capCamelName}() { + public ${javaNative}${arrayType} get${column.capCamelName}() { checkSpecifiedProperty("${column.uncapCamelName}"); return ${column.uncapCamelName}; } #end - public void set${column.capCamelName}(${javaNative} value) { + public void set${column.capCamelName}(${javaNative}${arrayType} value) { registerModifiedProperty("${column.uncapCamelName}"); this.${column.uncapCamelName} = value; } diff --git a/dbflute_fess/freegen/elasticsearch/DBMeta.vm b/dbflute_fess/freegen/elasticsearch/DBMeta.vm index da8e90830..366361de0 100644 --- a/dbflute_fess/freegen/elasticsearch/DBMeta.vm +++ b/dbflute_fess/freegen/elasticsearch/DBMeta.vm @@ -44,7 +44,11 @@ public class ${table.camelizedName}Dbm extends AbstractDBMeta { #elseif ($col.isRefColumn) #set ($javaNative = ${col.camelizedName}) #end +#if ($arrayColumnNames.contains($col.name)) + setupEpg(_epgMap, et-> ((${table.camelizedName})et).get${col.camelizedName}(),(et,vl)->((${table.camelizedName}) et).set${col.camelizedName}((${javaNative}[])vl), "${col.uncapCamelName}"); +#else setupEpg(_epgMap, et-> ((${table.camelizedName})et).get${col.camelizedName}(),(et,vl)->((${table.camelizedName}) et).set${col.camelizedName}(DfTypeUtil.to${javaNative}(vl)), "${col.uncapCamelName}"); +#end #end } @@ -62,7 +66,8 @@ public class ${table.camelizedName}Dbm extends AbstractDBMeta { #elseif ($col.isRefColumn) #set ($javaNative = ${col.camelizedName}) #end - protected final ColumnInfo _column${col.camelizedName} = cci("${col.name}", "${col.name}", null, null, ${javaNative}.class, "${col.uncapCamelName}", null, false, false, false, "${col.type}", 0, 0, null, false, null, null, null, null, null, false); +#if ($arrayColumnNames.contains($col.name))#set($arrayType = "[]")#else#set($arrayType = "")#end + protected final ColumnInfo _column${col.camelizedName} = cci("${col.name}", "${col.name}", null, null, ${javaNative}${arrayType}.class, "${col.uncapCamelName}", null, false, false, false, "${col.type}", 0, 0, null, false, null, null, null, null, null, false); #end #foreach ($col in $table.columnList) diff --git a/pom.xml b/pom.xml index 5561aa5ad..42265f408 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ 1.1.0-sp8 - 0.6.1 + 0.6.2-A-SNAPSHOT 0.6.0 3.1.0 2.3.1 diff --git a/src/main/config/es/fess_user.json b/src/main/config/es/fess_user.json index b15b2ce75..7ef815b06 100644 --- a/src/main/config/es/fess_user.json +++ b/src/main/config/es/fess_user.json @@ -27,7 +27,7 @@ "path" : "id" }, "properties" : { - "group" : { + "groups" : { "type" : "string", "index" : "not_analyzed" }, @@ -43,7 +43,7 @@ "type" : "string", "index" : "not_analyzed" }, - "role" : { + "roles" : { "type" : "string", "index" : "not_analyzed" } diff --git a/src/main/java/org/codelibs/fess/app/pager/GroupPager.java b/src/main/java/org/codelibs/fess/app/pager/GroupPager.java new file mode 100644 index 000000000..82b323290 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/pager/GroupPager.java @@ -0,0 +1,132 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.pager; + +import java.io.Serializable; +import java.util.List; + +import org.codelibs.fess.Constants; + +public class GroupPager implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int DEFAULT_PAGE_SIZE = 20; + + public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1; + + private int allRecordCount; + + private int allPageCount; + + private boolean existPrePage; + + private boolean existNextPage; + + private List pageNumberList; + + private int pageSize; + + private int currentPageNumber; + + public String id; + + public String name; + + public String versionNo; + + public void clear() { + pageSize = getDefaultPageSize(); + currentPageNumber = getDefaultCurrentPageNumber(); + + id = null; + name = null; + versionNo = null; + + } + + protected int getDefaultCurrentPageNumber() { + return DEFAULT_CURRENT_PAGE_NUMBER; + } + + public int getAllRecordCount() { + return allRecordCount; + } + + public void setAllRecordCount(final int allRecordCount) { + this.allRecordCount = allRecordCount; + } + + public int getAllPageCount() { + return allPageCount; + } + + public void setAllPageCount(final int allPageCount) { + this.allPageCount = allPageCount; + } + + public boolean isExistPrePage() { + return existPrePage; + } + + public void setExistPrePage(final boolean existPrePage) { + this.existPrePage = existPrePage; + } + + public boolean isExistNextPage() { + return existNextPage; + } + + public void setExistNextPage(final boolean existNextPage) { + this.existNextPage = existNextPage; + } + + public int getPageSize() { + if (pageSize <= 0) { + pageSize = getDefaultPageSize(); + } + return pageSize; + } + + public void setPageSize(final int pageSize) { + this.pageSize = pageSize; + } + + public int getCurrentPageNumber() { + if (currentPageNumber <= 0) { + currentPageNumber = getDefaultCurrentPageNumber(); + } + return currentPageNumber; + } + + public void setCurrentPageNumber(final int currentPageNumber) { + this.currentPageNumber = currentPageNumber; + } + + public List getPageNumberList() { + return pageNumberList; + } + + public void setPageNumberList(final List pageNumberList) { + this.pageNumberList = pageNumberList; + } + + protected int getDefaultPageSize() { + return Constants.DEFAULT_ADMIN_PAGE_SIZE; + } + +} diff --git a/src/main/java/org/codelibs/fess/app/pager/RolePager.java b/src/main/java/org/codelibs/fess/app/pager/RolePager.java new file mode 100644 index 000000000..29e0ab2a1 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/pager/RolePager.java @@ -0,0 +1,132 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.pager; + +import java.io.Serializable; +import java.util.List; + +import org.codelibs.fess.Constants; + +public class RolePager implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int DEFAULT_PAGE_SIZE = 20; + + public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1; + + private int allRecordCount; + + private int allPageCount; + + private boolean existPrePage; + + private boolean existNextPage; + + private List pageNumberList; + + private int pageSize; + + private int currentPageNumber; + + public String id; + + public String name; + + public String versionNo; + + public void clear() { + pageSize = getDefaultPageSize(); + currentPageNumber = getDefaultCurrentPageNumber(); + + id = null; + name = null; + versionNo = null; + + } + + protected int getDefaultCurrentPageNumber() { + return DEFAULT_CURRENT_PAGE_NUMBER; + } + + public int getAllRecordCount() { + return allRecordCount; + } + + public void setAllRecordCount(final int allRecordCount) { + this.allRecordCount = allRecordCount; + } + + public int getAllPageCount() { + return allPageCount; + } + + public void setAllPageCount(final int allPageCount) { + this.allPageCount = allPageCount; + } + + public boolean isExistPrePage() { + return existPrePage; + } + + public void setExistPrePage(final boolean existPrePage) { + this.existPrePage = existPrePage; + } + + public boolean isExistNextPage() { + return existNextPage; + } + + public void setExistNextPage(final boolean existNextPage) { + this.existNextPage = existNextPage; + } + + public int getPageSize() { + if (pageSize <= 0) { + pageSize = getDefaultPageSize(); + } + return pageSize; + } + + public void setPageSize(final int pageSize) { + this.pageSize = pageSize; + } + + public int getCurrentPageNumber() { + if (currentPageNumber <= 0) { + currentPageNumber = getDefaultCurrentPageNumber(); + } + return currentPageNumber; + } + + public void setCurrentPageNumber(final int currentPageNumber) { + this.currentPageNumber = currentPageNumber; + } + + public List getPageNumberList() { + return pageNumberList; + } + + public void setPageNumberList(final List pageNumberList) { + this.pageNumberList = pageNumberList; + } + + protected int getDefaultPageSize() { + return Constants.DEFAULT_ADMIN_PAGE_SIZE; + } + +} diff --git a/src/main/java/org/codelibs/fess/app/pager/UserPager.java b/src/main/java/org/codelibs/fess/app/pager/UserPager.java new file mode 100644 index 000000000..7b30f7eee --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/pager/UserPager.java @@ -0,0 +1,136 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.pager; + +import java.io.Serializable; +import java.util.List; + +import org.codelibs.fess.Constants; + +public class UserPager implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int DEFAULT_PAGE_SIZE = 20; + + public static final int DEFAULT_CURRENT_PAGE_NUMBER = 1; + + private int allRecordCount; + + private int allPageCount; + + private boolean existPrePage; + + private boolean existNextPage; + + private List pageNumberList; + + private int pageSize; + + private int currentPageNumber; + + public String id; + + public String name; + + public String[] roles; + public String[] groups; + + public String versionNo; + + public void clear() { + pageSize = getDefaultPageSize(); + currentPageNumber = getDefaultCurrentPageNumber(); + + id = null; + roles = null; + groups = null; + versionNo = null; + + } + + protected int getDefaultCurrentPageNumber() { + return DEFAULT_CURRENT_PAGE_NUMBER; + } + + public int getAllRecordCount() { + return allRecordCount; + } + + public void setAllRecordCount(final int allRecordCount) { + this.allRecordCount = allRecordCount; + } + + public int getAllPageCount() { + return allPageCount; + } + + public void setAllPageCount(final int allPageCount) { + this.allPageCount = allPageCount; + } + + public boolean isExistPrePage() { + return existPrePage; + } + + public void setExistPrePage(final boolean existPrePage) { + this.existPrePage = existPrePage; + } + + public boolean isExistNextPage() { + return existNextPage; + } + + public void setExistNextPage(final boolean existNextPage) { + this.existNextPage = existNextPage; + } + + public int getPageSize() { + if (pageSize <= 0) { + pageSize = getDefaultPageSize(); + } + return pageSize; + } + + public void setPageSize(final int pageSize) { + this.pageSize = pageSize; + } + + public int getCurrentPageNumber() { + if (currentPageNumber <= 0) { + currentPageNumber = getDefaultCurrentPageNumber(); + } + return currentPageNumber; + } + + public void setCurrentPageNumber(final int currentPageNumber) { + this.currentPageNumber = currentPageNumber; + } + + public List getPageNumberList() { + return pageNumberList; + } + + public void setPageNumberList(final List pageNumberList) { + this.pageNumberList = pageNumberList; + } + + protected int getDefaultPageSize() { + return Constants.DEFAULT_ADMIN_PAGE_SIZE; + } + +} diff --git a/src/main/java/org/codelibs/fess/app/service/GroupService.java b/src/main/java/org/codelibs/fess/app/service/GroupService.java new file mode 100644 index 000000000..46b92ac6c --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/service/GroupService.java @@ -0,0 +1,125 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.service; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.core.beans.util.BeanUtil; +import org.codelibs.fess.app.pager.GroupPager; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; +import org.codelibs.fess.es.cbean.GroupCB; +import org.codelibs.fess.es.exbhv.GroupBhv; +import org.codelibs.fess.es.exentity.Group; +import org.dbflute.cbean.result.PagingResultBean; + +public class GroupService implements Serializable { + + private static final long serialVersionUID = 1L; + + @Resource + protected GroupBhv groupBhv; + + public List getGroupList(final GroupPager groupPager) { + + final PagingResultBean groupList = groupBhv.selectPage(cb -> { + cb.paging(groupPager.getPageSize(), groupPager.getCurrentPageNumber()); + setupListCondition(cb, groupPager); + }); + + // update pager + BeanUtil.copyBeanToBean(groupList, groupPager, option -> option.include(CommonConstants.PAGER_CONVERSION_RULE)); + groupPager.setPageNumberList(groupList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return groupList; + } + + public Group getGroup(final Map keys) { + final Group group = groupBhv.selectEntity(cb -> { + cb.query().docMeta().setId_Equal(keys.get("id")); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (group == null) { + // TODO exception? + return null; + } + + return group; + } + + public void store(final Group group) throws CrudMessageException { + setupStoreCondition(group); + + groupBhv.insertOrUpdate(group, op -> { + op.setRefresh(true); + }); + + } + + public void delete(final Group group) throws CrudMessageException { + setupDeleteCondition(group); + + groupBhv.delete(group, op -> { + op.setRefresh(true); + }); + + } + + protected void setupListCondition(final GroupCB cb, final GroupPager groupPager) { + if (groupPager.id != null) { + cb.query().docMeta().setId_Equal(groupPager.id); + } + // TODO Long, Integer, String supported only. + + // setup condition + cb.query().addOrderBy_Name_Asc(); + + // search + + } + + protected void setupEntityCondition(final GroupCB cb, final Map keys) { + + // setup condition + + } + + protected void setupStoreCondition(final Group group) { + + // setup condition + + } + + protected void setupDeleteCondition(final Group group) { + + // setup condition + + } + + public List getAvailableGroupList() { + return groupBhv.selectList(cb -> { + cb.query().matchAll(); + }); + } + +} diff --git a/src/main/java/org/codelibs/fess/app/service/RoleService.java b/src/main/java/org/codelibs/fess/app/service/RoleService.java new file mode 100644 index 000000000..7f7eb5cbd --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/service/RoleService.java @@ -0,0 +1,125 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.service; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.core.beans.util.BeanUtil; +import org.codelibs.fess.app.pager.RolePager; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; +import org.codelibs.fess.es.cbean.RoleCB; +import org.codelibs.fess.es.exbhv.RoleBhv; +import org.codelibs.fess.es.exentity.Role; +import org.dbflute.cbean.result.PagingResultBean; + +public class RoleService implements Serializable { + + private static final long serialVersionUID = 1L; + + @Resource + protected RoleBhv roleBhv; + + public List getRoleList(final RolePager rolePager) { + + final PagingResultBean roleList = roleBhv.selectPage(cb -> { + cb.paging(rolePager.getPageSize(), rolePager.getCurrentPageNumber()); + setupListCondition(cb, rolePager); + }); + + // update pager + BeanUtil.copyBeanToBean(roleList, rolePager, option -> option.include(CommonConstants.PAGER_CONVERSION_RULE)); + rolePager.setPageNumberList(roleList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return roleList; + } + + public Role getRole(final Map keys) { + final Role role = roleBhv.selectEntity(cb -> { + cb.query().docMeta().setId_Equal(keys.get("id")); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (role == null) { + // TODO exception? + return null; + } + + return role; + } + + public void store(final Role role) throws CrudMessageException { + setupStoreCondition(role); + + roleBhv.insertOrUpdate(role, op -> { + op.setRefresh(true); + }); + + } + + public void delete(final Role role) throws CrudMessageException { + setupDeleteCondition(role); + + roleBhv.delete(role, op -> { + op.setRefresh(true); + }); + + } + + protected void setupListCondition(final RoleCB cb, final RolePager rolePager) { + if (rolePager.id != null) { + cb.query().docMeta().setId_Equal(rolePager.id); + } + // TODO Long, Integer, String supported only. + + // setup condition + cb.query().addOrderBy_Name_Asc(); + + // search + + } + + protected void setupEntityCondition(final RoleCB cb, final Map keys) { + + // setup condition + + } + + protected void setupStoreCondition(final Role role) { + + // setup condition + + } + + protected void setupDeleteCondition(final Role role) { + + // setup condition + + } + + public List getAvailableRoleList() { + return roleBhv.selectList(cb -> { + cb.query().matchAll(); + }); + } + +} diff --git a/src/main/java/org/codelibs/fess/app/service/UserService.java b/src/main/java/org/codelibs/fess/app/service/UserService.java new file mode 100644 index 000000000..70d48c53c --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/service/UserService.java @@ -0,0 +1,129 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.service; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.core.beans.util.BeanUtil; +import org.codelibs.fess.app.pager.UserPager; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; +import org.codelibs.fess.es.cbean.UserCB; +import org.codelibs.fess.es.exbhv.UserBhv; +import org.codelibs.fess.es.exentity.User; +import org.dbflute.cbean.result.PagingResultBean; + +public class UserService implements Serializable { + + private static final long serialVersionUID = 1L; + + @Resource + protected UserBhv userBhv; + + public UserService() { + super(); + } + + public List getUserList(final UserPager userPager) { + + final PagingResultBean userList = userBhv.selectPage(cb -> { + cb.paging(userPager.getPageSize(), userPager.getCurrentPageNumber()); + setupListCondition(cb, userPager); + }); + + // update pager + BeanUtil.copyBeanToBean(userList, userPager, option -> option.include(CommonConstants.PAGER_CONVERSION_RULE)); + userPager.setPageNumberList(userList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return userList; + } + + public User getUser(final Map keys) { + final User user = userBhv.selectEntity(cb -> { + cb.query().docMeta().setId_Equal(keys.get("id")); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (user == null) { + // TODO exception? + return null; + } + + return user; + } + + public void store(final User user) throws CrudMessageException { + setupStoreCondition(user); + + userBhv.insertOrUpdate(user, op -> { + op.setRefresh(true); + }); + + } + + public void delete(final User user) throws CrudMessageException { + setupDeleteCondition(user); + + userBhv.delete(user, op -> { + op.setRefresh(true); + }); + + } + + protected void setupListCondition(final UserCB cb, final UserPager userPager) { + if (userPager.id != null) { + cb.query().docMeta().setId_Equal(userPager.id); + } + // TODO Long, Integer, String supported only. + + // setup condition + cb.query().addOrderBy_Name_Asc(); + + // search + + } + + protected void setupEntityCondition(final UserCB cb, final Map keys) { + + // setup condition + + } + + protected void setupStoreCondition(final User user) { + + // setup condition + + } + + protected void setupDeleteCondition(final User user) { + + // setup condition + + } + + public List getAvailableUserList() { + return userBhv.selectList(cb -> { + cb.query().matchAll(); + }); + } + +} diff --git a/src/main/java/org/codelibs/fess/app/web/RootForm.java b/src/main/java/org/codelibs/fess/app/web/RootForm.java index 9aceac4ab..4b1668890 100644 --- a/src/main/java/org/codelibs/fess/app/web/RootForm.java +++ b/src/main/java/org/codelibs/fess/app/web/RootForm.java @@ -17,14 +17,14 @@ package org.codelibs.fess.app.web; import java.io.Serializable; - -import org.codelibs.fess.util.SearchParamMap; +import java.util.HashMap; +import java.util.Map; public class RootForm implements Serializable { private static final long serialVersionUID = 1L; - public SearchParamMap fields = new SearchParamMap(); + public Map fields = new HashMap<>(); //@Maxbytelength(maxbytelength = 1000) public String query; diff --git a/src/main/java/org/codelibs/fess/app/web/admin/crawl/AdminCrawlAction.java b/src/main/java/org/codelibs/fess/app/web/admin/crawl/AdminCrawlAction.java index ba73cc976..a043b44b7 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/crawl/AdminCrawlAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/crawl/AdminCrawlAction.java @@ -68,7 +68,7 @@ public class AdminCrawlAction extends FessAdminAction { // =================================================================================== - protected void updateForm(CrawlEditForm form) { + protected void updateForm(final CrawlEditForm form) { form.diffCrawling = crawlerProperties.getProperty(Constants.DIFF_CRAWLING_PROPERTY, Constants.TRUE); form.useAclAsRole = crawlerProperties.getProperty(Constants.USE_ACL_AS_ROLE, Constants.FALSE); form.dayForCleanup = crawlerProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, "1"); diff --git a/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java b/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java new file mode 100644 index 000000000..e2fe6673e --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java @@ -0,0 +1,271 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.group; + +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.fess.Constants; +import org.codelibs.fess.annotation.Token; +import org.codelibs.fess.app.pager.GroupPager; +import org.codelibs.fess.app.service.GroupService; +import org.codelibs.fess.app.web.base.FessAdminAction; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.es.exentity.Group; +import org.codelibs.fess.helper.SystemHelper; +import org.lastaflute.web.Execute; +import org.lastaflute.web.callback.ActionRuntime; +import org.lastaflute.web.response.HtmlResponse; +import org.lastaflute.web.response.render.RenderData; +import org.lastaflute.web.validation.VaErrorHook; + +/** + * @author shinsuke + */ +public class AdminGroupAction extends FessAdminAction { + + // =================================================================================== + // Attribute + // ========= + @Resource + private GroupService groupService; + @Resource + private GroupPager groupPager; + @Resource + private SystemHelper systemHelper; + + // =================================================================================== + // Hook + // ====== + @Override + protected void setupHtmlData(final ActionRuntime runtime) { + super.setupHtmlData(runtime); + runtime.registerData("helpLink", systemHelper.getHelpLink("group")); + } + + // =================================================================================== + // Search Execute + // ============== + @Execute + public HtmlResponse index(final GroupSearchForm form) { + return asHtml(path_AdminGroup_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse list(final Integer pageNumber, final GroupSearchForm form) { + groupPager.setCurrentPageNumber(pageNumber); + return asHtml(path_AdminGroup_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse search(final GroupSearchForm form) { + copyBeanToBean(form.searchParams, groupPager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + return asHtml(path_AdminGroup_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse reset(final GroupSearchForm form) { + groupPager.clear(); + return asHtml(path_AdminGroup_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse back(final GroupSearchForm form) { + return asHtml(path_AdminGroup_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + protected void searchPaging(final RenderData data, final GroupSearchForm form) { + data.register("groupItems", groupService.getGroupList(groupPager)); // page navi + + // restore from pager + copyBeanToBean(groupPager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + } + + // =================================================================================== + // Edit Execute + // ============ + // ----------------------------------------------------- + // Entry Page + // ---------- + @Token(save = true, validate = false) + @Execute + public HtmlResponse createpage(final GroupEditForm form) { + form.initialize(); + form.crudMode = CommonConstants.CREATE_MODE; + return asHtml(path_AdminGroup_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editpage(final int crudMode, final String id, final GroupEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.EDIT_MODE); + loadGroup(form); + return asHtml(path_AdminGroup_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editagain(final GroupEditForm form) { + return asHtml(path_AdminGroup_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editfromconfirm(final GroupEditForm form) { + form.crudMode = CommonConstants.EDIT_MODE; + loadGroup(form); + return asHtml(path_AdminGroup_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletepage(final int crudMode, final String id, final GroupEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.DELETE_MODE); + loadGroup(form); + return asHtml(path_AdminGroup_ConfirmJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletefromconfirm(final GroupEditForm form) { + form.crudMode = CommonConstants.DELETE_MODE; + loadGroup(form); + return asHtml(path_AdminGroup_ConfirmJsp); + } + + // ----------------------------------------------------- + // Confirm + // ------- + @Execute + public HtmlResponse confirmpage(final int crudMode, final String id, final GroupEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.CONFIRM_MODE); + loadGroup(form); + return asHtml(path_AdminGroup_ConfirmJsp); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromcreate(final GroupEditForm form) { + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminGroup_ConfirmJsp); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromupdate(final GroupEditForm form) { + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminGroup_ConfirmJsp); + } + + // ----------------------------------------------------- + // Actually Crud + // ------------- + @Token(save = false, validate = true) + @Execute + public HtmlResponse create(final GroupEditForm form) { + validate(form, messages -> {}, toEditHtml()); + groupService.store(createGroup(form)); + saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Token(save = false, validate = true) + @Execute + public HtmlResponse update(final GroupEditForm form) { + validate(form, messages -> {}, toEditHtml()); + groupService.store(createGroup(form)); + saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Execute + public HtmlResponse delete(final GroupEditForm form) { + verifyCrudMode(form, CommonConstants.DELETE_MODE); + groupService.delete(getGroup(form)); + saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); + return redirect(getClass()); + } + + // =================================================================================== + // Assist Logic + // ============ + protected void loadGroup(final GroupEditForm form) { + copyBeanToBean(getGroup(form), form, op -> op.exclude("crudMode")); + } + + protected Group getGroup(final GroupEditForm form) { + final Group group = groupService.getGroup(createKeyMap(form)); + if (group == null) { + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml()); + } + return group; + } + + protected Group createGroup(final GroupEditForm form) { + Group group; + if (form.crudMode == CommonConstants.EDIT_MODE) { + group = getGroup(form); + } else { + group = new Group(); + } + copyBeanToBean(form, group, op -> op.exclude(CommonConstants.COMMON_CONVERSION_RULE)); + group.setId(Base64.getEncoder().encodeToString(group.getName().getBytes(Constants.CHARSET_UTF_8))); + return group; + } + + protected Map createKeyMap(final GroupEditForm form) { + final Map keys = new HashMap(); + keys.put("id", form.id); + return keys; + } + + // =================================================================================== + // Small Helper + // ============ + protected void verifyCrudMode(final GroupEditForm form, final int expectedMode) { + if (form.crudMode != expectedMode) { + throwValidationError(messages -> { + messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(form.crudMode)); + }, toEditHtml()); + } + } + + protected VaErrorHook toEditHtml() { + return () -> { + return asHtml(path_AdminGroup_EditJsp); + }; + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/group/GroupEditForm.java b/src/main/java/org/codelibs/fess/app/web/admin/group/GroupEditForm.java new file mode 100644 index 000000000..86f624e73 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/group/GroupEditForm.java @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.group; + +import java.io.Serializable; + +/** + * @author shinsuke + */ +public class GroupEditForm implements Serializable { + + private static final long serialVersionUID = 1L; + + //@IntegerType + public int crudMode; + + //@Required(target = "confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 1000) + public String id; + + //@Required(target = "confirmfromcreate,create,confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 100) + public String name; + + //@Required(target = "confirmfromupdate,update,delete") + //@IntegerType + public String versionNo; + + public void initialize() { + id = null; + name = null; + versionNo = null; + } +} diff --git a/src/main/java/org/codelibs/fess/util/SearchParamMap.java b/src/main/java/org/codelibs/fess/app/web/admin/group/GroupSearchForm.java similarity index 63% rename from src/main/java/org/codelibs/fess/util/SearchParamMap.java rename to src/main/java/org/codelibs/fess/app/web/admin/group/GroupSearchForm.java index e5a47b0a7..a56349955 100644 --- a/src/main/java/org/codelibs/fess/util/SearchParamMap.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/group/GroupSearchForm.java @@ -14,24 +14,18 @@ * governing permissions and limitations under the License. */ -package org.codelibs.fess.util; +package org.codelibs.fess.app.web.admin.group; +import java.io.Serializable; import java.util.HashMap; +import java.util.Map; -import org.codelibs.core.lang.StringUtil; - -public class SearchParamMap extends HashMap { +/** + * @author shinsuke + */ +public class GroupSearchForm implements Serializable { private static final long serialVersionUID = 1L; - public static final String CLASS_NAME = "org.codelibs.fess.util.SearchParamMap"; - - @Override - public String[] get(final Object key) { - if (CLASS_NAME.equals(key)) { - return StringUtil.EMPTY_STRINGS; - } - return super.get(key); - } - + public Map searchParams = new HashMap(); } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java b/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java new file mode 100644 index 000000000..02e23f87a --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java @@ -0,0 +1,271 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.role; + +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.fess.Constants; +import org.codelibs.fess.annotation.Token; +import org.codelibs.fess.app.pager.RolePager; +import org.codelibs.fess.app.service.RoleService; +import org.codelibs.fess.app.web.base.FessAdminAction; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.es.exentity.Role; +import org.codelibs.fess.helper.SystemHelper; +import org.lastaflute.web.Execute; +import org.lastaflute.web.callback.ActionRuntime; +import org.lastaflute.web.response.HtmlResponse; +import org.lastaflute.web.response.render.RenderData; +import org.lastaflute.web.validation.VaErrorHook; + +/** + * @author shinsuke + */ +public class AdminRoleAction extends FessAdminAction { + + // =================================================================================== + // Attribute + // ========= + @Resource + private RoleService roleService; + @Resource + private RolePager rolePager; + @Resource + private SystemHelper systemHelper; + + // =================================================================================== + // Hook + // ====== + @Override + protected void setupHtmlData(final ActionRuntime runtime) { + super.setupHtmlData(runtime); + runtime.registerData("helpLink", systemHelper.getHelpLink("role")); + } + + // =================================================================================== + // Search Execute + // ============== + @Execute + public HtmlResponse index(final RoleSearchForm form) { + return asHtml(path_AdminRole_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse list(final Integer pageNumber, final RoleSearchForm form) { + rolePager.setCurrentPageNumber(pageNumber); + return asHtml(path_AdminRole_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse search(final RoleSearchForm form) { + copyBeanToBean(form.searchParams, rolePager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + return asHtml(path_AdminRole_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse reset(final RoleSearchForm form) { + rolePager.clear(); + return asHtml(path_AdminRole_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse back(final RoleSearchForm form) { + return asHtml(path_AdminRole_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + protected void searchPaging(final RenderData data, final RoleSearchForm form) { + data.register("roleItems", roleService.getRoleList(rolePager)); // page navi + + // restore from pager + copyBeanToBean(rolePager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + } + + // =================================================================================== + // Edit Execute + // ============ + // ----------------------------------------------------- + // Entry Page + // ---------- + @Token(save = true, validate = false) + @Execute + public HtmlResponse createpage(final RoleEditForm form) { + form.initialize(); + form.crudMode = CommonConstants.CREATE_MODE; + return asHtml(path_AdminRole_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editpage(final int crudMode, final String id, final RoleEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.EDIT_MODE); + loadRole(form); + return asHtml(path_AdminRole_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editagain(final RoleEditForm form) { + return asHtml(path_AdminRole_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editfromconfirm(final RoleEditForm form) { + form.crudMode = CommonConstants.EDIT_MODE; + loadRole(form); + return asHtml(path_AdminRole_EditJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletepage(final int crudMode, final String id, final RoleEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.DELETE_MODE); + loadRole(form); + return asHtml(path_AdminRole_ConfirmJsp); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletefromconfirm(final RoleEditForm form) { + form.crudMode = CommonConstants.DELETE_MODE; + loadRole(form); + return asHtml(path_AdminRole_ConfirmJsp); + } + + // ----------------------------------------------------- + // Confirm + // ------- + @Execute + public HtmlResponse confirmpage(final int crudMode, final String id, final RoleEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.CONFIRM_MODE); + loadRole(form); + return asHtml(path_AdminRole_ConfirmJsp); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromcreate(final RoleEditForm form) { + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminRole_ConfirmJsp); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromupdate(final RoleEditForm form) { + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminRole_ConfirmJsp); + } + + // ----------------------------------------------------- + // Actually Crud + // ------------- + @Token(save = false, validate = true) + @Execute + public HtmlResponse create(final RoleEditForm form) { + validate(form, messages -> {}, toEditHtml()); + roleService.store(createRole(form)); + saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Token(save = false, validate = true) + @Execute + public HtmlResponse update(final RoleEditForm form) { + validate(form, messages -> {}, toEditHtml()); + roleService.store(createRole(form)); + saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Execute + public HtmlResponse delete(final RoleEditForm form) { + verifyCrudMode(form, CommonConstants.DELETE_MODE); + roleService.delete(getRole(form)); + saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); + return redirect(getClass()); + } + + // =================================================================================== + // Assist Logic + // ============ + protected void loadRole(final RoleEditForm form) { + copyBeanToBean(getRole(form), form, op -> op.exclude("crudMode")); + } + + protected Role getRole(final RoleEditForm form) { + final Role role = roleService.getRole(createKeyMap(form)); + if (role == null) { + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml()); + } + return role; + } + + protected Role createRole(final RoleEditForm form) { + Role role; + if (form.crudMode == CommonConstants.EDIT_MODE) { + role = getRole(form); + } else { + role = new Role(); + } + copyBeanToBean(form, role, op -> op.exclude(CommonConstants.COMMON_CONVERSION_RULE)); + role.setId(Base64.getEncoder().encodeToString(role.getName().getBytes(Constants.CHARSET_UTF_8))); + return role; + } + + protected Map createKeyMap(final RoleEditForm form) { + final Map keys = new HashMap(); + keys.put("id", form.id); + return keys; + } + + // =================================================================================== + // Small Helper + // ============ + protected void verifyCrudMode(final RoleEditForm form, final int expectedMode) { + if (form.crudMode != expectedMode) { + throwValidationError(messages -> { + messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(form.crudMode)); + }, toEditHtml()); + } + } + + protected VaErrorHook toEditHtml() { + return () -> { + return asHtml(path_AdminRole_EditJsp); + }; + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/role/RoleEditForm.java b/src/main/java/org/codelibs/fess/app/web/admin/role/RoleEditForm.java new file mode 100644 index 000000000..45f5c61e7 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/role/RoleEditForm.java @@ -0,0 +1,48 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.role; + +import java.io.Serializable; + +/** + * @author shinsuke + */ +public class RoleEditForm implements Serializable { + + private static final long serialVersionUID = 1L; + + //@IntegerType + public int crudMode; + + //@Required(target = "confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 1000) + public String id; + + //@Required(target = "confirmfromcreate,create,confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 100) + public String name; + + //@Required(target = "confirmfromupdate,update,delete") + //@IntegerType + public String versionNo; + + public void initialize() { + id = null; + name = null; + versionNo = null; + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/role/RoleSearchForm.java b/src/main/java/org/codelibs/fess/app/web/admin/role/RoleSearchForm.java new file mode 100644 index 000000000..98347c0b3 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/role/RoleSearchForm.java @@ -0,0 +1,31 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.role; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * @author shinsuke + */ +public class RoleSearchForm implements Serializable { + + private static final long serialVersionUID = 1L; + + public Map searchParams = new HashMap(); +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/suggestelevateword/AdminSuggestelevatewordAction.java b/src/main/java/org/codelibs/fess/app/web/admin/suggestelevateword/AdminSuggestelevatewordAction.java index 1a122f369..cb393f575 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/suggestelevateword/AdminSuggestelevatewordAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/suggestelevateword/AdminSuggestelevatewordAction.java @@ -45,7 +45,6 @@ import org.codelibs.fess.crud.CommonConstants; import org.codelibs.fess.es.exentity.SuggestElevateWord; import org.codelibs.fess.helper.SuggestHelper; import org.codelibs.fess.helper.SystemHelper; -import org.codelibs.fess.util.ComponentUtil; import org.lastaflute.web.Execute; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.HtmlResponse; diff --git a/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java new file mode 100644 index 000000000..0941e28c0 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java @@ -0,0 +1,361 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.user; + +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Resource; + +import org.codelibs.core.lang.StringUtil; +import org.codelibs.fess.Constants; +import org.codelibs.fess.annotation.Token; +import org.codelibs.fess.app.pager.UserPager; +import org.codelibs.fess.app.service.GroupService; +import org.codelibs.fess.app.service.RoleService; +import org.codelibs.fess.app.service.UserService; +import org.codelibs.fess.app.web.base.FessAdminAction; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.es.exentity.User; +import org.codelibs.fess.helper.SystemHelper; +import org.lastaflute.web.Execute; +import org.lastaflute.web.callback.ActionRuntime; +import org.lastaflute.web.response.HtmlResponse; +import org.lastaflute.web.response.render.RenderData; +import org.lastaflute.web.validation.VaErrorHook; + +/** + * @author shinsuke + */ +public class AdminUserAction extends FessAdminAction { + + private static final String TEMPORARY_PASSWORD = "fess.temporary_password"; + // =================================================================================== + // Attribute + // ========= + @Resource + private UserService userService; + @Resource + private RoleService roleService; + @Resource + private GroupService groupService; + @Resource + private UserPager userPager; + @Resource + private SystemHelper systemHelper; + + // =================================================================================== + // Hook + // ====== + @Override + protected void setupHtmlData(final ActionRuntime runtime) { + super.setupHtmlData(runtime); + runtime.registerData("helpLink", systemHelper.getHelpLink("user")); + } + + // =================================================================================== + // Search Execute + // ============== + @Execute + public HtmlResponse index(final UserSearchForm form) { + clearStoredPassword(); + return asHtml(path_AdminUser_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse list(final Integer pageNumber, final UserSearchForm form) { + clearStoredPassword(); + userPager.setCurrentPageNumber(pageNumber); + return asHtml(path_AdminUser_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse search(final UserSearchForm form) { + clearStoredPassword(); + copyBeanToBean(form.searchParams, userPager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + return asHtml(path_AdminUser_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse reset(final UserSearchForm form) { + clearStoredPassword(); + userPager.clear(); + return asHtml(path_AdminUser_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + @Execute + public HtmlResponse back(final UserSearchForm form) { + clearStoredPassword(); + return asHtml(path_AdminUser_IndexJsp).renderWith(data -> { + searchPaging(data, form); + }); + } + + protected void searchPaging(final RenderData data, final UserSearchForm form) { + data.register("userItems", userService.getUserList(userPager)); // page navi + + // restore from pager + copyBeanToBean(userPager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE)); + } + + private void registerForms(final RenderData data) { + data.register("roleItems", roleService.getAvailableRoleList()); + data.register("groupItems", groupService.getAvailableGroupList()); + } + + // =================================================================================== + // Edit Execute + // ============ + // ----------------------------------------------------- + // Entry Page + // ---------- + @Token(save = true, validate = false) + @Execute + public HtmlResponse createpage(final UserEditForm form) { + clearStoredPassword(); + form.initialize(); + form.crudMode = CommonConstants.CREATE_MODE; + return asHtml(path_AdminUser_EditJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editpage(final int crudMode, final String id, final UserEditForm form) { + clearStoredPassword(); + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.EDIT_MODE); + loadUser(form, false); + return asHtml(path_AdminUser_EditJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editagain(final UserEditForm form) { + clearStoredPassword(); + return asHtml(path_AdminUser_EditJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse editfromconfirm(final UserEditForm form) { + clearStoredPassword(); + form.crudMode = CommonConstants.EDIT_MODE; + loadUser(form, false); + return asHtml(path_AdminUser_EditJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletepage(final int crudMode, final String id, final UserEditForm form) { + clearStoredPassword(); + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.DELETE_MODE); + loadUser(form, false); + return asHtml(path_AdminUser_ConfirmJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = true, validate = false) + @Execute + public HtmlResponse deletefromconfirm(final UserEditForm form) { + clearStoredPassword(); + form.crudMode = CommonConstants.DELETE_MODE; + loadUser(form, false); + return asHtml(path_AdminUser_ConfirmJsp).renderWith(data -> { + registerForms(data); + }); + } + + // ----------------------------------------------------- + // Confirm + // ------- + @Execute + public HtmlResponse confirmpage(final int crudMode, final String id, final UserEditForm form) { + form.crudMode = crudMode; + form.id = id; + verifyCrudMode(form, CommonConstants.CONFIRM_MODE); + verifyPassword(form); + loadUser(form, false); + return asHtml(path_AdminUser_ConfirmJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromcreate(final UserEditForm form) { + verifyPassword(form); + storePassword(form); + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminUser_ConfirmJsp).renderWith(data -> { + registerForms(data); + }); + } + + @Token(save = false, validate = true, keep = true) + @Execute + public HtmlResponse confirmfromupdate(final UserEditForm form) { + verifyPassword(form); + storePassword(form); + validate(form, messages -> {}, toEditHtml()); + return asHtml(path_AdminUser_ConfirmJsp).renderWith(data -> { + registerForms(data); + }); + } + + // ----------------------------------------------------- + // Actually Crud + // ------------- + @Token(save = false, validate = true) + @Execute + public HtmlResponse create(final UserEditForm form) { + validate(form, messages -> {}, toEditHtml()); + verifyPassword(form); + userService.store(createUser(form)); + saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Token(save = false, validate = true) + @Execute + public HtmlResponse update(final UserEditForm form) { + validate(form, messages -> {}, toEditHtml()); + verifyPassword(form); + userService.store(createUser(form)); + saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); + return redirect(getClass()); + } + + @Execute + public HtmlResponse delete(final UserEditForm form) { + verifyCrudMode(form, CommonConstants.DELETE_MODE); + userService.delete(getUser(form)); + saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); + return redirect(getClass()); + } + + // =================================================================================== + // Assist Logic + // ============ + protected void loadUser(final UserEditForm form, final boolean hasPassword) { + copyBeanToBean(getUser(form), form, op -> op.exclude("crudMode")); + if (!hasPassword) { + form.password = null; + form.confirmPassword = null; + } + } + + protected User getUser(final UserEditForm form) { + final User user = userService.getUser(createKeyMap(form)); + if (user == null) { + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml()); + } + return user; + } + + protected User createUser(final UserEditForm form) { + User user; + if (form.crudMode == CommonConstants.EDIT_MODE) { + user = getUser(form); + } else { + user = new User(); + } + copyBeanToBean(form, user, op -> op.exclude("password", "confirmPassword")); + sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).ifPresent(password -> { + user.setPassword(password); + }); + user.setId(Base64.getEncoder().encodeToString(user.getName().getBytes(Constants.CHARSET_UTF_8))); + return user; + } + + protected Map createKeyMap(final UserEditForm form) { + final Map keys = new HashMap(); + keys.put("id", form.id); + return keys; + } + + // =================================================================================== + // Small Helper + // ============ + protected void verifyCrudMode(final UserEditForm form, final int expectedMode) { + if (form.crudMode != expectedMode) { + throwValidationError(messages -> { + messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(form.crudMode)); + }, toEditHtml()); + } + } + + protected void verifyPassword(final UserEditForm form) { + if (form.crudMode == CommonConstants.CREATE_MODE && StringUtil.isBlank(form.password)) { + throwValidationError(messages -> { + messages.addErrorsBlankPassword(GLOBAL); + }, toEditHtml()); + } + if (form.password != null && !form.password.equals(form.confirmPassword)) { + throwValidationError(messages -> { + messages.addErrorsInvalidConfirmPassword(GLOBAL); + }, toEditHtml()); + } + } + + protected void verifyStoredPassword(final UserEditForm form) { + if (!sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).isPresent()) { + throwValidationError(messages -> { + messages.addErrorsInvalidConfirmPassword(GLOBAL); + }, toEditHtml()); + } + } + + private void clearStoredPassword() { + sessionManager.removeAttribute(TEMPORARY_PASSWORD); + } + + private void storePassword(final UserEditForm form) { + final String encodedPassword = fessLoginAssist.encryptPassword(form.password); + sessionManager.setAttribute(TEMPORARY_PASSWORD, encodedPassword); + form.password = null; + form.confirmPassword = null; + } + + protected VaErrorHook toEditHtml() { + return () -> { + return asHtml(path_AdminUser_EditJsp).renderWith(data -> { + registerForms(data); + }); + }; + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/user/UserEditForm.java b/src/main/java/org/codelibs/fess/app/web/admin/user/UserEditForm.java new file mode 100644 index 000000000..28de99171 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/user/UserEditForm.java @@ -0,0 +1,60 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.user; + +import java.io.Serializable; + +/** + * @author shinsuke + */ +public class UserEditForm implements Serializable { + + private static final long serialVersionUID = 1L; + + //@IntegerType + public int crudMode; + + //@Required(target = "confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 1000) + public String id; + + //@Required(target = "confirmfromcreate,create,confirmfromupdate,update,delete") + //@Maxbytelength(maxbytelength = 100) + public String name; + + //@Maxbytelength(maxbytelength = 100) + public String password; + + //@Maxbytelength(maxbytelength = 100) + public String confirmPassword; + + public String[] roles; + + public String[] groups; + + //@Required(target = "confirmfromupdate,update,delete") + //@IntegerType + public String versionNo; + + public void initialize() { + id = null; + name = null; + roles = null; + groups = null; + versionNo = null; + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/admin/user/UserSearchForm.java b/src/main/java/org/codelibs/fess/app/web/admin/user/UserSearchForm.java new file mode 100644 index 000000000..2aa21c9c8 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/admin/user/UserSearchForm.java @@ -0,0 +1,31 @@ +/* + * Copyright 2009-2015 the CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +package org.codelibs.fess.app.web.admin.user; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * @author shinsuke + */ +public class UserSearchForm implements Serializable { + + private static final long serialVersionUID = 1L; + + public Map searchParams = new HashMap(); +} diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessAdminAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessAdminAction.java index ec7b6688d..353f3a3a0 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessAdminAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessAdminAction.java @@ -17,14 +17,12 @@ package org.codelibs.fess.app.web.base; import java.util.function.Consumer; -import javax.annotation.Resource; import javax.servlet.ServletContext; import org.codelibs.core.beans.util.BeanUtil; import org.codelibs.core.beans.util.CopyOptions; import org.codelibs.fess.mylasta.action.FessMessages; import org.lastaflute.di.util.LdiFileUtil; -import org.lastaflute.web.servlet.session.SessionManager; import org.lastaflute.web.util.LaServletContextUtil; import org.lastaflute.web.validation.VaMessenger; @@ -37,8 +35,6 @@ public abstract class FessAdminAction extends FessBaseAction { // =================================================================================== // Attribute // ========= - @Resource - private SessionManager sessionManager; // =================================================================================== // Small Helper diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java index c4029a61d..aae1d75c0 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessBaseAction.java @@ -44,6 +44,7 @@ import org.lastaflute.web.TypicalAction; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.login.LoginManager; import org.lastaflute.web.response.ActionResponse; +import org.lastaflute.web.servlet.session.SessionManager; import org.lastaflute.web.validation.ActionValidator; import org.lastaflute.web.validation.LaValidatable; @@ -66,7 +67,10 @@ public abstract class FessBaseAction extends TypicalAction // has several interf // Attribute // ========= @Resource - private FessLoginAssist fessLoginAssist; + protected FessLoginAssist fessLoginAssist; + + @Resource + protected SessionManager sessionManager; // =================================================================================== // Hook diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java index e97e31762..cda837f64 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java @@ -43,7 +43,6 @@ import org.codelibs.fess.helper.SystemHelper; import org.codelibs.fess.helper.UserInfoHelper; import org.codelibs.fess.helper.ViewHelper; import org.codelibs.fess.screenshot.ScreenShotManager; -import org.codelibs.fess.util.SearchParamMap; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.ActionResponse; import org.lastaflute.web.util.LaRequestUtil; @@ -135,7 +134,7 @@ public abstract class FessSearchAction extends FessBaseAction { } } - protected void buildLabelParams(final SearchParamMap fields) { + protected void buildLabelParams(final Map fields) { // label final List> labelTypeItems = labelTypeHelper.getLabelTypeItemList(); diff --git a/src/main/java/org/codelibs/fess/app/web/search/SearchAction.java b/src/main/java/org/codelibs/fess/app/web/search/SearchAction.java index 74d2ede4e..f7e733668 100644 --- a/src/main/java/org/codelibs/fess/app/web/search/SearchAction.java +++ b/src/main/java/org/codelibs/fess/app/web/search/SearchAction.java @@ -288,14 +288,15 @@ public class SearchAction extends FessSearchAction { List> documentItems = null; try { documentItems = - fessEsClient.search(fieldHelper.docIndex, fieldHelper.docType, searchRequestBuilder -> { - return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset((int) pageStart).size(pageNum) - .facetInfo(form.facet).geoInfo(form.geo).responseFields(queryHelper.getResponseFields()).build(); - }, (searchRequestBuilder, execTime, searchResponse) -> { - QueryResponseList queryResponseList = ComponentUtil.getQueryResponseList(); - queryResponseList.init(searchResponse, pageStart, pageNum); - return queryResponseList; - }); + fessEsClient.search(fieldHelper.docIndex, fieldHelper.docType, + searchRequestBuilder -> { + return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset(pageStart).size(pageNum) + .facetInfo(form.facet).geoInfo(form.geo).responseFields(queryHelper.getResponseFields()).build(); + }, (searchRequestBuilder, execTime, searchResponse) -> { + final QueryResponseList queryResponseList = ComponentUtil.getQueryResponseList(); + queryResponseList.init(searchResponse, pageStart, pageNum); + return queryResponseList; + }); } catch (final InvalidQueryException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); diff --git a/src/main/java/org/codelibs/fess/app/web/search/SearchForm.java b/src/main/java/org/codelibs/fess/app/web/search/SearchForm.java index 97fc5f579..2df128db3 100644 --- a/src/main/java/org/codelibs/fess/app/web/search/SearchForm.java +++ b/src/main/java/org/codelibs/fess/app/web/search/SearchForm.java @@ -16,10 +16,12 @@ package org.codelibs.fess.app.web.search; +import java.util.HashMap; +import java.util.Map; + import org.codelibs.fess.app.web.RootForm; import org.codelibs.fess.entity.FacetInfo; import org.codelibs.fess.entity.GeoInfo; -import org.codelibs.fess.util.SearchParamMap; public class SearchForm extends RootForm { @@ -79,6 +81,6 @@ public class SearchForm extends RootForm { // advance - public SearchParamMap options = new SearchParamMap(); + public Map options = new HashMap<>(); } diff --git a/src/main/java/org/codelibs/fess/es/bsbhv/AbstractBehavior.java b/src/main/java/org/codelibs/fess/es/bsbhv/AbstractBehavior.java index 34fd22b75..806abdc90 100644 --- a/src/main/java/org/codelibs/fess/es/bsbhv/AbstractBehavior.java +++ b/src/main/java/org/codelibs/fess/es/bsbhv/AbstractBehavior.java @@ -25,6 +25,7 @@ import org.dbflute.cbean.ConditionBean; import org.dbflute.cbean.coption.CursorSelectOption; import org.dbflute.cbean.result.ListResultBean; import org.dbflute.exception.IllegalBehaviorStateException; +import org.dbflute.util.DfTypeUtil; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -348,6 +349,19 @@ public abstract class AbstractBehavior) value).stream().map(v -> v.toString()).toArray(n -> new String[n]); + } + String str = DfTypeUtil.toString(value); + if (str == null) { + return null; + } + return new String[] { str }; + } + public static class BulkList implements List { private final List parent; diff --git a/src/main/java/org/codelibs/fess/es/bsbhv/BsUserBhv.java b/src/main/java/org/codelibs/fess/es/bsbhv/BsUserBhv.java index c29e9c0c7..4e8a9cdd4 100644 --- a/src/main/java/org/codelibs/fess/es/bsbhv/BsUserBhv.java +++ b/src/main/java/org/codelibs/fess/es/bsbhv/BsUserBhv.java @@ -55,11 +55,11 @@ public abstract class BsUserBhv extends AbstractBehavior { protected RESULT createEntity(Map source, Class entityType) { try { final RESULT result = entityType.newInstance(); - result.setGroup(DfTypeUtil.toString(source.get("group"))); + result.setGroups(toStringArray(source.get("groups"))); result.setId(DfTypeUtil.toString(source.get("id"))); result.setName(DfTypeUtil.toString(source.get("name"))); result.setPassword(DfTypeUtil.toString(source.get("password"))); - result.setRole(DfTypeUtil.toString(source.get("role"))); + result.setRoles(toStringArray(source.get("roles"))); return result; } catch (InstantiationException | IllegalAccessException e) { final String msg = "Cannot create a new instance: " + entityType.getName(); diff --git a/src/main/java/org/codelibs/fess/es/bsentity/BsUser.java b/src/main/java/org/codelibs/fess/es/bsentity/BsUser.java index f1b25c952..aa78453ef 100644 --- a/src/main/java/org/codelibs/fess/es/bsentity/BsUser.java +++ b/src/main/java/org/codelibs/fess/es/bsentity/BsUser.java @@ -26,8 +26,8 @@ public class BsUser extends AbstractEntity { // =================================================================================== // Attribute // ========= - /** group */ - protected String group; + /** groups */ + protected String[] groups; /** name */ protected String name; @@ -35,22 +35,22 @@ public class BsUser extends AbstractEntity { /** password */ protected String password; - /** role */ - protected String role; + /** roles */ + protected String[] roles; // [Referrers] *comment only // =================================================================================== // Accessor // ======== - public String getGroup() { - checkSpecifiedProperty("group"); - return group; + public String[] getGroups() { + checkSpecifiedProperty("groups"); + return groups; } - public void setGroup(String value) { - registerModifiedProperty("group"); - this.group = value; + public void setGroups(String[] value) { + registerModifiedProperty("groups"); + this.groups = value; } public String getId() { @@ -83,21 +83,21 @@ public class BsUser extends AbstractEntity { this.password = value; } - public String getRole() { - checkSpecifiedProperty("role"); - return role; + public String[] getRoles() { + checkSpecifiedProperty("roles"); + return roles; } - public void setRole(String value) { - registerModifiedProperty("role"); - this.role = value; + public void setRoles(String[] value) { + registerModifiedProperty("roles"); + this.roles = value; } @Override public Map toSource() { Map sourceMap = new HashMap<>(); - if (group != null) { - sourceMap.put("group", group); + if (groups != null) { + sourceMap.put("groups", groups); } if (asDocMeta().id() != null) { sourceMap.put("id", asDocMeta().id()); @@ -108,8 +108,8 @@ public class BsUser extends AbstractEntity { if (password != null) { sourceMap.put("password", password); } - if (role != null) { - sourceMap.put("role", role); + if (roles != null) { + sourceMap.put("roles", roles); } return sourceMap; } diff --git a/src/main/java/org/codelibs/fess/es/bsentity/dbmeta/UserDbm.java b/src/main/java/org/codelibs/fess/es/bsentity/dbmeta/UserDbm.java index 2dc3fd666..257434528 100644 --- a/src/main/java/org/codelibs/fess/es/bsentity/dbmeta/UserDbm.java +++ b/src/main/java/org/codelibs/fess/es/bsentity/dbmeta/UserDbm.java @@ -35,11 +35,11 @@ public class UserDbm extends AbstractDBMeta { // --------------- protected final Map _epgMap = newHashMap(); { - setupEpg(_epgMap, et -> ((User) et).getGroup(), (et, vl) -> ((User) et).setGroup(DfTypeUtil.toString(vl)), "group"); + setupEpg(_epgMap, et -> ((User) et).getGroups(), (et, vl) -> ((User) et).setGroups((String[]) vl), "groups"); setupEpg(_epgMap, et -> ((User) et).getId(), (et, vl) -> ((User) et).setId(DfTypeUtil.toString(vl)), "id"); setupEpg(_epgMap, et -> ((User) et).getName(), (et, vl) -> ((User) et).setName(DfTypeUtil.toString(vl)), "name"); setupEpg(_epgMap, et -> ((User) et).getPassword(), (et, vl) -> ((User) et).setPassword(DfTypeUtil.toString(vl)), "password"); - setupEpg(_epgMap, et -> ((User) et).getRole(), (et, vl) -> ((User) et).setRole(DfTypeUtil.toString(vl)), "role"); + setupEpg(_epgMap, et -> ((User) et).getRoles(), (et, vl) -> ((User) et).setRoles((String[]) vl), "roles"); } @Override @@ -50,19 +50,19 @@ public class UserDbm extends AbstractDBMeta { // =================================================================================== // Column Info // =========== - protected final ColumnInfo _columnGroup = cci("group", "group", null, null, String.class, "group", null, false, false, false, "String", - 0, 0, null, false, null, null, null, null, null, false); + protected final ColumnInfo _columnGroups = cci("groups", "groups", null, null, String[].class, "groups", null, false, false, false, + "String", 0, 0, null, false, null, null, null, null, null, false); protected final ColumnInfo _columnId = cci("id", "id", null, null, String.class, "id", null, false, false, false, "String", 0, 0, null, false, null, null, null, null, null, false); protected final ColumnInfo _columnName = cci("name", "name", null, null, String.class, "name", null, false, false, false, "String", 0, 0, null, false, null, null, null, null, null, false); protected final ColumnInfo _columnPassword = cci("password", "password", null, null, String.class, "password", null, false, false, false, "String", 0, 0, null, false, null, null, null, null, null, false); - protected final ColumnInfo _columnRole = cci("role", "role", null, null, String.class, "role", null, false, false, false, "String", 0, - 0, null, false, null, null, null, null, null, false); + protected final ColumnInfo _columnRoles = cci("roles", "roles", null, null, String[].class, "roles", null, false, false, false, + "String", 0, 0, null, false, null, null, null, null, null, false); - public ColumnInfo columnGroup() { - return _columnGroup; + public ColumnInfo columnGroups() { + return _columnGroups; } public ColumnInfo columnId() { @@ -77,17 +77,17 @@ public class UserDbm extends AbstractDBMeta { return _columnPassword; } - public ColumnInfo columnRole() { - return _columnRole; + public ColumnInfo columnRoles() { + return _columnRoles; } protected List ccil() { List ls = newArrayList(); - ls.add(columnGroup()); + ls.add(columnGroups()); ls.add(columnId()); ls.add(columnName()); ls.add(columnPassword()); - ls.add(columnRole()); + ls.add(columnRoles()); return ls; } diff --git a/src/main/java/org/codelibs/fess/es/cbean/bs/BsUserCB.java b/src/main/java/org/codelibs/fess/es/cbean/bs/BsUserCB.java index 7840c42de..3cca8c18f 100644 --- a/src/main/java/org/codelibs/fess/es/cbean/bs/BsUserCB.java +++ b/src/main/java/org/codelibs/fess/es/cbean/bs/BsUserCB.java @@ -123,8 +123,8 @@ public class BsUserCB extends AbstractConditionBean { columnList.add(name); } - public void columnGroup() { - doColumn("group"); + public void columnGroups() { + doColumn("groups"); } public void columnId() { @@ -139,8 +139,8 @@ public class BsUserCB extends AbstractConditionBean { doColumn("password"); } - public void columnRole() { - doColumn("role"); + public void columnRoles() { + doColumn("roles"); } } } diff --git a/src/main/java/org/codelibs/fess/es/cbean/cf/bs/BsUserCF.java b/src/main/java/org/codelibs/fess/es/cbean/cf/bs/BsUserCF.java index 7968a38ec..0166a7042 100644 --- a/src/main/java/org/codelibs/fess/es/cbean/cf/bs/BsUserCF.java +++ b/src/main/java/org/codelibs/fess/es/cbean/cf/bs/BsUserCF.java @@ -106,127 +106,127 @@ public abstract class BsUserCF extends AbstractConditionFilter { } } - public void setGroup_NotEqual(String group) { - setGroup_NotEqual(group, null, null); + public void setGroups_NotEqual(String groups) { + setGroups_NotEqual(groups, null, null); } - public void setGroup_NotEqual(String group, ConditionOptionCall notOpLambda, + public void setGroups_NotEqual(String groups, ConditionOptionCall notOpLambda, ConditionOptionCall eqOpLambda) { not(subCf -> { - subCf.setGroup_Equal(group, eqOpLambda); + subCf.setGroups_Equal(groups, eqOpLambda); }, notOpLambda); } - public void setGroup_Equal(String group) { - setGroup_Term(group, null); + public void setGroups_Equal(String groups) { + setGroups_Term(groups, null); } - public void setGroup_Equal(String group, ConditionOptionCall opLambda) { - setGroup_Term(group, opLambda); + public void setGroups_Equal(String groups, ConditionOptionCall opLambda) { + setGroups_Term(groups, opLambda); } - public void setGroup_Term(String group) { - setGroup_Term(group, null); + public void setGroups_Term(String groups) { + setGroups_Term(groups, null); } - public void setGroup_Term(String group, ConditionOptionCall opLambda) { - TermFilterBuilder builder = regTermF("group", group); + public void setGroups_Term(String groups, ConditionOptionCall opLambda) { + TermFilterBuilder builder = regTermF("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Terms(Collection groupList) { - setGroup_Terms(groupList, null); + public void setGroups_Terms(Collection groupsList) { + setGroups_Terms(groupsList, null); } - public void setGroup_Terms(Collection groupList, ConditionOptionCall opLambda) { - TermsFilterBuilder builder = regTermsF("group", groupList); + public void setGroups_Terms(Collection groupsList, ConditionOptionCall opLambda) { + TermsFilterBuilder builder = regTermsF("groups", groupsList); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_InScope(Collection groupList) { - setGroup_Terms(groupList, null); + public void setGroups_InScope(Collection groupsList) { + setGroups_Terms(groupsList, null); } - public void setGroup_InScope(Collection groupList, ConditionOptionCall opLambda) { - setGroup_Terms(groupList, opLambda); + public void setGroups_InScope(Collection groupsList, ConditionOptionCall opLambda) { + setGroups_Terms(groupsList, opLambda); } - public void setGroup_Prefix(String group) { - setGroup_Prefix(group, null); + public void setGroups_Prefix(String groups) { + setGroups_Prefix(groups, null); } - public void setGroup_Prefix(String group, ConditionOptionCall opLambda) { - PrefixFilterBuilder builder = regPrefixF("group", group); + public void setGroups_Prefix(String groups, ConditionOptionCall opLambda) { + PrefixFilterBuilder builder = regPrefixF("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Exists() { - setGroup_Exists(null); + public void setGroups_Exists() { + setGroups_Exists(null); } - public void setGroup_Exists(ConditionOptionCall opLambda) { - ExistsFilterBuilder builder = regExistsF("group"); + public void setGroups_Exists(ConditionOptionCall opLambda) { + ExistsFilterBuilder builder = regExistsF("groups"); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Missing() { - setGroup_Missing(null); + public void setGroups_Missing() { + setGroups_Missing(null); } - public void setGroup_Missing(ConditionOptionCall opLambda) { - MissingFilterBuilder builder = regMissingF("group"); + public void setGroups_Missing(ConditionOptionCall opLambda) { + MissingFilterBuilder builder = regMissingF("groups"); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_GreaterThan(String group) { - setGroup_GreaterThan(group, null); + public void setGroups_GreaterThan(String groups) { + setGroups_GreaterThan(groups, null); } - public void setGroup_GreaterThan(String group, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("group", ConditionKey.CK_GREATER_THAN, group); + public void setGroups_GreaterThan(String groups, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("groups", ConditionKey.CK_GREATER_THAN, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_LessThan(String group) { - setGroup_LessThan(group, null); + public void setGroups_LessThan(String groups) { + setGroups_LessThan(groups, null); } - public void setGroup_LessThan(String group, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("group", ConditionKey.CK_LESS_THAN, group); + public void setGroups_LessThan(String groups, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("groups", ConditionKey.CK_LESS_THAN, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_GreaterEqual(String group) { - setGroup_GreaterEqual(group, null); + public void setGroups_GreaterEqual(String groups) { + setGroups_GreaterEqual(groups, null); } - public void setGroup_GreaterEqual(String group, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("group", ConditionKey.CK_GREATER_EQUAL, group); + public void setGroups_GreaterEqual(String groups, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("groups", ConditionKey.CK_GREATER_EQUAL, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_LessEqual(String group) { - setGroup_LessEqual(group, null); + public void setGroups_LessEqual(String groups) { + setGroups_LessEqual(groups, null); } - public void setGroup_LessEqual(String group, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("group", ConditionKey.CK_LESS_EQUAL, group); + public void setGroups_LessEqual(String groups, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("groups", ConditionKey.CK_LESS_EQUAL, groups); if (opLambda != null) { opLambda.callback(builder); } @@ -610,127 +610,127 @@ public abstract class BsUserCF extends AbstractConditionFilter { } } - public void setRole_NotEqual(String role) { - setRole_NotEqual(role, null, null); + public void setRoles_NotEqual(String roles) { + setRoles_NotEqual(roles, null, null); } - public void setRole_NotEqual(String role, ConditionOptionCall notOpLambda, + public void setRoles_NotEqual(String roles, ConditionOptionCall notOpLambda, ConditionOptionCall eqOpLambda) { not(subCf -> { - subCf.setRole_Equal(role, eqOpLambda); + subCf.setRoles_Equal(roles, eqOpLambda); }, notOpLambda); } - public void setRole_Equal(String role) { - setRole_Term(role, null); + public void setRoles_Equal(String roles) { + setRoles_Term(roles, null); } - public void setRole_Equal(String role, ConditionOptionCall opLambda) { - setRole_Term(role, opLambda); + public void setRoles_Equal(String roles, ConditionOptionCall opLambda) { + setRoles_Term(roles, opLambda); } - public void setRole_Term(String role) { - setRole_Term(role, null); + public void setRoles_Term(String roles) { + setRoles_Term(roles, null); } - public void setRole_Term(String role, ConditionOptionCall opLambda) { - TermFilterBuilder builder = regTermF("role", role); + public void setRoles_Term(String roles, ConditionOptionCall opLambda) { + TermFilterBuilder builder = regTermF("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Terms(Collection roleList) { - setRole_Terms(roleList, null); + public void setRoles_Terms(Collection rolesList) { + setRoles_Terms(rolesList, null); } - public void setRole_Terms(Collection roleList, ConditionOptionCall opLambda) { - TermsFilterBuilder builder = regTermsF("role", roleList); + public void setRoles_Terms(Collection rolesList, ConditionOptionCall opLambda) { + TermsFilterBuilder builder = regTermsF("roles", rolesList); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_InScope(Collection roleList) { - setRole_Terms(roleList, null); + public void setRoles_InScope(Collection rolesList) { + setRoles_Terms(rolesList, null); } - public void setRole_InScope(Collection roleList, ConditionOptionCall opLambda) { - setRole_Terms(roleList, opLambda); + public void setRoles_InScope(Collection rolesList, ConditionOptionCall opLambda) { + setRoles_Terms(rolesList, opLambda); } - public void setRole_Prefix(String role) { - setRole_Prefix(role, null); + public void setRoles_Prefix(String roles) { + setRoles_Prefix(roles, null); } - public void setRole_Prefix(String role, ConditionOptionCall opLambda) { - PrefixFilterBuilder builder = regPrefixF("role", role); + public void setRoles_Prefix(String roles, ConditionOptionCall opLambda) { + PrefixFilterBuilder builder = regPrefixF("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Exists() { - setRole_Exists(null); + public void setRoles_Exists() { + setRoles_Exists(null); } - public void setRole_Exists(ConditionOptionCall opLambda) { - ExistsFilterBuilder builder = regExistsF("role"); + public void setRoles_Exists(ConditionOptionCall opLambda) { + ExistsFilterBuilder builder = regExistsF("roles"); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Missing() { - setRole_Missing(null); + public void setRoles_Missing() { + setRoles_Missing(null); } - public void setRole_Missing(ConditionOptionCall opLambda) { - MissingFilterBuilder builder = regMissingF("role"); + public void setRoles_Missing(ConditionOptionCall opLambda) { + MissingFilterBuilder builder = regMissingF("roles"); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_GreaterThan(String role) { - setRole_GreaterThan(role, null); + public void setRoles_GreaterThan(String roles) { + setRoles_GreaterThan(roles, null); } - public void setRole_GreaterThan(String role, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("role", ConditionKey.CK_GREATER_THAN, role); + public void setRoles_GreaterThan(String roles, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("roles", ConditionKey.CK_GREATER_THAN, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_LessThan(String role) { - setRole_LessThan(role, null); + public void setRoles_LessThan(String roles) { + setRoles_LessThan(roles, null); } - public void setRole_LessThan(String role, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("role", ConditionKey.CK_LESS_THAN, role); + public void setRoles_LessThan(String roles, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("roles", ConditionKey.CK_LESS_THAN, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_GreaterEqual(String role) { - setRole_GreaterEqual(role, null); + public void setRoles_GreaterEqual(String roles) { + setRoles_GreaterEqual(roles, null); } - public void setRole_GreaterEqual(String role, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("role", ConditionKey.CK_GREATER_EQUAL, role); + public void setRoles_GreaterEqual(String roles, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("roles", ConditionKey.CK_GREATER_EQUAL, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_LessEqual(String role) { - setRole_LessEqual(role, null); + public void setRoles_LessEqual(String roles) { + setRoles_LessEqual(roles, null); } - public void setRole_LessEqual(String role, ConditionOptionCall opLambda) { - RangeFilterBuilder builder = regRangeF("role", ConditionKey.CK_LESS_EQUAL, role); + public void setRoles_LessEqual(String roles, ConditionOptionCall opLambda) { + RangeFilterBuilder builder = regRangeF("roles", ConditionKey.CK_LESS_EQUAL, roles); if (opLambda != null) { opLambda.callback(builder); } diff --git a/src/main/java/org/codelibs/fess/es/cbean/cq/bs/BsUserCQ.java b/src/main/java/org/codelibs/fess/es/cbean/cq/bs/BsUserCQ.java index 5d84a1166..bc7f90984 100644 --- a/src/main/java/org/codelibs/fess/es/cbean/cq/bs/BsUserCQ.java +++ b/src/main/java/org/codelibs/fess/es/cbean/cq/bs/BsUserCQ.java @@ -62,150 +62,150 @@ public abstract class BsUserCQ extends AbstractConditionQuery { } } - public void setGroup_Equal(String group) { - setGroup_Term(group, null); + public void setGroups_Equal(String groups) { + setGroups_Term(groups, null); } - public void setGroup_Equal(String group, ConditionOptionCall opLambda) { - setGroup_Term(group, opLambda); + public void setGroups_Equal(String groups, ConditionOptionCall opLambda) { + setGroups_Term(groups, opLambda); } - public void setGroup_Term(String group) { - setGroup_Term(group, null); + public void setGroups_Term(String groups) { + setGroups_Term(groups, null); } - public void setGroup_Term(String group, ConditionOptionCall opLambda) { - TermQueryBuilder builder = regTermQ("group", group); + public void setGroups_Term(String groups, ConditionOptionCall opLambda) { + TermQueryBuilder builder = regTermQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Terms(Collection groupList) { - setGroup_Terms(groupList, null); + public void setGroups_Terms(Collection groupsList) { + setGroups_Terms(groupsList, null); } - public void setGroup_Terms(Collection groupList, ConditionOptionCall opLambda) { - TermsQueryBuilder builder = regTermsQ("group", groupList); + public void setGroups_Terms(Collection groupsList, ConditionOptionCall opLambda) { + TermsQueryBuilder builder = regTermsQ("groups", groupsList); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_InScope(Collection groupList) { - setGroup_Terms(groupList, null); + public void setGroups_InScope(Collection groupsList) { + setGroups_Terms(groupsList, null); } - public void setGroup_InScope(Collection groupList, ConditionOptionCall opLambda) { - setGroup_Terms(groupList, opLambda); + public void setGroups_InScope(Collection groupsList, ConditionOptionCall opLambda) { + setGroups_Terms(groupsList, opLambda); } - public void setGroup_Match(String group) { - setGroup_Match(group, null); + public void setGroups_Match(String groups) { + setGroups_Match(groups, null); } - public void setGroup_Match(String group, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchQ("group", group); + public void setGroups_Match(String groups, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_MatchPhrase(String group) { - setGroup_MatchPhrase(group, null); + public void setGroups_MatchPhrase(String groups) { + setGroups_MatchPhrase(groups, null); } - public void setGroup_MatchPhrase(String group, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchPhraseQ("group", group); + public void setGroups_MatchPhrase(String groups, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchPhraseQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_MatchPhrasePrefix(String group) { - setGroup_MatchPhrasePrefix(group, null); + public void setGroups_MatchPhrasePrefix(String groups) { + setGroups_MatchPhrasePrefix(groups, null); } - public void setGroup_MatchPhrasePrefix(String group, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchPhrasePrefixQ("group", group); + public void setGroups_MatchPhrasePrefix(String groups, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchPhrasePrefixQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Fuzzy(String group) { - setGroup_Fuzzy(group, null); + public void setGroups_Fuzzy(String groups) { + setGroups_Fuzzy(groups, null); } - public void setGroup_Fuzzy(String group, ConditionOptionCall opLambda) { - FuzzyQueryBuilder builder = regFuzzyQ("group", group); + public void setGroups_Fuzzy(String groups, ConditionOptionCall opLambda) { + FuzzyQueryBuilder builder = regFuzzyQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_Prefix(String group) { - setGroup_Prefix(group, null); + public void setGroups_Prefix(String groups) { + setGroups_Prefix(groups, null); } - public void setGroup_Prefix(String group, ConditionOptionCall opLambda) { - PrefixQueryBuilder builder = regPrefixQ("group", group); + public void setGroups_Prefix(String groups, ConditionOptionCall opLambda) { + PrefixQueryBuilder builder = regPrefixQ("groups", groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_GreaterThan(String group) { - setGroup_GreaterThan(group, null); + public void setGroups_GreaterThan(String groups) { + setGroups_GreaterThan(groups, null); } - public void setGroup_GreaterThan(String group, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("group", ConditionKey.CK_GREATER_THAN, group); + public void setGroups_GreaterThan(String groups, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("groups", ConditionKey.CK_GREATER_THAN, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_LessThan(String group) { - setGroup_LessThan(group, null); + public void setGroups_LessThan(String groups) { + setGroups_LessThan(groups, null); } - public void setGroup_LessThan(String group, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("group", ConditionKey.CK_LESS_THAN, group); + public void setGroups_LessThan(String groups, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("groups", ConditionKey.CK_LESS_THAN, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_GreaterEqual(String group) { - setGroup_GreaterEqual(group, null); + public void setGroups_GreaterEqual(String groups) { + setGroups_GreaterEqual(groups, null); } - public void setGroup_GreaterEqual(String group, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("group", ConditionKey.CK_GREATER_EQUAL, group); + public void setGroups_GreaterEqual(String groups, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("groups", ConditionKey.CK_GREATER_EQUAL, groups); if (opLambda != null) { opLambda.callback(builder); } } - public void setGroup_LessEqual(String group) { - setGroup_LessEqual(group, null); + public void setGroups_LessEqual(String groups) { + setGroups_LessEqual(groups, null); } - public void setGroup_LessEqual(String group, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("group", ConditionKey.CK_LESS_EQUAL, group); + public void setGroups_LessEqual(String groups, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("groups", ConditionKey.CK_LESS_EQUAL, groups); if (opLambda != null) { opLambda.callback(builder); } } - public BsUserCQ addOrderBy_Group_Asc() { - regOBA("group"); + public BsUserCQ addOrderBy_Groups_Asc() { + regOBA("groups"); return this; } - public BsUserCQ addOrderBy_Group_Desc() { - regOBD("group"); + public BsUserCQ addOrderBy_Groups_Desc() { + regOBD("groups"); return this; } @@ -650,150 +650,150 @@ public abstract class BsUserCQ extends AbstractConditionQuery { return this; } - public void setRole_Equal(String role) { - setRole_Term(role, null); + public void setRoles_Equal(String roles) { + setRoles_Term(roles, null); } - public void setRole_Equal(String role, ConditionOptionCall opLambda) { - setRole_Term(role, opLambda); + public void setRoles_Equal(String roles, ConditionOptionCall opLambda) { + setRoles_Term(roles, opLambda); } - public void setRole_Term(String role) { - setRole_Term(role, null); + public void setRoles_Term(String roles) { + setRoles_Term(roles, null); } - public void setRole_Term(String role, ConditionOptionCall opLambda) { - TermQueryBuilder builder = regTermQ("role", role); + public void setRoles_Term(String roles, ConditionOptionCall opLambda) { + TermQueryBuilder builder = regTermQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Terms(Collection roleList) { - setRole_Terms(roleList, null); + public void setRoles_Terms(Collection rolesList) { + setRoles_Terms(rolesList, null); } - public void setRole_Terms(Collection roleList, ConditionOptionCall opLambda) { - TermsQueryBuilder builder = regTermsQ("role", roleList); + public void setRoles_Terms(Collection rolesList, ConditionOptionCall opLambda) { + TermsQueryBuilder builder = regTermsQ("roles", rolesList); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_InScope(Collection roleList) { - setRole_Terms(roleList, null); + public void setRoles_InScope(Collection rolesList) { + setRoles_Terms(rolesList, null); } - public void setRole_InScope(Collection roleList, ConditionOptionCall opLambda) { - setRole_Terms(roleList, opLambda); + public void setRoles_InScope(Collection rolesList, ConditionOptionCall opLambda) { + setRoles_Terms(rolesList, opLambda); } - public void setRole_Match(String role) { - setRole_Match(role, null); + public void setRoles_Match(String roles) { + setRoles_Match(roles, null); } - public void setRole_Match(String role, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchQ("role", role); + public void setRoles_Match(String roles, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_MatchPhrase(String role) { - setRole_MatchPhrase(role, null); + public void setRoles_MatchPhrase(String roles) { + setRoles_MatchPhrase(roles, null); } - public void setRole_MatchPhrase(String role, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchPhraseQ("role", role); + public void setRoles_MatchPhrase(String roles, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchPhraseQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_MatchPhrasePrefix(String role) { - setRole_MatchPhrasePrefix(role, null); + public void setRoles_MatchPhrasePrefix(String roles) { + setRoles_MatchPhrasePrefix(roles, null); } - public void setRole_MatchPhrasePrefix(String role, ConditionOptionCall opLambda) { - MatchQueryBuilder builder = regMatchPhrasePrefixQ("role", role); + public void setRoles_MatchPhrasePrefix(String roles, ConditionOptionCall opLambda) { + MatchQueryBuilder builder = regMatchPhrasePrefixQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Fuzzy(String role) { - setRole_Fuzzy(role, null); + public void setRoles_Fuzzy(String roles) { + setRoles_Fuzzy(roles, null); } - public void setRole_Fuzzy(String role, ConditionOptionCall opLambda) { - FuzzyQueryBuilder builder = regFuzzyQ("role", role); + public void setRoles_Fuzzy(String roles, ConditionOptionCall opLambda) { + FuzzyQueryBuilder builder = regFuzzyQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_Prefix(String role) { - setRole_Prefix(role, null); + public void setRoles_Prefix(String roles) { + setRoles_Prefix(roles, null); } - public void setRole_Prefix(String role, ConditionOptionCall opLambda) { - PrefixQueryBuilder builder = regPrefixQ("role", role); + public void setRoles_Prefix(String roles, ConditionOptionCall opLambda) { + PrefixQueryBuilder builder = regPrefixQ("roles", roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_GreaterThan(String role) { - setRole_GreaterThan(role, null); + public void setRoles_GreaterThan(String roles) { + setRoles_GreaterThan(roles, null); } - public void setRole_GreaterThan(String role, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("role", ConditionKey.CK_GREATER_THAN, role); + public void setRoles_GreaterThan(String roles, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("roles", ConditionKey.CK_GREATER_THAN, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_LessThan(String role) { - setRole_LessThan(role, null); + public void setRoles_LessThan(String roles) { + setRoles_LessThan(roles, null); } - public void setRole_LessThan(String role, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("role", ConditionKey.CK_LESS_THAN, role); + public void setRoles_LessThan(String roles, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("roles", ConditionKey.CK_LESS_THAN, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_GreaterEqual(String role) { - setRole_GreaterEqual(role, null); + public void setRoles_GreaterEqual(String roles) { + setRoles_GreaterEqual(roles, null); } - public void setRole_GreaterEqual(String role, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("role", ConditionKey.CK_GREATER_EQUAL, role); + public void setRoles_GreaterEqual(String roles, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("roles", ConditionKey.CK_GREATER_EQUAL, roles); if (opLambda != null) { opLambda.callback(builder); } } - public void setRole_LessEqual(String role) { - setRole_LessEqual(role, null); + public void setRoles_LessEqual(String roles) { + setRoles_LessEqual(roles, null); } - public void setRole_LessEqual(String role, ConditionOptionCall opLambda) { - RangeQueryBuilder builder = regRangeQ("role", ConditionKey.CK_LESS_EQUAL, role); + public void setRoles_LessEqual(String roles, ConditionOptionCall opLambda) { + RangeQueryBuilder builder = regRangeQ("roles", ConditionKey.CK_LESS_EQUAL, roles); if (opLambda != null) { opLambda.callback(builder); } } - public BsUserCQ addOrderBy_Role_Asc() { - regOBA("role"); + public BsUserCQ addOrderBy_Roles_Asc() { + regOBA("roles"); return this; } - public BsUserCQ addOrderBy_Role_Desc() { - regOBD("role"); + public BsUserCQ addOrderBy_Roles_Desc() { + regOBD("roles"); return this; } diff --git a/src/main/java/org/codelibs/fess/helper/QueryHelper.java b/src/main/java/org/codelibs/fess/helper/QueryHelper.java index b11e6da6f..e4c392dd6 100644 --- a/src/main/java/org/codelibs/fess/helper/QueryHelper.java +++ b/src/main/java/org/codelibs/fess/helper/QueryHelper.java @@ -40,7 +40,6 @@ import org.codelibs.fess.entity.GeoInfo; import org.codelibs.fess.entity.SearchQuery; import org.codelibs.fess.entity.SearchQuery.SortField; import org.codelibs.fess.util.QueryUtil; -import org.codelibs.fess.util.SearchParamMap; import org.lastaflute.web.ruts.message.ActionMessages; import org.lastaflute.web.util.LaRequestUtil; @@ -965,7 +964,7 @@ public class QueryHelper implements Serializable { return "count".equals(sort) || "index".equals(sort); } - public String buildOptionQuery(final SearchParamMap optionMap) { + public String buildOptionQuery(final Map optionMap) { if (optionMap == null) { return StringUtil.EMPTY; } diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java index 90791aff3..d1651ea4e 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java @@ -131,6 +131,18 @@ public interface FessHtmlPath { /** The path of the HTML: /admin/fileconfig/index.jsp */ HtmlNext path_AdminFileconfig_IndexJsp = new HtmlNext("/admin/fileconfig/index.jsp"); + /** The path of the HTML: /admin/group/confirm.jsp */ + HtmlNext path_AdminGroup_ConfirmJsp = new HtmlNext("/admin/group/confirm.jsp"); + + /** The path of the HTML: /admin/group/edit.jsp */ + HtmlNext path_AdminGroup_EditJsp = new HtmlNext("/admin/group/edit.jsp"); + + /** The path of the HTML: /admin/group/error.jsp */ + HtmlNext path_AdminGroup_ErrorJsp = new HtmlNext("/admin/group/error.jsp"); + + /** The path of the HTML: /admin/group/index.jsp */ + HtmlNext path_AdminGroup_IndexJsp = new HtmlNext("/admin/group/index.jsp"); + /** The path of the HTML: /admin/joblog/confirm.jsp */ HtmlNext path_AdminJoblog_ConfirmJsp = new HtmlNext("/admin/joblog/confirm.jsp"); @@ -203,6 +215,18 @@ public interface FessHtmlPath { /** The path of the HTML: /admin/requestheader/index.jsp */ HtmlNext path_AdminRequestheader_IndexJsp = new HtmlNext("/admin/requestheader/index.jsp"); + /** The path of the HTML: /admin/role/confirm.jsp */ + HtmlNext path_AdminRole_ConfirmJsp = new HtmlNext("/admin/role/confirm.jsp"); + + /** The path of the HTML: /admin/role/edit.jsp */ + HtmlNext path_AdminRole_EditJsp = new HtmlNext("/admin/role/edit.jsp"); + + /** The path of the HTML: /admin/role/error.jsp */ + HtmlNext path_AdminRole_ErrorJsp = new HtmlNext("/admin/role/error.jsp"); + + /** The path of the HTML: /admin/role/index.jsp */ + HtmlNext path_AdminRole_IndexJsp = new HtmlNext("/admin/role/index.jsp"); + /** The path of the HTML: /admin/roletype/confirm.jsp */ HtmlNext path_AdminRoletype_ConfirmJsp = new HtmlNext("/admin/roletype/confirm.jsp"); @@ -275,6 +299,18 @@ public interface FessHtmlPath { /** The path of the HTML: /admin/systeminfo/index.jsp */ HtmlNext path_AdminSysteminfo_IndexJsp = new HtmlNext("/admin/systeminfo/index.jsp"); + /** The path of the HTML: /admin/user/confirm.jsp */ + HtmlNext path_AdminUser_ConfirmJsp = new HtmlNext("/admin/user/confirm.jsp"); + + /** The path of the HTML: /admin/user/edit.jsp */ + HtmlNext path_AdminUser_EditJsp = new HtmlNext("/admin/user/edit.jsp"); + + /** The path of the HTML: /admin/user/error.jsp */ + HtmlNext path_AdminUser_ErrorJsp = new HtmlNext("/admin/user/error.jsp"); + + /** The path of the HTML: /admin/user/index.jsp */ + HtmlNext path_AdminUser_IndexJsp = new HtmlNext("/admin/user/index.jsp"); + /** The path of the HTML: /admin/webauthentication/confirm.jsp */ HtmlNext path_AdminWebauthentication_ConfirmJsp = new HtmlNext("/admin/webauthentication/confirm.jsp"); diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java index 2e5b7f37e..188ad539c 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java @@ -566,6 +566,18 @@ public class FessLabels extends ActionMessages { /** The key of the message: » Role */ public static final String LABELS_MENU_role_type = "{labels.menu.role_type}"; + /** The key of the message: User */ + public static final String LABELS_menu_user = "{labels.menu_user}"; + + /** The key of the message: User */ + public static final String LABELS_MENU_USER = "{labels.menu.user}"; + + /** The key of the message: Role */ + public static final String LABELS_MENU_ROLE = "{labels.menu.role}"; + + /** The key of the message: Group */ + public static final String LABELS_MENU_GROUP = "{labels.menu.group}"; + /** The key of the message: Suggest */ public static final String LABELS_menu_suggest = "{labels.menu_suggest}"; @@ -605,9 +617,6 @@ public class FessLabels extends ActionMessages { /** The key of the message: » Statistics */ public static final String LABELS_MENU_STATS = "{labels.menu.stats}"; - /** The key of the message: » Users */ - public static final String LABELS_MENU_USER = "{labels.menu.user}"; - /** The key of the message: » Popular URL */ public static final String LABELS_MENU_FAVORITE_LOG = "{labels.menu.favoriteLog}"; @@ -767,9 +776,6 @@ public class FessLabels extends ActionMessages { /** The key of the message: Home */ public static final String LABELS_HOME = "{labels.home}"; - /** The key of the message: User Name */ - public static final String LABELS_user_name = "{labels.user_name}"; - /** The key of the message: Login */ public static final String LABELS_LOGIN = "{labels.login}"; @@ -3271,6 +3277,213 @@ public class FessLabels extends ActionMessages { /** The key of the message: Bad Word File */ public static final String LABELS_suggest_bad_word_file = "{labels.suggest_bad_word_file}"; + /** The key of the message: User */ + public static final String LABELS_user_configuration = "{labels.user_configuration}"; + + /** The key of the message: Create New */ + public static final String LABELS_user_link_create_new = "{labels.user_link_create_new}"; + + /** The key of the message: List */ + public static final String LABELS_user_link_list = "{labels.user_link_list}"; + + /** The key of the message: Create New */ + public static final String LABELS_user_link_create = "{labels.user_link_create}"; + + /** The key of the message: Edit */ + public static final String LABELS_user_link_update = "{labels.user_link_update}"; + + /** The key of the message: Details */ + public static final String LABELS_user_link_confirm = "{labels.user_link_confirm}"; + + /** The key of the message: Details */ + public static final String LABELS_user_link_details = "{labels.user_link_details}"; + + /** The key of the message: Edit */ + public static final String LABELS_user_link_edit = "{labels.user_link_edit}"; + + /** The key of the message: Delete */ + public static final String LABELS_user_link_delete = "{labels.user_link_delete}"; + + /** The key of the message: Prev */ + public static final String LABELS_user_link_prev_page = "{labels.user_link_prev_page}"; + + /** The key of the message: Next */ + public static final String LABELS_user_link_next_page = "{labels.user_link_next_page}"; + + /** The key of the message: Name */ + public static final String LABELS_user_list_name = "{labels.user_list_name}"; + + /** The key of the message: Name */ + public static final String LABELS_user_name = "{labels.user_name}"; + + /** The key of the message: Password */ + public static final String LABELS_user_password = "{labels.user_password}"; + + /** The key of the message: Confirm */ + public static final String LABELS_user_confirm_password = "{labels.user_confirm_password}"; + + /** The key of the message: Role */ + public static final String LABELS_user_role = "{labels.user_role}"; + + /** The key of the message: Group */ + public static final String LABELS_user_group = "{labels.user_group}"; + + /** The key of the message: User */ + public static final String LABELS_user_title_details = "{labels.user_title_details}"; + + /** The key of the message: Create */ + public static final String LABELS_user_button_create = "{labels.user_button_create}"; + + /** The key of the message: Back */ + public static final String LABELS_user_button_back = "{labels.user_button_back}"; + + /** The key of the message: Confirm */ + public static final String LABELS_user_button_confirm = "{labels.user_button_confirm}"; + + /** The key of the message: Confirm User */ + public static final String LABELS_user_title_confirm = "{labels.user_title_confirm}"; + + /** The key of the message: Update */ + public static final String LABELS_user_button_update = "{labels.user_button_update}"; + + /** The key of the message: Delete */ + public static final String LABELS_user_button_delete = "{labels.user_button_delete}"; + + /** The key of the message: Edit */ + public static final String LABELS_user_button_edit = "{labels.user_button_edit}"; + + /** The key of the message: Role */ + public static final String LABELS_role_configuration = "{labels.role_configuration}"; + + /** The key of the message: Create New */ + public static final String LABELS_role_link_create_new = "{labels.role_link_create_new}"; + + /** The key of the message: List */ + public static final String LABELS_role_link_list = "{labels.role_link_list}"; + + /** The key of the message: Create New */ + public static final String LABELS_role_link_create = "{labels.role_link_create}"; + + /** The key of the message: Edit */ + public static final String LABELS_role_link_update = "{labels.role_link_update}"; + + /** The key of the message: Details */ + public static final String LABELS_role_link_confirm = "{labels.role_link_confirm}"; + + /** The key of the message: Details */ + public static final String LABELS_role_link_details = "{labels.role_link_details}"; + + /** The key of the message: Edit */ + public static final String LABELS_role_link_edit = "{labels.role_link_edit}"; + + /** The key of the message: Delete */ + public static final String LABELS_role_link_delete = "{labels.role_link_delete}"; + + /** The key of the message: Prev */ + public static final String LABELS_role_link_prev_page = "{labels.role_link_prev_page}"; + + /** The key of the message: Next */ + public static final String LABELS_role_link_next_page = "{labels.role_link_next_page}"; + + /** The key of the message: Name */ + public static final String LABELS_role_list_name = "{labels.role_list_name}"; + + /** The key of the message: Name */ + public static final String LABELS_role_name = "{labels.role_name}"; + + /** The key of the message: Role */ + public static final String LABELS_role_title_details = "{labels.role_title_details}"; + + /** The key of the message: Create */ + public static final String LABELS_role_button_create = "{labels.role_button_create}"; + + /** The key of the message: Back */ + public static final String LABELS_role_button_back = "{labels.role_button_back}"; + + /** The key of the message: Confirm */ + public static final String LABELS_role_button_confirm = "{labels.role_button_confirm}"; + + /** The key of the message: Confirm Role */ + public static final String LABELS_role_title_confirm = "{labels.role_title_confirm}"; + + /** The key of the message: Update */ + public static final String LABELS_role_button_update = "{labels.role_button_update}"; + + /** The key of the message: Delete */ + public static final String LABELS_role_button_delete = "{labels.role_button_delete}"; + + /** The key of the message: Edit */ + public static final String LABELS_role_button_edit = "{labels.role_button_edit}"; + + /** The key of the message: group */ + public static final String LABELS_group_configuration = "{labels.group_configuration}"; + + /** The key of the message: Create New */ + public static final String LABELS_group_link_create_new = "{labels.group_link_create_new}"; + + /** The key of the message: List */ + public static final String LABELS_group_link_list = "{labels.group_link_list}"; + + /** The key of the message: Create New */ + public static final String LABELS_group_link_create = "{labels.group_link_create}"; + + /** The key of the message: Edit */ + public static final String LABELS_group_link_update = "{labels.group_link_update}"; + + /** The key of the message: Details */ + public static final String LABELS_group_link_confirm = "{labels.group_link_confirm}"; + + /** The key of the message: Details */ + public static final String LABELS_group_link_details = "{labels.group_link_details}"; + + /** The key of the message: Edit */ + public static final String LABELS_group_link_edit = "{labels.group_link_edit}"; + + /** The key of the message: Delete */ + public static final String LABELS_group_link_delete = "{labels.group_link_delete}"; + + /** The key of the message: Prev */ + public static final String LABELS_group_link_prev_page = "{labels.group_link_prev_page}"; + + /** The key of the message: Next */ + public static final String LABELS_group_link_next_page = "{labels.group_link_next_page}"; + + /** The key of the message: Name */ + public static final String LABELS_group_list_name = "{labels.group_list_name}"; + + /** The key of the message: Name */ + public static final String LABELS_group_name = "{labels.group_name}"; + + /** The key of the message: Group */ + public static final String LABELS_group_title_details = "{labels.group_title_details}"; + + /** The key of the message: Create */ + public static final String LABELS_group_button_create = "{labels.group_button_create}"; + + /** The key of the message: Back */ + public static final String LABELS_group_button_back = "{labels.group_button_back}"; + + /** The key of the message: Confirm */ + public static final String LABELS_group_button_confirm = "{labels.group_button_confirm}"; + + /** The key of the message: Confirm Group */ + public static final String LABELS_group_title_confirm = "{labels.group_title_confirm}"; + + /** The key of the message: Update */ + public static final String LABELS_group_button_update = "{labels.group_button_update}"; + + /** The key of the message: Delete */ + public static final String LABELS_group_button_delete = "{labels.group_button_delete}"; + + /** The key of the message: Edit */ + public static final String LABELS_group_button_edit = "{labels.group_button_edit}"; + + /** The key of the message: Roles */ + public static final String LABELS_ROLES = "{labels.roles}"; + + /** The key of the message: Groups */ + public static final String LABELS_GROUPS = "{labels.groups}"; + /** The key of the message: Create */ public static final String LABELS_crud_button_create = "{labels.crud_button_create}"; @@ -3894,6 +4107,18 @@ public class FessLabels extends ActionMessages { /** The key of the label: » Role */ String LABELS_MENU_role_type = "{labels.menu.role_type}"; + /** The key of the label: User */ + String LABELS_menu_user = "{labels.menu_user}"; + + /** The key of the label: User */ + String LABELS_MENU_USER = "{labels.menu.user}"; + + /** The key of the label: Role */ + String LABELS_MENU_ROLE = "{labels.menu.role}"; + + /** The key of the label: Group */ + String LABELS_MENU_GROUP = "{labels.menu.group}"; + /** The key of the label: Suggest */ String LABELS_menu_suggest = "{labels.menu_suggest}"; @@ -3933,9 +4158,6 @@ public class FessLabels extends ActionMessages { /** The key of the label: » Statistics */ String LABELS_MENU_STATS = "{labels.menu.stats}"; - /** The key of the label: » Users */ - String LABELS_MENU_USER = "{labels.menu.user}"; - /** The key of the label: » Popular URL */ String LABELS_MENU_FAVORITE_LOG = "{labels.menu.favoriteLog}"; @@ -4095,9 +4317,6 @@ public class FessLabels extends ActionMessages { /** The key of the label: Home */ String LABELS_HOME = "{labels.home}"; - /** The key of the label: User Name */ - String LABELS_user_name = "{labels.user_name}"; - /** The key of the label: Login */ String LABELS_LOGIN = "{labels.login}"; @@ -6597,6 +6816,213 @@ public class FessLabels extends ActionMessages { /** The key of the label: Bad Word File */ String LABELS_suggest_bad_word_file = "{labels.suggest_bad_word_file}"; + /** The key of the label: User */ + String LABELS_user_configuration = "{labels.user_configuration}"; + + /** The key of the label: Create New */ + String LABELS_user_link_create_new = "{labels.user_link_create_new}"; + + /** The key of the label: List */ + String LABELS_user_link_list = "{labels.user_link_list}"; + + /** The key of the label: Create New */ + String LABELS_user_link_create = "{labels.user_link_create}"; + + /** The key of the label: Edit */ + String LABELS_user_link_update = "{labels.user_link_update}"; + + /** The key of the label: Details */ + String LABELS_user_link_confirm = "{labels.user_link_confirm}"; + + /** The key of the label: Details */ + String LABELS_user_link_details = "{labels.user_link_details}"; + + /** The key of the label: Edit */ + String LABELS_user_link_edit = "{labels.user_link_edit}"; + + /** The key of the label: Delete */ + String LABELS_user_link_delete = "{labels.user_link_delete}"; + + /** The key of the label: Prev */ + String LABELS_user_link_prev_page = "{labels.user_link_prev_page}"; + + /** The key of the label: Next */ + String LABELS_user_link_next_page = "{labels.user_link_next_page}"; + + /** The key of the label: Name */ + String LABELS_user_list_name = "{labels.user_list_name}"; + + /** The key of the label: Name */ + String LABELS_user_name = "{labels.user_name}"; + + /** The key of the label: Password */ + String LABELS_user_password = "{labels.user_password}"; + + /** The key of the label: Confirm */ + String LABELS_user_confirm_password = "{labels.user_confirm_password}"; + + /** The key of the label: Role */ + String LABELS_user_role = "{labels.user_role}"; + + /** The key of the label: Group */ + String LABELS_user_group = "{labels.user_group}"; + + /** The key of the label: User */ + String LABELS_user_title_details = "{labels.user_title_details}"; + + /** The key of the label: Create */ + String LABELS_user_button_create = "{labels.user_button_create}"; + + /** The key of the label: Back */ + String LABELS_user_button_back = "{labels.user_button_back}"; + + /** The key of the label: Confirm */ + String LABELS_user_button_confirm = "{labels.user_button_confirm}"; + + /** The key of the label: Confirm User */ + String LABELS_user_title_confirm = "{labels.user_title_confirm}"; + + /** The key of the label: Update */ + String LABELS_user_button_update = "{labels.user_button_update}"; + + /** The key of the label: Delete */ + String LABELS_user_button_delete = "{labels.user_button_delete}"; + + /** The key of the label: Edit */ + String LABELS_user_button_edit = "{labels.user_button_edit}"; + + /** The key of the label: Role */ + String LABELS_role_configuration = "{labels.role_configuration}"; + + /** The key of the label: Create New */ + String LABELS_role_link_create_new = "{labels.role_link_create_new}"; + + /** The key of the label: List */ + String LABELS_role_link_list = "{labels.role_link_list}"; + + /** The key of the label: Create New */ + String LABELS_role_link_create = "{labels.role_link_create}"; + + /** The key of the label: Edit */ + String LABELS_role_link_update = "{labels.role_link_update}"; + + /** The key of the label: Details */ + String LABELS_role_link_confirm = "{labels.role_link_confirm}"; + + /** The key of the label: Details */ + String LABELS_role_link_details = "{labels.role_link_details}"; + + /** The key of the label: Edit */ + String LABELS_role_link_edit = "{labels.role_link_edit}"; + + /** The key of the label: Delete */ + String LABELS_role_link_delete = "{labels.role_link_delete}"; + + /** The key of the label: Prev */ + String LABELS_role_link_prev_page = "{labels.role_link_prev_page}"; + + /** The key of the label: Next */ + String LABELS_role_link_next_page = "{labels.role_link_next_page}"; + + /** The key of the label: Name */ + String LABELS_role_list_name = "{labels.role_list_name}"; + + /** The key of the label: Name */ + String LABELS_role_name = "{labels.role_name}"; + + /** The key of the label: Role */ + String LABELS_role_title_details = "{labels.role_title_details}"; + + /** The key of the label: Create */ + String LABELS_role_button_create = "{labels.role_button_create}"; + + /** The key of the label: Back */ + String LABELS_role_button_back = "{labels.role_button_back}"; + + /** The key of the label: Confirm */ + String LABELS_role_button_confirm = "{labels.role_button_confirm}"; + + /** The key of the label: Confirm Role */ + String LABELS_role_title_confirm = "{labels.role_title_confirm}"; + + /** The key of the label: Update */ + String LABELS_role_button_update = "{labels.role_button_update}"; + + /** The key of the label: Delete */ + String LABELS_role_button_delete = "{labels.role_button_delete}"; + + /** The key of the label: Edit */ + String LABELS_role_button_edit = "{labels.role_button_edit}"; + + /** The key of the label: group */ + String LABELS_group_configuration = "{labels.group_configuration}"; + + /** The key of the label: Create New */ + String LABELS_group_link_create_new = "{labels.group_link_create_new}"; + + /** The key of the label: List */ + String LABELS_group_link_list = "{labels.group_link_list}"; + + /** The key of the label: Create New */ + String LABELS_group_link_create = "{labels.group_link_create}"; + + /** The key of the label: Edit */ + String LABELS_group_link_update = "{labels.group_link_update}"; + + /** The key of the label: Details */ + String LABELS_group_link_confirm = "{labels.group_link_confirm}"; + + /** The key of the label: Details */ + String LABELS_group_link_details = "{labels.group_link_details}"; + + /** The key of the label: Edit */ + String LABELS_group_link_edit = "{labels.group_link_edit}"; + + /** The key of the label: Delete */ + String LABELS_group_link_delete = "{labels.group_link_delete}"; + + /** The key of the label: Prev */ + String LABELS_group_link_prev_page = "{labels.group_link_prev_page}"; + + /** The key of the label: Next */ + String LABELS_group_link_next_page = "{labels.group_link_next_page}"; + + /** The key of the label: Name */ + String LABELS_group_list_name = "{labels.group_list_name}"; + + /** The key of the label: Name */ + String LABELS_group_name = "{labels.group_name}"; + + /** The key of the label: Group */ + String LABELS_group_title_details = "{labels.group_title_details}"; + + /** The key of the label: Create */ + String LABELS_group_button_create = "{labels.group_button_create}"; + + /** The key of the label: Back */ + String LABELS_group_button_back = "{labels.group_button_back}"; + + /** The key of the label: Confirm */ + String LABELS_group_button_confirm = "{labels.group_button_confirm}"; + + /** The key of the label: Confirm Group */ + String LABELS_group_title_confirm = "{labels.group_title_confirm}"; + + /** The key of the label: Update */ + String LABELS_group_button_update = "{labels.group_button_update}"; + + /** The key of the label: Delete */ + String LABELS_group_button_delete = "{labels.group_button_delete}"; + + /** The key of the label: Edit */ + String LABELS_group_button_edit = "{labels.group_button_edit}"; + + /** The key of the label: Roles */ + String LABELS_ROLES = "{labels.roles}"; + + /** The key of the label: Groups */ + String LABELS_GROUPS = "{labels.groups}"; + /** The key of the label: Create */ String LABELS_crud_button_create = "{labels.crud_button_create}"; diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java b/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java index 5b067f5a7..6af8f89e1 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java @@ -354,6 +354,15 @@ public class FessMessages extends FessLabels { /** The key of the message: Failed to upload the UserDict file. */ public static final String ERRORS_failed_to_upload_userdict_file = "{errors.failed_to_upload_userdict_file}"; + /** The key of the message: Password is required. */ + public static final String ERRORS_blank_password = "{errors.blank_password}"; + + /** The key of the message: Confirm Password does not match. */ + public static final String ERRORS_invalid_confirm_password = "{errors.invalid_confirm_password}"; + + /** The key of the message: Invalid password. */ + public static final String ERRORS_password_does_not_exist_in_session = "{errors.password_does_not_exist_in_session}"; + /** The key of the message: The given query is invalid. */ public static final String ERRORS_invalid_query_unknown = "{errors.invalid_query_unknown}"; @@ -2207,6 +2216,48 @@ public class FessMessages extends FessLabels { return this; } + /** + * Add the created action message for the key 'errors.blank_password' with parameters. + *
+     * message: Password is required.
+     * 
+ * @param property The property name for the message. (NotNull) + * @return this. (NotNull) + */ + public FessMessages addErrorsBlankPassword(String property) { + assertPropertyNotNull(property); + add(property, new ActionMessage(ERRORS_blank_password)); + return this; + } + + /** + * Add the created action message for the key 'errors.invalid_confirm_password' with parameters. + *
+     * message: Confirm Password does not match.
+     * 
+ * @param property The property name for the message. (NotNull) + * @return this. (NotNull) + */ + public FessMessages addErrorsInvalidConfirmPassword(String property) { + assertPropertyNotNull(property); + add(property, new ActionMessage(ERRORS_invalid_confirm_password)); + return this; + } + + /** + * Add the created action message for the key 'errors.password_does_not_exist_in_session' with parameters. + *
+     * message: Invalid password.
+     * 
+ * @param property The property name for the message. (NotNull) + * @return this. (NotNull) + */ + public FessMessages addErrorsPasswordDoesNotExistInSession(String property) { + assertPropertyNotNull(property); + add(property, new ActionMessage(ERRORS_password_does_not_exist_in_session)); + return this; + } + /** * Add the created action message for the key 'errors.invalid_query_unknown' with parameters. *
diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessFwAssistantDirector.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessFwAssistantDirector.java
index ceb25e0b1..cef0e6e16 100644
--- a/src/main/java/org/codelibs/fess/mylasta/direction/FessFwAssistantDirector.java
+++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessFwAssistantDirector.java
@@ -37,8 +37,6 @@ import org.lastaflute.core.security.OneWayCryptographer;
 import org.lastaflute.db.dbflute.classification.ListedClassificationProvider;
 import org.lastaflute.db.direction.FwDbDirection;
 import org.lastaflute.web.direction.FwWebDirection;
-import org.lastaflute.web.ruts.multipart.MultipartRequestHandler;
-import org.lastaflute.web.ruts.multipart.MultipartResourceProvider;
 
 /**
  * @author jflute
@@ -127,12 +125,7 @@ public class FessFwAssistantDirector extends CachedFwAssistantDirector {
         direction.directAdjustment(createActionAdjustmentProvider());
         direction.directMessage(nameList -> nameList.add("fess_message"), "fess_label");
         direction.directApiCall(createApiFailureHook());
-        direction.directMultipart(new MultipartResourceProvider() {
-            @Override
-            public MultipartRequestHandler createHandler() {
-                return new FessMultipartRequestHandler();
-            }
-        });
+        direction.directMultipart(() -> new FessMultipartRequestHandler());
     }
 
     protected FessUserLocaleProcessProvider createUserLocaleProcessProvider() {
diff --git a/src/main/java/org/codelibs/fess/util/QueryResponseList.java b/src/main/java/org/codelibs/fess/util/QueryResponseList.java
index 446ccffae..4eeda36bb 100644
--- a/src/main/java/org/codelibs/fess/util/QueryResponseList.java
+++ b/src/main/java/org/codelibs/fess/util/QueryResponseList.java
@@ -158,7 +158,7 @@ public class QueryResponseList implements List> {
         allPageCount = (int) ((allRecordCount - 1) / pageSize) + 1;
         existPrevPage = start > 0;
         existNextPage = start < (long) (allPageCount - 1) * (long) pageSize;
-        currentPageNumber = (int) (start / pageSize) + 1;
+        currentPageNumber = start / pageSize + 1;
         currentStartRecordNumber = allRecordCount != 0 ? (currentPageNumber - 1) * pageSize + 1 : 0;
         currentEndRecordNumber = currentPageNumber * pageSize;
         currentEndRecordNumber = allRecordCount < currentEndRecordNumber ? allRecordCount : currentEndRecordNumber;
diff --git a/src/main/resources/fess_es.xml b/src/main/resources/fess_es.xml
index 7bfde1d78..a5701f4db 100644
--- a/src/main/resources/fess_es.xml
+++ b/src/main/resources/fess_es.xml
@@ -37,4 +37,8 @@
     
     
     
+
+    
+    
+    
 
diff --git a/src/main/resources/fess_indices/.fess_user/role.bulk b/src/main/resources/fess_indices/.fess_user/role.bulk
new file mode 100644
index 000000000..72b534122
--- /dev/null
+++ b/src/main/resources/fess_indices/.fess_user/role.bulk
@@ -0,0 +1,2 @@
+{"index":{"_index":".fess_user","_type":"role","_id":"YWRtaW4="}}
+{"name":"admin","id":"YWRtaW4="}
diff --git a/src/main/resources/fess_indices/.fess_user/user.bulk b/src/main/resources/fess_indices/.fess_user/user.bulk
new file mode 100644
index 000000000..5f8d1cec5
--- /dev/null
+++ b/src/main/resources/fess_indices/.fess_user/user.bulk
@@ -0,0 +1,2 @@
+{"index":{"_index":".fess_user","_type":"user","_id":"YWRtaW4="}}
+{"password":"8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918","roles":["YWRtaW4="],"name":"admin","id":"YWRtaW4="}
diff --git a/src/main/resources/fess_indices/.fess_user/user.json b/src/main/resources/fess_indices/.fess_user/user.json
index 98d0a4725..c0869f61d 100644
--- a/src/main/resources/fess_indices/.fess_user/user.json
+++ b/src/main/resources/fess_indices/.fess_user/user.json
@@ -22,11 +22,11 @@
         "type": "string",
         "index": "not_analyzed"
       },
-      "group": {
+      "groups": {
         "type": "string",
         "index": "not_analyzed"
       },
-      "role": {
+      "roles": {
         "type": "string",
         "index": "not_analyzed"
       }
diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties
index 67338e544..14622feb9 100644
--- a/src/main/resources/fess_label.properties
+++ b/src/main/resources/fess_label.properties
@@ -189,6 +189,10 @@ labels.menu.file_authentication=» File Authentication
 labels.menu.request_header=» Request Header
 labels.menu.overlapping_host=» Overlapping Host
 labels.menu.role_type=» Role
+labels.menu_user=User
+labels.menu.user=User
+labels.menu.role=Role
+labels.menu.group=Group
 labels.menu_suggest=Suggest
 labels.menu.suggest_elevate_word=» Additional Word
 labels.menu.suggest_bad_word=» Bad Word
@@ -202,7 +206,6 @@ labels.menu.search_list=» Search
 labels.menu_user_log=User Info
 labels.menu.search_log=» Search Log
 labels.menu.stats=» Statistics
-labels.menu.user=» Users
 labels.menu.favoriteLog=» Popular URL
 labels.menu.logout=Logout
 labels.header.logo_alt=Fess
@@ -1119,6 +1122,78 @@ labels.suggest_bad_word_suggest_word=Bad Word
 labels.suggest_bad_word_target_role=Role
 labels.suggest_bad_word_target_label=Label
 labels.suggest_bad_word_file=Bad Word File
+labels.user_configuration=User
+labels.user_link_create_new=Create New
+labels.user_link_list=List
+labels.user_link_create=Create New
+labels.user_link_update=Edit
+labels.user_link_delete=Delete
+labels.user_link_confirm=Details
+labels.user_link_details=Details
+labels.user_link_edit=Edit
+labels.user_link_delete=Delete
+labels.user_link_prev_page=Prev
+labels.user_link_next_page=Next
+labels.user_list_name=Name
+labels.user_name=Name
+labels.user_password=Password
+labels.user_confirm_password=Confirm
+labels.user_role=Role
+labels.user_group=Group
+labels.user_title_details=User
+labels.user_button_create=Create
+labels.user_button_back=Back
+labels.user_button_confirm=Confirm
+labels.user_title_confirm=Confirm User
+labels.user_button_update=Update
+labels.user_button_delete=Delete
+labels.user_button_edit=Edit
+labels.role_configuration=Role
+labels.role_link_create_new=Create New
+labels.role_link_list=List
+labels.role_link_create=Create New
+labels.role_link_update=Edit
+labels.role_link_delete=Delete
+labels.role_link_confirm=Details
+labels.role_link_details=Details
+labels.role_link_edit=Edit
+labels.role_link_delete=Delete
+labels.role_link_prev_page=Prev
+labels.role_link_next_page=Next
+labels.role_list_name=Name
+labels.role_name=Name
+labels.role_title_details=Role
+labels.role_button_create=Create
+labels.role_button_back=Back
+labels.role_button_confirm=Confirm
+labels.role_title_confirm=Confirm Role
+labels.role_button_update=Update
+labels.role_button_delete=Delete
+labels.role_button_edit=Edit
+labels.group_configuration=group
+labels.group_link_create_new=Create New
+labels.group_link_list=List
+labels.group_link_create=Create New
+labels.group_link_update=Edit
+labels.group_link_delete=Delete
+labels.group_link_confirm=Details
+labels.group_link_details=Details
+labels.group_link_edit=Edit
+labels.group_link_delete=Delete
+labels.group_link_prev_page=Prev
+labels.group_link_next_page=Next
+labels.group_list_name=Name
+labels.group_name=Name
+labels.group_title_details=Group
+labels.group_button_create=Create
+labels.group_button_back=Back
+labels.group_button_confirm=Confirm
+labels.group_title_confirm=Confirm Group
+labels.group_button_update=Update
+labels.group_button_delete=Delete
+labels.group_button_edit=Edit
+labels.roles=Roles
+labels.groups=Groups
 labels.crud_button_create=Create
 labels.crud_button_update=Update
 labels.crud_button_delete=Delete
diff --git a/src/main/resources/fess_label_en.properties b/src/main/resources/fess_label_en.properties
index 73d7e9c24..fa18eb554 100644
--- a/src/main/resources/fess_label_en.properties
+++ b/src/main/resources/fess_label_en.properties
@@ -189,6 +189,10 @@ labels.menu.file_authentication=File Authentication
 labels.menu.request_header=Request Header
 labels.menu.overlapping_host=Overlapping Host
 labels.menu.role_type=Role
+labels.menu_user=User
+labels.menu.user=User
+labels.menu.role=Role
+labels.menu.group=Group
 labels.menu_suggest=Suggest
 labels.menu.suggest_elevate_word=Additional Word
 labels.menu.suggest_bad_word=Bad Word
@@ -202,7 +206,6 @@ labels.menu.search_list=Search
 labels.menu_user_log=User Info
 labels.menu.search_log=Search Log
 labels.menu.stats=Statistics
-labels.menu.user=Users
 labels.menu.favoriteLog=Popular URL
 labels.menu.logout=Logout
 labels.header.logo_alt=Fess
@@ -1119,6 +1122,78 @@ labels.suggest_bad_word_suggest_word=Bad Word
 labels.suggest_bad_word_target_role=Role
 labels.suggest_bad_word_target_label=Label
 labels.suggest_bad_word_file=Bad Word File
+labels.user_configuration=User
+labels.user_link_create_new=Create New
+labels.user_link_list=List
+labels.user_link_create=Create New
+labels.user_link_update=Edit
+labels.user_link_delete=Delete
+labels.user_link_confirm=Details
+labels.user_link_details=Details
+labels.user_link_edit=Edit
+labels.user_link_delete=Delete
+labels.user_link_prev_page=Prev
+labels.user_link_next_page=Next
+labels.user_list_name=Name
+labels.user_name=Name
+labels.user_password=Password
+labels.user_confirm_password=Confirm
+labels.user_role=Role
+labels.user_group=Group
+labels.user_title_details=User
+labels.user_button_create=Create
+labels.user_button_back=Back
+labels.user_button_confirm=Confirm
+labels.user_title_confirm=Confirm User
+labels.user_button_update=Update
+labels.user_button_delete=Delete
+labels.user_button_edit=Edit
+labels.role_configuration=Role
+labels.role_link_create_new=Create New
+labels.role_link_list=List
+labels.role_link_create=Create New
+labels.role_link_update=Edit
+labels.role_link_delete=Delete
+labels.role_link_confirm=Details
+labels.role_link_details=Details
+labels.role_link_edit=Edit
+labels.role_link_delete=Delete
+labels.role_link_prev_page=Prev
+labels.role_link_next_page=Next
+labels.role_list_name=Name
+labels.role_name=Name
+labels.role_title_details=Role
+labels.role_button_create=Create
+labels.role_button_back=Back
+labels.role_button_confirm=Confirm
+labels.role_title_confirm=Confirm Role
+labels.role_button_update=Update
+labels.role_button_delete=Delete
+labels.role_button_edit=Edit
+labels.group_configuration=Group
+labels.group_link_create_new=Create New
+labels.group_link_list=List
+labels.group_link_create=Create New
+labels.group_link_update=Edit
+labels.group_link_delete=Delete
+labels.group_link_confirm=Details
+labels.group_link_details=Details
+labels.group_link_edit=Edit
+labels.group_link_delete=Delete
+labels.group_link_prev_page=Prev
+labels.group_link_next_page=Next
+labels.group_list_name=Name
+labels.group_name=Name
+labels.group_title_details=Group
+labels.group_button_create=Create
+labels.group_button_back=Back
+labels.group_button_confirm=Confirm
+labels.group_title_confirm=Confirm Group
+labels.group_button_update=Update
+labels.group_button_delete=Delete
+labels.group_button_edit=Edit
+labels.roles=Roles
+labels.groups=Groups
 labels.crud_button_create=Create
 labels.crud_button_update=Update
 labels.crud_button_delete=Delete
diff --git a/src/main/resources/fess_label_ja.properties b/src/main/resources/fess_label_ja.properties
index ae7c85196..9ff3e7925 100644
--- a/src/main/resources/fess_label_ja.properties
+++ b/src/main/resources/fess_label_ja.properties
@@ -189,6 +189,10 @@ labels.menu.file_authentication=\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0
 labels.menu.request_header=\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u30fc
 labels.menu.overlapping_host=\u91cd\u8907\u30db\u30b9\u30c8
 labels.menu.role_type=\u30ed\u30fc\u30eb
+labels.menu_user=\u30e6\u30fc\u30b6\u30fc
+labels.menu.user=\u30e6\u30fc\u30b6\u30fc
+labels.menu.role=\u30ed\u30fc\u30eb
+labels.menu.group=\u30b0\u30eb\u30fc\u30d7
 labels.menu_suggest=\u30b5\u30b8\u30a7\u30b9\u30c8
 labels.menu.suggest_elevate_word=\u8ffd\u52a0\u5019\u88dc
 labels.menu.suggest_bad_word=NG\u30ef\u30fc\u30c9
@@ -202,7 +206,6 @@ labels.menu.search_list=\u691c\u7d22
 labels.menu_user_log=\u5229\u7528\u8005\u60c5\u5831
 labels.menu.search_log=\u691c\u7d22\u30ed\u30b0
 labels.menu.stats=\u7d71\u8a08
-labels.menu.user=\u5229\u7528\u8005
 labels.menu.favoriteLog=\u4eba\u6c17URL
 labels.menu.logout=\u30ed\u30b0\u30a2\u30a6\u30c8
 labels.header.logo_alt=Fess
@@ -1119,6 +1122,78 @@ labels.suggest_bad_word_suggest_word=\u30b5\u30b8\u30a7\u30b9\u30c8\u5019\u88dc
 labels.suggest_bad_word_target_role=\u30ed\u30fc\u30eb\u540d
 labels.suggest_bad_word_target_label=\u30e9\u30d9\u30eb\u540d
 labels.suggest_bad_word_file=NG\u30ef\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb
+labels.user_configuration=\u30e6\u30fc\u30b6\u30fc
+labels.user_link_create_new=\u65b0\u898f\u4f5c\u6210
+labels.user_link_list=\u4e00\u89a7
+labels.user_link_create=\u65b0\u898f\u4f5c\u6210
+labels.user_link_update=\u7de8\u96c6
+labels.user_link_delete=\u524a\u9664
+labels.user_link_confirm=\u8a73\u7d30
+labels.user_link_details=\u8a73\u7d30
+labels.user_link_edit=\u7de8\u96c6
+labels.user_link_delete=\u524a\u9664
+labels.user_link_prev_page=\u524d\u3078
+labels.user_link_next_page=\u6b21\u3078
+labels.user_list_name=\u540d\u524d
+labels.user_name=\u540d\u524d
+labels.user_password=\u30d1\u30b9\u30ef\u30fc\u30c9
+labels.user_confirm_password=\u78ba\u8a8d
+labels.user_role=\u30ed\u30fc\u30eb
+labels.user_group=\u30b0\u30eb\u30fc\u30d7
+labels.user_title_details=\u30e6\u30fc\u30b6\u30fc
+labels.user_button_create=\u4f5c\u6210
+labels.user_button_back=\u623b\u308b
+labels.user_button_confirm=\u78ba\u8a8d
+labels.user_title_confirm=\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\u306e\u78ba\u8a8d
+labels.user_button_update=\u66f4\u65b0
+labels.user_button_delete=\u524a\u9664
+labels.user_button_edit=\u7de8\u96c6
+labels.role_configuration=\u30ed\u30fc\u30eb
+labels.role_link_create_new=\u65b0\u898f\u4f5c\u6210
+labels.role_link_list=\u4e00\u89a7
+labels.role_link_create=\u65b0\u898f\u4f5c\u6210
+labels.role_link_update=\u7de8\u96c6
+labels.role_link_delete=\u524a\u9664
+labels.role_link_confirm=\u8a73\u7d30
+labels.role_link_details=\u8a73\u7d30
+labels.role_link_edit=\u7de8\u96c6
+labels.role_link_delete=\u524a\u9664
+labels.role_link_prev_page=\u524d\u3078
+labels.role_link_next_page=\u6b21\u3078
+labels.role_list_name=\u540d\u524d
+labels.role_name=\u540d\u524d
+labels.role_title_details=\u30ed\u30fc\u30eb
+labels.role_button_create=\u4f5c\u6210
+labels.role_button_back=\u623b\u308b
+labels.role_button_confirm=\u78ba\u8a8d
+labels.role_title_confirm=\u30ed\u30fc\u30eb\u8a2d\u5b9a\u306e\u78ba\u8a8d
+labels.role_button_update=\u66f4\u65b0
+labels.role_button_delete=\u524a\u9664
+labels.role_button_edit=\u7de8\u96c6
+labels.group_configuration=\u30b0\u30eb\u30fc\u30d7
+labels.group_link_create_new=\u65b0\u898f\u4f5c\u6210
+labels.group_link_list=\u4e00\u89a7
+labels.group_link_create=\u65b0\u898f\u4f5c\u6210
+labels.group_link_update=\u7de8\u96c6
+labels.group_link_delete=\u524a\u9664
+labels.group_link_confirm=\u8a73\u7d30
+labels.group_link_details=\u8a73\u7d30
+labels.group_link_edit=\u7de8\u96c6
+labels.group_link_delete=\u524a\u9664
+labels.group_link_prev_page=\u524d\u3078
+labels.group_link_next_page=\u6b21\u3078
+labels.group_list_name=\u540d\u524d
+labels.group_name=\u540d\u524d
+labels.group_title_details=\u30b0\u30eb\u30fc\u30d7
+labels.group_button_create=\u4f5c\u6210
+labels.group_button_back=\u623b\u308b
+labels.group_button_confirm=\u78ba\u8a8d
+labels.group_title_confirm=\u30b0\u30eb\u30fc\u30d7\u8a2d\u5b9a\u306e\u78ba\u8a8d
+labels.group_button_update=\u66f4\u65b0
+labels.group_button_delete=\u524a\u9664
+labels.group_button_edit=\u7de8\u96c6
+labels.roles=\u30ed\u30fc\u30eb
+labels.groups=\u30b0\u30eb\u30fc\u30d7
 labels.crud_button_create=\u4f5c\u6210
 labels.crud_button_update=\u66f4\u65b0
 labels.crud_button_delete=\u524a\u9664
diff --git a/src/main/resources/fess_message.properties b/src/main/resources/fess_message.properties
index 0c5c09cf3..fe813694e 100644
--- a/src/main/resources/fess_message.properties
+++ b/src/main/resources/fess_message.properties
@@ -150,6 +150,9 @@ errors.failed_to_upload_synonym_file=Failed to upload the Synonym file.
 errors.userdict_file_is_not_found=Synonym file is not found
 errors.failed_to_download_userdict_file=Failed to download the UserDict file.
 errors.failed_to_upload_userdict_file=Failed to upload the UserDict file.
+errors.blank_password=Password is required.
+errors.invalid_confirm_password=Confirm Password does not match.
+errors.password_does_not_exist_in_session=Invalid password.
 
 errors.invalid_query_unknown=The given query is invalid.
 errors.invalid_query_quoted=An invalid quote character is used.
diff --git a/src/main/resources/fess_message_en.properties b/src/main/resources/fess_message_en.properties
index 75afe0459..00be26f1a 100644
--- a/src/main/resources/fess_message_en.properties
+++ b/src/main/resources/fess_message_en.properties
@@ -79,6 +79,9 @@ errors.failed_to_upload_synonym_file=Failed to upload the Synonym file.
 errors.userdict_file_is_not_found=Synonym file is not found
 errors.failed_to_download_userdict_file=Failed to download the UserDict file.
 errors.failed_to_upload_userdict_file=Failed to upload the UserDict file.
+errors.blank_password=Password is required.
+errors.invalid_confirm_password=Confirm Password does not match.
+errors.password_does_not_exist_in_session=Invalid password.
 
 errors.invalid_query_unknown=The given query is invalid.
 errors.invalid_query_quoted=An invalid quote character is used.
diff --git a/src/main/webapp/WEB-INF/view/admin/group/confirm.jsp b/src/main/webapp/WEB-INF/view/admin/group/confirm.jsp
new file mode 100644
index 000000000..c692c2d18
--- /dev/null
+++ b/src/main/webapp/WEB-INF/view/admin/group/confirm.jsp
@@ -0,0 +1,144 @@
+<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
+
+
+
+Fess | <la:message key="labels.group_configuration" />
+
+
+
+	
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + + + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> + + + + + + + +
${f:h(name)}
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/group/edit.jsp b/src/main/webapp/WEB-INF/view/admin/group/edit.jsp new file mode 100644 index 000000000..38494efe7 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/group/edit.jsp @@ -0,0 +1,117 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.group_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> +
+ + +
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/group/error.jsp b/src/main/webapp/WEB-INF/view/admin/group/error.jsp new file mode 100644 index 000000000..6523b4bbd --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/group/error.jsp @@ -0,0 +1,50 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.group_configuration" /> + + + +
+ + + + + + +
+
+

+ +

+ +
+ +
+ +
+

Error

+

+ +

+

+ + + +

+
+ +
+
+ + + +
+ + + diff --git a/src/main/webapp/WEB-INF/view/admin/group/index.jsp b/src/main/webapp/WEB-INF/view/admin/group/index.jsp new file mode 100644 index 000000000..cf9bd75f8 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/group/index.jsp @@ -0,0 +1,126 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.group_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ +
+
+
+ <%-- Box Header --%> +
+

+ +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- List --%> + +

+ +

+
+ + + + + + + + + + + + + + +
${f:h(data.name)}
+
+ +
+ <%-- Box Footer --%> + +
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/role/confirm.jsp b/src/main/webapp/WEB-INF/view/admin/role/confirm.jsp new file mode 100644 index 000000000..803495b5f --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/role/confirm.jsp @@ -0,0 +1,144 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.role_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + + + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> + + + + + + + +
${f:h(name)}
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/role/edit.jsp b/src/main/webapp/WEB-INF/view/admin/role/edit.jsp new file mode 100644 index 000000000..5f325561d --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/role/edit.jsp @@ -0,0 +1,117 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.role_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> +
+ + +
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/role/error.jsp b/src/main/webapp/WEB-INF/view/admin/role/error.jsp new file mode 100644 index 000000000..71ca8c9c8 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/role/error.jsp @@ -0,0 +1,50 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.role_configuration" /> + + + +
+ + + + + + +
+
+

+ +

+ +
+ +
+ +
+

Error

+

+ +

+

+ + + +

+
+ +
+
+ + + +
+ + + diff --git a/src/main/webapp/WEB-INF/view/admin/role/index.jsp b/src/main/webapp/WEB-INF/view/admin/role/index.jsp new file mode 100644 index 000000000..e2f833358 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/role/index.jsp @@ -0,0 +1,126 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.role_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ +
+
+
+ <%-- Box Header --%> +
+

+ +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- List --%> + +

+ +

+
+ + + + + + + + + + + + + + +
${f:h(data.name)}
+
+ +
+ <%-- Box Footer --%> + +
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/user/confirm.jsp b/src/main/webapp/WEB-INF/view/admin/user/confirm.jsp new file mode 100644 index 000000000..c47775861 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/user/confirm.jsp @@ -0,0 +1,176 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.user_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + + + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> + + + + + + + + + + + + + + + +
${f:h(name)}
+ + + + ${f:h(rt.name)}
+
+
+
+ + + ${f:h(rt.name)} + + +
+ + + + ${f:h(rt.name)}
+
+
+
+ + + ${f:h(rt.name)} + + +
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/user/edit.jsp b/src/main/webapp/WEB-INF/view/admin/user/edit.jsp new file mode 100644 index 000000000..65d22e35e --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/user/edit.jsp @@ -0,0 +1,147 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.user_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ + <%-- Form --%> + + + + + + +
+
+
+ <%-- Box Header --%> +
+

+ + + + + + +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- Form Fields --%> +
+ + + + + + ${f:h(name)} + + +
+
+ + +
+
+ + +
+
+ + + + ${f:h(l.name)} + + +
+
+ + + + ${f:h(l.name)} + + +
+ +
+ <%-- Box Footer --%> + +
+
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/admin/user/error.jsp b/src/main/webapp/WEB-INF/view/admin/user/error.jsp new file mode 100644 index 000000000..638128143 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/user/error.jsp @@ -0,0 +1,50 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.user_configuration" /> + + + +
+ + + + + + +
+
+

+ +

+ +
+ +
+ +
+

Error

+

+ +

+

+ + + +

+
+ +
+
+ + + +
+ + + diff --git a/src/main/webapp/WEB-INF/view/admin/user/index.jsp b/src/main/webapp/WEB-INF/view/admin/user/index.jsp new file mode 100644 index 000000000..18ed12183 --- /dev/null +++ b/src/main/webapp/WEB-INF/view/admin/user/index.jsp @@ -0,0 +1,126 @@ +<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> + + + +Fess | <la:message key="labels.user_configuration" /> + + + +
+ + + + + + +
+ + <%-- Content Header --%> +
+

+ +

+ +
+ +
+ +
+
+
+ <%-- Box Header --%> +
+

+ +

+
+ + + +
+
+ <%-- Box Body --%> +
+ <%-- Message --%> +
+ +
+ ${msg} +
+
+ +
+ + <%-- List --%> + +

+ +

+
+ + + + + + + + + + + + + + +
${f:h(data.name)}
+
+ +
+ <%-- Box Footer --%> + +
+
+
+ +
+
+ + +
+ + + + diff --git a/src/main/webapp/WEB-INF/view/common/admin2/sidebar.jsp b/src/main/webapp/WEB-INF/view/common/admin2/sidebar.jsp index fd278d22a..0f869c9b2 100644 --- a/src/main/webapp/WEB-INF/view/common/admin2/sidebar.jsp +++ b/src/main/webapp/WEB-INF/view/common/admin2/sidebar.jsp @@ -59,7 +59,8 @@ - + +
  • active"> @@ -137,7 +138,36 @@
  • - + + +
  • active"> +
      + +
    • class="active"> + + +
    • + +
    • class="active"> + + +
    • + +
    • class="active"> + + +
    • + +
    +
  • active"> @@ -157,7 +187,8 @@
  • - + +
  • active"> @@ -195,7 +226,8 @@
  • - + +