svnno****@sourc*****
svnno****@sourc*****
2007年 7月 20日 (金) 16:03:53 JST
Revision: 321 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=321 Author: shinsuke Date: 2007-07-20 16:03:52 +0900 (Fri, 20 Jul 2007) Log Message: ----------- replaced FacesMessageUtil. Modified Paths: -------------- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupConfirmPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupListPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleConfirmPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleListPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeConfirmPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeListPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserConfirmPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserCreatePage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserGroupEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserListPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserProfilingRuleEditPage.java pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserRoleEditPage.java -------------- next part -------------- Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupConfirmPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupConfirmPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupConfirmPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,32 +1,29 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.group; import java.io.Serializable; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; -public class GroupConfirmPage extends AbstractGroupPage implements Serializable -{ +public class GroupConfirmPage extends AbstractGroupPage implements Serializable { /** * @@ -39,59 +36,49 @@ private static final Logger logger = Logger .getLogger(GroupConfirmPage.class); - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public Class doFinish() - { - switch (getCrudType()) - { - case CrudType.CREATE: - try - { - getGroupManagementService().insert(this); - FacesMessageUtil.addInfoMessage("added.new.group", - new Object[] { getName() }); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.add.new.group", - new Object[] { getName() }); - logger.error("Failed to add a new group: " + getName(), e); - } - break; - // case CrudType.UPDATE: - // break; - case CrudType.DELETE: - try - { - getGroupManagementService().delete(this); - FacesMessageUtil.addInfoMessage("deleted.group", - new Object[] { getName() }); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.delete.group", - new Object[] { getName() }); - logger.error("Failed to delete a new group: " + getName(), - e); - } - break; - default: - break; + public Class doFinish() { + switch (getCrudType()) { + case CrudType.CREATE: + try { + getGroupManagementService().insert(this); + FacesMessageUtil.addInfoMessage("added.new.group", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage("failed.to.add.new.group", + new Object[] { getName() }); + logger.error("Failed to add a new group: " + getName(), e); + } + break; + // case CrudType.UPDATE: + // break; + case CrudType.DELETE: + try { + getGroupManagementService().delete(this); + FacesMessageUtil.addInfoMessage("deleted.group", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage("failed.to.delete.group", + new Object[] { getName() }); + logger.error("Failed to delete a new group: " + getName(), e); + } + break; + default: + break; } return GroupListPage.class; } - public boolean isComeFromList() - { + public boolean isComeFromList() { return getCrudType() == CrudType.READ || getCrudType() == CrudType.DELETE; Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,39 +1,40 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.group; import java.io.Serializable; -public class GroupEditPage extends AbstractGroupPage implements Serializable -{ +import jp.sf.pal.common.util.FacesMessageUtil; +public class GroupEditPage extends AbstractGroupPage implements Serializable { + /** * */ private static final long serialVersionUID = 666316850285389222L; - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // update + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupListPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupListPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/group/GroupListPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.group; @@ -23,11 +22,11 @@ import jp.sf.pal.admin.service.GroupManagementService; import jp.sf.pal.admin.web.AbstractPagerPage; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.teeda.extension.annotation.takeover.TakeOver; -public class GroupListPage extends AbstractPagerPage implements Serializable -{ +public class GroupListPage extends AbstractPagerPage implements Serializable { /** * @@ -42,41 +41,34 @@ private GroupManagementService groupManagementService; - public int getGroupIndex() - { + public int getGroupIndex() { return groupIndex; } - public void setGroupIndex(int groupIndex) - { + public void setGroupIndex(int groupIndex) { this.groupIndex = groupIndex; } - public List<Map<String, Object>> getGroupItems() - { + public List<Map<String, Object>> getGroupItems() { return groupItems; } - public void setGroupItems(List<Map<String, Object>> groupItems) - { + public void setGroupItems(List<Map<String, Object>> groupItems) { this.groupItems = groupItems; } - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } /** * @return the groupManagementService */ - public GroupManagementService getGroupManagementService() - { + public GroupManagementService getGroupManagementService() { return groupManagementService; } @@ -84,26 +76,24 @@ * @param groupManagementService the groupManagementService to set */ public void setGroupManagementService( - GroupManagementService groupManagementService) - { + GroupManagementService groupManagementService) { this.groupManagementService = groupManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { getGroupManagementService().loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(properties = "crudType") - public Class doCreate() - { + public Class doCreate() { setCrudType(CrudType.CREATE); return GroupEditPage.class; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleConfirmPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleConfirmPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleConfirmPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,92 +1,84 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.role; - import java.io.Serializable; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; -public class RoleConfirmPage extends AbstractRolePage implements Serializable -{ +public class RoleConfirmPage extends AbstractRolePage implements Serializable { /** * */ private static final long serialVersionUID = 8565809646908671454L; + /** * Logger for this class */ private static final Logger logger = Logger .getLogger(RoleConfirmPage.class); - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public Class doFinish() - { - switch (getCrudType()) - { - case CrudType.CREATE: - try - { - getRoleManagementService().insert(this); - FacesMessageUtil.addInfoMessage("added.new.role", new Object[]{getName()}); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.add.new.role", new Object[]{getName()}); - logger.error("Failed to add a new role: "+getName(), e); - } - break; - // case CrudType.UPDATE: - // break; - case CrudType.DELETE: - try - { - getRoleManagementService().delete(this); - FacesMessageUtil.addInfoMessage("deleted.role", new Object[]{getName()}); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.delete.role", new Object[]{getName()}); - logger.error("Failed to delete a new role: "+getName(), e); - } - break; - default: - break; + public Class doFinish() { + switch (getCrudType()) { + case CrudType.CREATE: + try { + getRoleManagementService().insert(this); + FacesMessageUtil.addInfoMessage("added.new.role", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage("failed.to.add.new.role", + new Object[] { getName() }); + logger.error("Failed to add a new role: " + getName(), e); + } + break; + // case CrudType.UPDATE: + // break; + case CrudType.DELETE: + try { + getRoleManagementService().delete(this); + FacesMessageUtil.addInfoMessage("deleted.role", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage("failed.to.delete.role", + new Object[] { getName() }); + logger.error("Failed to delete a new role: " + getName(), e); + } + break; + default: + break; } return RoleListPage.class; } - public boolean isComeFromList() - { + public boolean isComeFromList() { return getCrudType() == CrudType.READ || getCrudType() == CrudType.DELETE; Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,39 +1,40 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.role; import java.io.Serializable; -public class RoleEditPage extends AbstractRolePage implements Serializable -{ +import jp.sf.pal.common.util.FacesMessageUtil; +public class RoleEditPage extends AbstractRolePage implements Serializable { + /** * */ private static final long serialVersionUID = 8348278121674992785L; - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // update + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleListPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleListPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/role/RoleListPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.role; @@ -23,11 +22,11 @@ import jp.sf.pal.admin.service.RoleManagementService; import jp.sf.pal.admin.web.AbstractPagerPage; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.teeda.extension.annotation.takeover.TakeOver; -public class RoleListPage extends AbstractPagerPage implements Serializable -{ +public class RoleListPage extends AbstractPagerPage implements Serializable { /** * @@ -42,59 +41,51 @@ private RoleManagementService roleManagementService; - public RoleListPage() - { + public RoleListPage() { super(); } - public String getName() - { + public String getName() { return name; } - public void setName(String roleName) - { + public void setName(String roleName) { this.name = roleName; } /** * @return the roleIndex */ - public int getRoleIndex() - { + public int getRoleIndex() { return roleIndex; } /** * @param roleIndex the roleIndex to set */ - public void setRoleIndex(int roleIndex) - { + public void setRoleIndex(int roleIndex) { this.roleIndex = roleIndex; } /** * @return the roleItems */ - public List<Map<String, Object>> getRoleItems() - { + public List<Map<String, Object>> getRoleItems() { return roleItems; } /** * @param roleItems the roleItems to set */ - public void setRoleItems(List<Map<String, Object>> roleItems) - { + public void setRoleItems(List<Map<String, Object>> roleItems) { this.roleItems = roleItems; } /** * @return the roleManagementService */ - public RoleManagementService getRoleManagementService() - { + public RoleManagementService getRoleManagementService() { return roleManagementService; } @@ -102,26 +93,24 @@ * @param roleManagementService the roleManagementService to set */ public void setRoleManagementService( - RoleManagementService roleManagementService) - { + RoleManagementService roleManagementService) { this.roleManagementService = roleManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { roleManagementService.loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(properties = "crudType") - public Class doCreate() - { + public Class doCreate() { setCrudType(CrudType.CREATE); return RoleEditPage.class; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeConfirmPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeConfirmPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeConfirmPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2007 Portal Application Laboratory 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 jp.sf.pal.admin.web.user; import java.io.Serializable; @@ -2,6 +17,5 @@ -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; @@ -11,8 +25,8 @@ import org.seasar.teeda.extension.annotation.takeover.TakeOver; import org.seasar.teeda.extension.annotation.takeover.TakeOverType; -public class UserAttributeConfirmPage extends AbstractUserAttributePage implements Serializable -{ +public class UserAttributeConfirmPage extends AbstractUserAttributePage + implements Serializable { /** * @@ -22,90 +36,88 @@ /** * Logger for this class */ - private static final Logger logger = Logger.getLogger(UserAttributeConfirmPage.class); + private static final Logger logger = Logger + .getLogger(UserAttributeConfirmPage.class); - public Class initialize() - { + public Class initialize() { return null; } - public Class prerender() - { - if (getCrudType() == CrudType.DELETE) - { + public Class prerender() { + if (getCrudType() == CrudType.DELETE) { // update - if (getKey() != null) - { - try - { + if (getKey() != null) { + try { getUserManagementService().loadPage(this); + } catch (PALAdminException e) { + FacesMessageUtil + .addErrorMessage("failed.to.get.userattributes"); + logger.error("Failed to get user attributes: " + getName(), + e); } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.get.userattributes"); - logger.error("Failed to get user attributes: " + getName(), e); - } - } - else - { + } else { setCrudType(CrudType.READ); return UserAttributeListPage.class; } } + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(type = TakeOverType.INCLUDE, properties = "name") - public Class doUpdate() - { + public Class doUpdate() { - switch (getCrudType()) - { - case CrudType.CREATE: - try - { - getUserManagementService().insert(this); - FacesMessageUtil.addInfoMessage("added.new.userattribute", new Object[] { getName() }); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.add.new.userattribute", new Object[] { getName() }); - logger.error("Failed to add a new user attribute: " + getName(), e); - } - break; - case CrudType.UPDATE: - try - { - getUserManagementService().update(this); - FacesMessageUtil.addInfoMessage("added.new.userattribute", new Object[] { getName() }); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.add.new.userattribute", new Object[] { getName() }); - logger.error("Failed to add a new user attribute: " + getName(), e); - } - break; - case CrudType.DELETE: - try - { - getUserManagementService().delete(this); - FacesMessageUtil.addInfoMessage("deleted.userattribute", new Object[] { getName() }); - } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.delete.userattribute", new Object[] { getName() }); - logger.error("Failed to delete a new user attribute: " + getName(), e); - } - break; - default: - break; + switch (getCrudType()) { + case CrudType.CREATE: + try { + getUserManagementService().insert(this); + FacesMessageUtil.addInfoMessage("added.new.userattribute", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage( + "failed.to.add.new.userattribute", + new Object[] { getName() }); + logger.error( + "Failed to add a new user attribute: " + getName(), e); + } + break; + case CrudType.UPDATE: + try { + getUserManagementService().update(this); + FacesMessageUtil.addInfoMessage("added.new.userattribute", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage( + "failed.to.add.new.userattribute", + new Object[] { getName() }); + logger.error( + "Failed to add a new user attribute: " + getName(), e); + } + break; + case CrudType.DELETE: + try { + getUserManagementService().delete(this); + FacesMessageUtil.addInfoMessage("deleted.userattribute", + new Object[] { getName() }); + } catch (PALAdminException e) { + FacesMessageUtil.addErrorMessage( + "failed.to.delete.userattribute", + new Object[] { getName() }); + logger.error("Failed to delete a new user attribute: " + + getName(), e); + } + break; + default: + break; } return UserAttributeListPage.class; } - public boolean isComeFromList() - { - return getCrudType() == CrudType.READ || getCrudType() == CrudType.DELETE; + public boolean isComeFromList() { + return getCrudType() == CrudType.READ + || getCrudType() == CrudType.DELETE; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2007 Portal Application Laboratory 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 jp.sf.pal.admin.web.user; import java.io.Serializable; @@ -2,12 +17,11 @@ -import javax.faces.internal.FacesMessageUtil; +import jp.sf.pal.admin.PALAdminException; +import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; -import jp.sf.pal.admin.PALAdminException; -import jp.sf.pal.admin.web.CrudType; +public class UserAttributeEditPage extends AbstractUserAttributePage implements + Serializable { -public class UserAttributeEditPage extends AbstractUserAttributePage implements Serializable -{ - /** @@ -20,40 +34,36 @@ /** * Logger for this class */ - private static final Logger logger = Logger.getLogger(UserAttributeEditPage.class); + private static final Logger logger = Logger + .getLogger(UserAttributeEditPage.class); - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { - if (getCrudType() == CrudType.UPDATE) - { + public String prerender() { + if (getCrudType() == CrudType.UPDATE) { // update - if (getKey() != null) - { - try - { + if (getKey() != null) { + try { getUserManagementService().loadPage(this); + } catch (PALAdminException e) { + FacesMessageUtil + .addErrorMessage("failed.to.get.userattributes"); + logger.error("Failed to get user attributes: " + getName(), + e); } - catch (PALAdminException e) - { - FacesMessageUtil.addErrorMessage("failed.to.get.userattributes"); - logger.error("Failed to get user attributes: " + getName(), e); - } - } - else - { + } else { setCrudType(CrudType.CREATE); } } + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public Class doBack() - { + public Class doBack() { setCrudType(CrudType.READ); return UserAttributeListPage.class; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeListPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeListPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserAttributeListPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,3 +1,18 @@ +/* + * Copyright 2005-2007 Portal Application Laboratory 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 jp.sf.pal.admin.web.user; import java.io.Serializable; @@ -4,19 +19,18 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - -import org.seasar.framework.log.Logger; -import org.seasar.teeda.extension.annotation.takeover.TakeOver; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.web.AbstractPagerPage; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; -public class UserAttributeListPage extends AbstractPagerPage implements Serializable -{ +import org.seasar.framework.log.Logger; +import org.seasar.teeda.extension.annotation.takeover.TakeOver; +public class UserAttributeListPage extends AbstractPagerPage implements + Serializable { + /** * */ @@ -25,7 +39,8 @@ /** * Logger for this class */ - private static final Logger logger = Logger.getLogger(UserAttributeListPage.class); + private static final Logger logger = Logger + .getLogger(UserAttributeListPage.class); private String name; @@ -39,101 +54,88 @@ private UserManagementService userManagementService; - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } /** * @return the key */ - public String getKey() - { + public String getKey() { return key; } /** * @param key the key to set */ - public void setKey(String key) - { + public void setKey(String key) { this.key = key; } - public int getUserAttributeIndex() - { + public int getUserAttributeIndex() { return userAttributeIndex; } - public void setUserAttributeIndex(int userAttributeIndex) - { + public void setUserAttributeIndex(int userAttributeIndex) { this.userAttributeIndex = userAttributeIndex; } - public List<Map<String, Object>> getUserAttributeItems() - { + public List<Map<String, Object>> getUserAttributeItems() { return userAttributeItems; } - public void setUserAttributeItems(List<Map<String, Object>> userAttributeItems) - { + public void setUserAttributeItems( + List<Map<String, Object>> userAttributeItems) { this.userAttributeItems = userAttributeItems; } - public String getValue() - { + public String getValue() { return value; } - public void setValue(String value) - { + public void setValue(String value) { this.value = value; } /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } /** * @param userManagementService the userManagementService to set */ - public void setUserManagementService(UserManagementService userManagementService) - { + public void setUserManagementService( + UserManagementService userManagementService) { this.userManagementService = userManagementService; } @TakeOver(properties = "crudType,name") - public Class doCreate() - { + public Class doCreate() { setCrudType(CrudType.CREATE); return UserAttributeEditPage.class; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { - try - { + public String prerender() { + try { getUserManagementService().loadPage(this); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.get.userattributes"); logger.error("Failed to get user attributes: " + getName(), e); } + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserConfirmPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserConfirmPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserConfirmPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,35 +1,32 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; import java.io.Serializable; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.util.PALAdminUtil; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; import org.seasar.teeda.extension.annotation.takeover.TakeOver; import org.seasar.teeda.extension.annotation.takeover.TakeOverType; -public class UserConfirmPage extends AbstractUserPage implements Serializable -{ +public class UserConfirmPage extends AbstractUserPage implements Serializable { /** * */ @@ -41,63 +38,53 @@ private static final Logger logger = Logger .getLogger(UserConfirmPage.class); - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(type = TakeOverType.NEVER) - public Class doFinish() - { - switch (getCrudType()) - { - case CrudType.CREATE: - addUser(); - break; - // case CrudType.UPDATE: - // break; - case CrudType.DELETE: - deleteUser(); - break; - default: - break; + public Class doFinish() { + switch (getCrudType()) { + case CrudType.CREATE: + addUser(); + break; + // case CrudType.UPDATE: + // break; + case CrudType.DELETE: + deleteUser(); + break; + default: + break; } return UserListPage.class; } - protected void addUser() - { - try - { + protected void addUser() { + try { setPassword(PALAdminUtil.getPasswordFromSession()); PALAdminUtil.removePasswordFromSession(); getUserManagementService().insert(this); FacesMessageUtil.addInfoMessage("added.new.user", new Object[] { getName() }); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.add.new.user", new Object[] { getName() }); logger.error("Failed to add a new user: " + getName(), e); } } - protected void deleteUser() - { - try - { + protected void deleteUser() { + try { getUserManagementService().delete(this); FacesMessageUtil.addInfoMessage("deleted.user", new Object[] { getName() }); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.delete.user", new Object[] { getName() }); logger.error("Failed to delete the user: " + getName(), e); @@ -105,14 +92,12 @@ } @TakeOver(properties = "name,updateRequired,roleName") - public Class doCreate() - { + public Class doCreate() { PALAdminUtil.removePasswordFromSession(); return UserCreatePage.class; } - public boolean isComeFromList() - { + public boolean isComeFromList() { return getCrudType() == CrudType.READ || getCrudType() == CrudType.DELETE; Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserCreatePage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserCreatePage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserCreatePage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -20,13 +19,12 @@ import java.util.List; import java.util.Map; -import jp.sf.pal.admin.PALAdminConstants; import jp.sf.pal.admin.util.PALAdminUtil; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.teeda.extension.annotation.takeover.TakeOver; -public class UserCreatePage extends AbstractUserPage implements Serializable -{ +public class UserCreatePage extends AbstractUserPage implements Serializable { /** * */ @@ -37,36 +35,34 @@ /** * @return the roleItems */ - public List<Map<String, String>> getRoleNameItems() - { + public List<Map<String, String>> getRoleNameItems() { return roleNameItems; } /** * @param roleItems the roleItems to set */ - public void setRoleNameItems(List<Map<String, String>> roleItems) - { + public void setRoleNameItems(List<Map<String, String>> roleItems) { this.roleNameItems = roleItems; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // set pull-down setRoleNameItems(getUserManagementService().getRoleNames()); // update? + + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(properties = "name,password,updateRequired,roleName") - public Class doConfirm() - { + public Class doConfirm() { PALAdminUtil.setPasswordToSession(getPassword()); setPassword("******"); return UserConfirmPage.class; Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -20,17 +19,15 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.web.AbstractCrudPage; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; import org.seasar.teeda.extension.annotation.validator.Required; -public class UserEditPage extends AbstractCrudPage implements Serializable -{ +public class UserEditPage extends AbstractCrudPage implements Serializable { /** * */ @@ -64,8 +61,7 @@ /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } @@ -73,26 +69,22 @@ * @param userManagementService the userManagementService to set */ public void setUserManagementService( - UserManagementService userManagementService) - { + UserManagementService userManagementService) { this.userManagementService = userManagementService; } - public List<Map<String, String>> getExpiresItems() - { + public List<Map<String, String>> getExpiresItems() { return expiresItems; } - public void setExpiresItems(List<Map<String, String>> expiresItems) - { + public void setExpiresItems(List<Map<String, String>> expiresItems) { this.expiresItems = expiresItems; } /** * @return the expires */ - public String getExpires() - { + public String getExpires() { return expires; } @@ -100,104 +92,86 @@ * @param expires the expires to set */ @Required - public void setExpires(String expires) - { + public void setExpires(String expires) { this.expires = expires; } /** * @return the expiresIndex */ - public int getExpiresIndex() - { + public int getExpiresIndex() { return expiresIndex; } /** * @param expiresIndex the expiresIndex to set */ - public void setExpiresIndex(int expiresIndex) - { + public void setExpiresIndex(int expiresIndex) { this.expiresIndex = expiresIndex; } - public String getLastLogon() - { + public String getLastLogon() { return lastLogon; } - public void setLastLogon(String lastLogon) - { + public void setLastLogon(String lastLogon) { this.lastLogon = lastLogon; } - public String getName() - { + public String getName() { return name; } @Required - public void setName(String name) - { + public void setName(String name) { this.name = name; } - public String getPassword() - { + public String getPassword() { return password; } - public void setPassword(String password) - { + public void setPassword(String password) { this.password = password; } - public boolean isUpdateRequired() - { + public boolean isUpdateRequired() { return updateRequired; } - public void setUpdateRequired(boolean updateRequired) - { + public void setUpdateRequired(boolean updateRequired) { this.updateRequired = updateRequired; } - public boolean isUserEnabled() - { + public boolean isUserEnabled() { return userEnabled; } - public void setUserEnabled(boolean userEnabled) - { + public void setUserEnabled(boolean userEnabled) { this.userEnabled = userEnabled; } /** * @return the expirationDate */ - public String getExpirationDate() - { + public String getExpirationDate() { return expirationDate; } /** * @param expirationDate the expirationDate to set */ - public void setExpirationDate(String expirationDate) - { + public void setExpirationDate(String expirationDate) { this.expirationDate = expirationDate; } - public String initialize() - { + public String initialize() { return null; } - public Class prerender() - { + public Class prerender() { // Check name - if (!getUserManagementService().isUserExists(getName())) - { + if (!getUserManagementService().isUserExists(getName())) { FacesMessageUtil.addWarnMessage("could.not.find.user"); return UserListPage.class; } @@ -205,19 +179,17 @@ // update this page getUserManagementService().loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public String doUpdate() - { - try - { + public String doUpdate() { + try { getUserManagementService().update(this); FacesMessageUtil.addInfoMessage("updated.user.information", new Object[] { getName() }); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage( "failed.to.update.user.information", new Object[] { getName() }); Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserGroupEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserGroupEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserGroupEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -20,17 +19,15 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.util.PALAdminUtil; import jp.sf.pal.admin.web.AbstractCrudPage; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; -public class UserGroupEditPage extends AbstractCrudPage implements Serializable -{ +public class UserGroupEditPage extends AbstractCrudPage implements Serializable { /** * */ @@ -59,78 +56,66 @@ /** * @return the name */ - public String getName() - { + public String getName() { return name; } /** * @param name the name to set */ - public void setName(String name) - { + public void setName(String name) { this.name = name; } - public List<Map<String, String>> getNewGroupItems() - { + public List<Map<String, String>> getNewGroupItems() { return newGroupItems; } - public void setNewGroupItems(List<Map<String, String>> newGroupItems) - { + public void setNewGroupItems(List<Map<String, String>> newGroupItems) { this.newGroupItems = newGroupItems; } - public List<Map<String, String>> getGroupsItems() - { + public List<Map<String, String>> getGroupsItems() { return groupsItems; } - public void setGroupsItems(List<Map<String, String>> usersGroupItems) - { + public void setGroupsItems(List<Map<String, String>> usersGroupItems) { this.groupsItems = usersGroupItems; } /** * @return the newGroup */ - public String getNewGroup() - { + public String getNewGroup() { return newGroup; } /** * @param newGroup the newGroup to set */ - public void setNewGroup(String newGroup) - { + public void setNewGroup(String newGroup) { this.newGroup = newGroup; } /** * @return the newGroupIndex */ - public int getNewGroupIndex() - { + public int getNewGroupIndex() { return newGroupIndex; } /** * @param newGroupIndex the newGroupIndex to set */ - public void setNewGroupIndex(int newGroupIndex) - { + public void setNewGroupIndex(int newGroupIndex) { this.newGroupIndex = newGroupIndex; } /** * @return the usersGroup */ - public String[] getGroups() - { - if (groups == null) - { + public String[] getGroups() { + if (groups == null) { groups = new String[0]; } return groups; @@ -139,16 +124,14 @@ /** * @param usersGroup the usersGroup to set */ - public void setGroups(String[] groups) - { + public void setGroups(String[] groups) { this.groups = groups; } /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } @@ -156,52 +139,45 @@ * @param userManagementService the userManagementService to set */ public void setUserManagementService( - UserManagementService userManagementService) - { + UserManagementService userManagementService) { this.userManagementService = userManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // load page getUserManagementService().loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public String doAddGroup() - { - if (getName() == null || getNewGroup() == null) - { + public String doAddGroup() { + if (getName() == null || getNewGroup() == null) { FacesMessageUtil.addWarnMessage("invalid.group.or.user.name"); return null; } // check if group exists if (getUserManagementService().isGroupExistsInUser(getName(), - getNewGroup())) - { + getNewGroup())) { FacesMessageUtil.addWarnMessage("group.exists.in.user", new Object[] { getName(), getNewGroup() }); return null; } - try - { + try { getUserManagementService().addGroupToUser(this); FacesMessageUtil.addInfoMessage("added.group.to.user", new Object[] { getName(), getNewGroup() }); // clear setNewGroup(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.add.group.to.user", new Object[] { getName(), getNewGroup() }); logger.error("Failed to add group to user. user=" + getName() @@ -210,10 +186,8 @@ return null; } - public String doRemoveGroup() - { - try - { + public String doRemoveGroup() { + try { getUserManagementService().removeGroupsFromUser(this); FacesMessageUtil.addInfoMessage("removed.groups.from.user", new Object[] { getName(), @@ -221,9 +195,7 @@ // clear setGroups(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage( "failed.to.remove.groups.from.user", new Object[] { getName(), getGroups() }); @@ -233,8 +205,7 @@ return null; } - public boolean isGroupsForUser() - { + public boolean isGroupsForUser() { return getGroupsItems().size() > 0; } } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserListPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserListPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserListPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -20,18 +19,16 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.web.AbstractPagerPage; import jp.sf.pal.admin.web.CrudType; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; import org.seasar.teeda.extension.annotation.takeover.TakeOver; -public class UserListPage extends AbstractPagerPage implements Serializable -{ +public class UserListPage extends AbstractPagerPage implements Serializable { /** * @@ -53,103 +50,88 @@ private UserManagementService userManagementService; - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } /** * @return the filter */ - public String getFilter() - { + public String getFilter() { return filter; } /** * @param filter the filter to set */ - public void setFilter(String filter) - { + public void setFilter(String filter) { this.filter = filter; } - public int getUserIndex() - { + public int getUserIndex() { return userIndex; } - public void setUserIndex(int userIndex) - { + public void setUserIndex(int userIndex) { this.userIndex = userIndex; } - public List<Map<String, Object>> getUserItems() - { + public List<Map<String, Object>> getUserItems() { return userItems; } - public void setUserItems(List<Map<String, Object>> userItems) - { + public void setUserItems(List<Map<String, Object>> userItems) { this.userItems = userItems; } /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } /** * @param userManagementService the userManagementService to set */ - public void setUserManagementService(UserManagementService userManagementService) - { + public void setUserManagementService( + UserManagementService userManagementService) { this.userManagementService = userManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { - try - { + public String prerender() { + try { userManagementService.loadPage(this); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.get.users"); logger.error("Failed to get users: " + getName(), e); } + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } @TakeOver(properties = "crudType") - public Class doCreate() - { + public Class doCreate() { setCrudType(CrudType.CREATE); return UserCreatePage.class; } - public Class doSearch() - { + public Class doSearch() { getUserManagementService().updateQuery(this); return null; } - public Class doResetSearch() - { + public Class doResetSearch() { setFilter(""); getUserManagementService().updateQuery(this); return null; Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserProfilingRuleEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserProfilingRuleEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserProfilingRuleEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -21,19 +20,17 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.entity.PrincipalRule; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.util.PALAdminUtil; import jp.sf.pal.admin.web.AbstractCrudPage; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; public class UserProfilingRuleEditPage extends AbstractCrudPage implements - Serializable -{ + Serializable { /** * */ @@ -65,133 +62,114 @@ private UserManagementService userManagementService; - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } - public List<Map<String, String>> getNewProfilingRuleNameItems() - { + public List<Map<String, String>> getNewProfilingRuleNameItems() { return newProfilingRuleNameItems; } public void setNewProfilingRuleNameItems( - List<Map<String, String>> newProfilingRuleItems) - { + List<Map<String, String>> newProfilingRuleItems) { this.newProfilingRuleNameItems = newProfilingRuleItems; } - public List<Map<String, String>> getNewLocatorNameItems() - { + public List<Map<String, String>> getNewLocatorNameItems() { return newLocatorNameItems; } public void setNewLocatorNameItems( - List<Map<String, String>> newProfilingRuleTypeItems) - { + List<Map<String, String>> newProfilingRuleTypeItems) { this.newLocatorNameItems = newProfilingRuleTypeItems; } - public List<PrincipalRule> getPrincipalRulesItems() - { + public List<PrincipalRule> getPrincipalRulesItems() { return principalRulesItems; } - public void setPrincipalRulesItems(List<PrincipalRule> profilingRulesItems) - { + public void setPrincipalRulesItems(List<PrincipalRule> profilingRulesItems) { this.principalRulesItems = profilingRulesItems; } /** * @return the newProfilingRuleName */ - public String getNewProfilingRuleName() - { + public String getNewProfilingRuleName() { return newProfilingRuleName; } /** * @param newProfilingRuleName the newProfilingRuleName to set */ - public void setNewProfilingRuleName(String newProfilingRule) - { + public void setNewProfilingRuleName(String newProfilingRule) { this.newProfilingRuleName = newProfilingRule; } /** * @return the newProfilingRuleNameIndex */ - public int getNewProfilingRuleNameIndex() - { + public int getNewProfilingRuleNameIndex() { return newProfilingRuleNameIndex; } /** * @param newProfilingRuleNameIndex the newProfilingRuleNameIndex to set */ - public void setNewProfilingRuleNameIndex(int newProfilingRuleIndex) - { + public void setNewProfilingRuleNameIndex(int newProfilingRuleIndex) { this.newProfilingRuleNameIndex = newProfilingRuleIndex; } /** * @return the newLocatorName */ - public String getNewLocatorName() - { + public String getNewLocatorName() { return newLocatorName; } /** * @param newLocatorName the newLocatorName to set */ - public void setNewLocatorName(String newProfilingRuleType) - { + public void setNewLocatorName(String newProfilingRuleType) { this.newLocatorName = newProfilingRuleType; } /** * @return the newLocatorNameIndex */ - public int getNewLocatorNameIndex() - { + public int getNewLocatorNameIndex() { return newLocatorNameIndex; } /** * @param newLocatorNameIndex the newLocatorNameIndex to set */ - public void setNewLocatorNameIndex(int newProfilingRuleTypeIndex) - { + public void setNewLocatorNameIndex(int newProfilingRuleTypeIndex) { this.newLocatorNameIndex = newProfilingRuleTypeIndex; } /** * @return the profilingRules */ - public String[] getPrincipalRules() - { + public String[] getPrincipalRules() { return principalRules; } /** * @param profilingRules the profilingRules to set */ - public void setPrincipalRules(String[] profilingRules) - { + public void setPrincipalRules(String[] profilingRules) { this.principalRules = profilingRules; } /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } @@ -199,36 +177,32 @@ * @param userManagementService the userManagementService to set */ public void setUserManagementService( - UserManagementService userManagementService) - { + UserManagementService userManagementService) { this.userManagementService = userManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // load page getUserManagementService().loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public String doAddProfilingRule() - { + public String doAddProfilingRule() { if (getName() == null || getNewLocatorName() == null - || getNewProfilingRuleName() == null) - { + || getNewProfilingRuleName() == null) { FacesMessageUtil .addWarnMessage("invalid.profilingRule.or.user.name"); return null; } - try - { + try { getUserManagementService().addPrincipalRuleToUser(this); FacesMessageUtil.addInfoMessage("added.principalRule.to.user", new Object[] { getName(), getNewLocatorName(), @@ -237,9 +211,7 @@ // clear setNewLocatorName(null); setNewProfilingRuleName(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage( "failed.to.add.principalRule.to.user", new Object[] { getName(), getNewLocatorName(), @@ -251,10 +223,8 @@ return null; } - public String doRemoveProfilingRule() - { - try - { + public String doRemoveProfilingRule() { + try { getUserManagementService().removePrincipalRulesFromUser(this); FacesMessageUtil .addInfoMessage( @@ -266,9 +236,7 @@ // clear setPrincipalRules(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil .addErrorMessage( "failed.to.remove.principalRules.from.user", @@ -282,18 +250,15 @@ return null; } - private Object[] parsePrincipalRules(String[] rules) - { + private Object[] parsePrincipalRules(String[] rules) { List<PrincipalRule> list = new ArrayList<PrincipalRule>(); - for (int i = 0; i < rules.length; i++) - { + for (int i = 0; i < rules.length; i++) { list.add(PrincipalRule.getInstance(rules[i])); } return list.toArray(); } - public boolean isProfilingRulesForUser() - { + public boolean isProfilingRulesForUser() { return getPrincipalRulesItems().size() > 0; } Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserRoleEditPage.java =================================================================== --- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserRoleEditPage.java 2007-07-19 23:56:31 UTC (rev 320) +++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/user/UserRoleEditPage.java 2007-07-20 07:03:52 UTC (rev 321) @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * + * Copyright 2005-2007 Portal Application Laboratory 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. + * 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 jp.sf.pal.admin.web.user; @@ -20,17 +19,15 @@ import java.util.List; import java.util.Map; -import javax.faces.internal.FacesMessageUtil; - import jp.sf.pal.admin.PALAdminException; import jp.sf.pal.admin.service.UserManagementService; import jp.sf.pal.admin.util.PALAdminUtil; import jp.sf.pal.admin.web.AbstractCrudPage; +import jp.sf.pal.common.util.FacesMessageUtil; import org.seasar.framework.log.Logger; -public class UserRoleEditPage extends AbstractCrudPage implements Serializable -{ +public class UserRoleEditPage extends AbstractCrudPage implements Serializable { /** * */ @@ -56,89 +53,76 @@ private UserManagementService userManagementService; - public String getName() - { + public String getName() { return name; } - public void setName(String name) - { + public void setName(String name) { this.name = name; } - public List<Map<String, String>> getNewRoleItems() - { + public List<Map<String, String>> getNewRoleItems() { return newRoleItems; } - public void setNewRoleItems(List<Map<String, String>> newRoleItems) - { + public void setNewRoleItems(List<Map<String, String>> newRoleItems) { this.newRoleItems = newRoleItems; } - public List<Map<String, String>> getRolesItems() - { + public List<Map<String, String>> getRolesItems() { return rolesItems; } - public void setRolesItems(List<Map<String, String>> rolesItems) - { + public void setRolesItems(List<Map<String, String>> rolesItems) { this.rolesItems = rolesItems; } /** * @return the newRole */ - public String getNewRole() - { + public String getNewRole() { return newRole; } /** * @param newRole the newRole to set */ - public void setNewRole(String newRole) - { + public void setNewRole(String newRole) { this.newRole = newRole; } /** * @return the newRoleIndex */ - public int getNewRoleIndex() - { + public int getNewRoleIndex() { return newRoleIndex; } /** * @param newRoleIndex the newRoleIndex to set */ - public void setNewRoleIndex(int newRoleIndex) - { + public void setNewRoleIndex(int newRoleIndex) { this.newRoleIndex = newRoleIndex; } /** * @return the roles */ - public String[] getRoles() - { + public String[] getRoles() { return roles; } /** * @param roles the roles to set */ - public void setRoles(String[] roles) - { + public void setRoles(String[] roles) { this.roles = roles; } /** * @return the userManagementService */ - public UserManagementService getUserManagementService() - { + public UserManagementService getUserManagementService() { return userManagementService; } @@ -146,52 +130,45 @@ * @param userManagementService the userManagementService to set */ public void setUserManagementService( - UserManagementService userManagementService) - { + UserManagementService userManagementService) { this.userManagementService = userManagementService; } - public String initialize() - { + public String initialize() { return null; } - public String prerender() - { + public String prerender() { // load page getUserManagementService().loadPage(this); + // render FacesMessages + FacesMessageUtil.renderMessages(); return null; } - public String doAddRole() - { - if (getName() == null || getNewRole() == null) - { + public String doAddRole() { + if (getName() == null || getNewRole() == null) { FacesMessageUtil.addWarnMessage("invalid.role.or.user.name"); return null; } // check if role exists if (getUserManagementService().isRoleExistsInUser(getName(), - getNewRole())) - { + getNewRole())) { FacesMessageUtil.addWarnMessage("role.exists.in.user", new Object[] { getName(), getNewRole() }); return null; } - try - { + try { getUserManagementService().addRoleToUser(this); FacesMessageUtil.addInfoMessage("added.role.to.user", new Object[] { getName(), getNewRole() }); // clear setNewRole(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage("failed.to.add.role.to.user", new Object[] { getName(), getNewRole() }); logger.error("Failed to add role to user. user=" + getName() @@ -200,10 +177,8 @@ return null; } - public String doRemoveRole() - { - try - { + public String doRemoveRole() { + try { getUserManagementService().removeRolesFromUser(this); FacesMessageUtil.addInfoMessage("removed.roles.from.user", new Object[] { getName(), @@ -211,9 +186,7 @@ // clear setRoles(null); - } - catch (PALAdminException e) - { + } catch (PALAdminException e) { FacesMessageUtil.addErrorMessage( "failed.to.remove.roles.from.user", new Object[] { getName(), getRoles() }); @@ -223,8 +196,7 @@ return null; } - public boolean isRolesForUser() - { + public boolean isRolesForUser() { return getRolesItems().size() > 0; }