JBoss Portal SVN: r13438 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests: src/org/jboss/portal/test/selenium and 1 other directories.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-05 11:17:37 -0400 (Fri, 05 Jun 2009)
New Revision: 13438
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
Log:
[selenium] - more xss tests
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/build.xml 2009-06-05 15:17:37 UTC (rev 13438)
@@ -113,6 +113,8 @@
<echo message="Starting Selenium Remote Control" />
<java jar="${selsrv.dir}/selenium-server.jar" fork="true" spawn="true">
<arg value="-multiWindow" />
+ <arg value="-timeout" />
+ <arg value="320000" />
<arg value="-port" />
<arg value="44444" />
<arg value="-log" />
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-05 15:17:37 UTC (rev 13438)
@@ -8,15 +8,14 @@
import org.testng.annotations.Test;
/**
- * IdentityAdminTestCase is responsible for
+ * IdentityAdminTestCase is responsible for
+ *
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "admin_ui" }, enabled = true)
public class IdentityAdminTestCase extends JBossPortalSeleniumTestCase {
-
-
private static final String LNK_MEMBERS = "link=Members";
private static final String LNK_ADMIN = "link=Admin";
@@ -50,7 +49,6 @@
private final String LNK_T_USRLIST_ROLES = getLoc(casePfx + "lnk.t.usrlist.roles", "//a[contains(@id,''search-user-form1:userlist:{0}:assign-role-link'')]");
private final String LNK_T_USRLIST_DIS = getLoc(casePfx + "lnk.t.usrlist.dis", "//a[contains(@id,''search-user-form1:userlist:{0}:enable-user-link'')]");
private final String LNK_T_USRLIST_EDIT = getLoc(casePfx + "lnk.t.usrlist.edit", "//a[contains(@id,''search-user-form1:userlist:{0}:rename-link'')]");
-
private final String TBL_ROLELIST = getLoc(casePfx + "tbl.rolelist", "//table[contains(@id,'roles-form:userlist')]");
private final String LNK_T_ROLLIST_DEL = getLoc(casePfx + "lnk.t.rollist.del", "//a[contains(@id,''roles-form:userlist:{0}:delete-role-link'')]");
@@ -81,8 +79,7 @@
private final String LNK_USERMAIN = getLoc(casePfx + "lnk.usermain", "//a[contains(@id,'user-temp-form1:user-adm-link')]");
private final String LNK_ROLETAB = getLoc(casePfx + "lnk.roletab", "//a[contains(@id,'user-temp-form:role-mgm-link')]");
-
- private final String LNK_ROLEMAIN = getLoc(casePfx + "lnk.rolemain", "//a[contains(@id, 'role-temp-form1:role-admin-link')]");
+ private final String LNK_ROLEMAIN = getLoc(casePfx + "lnk.rolemain", "//a[contains(@id, 'role-temp-form1:role-adm-link')]");
private final String LNK_USERMANG_MAIN = getLoc(casePfx + "lnk.usermang.main", "//a[contains(@id,'user-temp-form1:assign-role-link')]");
private final String LNK_USERMANG_MAIN2 = getLoc(casePfx + "lnk.usermang.main2", "//a[contains(@id,'user-temp-form1:user-mgm-link')]");
private final String LNK_CREATE_USER = getLoc(casePfx + "lnk.create.user", "//a[contains(@id,':user-form:create-user-link')]");
@@ -90,7 +87,7 @@
private final String CHK_ROLE = getLoc(casePfx + "chk.role", "//input[contains(@name,''assign-roles-form:roles'') and @value=''{0}'']");
private final String MSG_CREATE_ROLE = getMess(casePfx + "chk.role", "Create role");
-
+
/** The timeout used to wait after clicking submit button in user search. */
public final long SEARCH_TIMEOUT = 10000;
@@ -129,10 +126,10 @@
*/
/**
- * Test create user is responsible for user creation.
- * It creates a user named "tempUser" with password "TempPassword" and e-mail "tempUser(a)redhat.com".
- * Then it tries to look up the user with search function.
- * At the end, it deletes the temp user.
+ * Test create user is responsible for user creation. It creates a user
+ * named "tempUser" with password "TempPassword" and e-mail
+ * "tempUser(a)redhat.com". Then it tries to look up the user with search
+ * function. At the end, it deletes the temp user.
*/
@Test(enabled = true, description = "Creation of new user.")
public void testCreateUser() {
@@ -142,11 +139,11 @@
}
/**
- * Test create existing user is respnosible for testing already created user creation.
- * It creates a user named "tempUser" with password "TempPassword" and e-mail "tempUser(a)redhat.com".
- * Then it tries to look up the user with search function.
- * After success it tries to create the same user again and asserts that it is not possible.
- * At the end, it deletes the temp user.
+ * Test create existing user is respnosible for testing already created user
+ * creation. It creates a user named "tempUser" with password "TempPassword"
+ * and e-mail "tempUser(a)redhat.com". Then it tries to look up the user with
+ * search function. After success it tries to create the same user again and
+ * asserts that it is not possible. At the end, it deletes the temp user.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateUser" }, description = "Creation of already existing user.")
public void testCreateExistingUser() {
@@ -157,9 +154,9 @@
}
/**
- * Test create role is responsible for user creation.
- * It creates a role named "tempRole" with display name "tempRoleDisplay".
- * At the end, it deletes the temp user.
+ * Test create role is responsible for user creation. It creates a role
+ * named "tempRole" with display name "tempRoleDisplay". At the end, it
+ * deletes the temp user.
*/
@Test(enabled = true, description = "Creation of new role.")
public void testCreateRole() {
@@ -169,9 +166,9 @@
}
/**
- * Test delete user is responsible for deleting a user.
- * At first it creates user "deleteMe" with password "deleterPass" and e-mail "disableMe(a)redhat.com"
- * At the end it deletes the user.
+ * Test delete user is responsible for deleting a user. At first it creates
+ * user "deleteMe" with password "deleterPass" and e-mail
+ * "disableMe(a)redhat.com" At the end it deletes the user.
*/
@Test(enabled = true, description = "Creating and deteling a user.")
public void testDeleteUser() {
@@ -180,11 +177,13 @@
}
/**
- * Test disable user is responsible for disabling a user.
- * At first it creates user "disableMe" with password "disablePass" and e-mail "disableMe(a)redhat.com"
- * After that, it logs out and try to login as disableMe/disablePass.
- * After success it logs out again, and login as admin.
- * It disables the disableMe user and tries to login as disableMe/disablePass again asserting that login is not possible ( message about disabled account has to appear ).
+ * Test disable user is responsible for disabling a user. At first it
+ * creates user "disableMe" with password "disablePass" and e-mail
+ * "disableMe(a)redhat.com" After that, it logs out and try to login as
+ * disableMe/disablePass. After success it logs out again, and login as
+ * admin. It disables the disableMe user and tries to login as
+ * disableMe/disablePass again asserting that login is not possible (
+ * message about disabled account has to appear ).
*
*/
@Test(enabled = true, description = "Creating and disabling a user.")
@@ -224,7 +223,7 @@
selenium.type(INPUT_USERNAME, userName);
selenium.type(INPUT_PASSWORD, userPass);
selenium.fireEvent(INPUT_PASSWORD, "keydown");
-
+
selenium.click(SUBMIT_LOGIN);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Your account is disabled"), "Message telling that account is disabled is other then expected or missing.");
@@ -238,12 +237,14 @@
}
/**
- * Test enable user is responsible for enabling a user.
- * At first it creates user "enableMe" with password "enableMe" and e-mail "enableMe(a)redhat.com"
- * Then it disables the user, asserts the user is really disabled and at the end it enables the user.
- * Only the appereance (or non-appereance ) of the "Enable" button for the user is used for assertions.
+ * Test enable user is responsible for enabling a user. At first it creates
+ * user "enableMe" with password "enableMe" and e-mail "enableMe(a)redhat.com"
+ * Then it disables the user, asserts the user is really disabled and at the
+ * end it enables the user. Only the appereance (or non-appereance ) of the
+ * "Enable" button for the user is used for assertions.
*/
- //TODO better chcecking of the user status should be reconsidered (logging in)
+ // TODO better chcecking of the user status should be reconsidered (logging
+ // in)
@Test(enabled = true, dependsOnMethods = { "testDisableUser" }, description = "Enabling disabled user.")
public void testEnableUser() {
final String userName = "enableMe";
@@ -275,11 +276,12 @@
}
/**
- * Test edit user is responsible for user editing.
- * At first it creates user "editMe" with password "editPass" and e-mail "editMe(a)redhat.com".
- * Then it searches for the user and click on edit link. The e-mail of user is changed to "editMe2(a)redhat.com".
- * The user is searched again and assert for his e-mail is made at the end.
- * The user is deleted at the end of this test.
+ * Test edit user is responsible for user editing. At first it creates user
+ * "editMe" with password "editPass" and e-mail "editMe(a)redhat.com". Then it
+ * searches for the user and click on edit link. The e-mail of user is
+ * changed to "editMe2(a)redhat.com". The user is searched again and assert
+ * for his e-mail is made at the end. The user is deleted at the end of this
+ * test.
*/
@Test(enabled = true, description = "Editing a user.")
public void testEditUser() {
@@ -318,10 +320,12 @@
}
/**
- * Test edit user change password is responsible for testing the change of password for a user.
- * At first it creates user "changePass" with password "changePassPass" and e-mail "changePass(a)redhat.com".
- * Then the password change orm is filled, but canceled. The next step is submitting the password change to new value "changePass2".
- * At the end the test tries to login with the new password and then it deletes the "changePass" user.
+ * Test edit user change password is responsible for testing the change of
+ * password for a user. At first it creates user "changePass" with password
+ * "changePassPass" and e-mail "changePass(a)redhat.com". Then the password
+ * change orm is filled, but canceled. The next step is submitting the
+ * password change to new value "changePass2". At the end the test tries to
+ * login with the new password and then it deletes the "changePass" user.
*/
@Test(enabled = true, description = "Editing a user - changing of password.")
public void testEditUserChangePassword() {
@@ -383,12 +387,13 @@
}
/**
- * Test role members is responsible for role assignment.
- * At first it creates user "newRoleMember" with password "newRoleMember" and e-mail "newRoleMem(a)redhatqa.com".
- * Then it creates role with name "membersRole" and display name "membersRoleDisplay".
- * At next step it assignes the role to the user.
- * It click for the "members" button for the "membersRole" and tries to find "newRoleMember".
- * At the end it deletes the "newRoleMember" user and "membersRole" role.
+ * Test role members is responsible for role assignment. At first it creates
+ * user "newRoleMember" with password "newRoleMember" and e-mail
+ * "newRoleMem(a)redhatqa.com". Then it creates role with name "membersRole"
+ * and display name "membersRoleDisplay". At next step it assignes the role
+ * to the user. It click for the "members" button for the "membersRole" and
+ * tries to find "newRoleMember". At the end it deletes the "newRoleMember"
+ * user and "membersRole" role.
*/
@Test(enabled = true, description = "Managing members of role.")
public void testRoleMembers() {
@@ -430,9 +435,10 @@
}
/**
- * Test role edit is responsible for testing of role editing.
- * At first it creates role with name "editRole" and display name "editRoleDisplay".
- * At the end it change the display name to "editedRoleDisplay" and delete the role.
+ * Test role edit is responsible for testing of role editing. At first it
+ * creates role with name "editRole" and display name "editRoleDisplay". At
+ * the end it change the display name to "editedRoleDisplay" and delete the
+ * role.
*/
@Test(enabled = true, description = "Creation of new role.")
public void testRoleEdit() {
@@ -487,43 +493,46 @@
}
/**
- * Xss testing of user creating dialog. XSS string is passed to user name input, the form is submitted and text indicating incorrect username input is asserted.
- * The page is realoaded and XSS string is passed to user e-mail input, the form is submitted and text indicating incorrect user e-mail input is asserted.
+ * Xss testing of user creating dialog. XSS string is passed to user name
+ * input, the form is submitted and text indicating incorrect username input
+ * is asserted. The page is realoaded and XSS string is passed to user
+ * e-mail input, the form is submitted and text indicating incorrect user
+ * e-mail input is asserted.
*/
- //TODO Q: password can be anystring?
- //TODO Q: what about serach input?
+ // TODO Q: password can be anystring?
+ // TODO Q: what about serach input?
@Test(enabled = true)
- public void testUserCreateXss() {
+ public void testUserCreateXss() {
openAndWait(ADR_PORTAL);
clickAndWait(LNK_ADMIN);
clickAndWait(LNK_MEMBERS);
clickAndWait(LNK_CREATE_USER);
-
+
selenium.type(INP_USERNAME, XSS_STR1);
clickAndWait(SUB_CREATE_USER);
-
+
Assert.assertTrue(selenium.isTextPresent("is an invalid username"));
-
+
openAndWait(ADR_PORTAL);
-
+
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_MEMBERS);
clickIfVisible(LNK_CREATE_USER);
-
+
selenium.type(INP_USERNAME, "user");
selenium.type(INP_USEREMAIL, XSS_STR1);
-
+
clickAndWait(SUB_CREATE_USER);
-
+
Assert.assertTrue(selenium.isTextPresent("Invalid E-Mail address."));
-
+
}
-
+
/**
*
- */
+ */
@Test(enabled = true)
- public void testRoleCreateXss() {
+ public void testRoleCreateXss() {
openAndWait(ADR_PORTAL);
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_ADMIN);
@@ -531,109 +540,150 @@
clickIfVisible(LNK_ROLETAB);
clickIfVisible(LNK_ROLEMAIN);
clickIfVisible(LNK_ROLE_CREATE);
-
+
selenium.type(INP_ROLENAME, XSS_STR1);
- selenium.type(INP_ROLEDISNAME,"diddi");
+ selenium.type(INP_ROLEDISNAME, "diddi");
clickAndWait(SUB_ROLE_CREATE);
-
+
Assert.assertTrue(selenium.isTextPresent("is an invalid role name"));
-
+
openAndWait(ADR_PORTAL);
-
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_ADMIN);
clickIfVisible(LNK_MEMBERS);
clickIfVisible(LNK_ROLETAB);
clickIfVisible(LNK_ROLEMAIN);
clickIfVisible(LNK_ROLE_CREATE);
-
+
selenium.type(INP_ROLENAME, "rolee");
selenium.type(INP_ROLEDISNAME, XSS_STR1);
-
+
clickAndWait(SUB_ROLE_CREATE);
-
- Assert.assertTrue(selenium.isTextPresent("is an invalid role display name"));
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role display name"));
+
}
-
+
/**
*
- */
- @Test(enabled = true, dependsOnMethods = {"testEditUser"})
- public void testEditUserXss() {
+ */
+ @Test(enabled = true)
+ public void testRoleEditXss() {
+ // EDIT ROLE
+
+ final String roleName = "editRole";
+ final String roleDisplayName = "editRoleDisplay";
+
+ openAndWait(ADR_PORTAL);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+ clickIfVisible(LNK_ROLE_CREATE);
+
+ createRole(roleName, roleDisplayName);
+
+ openAndWait(ADR_PORTAL);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+
+ int r = findTableRow(TBL_ROLELIST, roleName, 0);
+ selenium.click(MessageFormat.format(LNK_T_ROLLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_EDIT_ROLE_NAME, XSS_STR1);
+ selenium.click(SUB_EDIT_ROLE_SUBMIT);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role display name"));
+
+ deleteRole(roleName);
+ }
+
+ /**
+ *
+ */
+ @Test(enabled = true, dependsOnMethods = { "testEditUser" })
+ public void testEditUserXss() {
final String userName = "editXssMe";
final String userPass = "editXssPass";
final String userMail = "editXssMe(a)redhat.com";
createUser(userName, userPass, userMail);
goToEdit(userName, userMail);
-
+
testInput(INP_EDIT_USER_EMAIL, XSS_STR1, SUB_EDIT_PROF, "Invalid E-Mail address.");
-
- //firstname
+
+ // firstname
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:givenname')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //lastname
+ // lastname
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:familyname')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //location
+ // location
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:location')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //skype
+ // skype
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:skype')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //icq
+ // icq
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:icq')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //aim
+ // aim
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:aim')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //msn
+ // msn
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:msnm')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //yahoo
+ // yahoo
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:yim')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //xmmp
+ // xmmp
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:xmmp')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //homepage
+ // homepage
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:homepage')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //occup
+ // occup
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:occupation')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //hobby
+ // hobby
goToEdit(userName, userMail);
testInput("//input[contains(@id,'profile-form:interests')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //sign
+ // sign
goToEdit(userName, userMail);
testInput("//textarea[contains(@id,'profile-form:signature')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
- //extra
+ // extra
goToEdit(userName, userMail);
testInput("//textarea[contains(@id,'profile-form:extra')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
-
+
deleteUser(userName, userMail);
}
- private void goToEdit(String userName, String userMail){
+ private void goToEdit(String userName, String userMail) {
searchUser(userName, userMail);
int r = findTableRow(TBL_USERLIST, userName, 0);
selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
}
-
- private void testInput(String inpLoc, String inpStr, String subLoc, String mes){
+
+ private void testInput(String inpLoc, String inpStr, String subLoc, String mes) {
selenium.type(inpLoc, inpStr);
clickAndWait(subLoc);
Assert.assertTrue(selenium.isTextPresent(mes));
}
/**
- * Test search user count is responsible for the search functions for users..
- * The test creates 95 users named man0us - man94us.
- * Then it tests the paginator of the search functions. It sets count of results to 10,50 and 100,
- * traverse through paginator and check, whether the amount of returned results is correct.
+ * Test search user count is responsible for the search functions for
+ * users.. The test creates 95 users named man0us - man94us. Then it tests
+ * the paginator of the search functions. It sets count of results to 10,50
+ * and 100, traverse through paginator and check, whether the amount of
+ * returned results is correct.
*/
@Test(enabled = true, description = "Altering the number of rows in user search")
public void testSearchUserCount() {
@@ -655,12 +705,12 @@
selenium.click(INP_USER_SEARCH_PREV);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 50, "Wrong number of row in user table #2.");
-
+
searchSimple("man", "100");
selenium.waitForPageToLoad(PAGE_LOAD);
- //selenium.setSpeed("60000");
+ // selenium.setSpeed("60000");
Assert.assertEquals(countTableRows(TBL_USERLIST) - 1, 95, "Wrong number of row in user table #4.");
- //selenium.setSpeed("0");
+ // selenium.setSpeed("0");
/*
* for(int i=0; i< 95; i++){ deleteUser("man"+i+"us",
* "man"+i+"us"+"@redhatqa.com"); }
@@ -744,7 +794,7 @@
clickIfVisible(LNK_USERMAIN);
selenium.click(LNK_CREATE_USER);
waitFor(AJAX_LOAD);
- //selenium.waitForPageToLoad(PAGE_LOAD);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Username *"), "Label for username input is wrong or missing.");
selenium.type(INP_USERNAME, userName);
@@ -917,6 +967,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_ROLETAB);
+
clickIfVisible(LNK_ROLEMAIN);
Assert.assertTrue(selenium.isTextPresent(roleName), "Role name is missing");
@@ -949,10 +1000,10 @@
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.select(SEL_SEARCHUSER_LIMIT, "label=" + count);
- //waitFor(SEARCH_TIMEOUT);
+ // waitFor(SEARCH_TIMEOUT);
selenium.type(INP_SEARCH_USER, name);
selenium.click(SUB_SEARCH_USER);
-
+
waitFor(SEARCH_TIMEOUT);
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-06-05 15:17:37 UTC (rev 13438)
@@ -266,6 +266,13 @@
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
+
+ public void check(String locator, boolean d) {
+ waitForElement(locator);
+ if (selenium.isChecked(locator) != d) {
+ selenium.click(locator);
+ }
+ }
/**
* Asserts the text order on the page. The messages which order is to be determined are inputed in a comma separated way. i.e. "string1;string2;string3". The method
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/WSRPTestCase.java 2009-06-05 15:17:37 UTC (rev 13438)
@@ -8,45 +8,48 @@
import org.testng.annotations.Test;
/**
- * The Class WSRPTestCase is reponsible for testing the WSRP GUI of JBoss Portal.
+ * The Class WSRPTestCase is reponsible for testing the WSRP GUI of JBoss
+ * Portal.
*
* @author <a href="mailto:vrockai@redhat.com">Viliam Rockai</a>
*/
@Test(groups = { "cms_wsrp" }, enabled = true, description = "WSRP test case.")
public class WSRPTestCase extends JBossPortalSeleniumTestCase {
-
+
/** prefix for locator properties */
public static String casePfx = "test.wsrp.";
-
- private final String INP_CONSUMER_NAME = getLoc(casePfx+"inp.consumer.name","//input[contains(@id,'edit-cons-form:id')]");
- private final String SUB_REFRESH_CANCEL = getLoc(casePfx+"submit.refresh.cancel","//a[contains(@id,'edit-cons-form:list-cons-link')]");
- private final String SUB_PROD_SAVE = getLoc(casePfx+"submit.prod.save","//input[contains(@id,'producer-form:save-producer')]");
- private final String SUB_CONSDEL_CONF = getLoc(casePfx+"submit.consdel.conf","//a[contains(@id,'confirm-delete-form:destroy-link')]");
- private final String SUB_CONS_REGVAL = getLoc(casePfx+"submit.cons.regval","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String SUB_REFRESHFINAL = getLoc(casePfx+"submit.refreshfinal","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String INPUT_CONS_REGVALUE = getLoc(casePfx+"input.cons.regvalue","//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
- private final String SUBMIT_REFRESHSAVE = getLoc(casePfx+"submit.refreshsave","//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
- private final String INPUT_CONSWSDL = getLoc(casePfx+"input.conswsdl","//input[contains(@id,'edit-cons-form:wsdl')]");
- private final String INPUT_CACHEEXP = getLoc(casePfx+"input.cacheexp","//input[contains(@id,'edit-cons-form:cache')]");
- private final String SUBMIT_ADDPROP_INIT = getLoc(casePfx+"submit.addprop.init","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String SUBMIT_ADDPROP = getLoc(casePfx+"submit.addprop","//a[contains(@id,'producer-form:add-reg-prop')]");
- private final String INPUT_PROPHINT = getLoc(casePfx+"input.prophint","//input[contains(@id,'producer-form:reg-properties:0:hint')]");
- private final String INPUT_PROPLABEL = getLoc(casePfx+"input.proplabel","//input[contains(@id,'producer-form:reg-properties:0:label')]");
- private final String INPUT_PROPNAME = getLoc(casePfx+"input.propname","//input[contains(@id,'producer-form:reg-properties:0:name')]");
- private final String SUBMIT_CREATECONS = getLoc(casePfx+"submit.createcons","//input[contains(@id,'createConsumer:createConsumerButton')]");
- private final String INPUT_CREATECONS = getLoc(casePfx+"input.createcons","//input[contains(@id,'createConsumer:consumerName')]");
- private final String ID_LINK_PRODCONF = getLoc(casePfx+"id.link.prodconf","//a[contains(@id,'cons-temp-form:producer-link')]");
- private final String ID_LINK_CONSCONF = getLoc(casePfx+"id.link.consconf","//a[contains(@id,'producer-temp-form:consumersTab')]");
- private final String LINK_CONSUMER_HOME =getLoc(casePfx+"link.consumer.home","//a[contains(@id,'cons-temp-form1:list-cons-link')]");
- private final String LINK_T_CONS_CON=getLoc(casePfx+"link.t.cons.con","//a[contains(@id,''consumer-list-form:consumersList:{0}:configure'')]");
- private final String LINK_T_CONS_REF=getLoc(casePfx+"link.t.cons.ref","//a[contains(@id,''consumer-list-form:consumersList:{0}:refresh'')]");
- private final String LINK_T_CONS_ACT=getLoc(casePfx+"link.t.cons.act","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String LINK_T_CONS_DEA=getLoc(casePfx+"link.t.cons.dea","//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
- private final String LINK_T_CONS_REG=getLoc(casePfx+"link.t.cons.reg","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String LINK_T_CONS_DER=getLoc(casePfx+"link.t.cons.der","//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
- private final String LINK_T_CONS_DEL=getLoc(casePfx+"link.t.cons.del","//a[contains(@id,''consumer-list-form:consumersList:{0}:delete'')]");
- private final String WSRP_CONSUMER_TABLE = getLoc(casePfx+"link.wsrp.consumer.table","//table[contains(@id,':consumer-list-form:consumersList')]");
-
+
+ private final String INP_CONSUMER_NAME = getLoc(casePfx + "inp.consumer.name", "//input[contains(@id,'edit-cons-form:id')]");
+ private final String INP_PRODID = getLoc(casePfx + "inp.prodid", "//input[contains(@id,'edit-cons-form:id')]");
+ private final String SUB_REFRESH_CANCEL = getLoc(casePfx + "submit.refresh.cancel", "//a[contains(@id,'edit-cons-form:list-cons-link')]");
+ private final String SUB_PROD_SAVE = getLoc(casePfx + "submit.prod.save", "//input[contains(@id,'producer-form:save-producer')]");
+ private final String SUB_CONSDEL_CONF = getLoc(casePfx + "submit.consdel.conf", "//a[contains(@id,'confirm-delete-form:destroy-link')]");
+ private final String SUB_CONS_REGVAL = getLoc(casePfx + "submit.cons.regval", "//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String SUB_REFRESHFINAL = getLoc(casePfx + "submit.refreshfinal", "//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String INPUT_CONS_REGVALUE = getLoc(casePfx + "input.cons.regvalue",
+ "//input[contains(@id,'edit-cons-form:existingProps:0:prop-value-input')]");
+ private final String SUBMIT_REFRESHSAVE = getLoc(casePfx + "submit.refreshsave", "//input[contains(@id,'edit-cons-form:refresh-cons-link')]");
+ private final String INPUT_CONSWSDL = getLoc(casePfx + "input.conswsdl", "//input[contains(@id,'edit-cons-form:wsdl')]");
+ private final String INPUT_CACHEEXP = getLoc(casePfx + "input.cacheexp", "//input[contains(@id,'edit-cons-form:cache')]");
+ private final String SUBMIT_ADDPROP_INIT = getLoc(casePfx + "submit.addprop.init", "//a[contains(@id,'producer-form:add-reg-prop')]");
+ private final String SUBMIT_ADDPROP = getLoc(casePfx + "submit.addprop", "//a[contains(@id,'producer-form:add-reg-prop')]");
+ private final String INPUT_PROPHINT = getLoc(casePfx + "input.prophint", "//input[contains(@id,'producer-form:reg-properties:0:hint')]");
+ private final String INPUT_PROPLABEL = getLoc(casePfx + "input.proplabel", "//input[contains(@id,'producer-form:reg-properties:0:label')]");
+ private final String INPUT_PROPNAME = getLoc(casePfx + "input.propname", "//input[contains(@id,'producer-form:reg-properties:0:name')]");
+ private final String SUBMIT_CREATECONS = getLoc(casePfx + "submit.createcons", "//input[contains(@id,'createConsumer:createConsumerButton')]");
+ private final String INPUT_CREATECONS = getLoc(casePfx + "input.createcons", "//input[contains(@id,'createConsumer:consumerName')]");
+ private final String ID_LINK_PRODCONF = getLoc(casePfx + "id.link.prodconf", "//a[contains(@id,'cons-temp-form:producer-link')]");
+ private final String ID_LINK_CONSCONF = getLoc(casePfx + "id.link.consconf", "//a[contains(@id,'producer-temp-form:consumersTab')]");
+ private final String LINK_CONSUMER_HOME = getLoc(casePfx + "link.consumer.home", "//a[contains(@id,'cons-temp-form1:list-cons-link')]");
+ private final String LINK_T_CONS_CON = getLoc(casePfx + "link.t.cons.con", "//a[contains(@id,''consumer-list-form:consumersList:{0}:configure'')]");
+ private final String LINK_T_CONS_REF = getLoc(casePfx + "link.t.cons.ref", "//a[contains(@id,''consumer-list-form:consumersList:{0}:refresh'')]");
+ private final String LINK_T_CONS_ACT = getLoc(casePfx + "link.t.cons.act", "//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
+ private final String LINK_T_CONS_DEA = getLoc(casePfx + "link.t.cons.dea", "//a[contains(@id,''consumer-list-form:consumersList:{0}:activate'')]");
+ private final String LINK_T_CONS_REG = getLoc(casePfx + "link.t.cons.reg", "//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
+ private final String LINK_T_CONS_DER = getLoc(casePfx + "link.t.cons.der", "//a[contains(@id,''consumer-list-form:consumersList:{0}:register'')]");
+ private final String LINK_T_CONS_DEL = getLoc(casePfx + "link.t.cons.del", "//a[contains(@id,''consumer-list-form:consumersList:{0}:delete'')]");
+ private final String WSRP_CONSUMER_TABLE = getLoc(casePfx + "link.wsrp.consumer.table", "//table[contains(@id,':consumer-list-form:consumersList')]");
+
@BeforeMethod(groups = { "log" })
private void loginBeforeTest() {
logoutIfPossible();
@@ -55,31 +58,38 @@
@AfterMethod(groups = { "log" })
private void logoutAfterTest() {
- //logout();
+ // logout();
}
/**
- * Test create bea consume is responsible for creating BEA consumer named <b>BEA</b>. Navigate to WSRP gui and create consumer with these parameters:
- * <br/>
+ * Test create bea consume is responsible for creating BEA consumer named
+ * <b>BEA</b>. Navigate to WSRP gui and create consumer with these
+ * parameters: <br/>
* <table>
* <tr>
- * <td><b>Producer id:</b></td><td>BEA</td>
+ * <td><b>Producer id:</b></td>
+ * <td>BEA</td>
* </tr>
* <tr>
- * <td><b>Cache expiration:</b></td><td>600</td>
+ * <td><b>Cache expiration:</b></td>
+ * <td>600</td>
* </tr>
* <tr>
- * <td><b>Endpoint configuration:</b></td><td>http://wsrp.bea.com:7001/producer/producer?WSDL (using WSDL)</td>
+ * <td><b>Endpoint configuration:</b></td>
+ * <td>http://wsrp.bea.com:7001/producer/producer?WSDL (using WSDL)</td>
* </tr>
* <tr>
- * <td><b>Registration information:</b></td><td><code>{urn:bea:wlp:prop:reg:registration}consumerRole</code> : public</td>
+ * <td><b>Registration information:</b></td>
+ * <td><code>{urn:bea:wlp:prop:reg:registration}consumerRole</code> : public
+ * </td>
* </tr>
* </table>
- * <br/>
- * After clicking refresh&save button, the test checks for text message about successful refresh.
- * Then it check whether the BEA consumer is appearing in the main consumers table.
+ * <br/> After clicking refresh&save button, the test checks for text
+ * message about successful refresh. Then it check whether the BEA consumer
+ * is appearing in the main consumers table.
*/
- //TODO checking for the resulting consumer in table should be using selenium extension
+ // TODO checking for the resulting consumer in table should be using
+ // selenium extension
@Test(enabled = true, description = "Creating a standard BEA consumer.")
public void testCreateBeaConsumer() {
selenium.open("/portal/");
@@ -91,11 +101,11 @@
clickIfVisible(ID_LINK_CONSCONF);
selenium.type(INPUT_CREATECONS, "BEA");
-
+
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.type(INPUT_CACHEEXP, "600");
-
+
selenium.type(INPUT_CONSWSDL, "http://wsrp.bea.com:7001/producer/producer?WSDL");
selenium.click(SUBMIT_REFRESHSAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -112,9 +122,10 @@
}
/**
- * Test bea consumer register is reponsible for registering previously deregistered consumer <b>BEAreg</b>.
- * It finds the <b>BEAreg</b> consumer in the main consumer table and clicks on its register icon.
- * After that, it checks whether the register icon changed its text to "deregister"
+ * Test bea consumer register is reponsible for registering previously
+ * deregistered consumer <b>BEAreg</b>. It finds the <b>BEAreg</b> consumer
+ * in the main consumer table and clicks on its register icon. After that,
+ * it checks whether the register icon changed its text to "deregister"
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer", "testBeaConsumerDeregister" }, description = "Standard BEA consumer registering.")
public void testBeaConsumerRegister() {
@@ -127,8 +138,8 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0)-1 ;
- selenium.click(MessageFormat.format(LINK_T_CONS_REG,r));
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) - 1;
+ selenium.click(MessageFormat.format(LINK_T_CONS_REG, r));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUBMIT_REFRESHSAVE);
@@ -137,13 +148,15 @@
selenium.click(LINK_CONSUMER_HOME);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)), "Deregister");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER, r)), "Deregister");
}
/**
- * Test bea consumer deregister is responsible for deleting previously created BEA consumer.
- * It creates BEA consumer with name BEA and values similiar to that from testCreateBeaConsumer.
- * Then it clicks on deregister link for the consumer and checks whether deregister link has changed into register link.
+ * Test bea consumer deregister is responsible for deleting previously
+ * created BEA consumer. It creates BEA consumer with name BEA and values
+ * similiar to that from testCreateBeaConsumer. Then it clicks on deregister
+ * link for the consumer and checks whether deregister link has changed into
+ * register link.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" }, description = "Standard BEA consumer deregistering.")
public void testBeaConsumerDeregister() {
@@ -157,26 +170,28 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) -1;
- selenium.click(MessageFormat.format(LINK_T_CONS_DER,r));
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAreg", 0) - 1;
+
+ selenium.click(MessageFormat.format(LINK_T_CONS_DER, r));
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(SUB_REFRESH_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER,r)), "Register");
+ Assert.assertEquals(selenium.getText(MessageFormat.format(LINK_T_CONS_DER, r)), "Register");
}
/**
- * Test bea consumer activate is responsible for activating previously deactivated consumer.
- * It works with consumer named <b>BEAact</b> and checks whether the consumer has message showing it's inactive and refresh is needed.
- * Then it click on activate link and check that the message has disappeared.
+ * Test bea consumer activate is responsible for activating previously
+ * deactivated consumer. It works with consumer named <b>BEAact</b> and
+ * checks whether the consumer has message showing it's inactive and refresh
+ * is needed. Then it click on activate link and check that the message has
+ * disappeared.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer", "testBeaConsumerDeactivate" }, description = "Standard BEA consumer activating.")
public void testBeaConsumerActivate() {
selenium.open("/portal/");
-
+
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -184,21 +199,23 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0) - 1;
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
- selenium.click(MessageFormat.format(LINK_T_CONS_ACT,r));
+ selenium.click(MessageFormat.format(LINK_T_CONS_ACT, r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
}
/**
- * Test bea consumer deactivate is responsible for deactivating a bea consumer.
- * Firstly it creates bea consumer named <b>BEAact</b> with parameters similiar to that from testCreateBeaConsumer.
- * Then it asserts that message signalling the consumer non-active state is missing.
- * After clicking on deactivation link it assert, that the message signalling non-active state of consumer has appeared.
+ * Test bea consumer deactivate is responsible for deactivating a bea
+ * consumer. Firstly it creates bea consumer named <b>BEAact</b> with
+ * parameters similiar to that from testCreateBeaConsumer. Then it asserts
+ * that message signalling the consumer non-active state is missing. After
+ * clicking on deactivation link it assert, that the message signalling
+ * non-active state of consumer has appeared.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" }, description = "Standard BEA consumer deactivating.")
public void testBeaConsumerDeactivate() {
@@ -213,31 +230,33 @@
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0)-1;
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAact", 0) - 1;
+
Assert.assertFalse(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
- selenium.click(MessageFormat.format(LINK_T_CONS_DEA,r));
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEA, r));
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("BEAact (inactive) (refresh needed)"));
}
/**
- * Test bea consumer configure. Test is disabled - deleting of the method should be considered.
+ * Test bea consumer configure. Test is disabled - deleting of the method
+ * should be considered.
*/
- //TODO deleting of the method should be considered.
+ // TODO deleting of the method should be considered.
@Test(enabled = false, dependsOnMethods = { "testCreateBeaConsumer" }, description = "Standard BEA consumer configuring.")
public void testBeaConsumerConfigure() {
}
-
/**
* Test bea consumer delete is responsible for deleting a bea consumer.
- * Firstly it creates bea consumer named <b>BEAdel</b> with parameters similiar to that from testCreateBeaConsumer.
- * It click on the delete icon for the consumer and then it asserts the consumer has disappeared from the table.
+ * Firstly it creates bea consumer named <b>BEAdel</b> with parameters
+ * similiar to that from testCreateBeaConsumer. It click on the delete icon
+ * for the consumer and then it asserts the consumer has disappeared from
+ * the table.
*/
@Test(enabled = true, dependsOnMethods = { "testCreateBeaConsumer" }, description = "Standard BEA consumer deleting.")
public void testBeaConsumerDelete() {
@@ -253,16 +272,16 @@
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
Assert.assertTrue(selenium.isTextPresent("BEAdel"));
-
- Assert.assertTrue(selenium.isElementPresent(WSRP_CONSUMER_TABLE),"Consumer table not available.");
- int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0)-1;
- Assert.assertFalse(r < 0,"Consumer BEAdel not found");
- selenium.click(MessageFormat.format(LINK_T_CONS_DEL,r));
+ Assert.assertTrue(selenium.isElementPresent(WSRP_CONSUMER_TABLE), "Consumer table not available.");
+ int r = findTableRow(WSRP_CONSUMER_TABLE, "BEAdel", 0) - 1;
+ Assert.assertFalse(r < 0, "Consumer BEAdel not found");
+
+ selenium.click(MessageFormat.format(LINK_T_CONS_DEL, r));
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isTextPresent("Delete 'BEAdel' consumer?"));
-
+
clickAndWait(SUB_CONSDEL_CONF);
Assert.assertFalse(selenium.isTextPresent("BEAdel"));
@@ -273,17 +292,22 @@
* If fills up the registration properties with these values:
* <table>
* <tr>
- * <td><b>Name</b></td><td>testProp</td>
- * <td><b>Label</b></td><td>testProp label</td>
- * <td><b>Hint</b></td><td>tetsPropHint</td>
+ * <td><b>Name</b></td>
+ * <td>testProp</td>
+ * <td><b>Label</b></td>
+ * <td>testProp label</td>
+ * <td><b>Hint</b></td>
+ * <td>tetsPropHint</td>
* </tr>
* </table>
*
- * It saves the properties and checks they were saved.
- * <br/>
- * Missing: It doesn't test the function of cancel button and checkboxes in producer configuration.
+ * It saves the properties and checks they were saved. <br/> Missing: It
+ * doesn't test the function of cancel button and checkboxes in producer
+ * configuration.
*/
- //TODO the function of cancel button and checkboxes in producer configuration.
+ // TODO the function of cancel button and checkboxes in producer
+ // configuration.
+ // TODO registration policy properties tests missing
@Test(enabled = true, description = "Basic configuring of WSRP producer.")
public void testConfigureProducer() {
selenium.open("/portal/");
@@ -300,10 +324,10 @@
selenium.type(INPUT_PROPNAME, "testProp");
selenium.type(INPUT_PROPLABEL, "testProp label");
selenium.type(INPUT_PROPHINT, "tetsPropHint");
-
+
selenium.click(SUB_PROD_SAVE);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully saved!"));
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(ID_LINK_PRODCONF);
@@ -313,12 +337,14 @@
Assert.assertEquals("tetsPropHint", selenium.getValue(INPUT_PROPHINT));
}
-
+
/**
* Test configure consumer is responsible for configuring bea consumer.
- * Firstly it creates bea consumer named <b>renameMe</b> with parameters similiar to that from testCreateBeaConsumer.
- * Then it clicks on configure button for the consumer and rename it to <b>renameNewMe</b>.
- * At the end it asserts that the previous name is missing in the consumers table and the new name has appeared.
+ * Firstly it creates bea consumer named <b>renameMe</b> with parameters
+ * similiar to that from testCreateBeaConsumer. Then it clicks on configure
+ * button for the consumer and rename it to <b>renameNewMe</b>. At the end
+ * it asserts that the previous name is missing in the consumers table and
+ * the new name has appeared.
*/
@Test(enabled = true, description = "Renaming a consumer through the configure button.")
public void testConfigureConsumer() {
@@ -335,37 +361,160 @@
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
int r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
-
- Assert.assertTrue(r<0, "Not created consumer already in table");
-
+
+ Assert.assertTrue(r < 0, "Not created consumer already in table");
+
// create consumer to be renamed
createConsumer(name, "100", "http://wsrp.bea.com:7001/producer/producer?WSDL");
-
+
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
+
r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
- Assert.assertTrue(r>0, "Created consumer not found in table");
-
+ Assert.assertTrue(r > 0, "Created consumer not found in table");
+
// rename the consumer
- clickAndWait(MessageFormat.format(LINK_T_CONS_CON,r-1));
-
+ clickAndWait(MessageFormat.format(LINK_T_CONS_CON, r - 1));
+
selenium.type(INP_CONSUMER_NAME, nameNew);
- clickAndWait(SUBMIT_REFRESHSAVE);
-
+ clickAndWait(SUBMIT_REFRESHSAVE);
+
clickIfVisible(ID_LINK_CONSCONF);
clickIfVisible(LINK_CONSUMER_HOME);
-
+
waitForElement(WSRP_CONSUMER_TABLE);
r = findTableRow(WSRP_CONSUMER_TABLE, name, 0);
- Assert.assertTrue(r<0, "Renamed consumer still in table");
-
+ Assert.assertTrue(r < 0, "Renamed consumer still in table");
+
r = findTableRow(WSRP_CONSUMER_TABLE, nameNew, 0);
- Assert.assertTrue(r>0, "Renamed consumer not found in table");
+ Assert.assertTrue(r > 0, "Renamed consumer not found in table");
}
-
+
+ /*
+ *
+ */
+ @Test(enabled = true)
+ public void testXssConsumerManage() {
+ String beaName = "XssBeaConsumer";
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(LINK_CONSUMER_HOME);
+
+ selenium.type(INPUT_CREATECONS, XSS_STR1);
+ selenium.click(SUBMIT_CREATECONS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid Consumer name"));
+
+ selenium.type(INPUT_CREATECONS, beaName);
+
+ selenium.click(SUBMIT_CREATECONS);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.type(INPUT_CACHEEXP, "600");
+
+ selenium.type(INPUT_CONSWSDL, XSS_STR1);
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Require a well-formed URL"));
+
+ selenium.type(INPUT_CACHEEXP, XSS_STR1);
+ selenium.type(INPUT_CONSWSDL, "http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("must be a number between"));
+
+ selenium.type(INP_PRODID, XSS_STR1);
+ selenium.type(INPUT_CACHEEXP, "600");
+ selenium.type(INPUT_CONSWSDL, "http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid Consumer name"));
+
+ selenium.type(INP_PRODID, beaName);
+ selenium.type(INPUT_CACHEEXP, "600");
+ selenium.type(INPUT_CONSWSDL, "http://wsrp.bea.com:7001/producer/producer?WSDL");
+ selenium.click(SUBMIT_REFRESHSAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INPUT_CONS_REGVALUE, XSS_STR1);
+ selenium.click(SUB_CONS_REGVAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("An unexpected error occured"));
+ }
+
+ /*
+ *
+ */
+ @Test(enabled = true)
+ public void testXssProducerManage() {
+
+ goToProducers();
+ selenium.type("_WSRPConfigurationPortletWindow:j_id24:producer-form:registrationPolicy", XSS_STR1);
+ selenium.click(SUB_PROD_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("Couldn't find policy class"));
+
+ // goToProducers();
+ // selenium.type(
+ // "_WSRPConfigurationPortletWindow:j_id24:producer-form:validator"
+ // ,XSS_STR1);
+ // selenium.click(SUB_PROD_SAVE);
+ // selenium.waitForPageToLoad(PAGE_LOAD);
+ //Assert.assertTrue(selenium.isTextPresent("Couldn't find policy class")
+ // );
+
+ // properties
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_PRODCONF);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration"));
+ clickAndWait(SUBMIT_ADDPROP_INIT);
+
+ selenium.type(INPUT_PROPNAME, "testProp");
+ selenium.type(INPUT_PROPLABEL, "testProp label");
+ selenium.type(INPUT_PROPHINT, "tetsPropHint");
+
+ selenium.click(SUB_PROD_SAVE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration successfully saved!"));
+ clickIfVisible(ID_LINK_CONSCONF);
+ clickIfVisible(ID_LINK_PRODCONF);
+
+ Assert.assertEquals("testProp", selenium.getValue(INPUT_PROPNAME));
+ Assert.assertEquals("testProp label", selenium.getValue(INPUT_PROPLABEL));
+ Assert.assertEquals("tetsPropHint", selenium.getValue(INPUT_PROPHINT));
+ }
+
+ private void goToProducers() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=WSRP");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(ID_LINK_PRODCONF);
+ Assert.assertTrue(selenium.isTextPresent("Producer configuration"));
+ }
+
private void createConsumer(String name, String timeout, String address) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -377,7 +526,7 @@
selenium.type(INPUT_CREATECONS, name);
selenium.click(SUBMIT_CREATECONS);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
waitForElement(INPUT_CACHEEXP);
selenium.type(INPUT_CACHEEXP, timeout);
waitForElement(INPUT_CONSWSDL);
@@ -388,7 +537,7 @@
selenium.type(INPUT_CONS_REGVALUE, "public");
selenium.click(SUB_CONS_REGVAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
selenium.click(SUB_REFRESHFINAL);
selenium.waitForPageToLoad(PAGE_LOAD);
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/locator.properties 2009-06-05 15:17:37 UTC (rev 13438)
@@ -68,8 +68,8 @@
iden.man.lnk.search.user=//a[contains(@id,'user-form:search-user-link')]
iden.man.lnk.usertab=//a[contains(@id,'role-temp-form:manage-users')]
iden.man.lnk.usermain=//a[contains(@id,'user-temp-form1:user-adm-link')]
-iden.man.lnk.roletab=//a[contains(@id,'user-temp-form:role-mgm-link')]
-iden.man.lnk.rolemain=//a[contains(@id, 'role-temp-form1:role-admin-link')]
+iden.man.lnk.roletab=//a[contains(@id,'role-mgm-link')]
+iden.man.lnk.rolemain=//a[contains(@id, 'role-adm-link')]
iden.man.lnk.usermang.main=//a[contains(@id,'user-temp-form1:assign-role-link')]
iden.man.lnk.usermang.main2=//a[contains(@id,'user-temp-form1:user-mgm-link')]
iden.man.lnk.create.user=//a[contains(@id,':user-form:create-user-link')]
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-06-05 04:01:09 UTC (rev 13437)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/AdminPortalTestCase.java 2009-06-05 15:17:37 UTC (rev 13438)
@@ -22,21 +22,21 @@
/** prefix for locator properties = portal.admin. */
public final String casePfx = "portal.admin.";
- private final String SUB_SEC_SUBMIT = getLoc(casePfx + "sub.sec.submit","//input[contains(@id,'common-edit-security-form:update')]");
- private final String SUB_SEC_CANCEL = getLoc(casePfx + "sub.sec.cancel","//input[contains(@id,'common-edit-security-form:cancel')]");
+ private final String SUB_SEC_SUBMIT = getLoc(casePfx + "sub.sec.submit", "//input[contains(@id,'common-edit-security-form:update')]");
+ private final String SUB_SEC_CANCEL = getLoc(casePfx + "sub.sec.cancel", "//input[contains(@id,'common-edit-security-form:cancel')]");
- private final String CHK_SEC_RUN_PR = getLoc(casePfx + "chk.sec.run.pr","//input[contains(@id,'common-edit-security-form:cars_2:3')]");
- private final String CHK_SEC_RUN_P = getLoc(casePfx + "chk.sec.run.p","//input[contains(@id,'common-edit-security-form:cars_2:2')]");
- private final String CHK_SEC_RUN_VR = getLoc(casePfx + "chk.sec.run.vr","//input[contains(@id,'common-edit-security-form:cars_2:1')]");
- private final String CHK_SEC_RUN_V = getLoc(casePfx + "chk.sec.run.v","//input[contains(@id,'common-edit-security-form:cars_2:0')]");
- private final String CHK_SEC_RU_PR = getLoc(casePfx + "chk.sec.ru.pr","//input[contains(@id,'common-edit-security-form:cars_1:3')]");
- private final String CHK_SEC_RU_P = getLoc(casePfx + "chk.sec.ru.p","//input[contains(@id,'common-edit-security-form:cars_1:2')]");
- private final String CHK_SEC_RU_VR = getLoc(casePfx + "chk.sec.ru.vr","//input[contains(@id,'common-edit-security-form:cars_1:1')]");
- private final String CHK_SEC_RU_V = getLoc(casePfx + "chk.sec.ru.v","//input[contains(@id,'common-edit-security-form:cars_1:0')]");
- private final String CHK_SEC_RA_PR = getLoc(casePfx + "chk.sec.ra.pr","//input[contains(@id,'common-edit-security-form:cars_0:3')]");
- private final String CHK_SEC_RA_P = getLoc(casePfx + "chk.sec.ra.p","//input[contains(@id,'common-edit-security-form:cars_0:2')]");
- private final String CHK_SEC_RA_VR = getLoc(casePfx + "chk.sec.ra.vr","//input[contains(@id,'common-edit-security-form:cars_0:1')]");
- private final String CHK_SEC_RA_V = getLoc(casePfx + "chk.sec.ra.v","//input[contains(@id,'common-edit-security-form:cars_0:0')]");
+ private final String CHK_SEC_RUN_PR = getLoc(casePfx + "chk.sec.run.pr", "//input[contains(@id,'common-edit-security-form:cars_2:3')]");
+ private final String CHK_SEC_RUN_P = getLoc(casePfx + "chk.sec.run.p", "//input[contains(@id,'common-edit-security-form:cars_2:2')]");
+ private final String CHK_SEC_RUN_VR = getLoc(casePfx + "chk.sec.run.vr", "//input[contains(@id,'common-edit-security-form:cars_2:1')]");
+ private final String CHK_SEC_RUN_V = getLoc(casePfx + "chk.sec.run.v", "//input[contains(@id,'common-edit-security-form:cars_2:0')]");
+ private final String CHK_SEC_RU_PR = getLoc(casePfx + "chk.sec.ru.pr", "//input[contains(@id,'common-edit-security-form:cars_1:3')]");
+ private final String CHK_SEC_RU_P = getLoc(casePfx + "chk.sec.ru.p", "//input[contains(@id,'common-edit-security-form:cars_1:2')]");
+ private final String CHK_SEC_RU_VR = getLoc(casePfx + "chk.sec.ru.vr", "//input[contains(@id,'common-edit-security-form:cars_1:1')]");
+ private final String CHK_SEC_RU_V = getLoc(casePfx + "chk.sec.ru.v", "//input[contains(@id,'common-edit-security-form:cars_1:0')]");
+ private final String CHK_SEC_RA_PR = getLoc(casePfx + "chk.sec.ra.pr", "//input[contains(@id,'common-edit-security-form:cars_0:3')]");
+ private final String CHK_SEC_RA_P = getLoc(casePfx + "chk.sec.ra.p", "//input[contains(@id,'common-edit-security-form:cars_0:2')]");
+ private final String CHK_SEC_RA_VR = getLoc(casePfx + "chk.sec.ra.vr", "//input[contains(@id,'common-edit-security-form:cars_0:1')]");
+ private final String CHK_SEC_RA_V = getLoc(casePfx + "chk.sec.ra.v", "//input[contains(@id,'common-edit-security-form:cars_0:0')]");
private final String MES_P1 = getMess(casePfx + "p1", "Who's online portlet");
private final String MES_P2 = getMess(casePfx + "p1", "CharsetPortletInstance");
@@ -70,7 +70,7 @@
private final String CHK_PPA_ACCESS_CHECK = getLoc(casePfx + "chk.ppa.access.check",
"//input[contains(@id,'common-edit-page-error-form:page-access-check')]");
private final String SUB_PP_ERROR_FORM_UPDATE = getLoc(casePfx + "sub.pp.error.form.update",
- "//input[contains(@id,'common-edit-portal-error-form:update')]");
+ "//input[contains(@id,'common-edit-portal-error-form:update')]");
private final String INP_PP_RES_INPUT = getLoc(casePfx + "inp.pp.res.input", "//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
private final String SEL_PP_NF_SELECT = getLoc(casePfx + "sel.pp.nf.select",
"//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
@@ -725,23 +725,27 @@
Assert.assertTrue(r < 0, "Renamed page was found with the old name.");
}
-
+
/**
- * Page security testing. New page "PageToSecure" is created in "TestPortal". The security page for the page is opened. It is asserted that all checkboxes are off by
- * default. All checkboxes are set to "checked" and cancel is clicked. The security page is loaded again and it is asserted that all checkboxes are off after cancel.
- * All checkboxes are then set to "checked" and update button is clicked. The security page is loaded again and it is asserted that all the checkboxes are in the
+ * Page security testing. New page "PageToSecure" is created in
+ * "TestPortal". The security page for the page is opened. It is asserted
+ * that all checkboxes are off by default. All checkboxes are set to
+ * "checked" and cancel is clicked. The security page is loaded again and it
+ * is asserted that all checkboxes are off after cancel. All checkboxes are
+ * then set to "checked" and update button is clicked. The security page is
+ * loaded again and it is asserted that all the checkboxes are in the
* "checked" state.
*/
@Test(enabled = true, dependsOnMethods = { "testPortalCreate", "testAddPage" }, description = "Tests page security")
public void testPageSecurity() {
-
+
String portalName = "TestPortal";
String pageName = "PageToSecure";
createPage(portalName, pageName);
- // cancel
-
+ // cancel
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -753,22 +757,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be checked");
-
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should not be checked");
+
selenium.click(CHK_SEC_RA_V);
selenium.click(CHK_SEC_RA_VR);
selenium.click(CHK_SEC_RA_P);
@@ -786,9 +790,9 @@
selenium.click(SUB_SEC_CANCEL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
+
// update
-
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -800,22 +804,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should not be checked");
- Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should not be checked");
-
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should not be checked");
+
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should not be checked");
+ Assert.assertFalse(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should not be checked");
+
selenium.click(CHK_SEC_RA_V);
selenium.click(CHK_SEC_RA_VR);
selenium.click(CHK_SEC_RA_P);
@@ -835,7 +839,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assert
-
+
clickIfVisible(TAB_PORTALOBJ_ID);
clickIfVisible(LINK_PORTALS_ID);
clickIfVisible(LINK_PORTAL_HOME);
@@ -847,22 +851,22 @@
r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
clickAndWait(MessageFormat.format(PAG_TL_SECURITY, r));
-
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_V), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_VR), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_P), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RA_PR), "Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P),"Checkbox should be checked");
- Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR),"Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_V), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_VR), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_P), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RU_PR), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_V), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_VR), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_P), "Checkbox should be checked");
+ Assert.assertTrue(selenium.isChecked(CHK_SEC_RUN_PR), "Checkbox should be checked");
+
}
/**
@@ -1066,6 +1070,140 @@
}
+ @Test(enabled = true)
+ public void testXssPortalCreate() {
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ selenium.type(INPUT_PORTALNAME, XSS_STR1);
+ selenium.click(INPUT_SUBMIT_CREATEPORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid portal name"));
+ }
+
+ @Test(enabled = true)
+ public void testXssPageCreate() {
+ final String portalName = "XssPortal";
+
+ createPortal(portalName);
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_PP_RES_INPUT, XSS_STR1);
+ selenium.click(SUB_PP_ERROR_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid page name"));
+
+ selenium.type(INP_PPA_RES_SELECT, XSS_STR1);
+ selenium.click(SUB_PPA_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid page name"));
+ }
+
+ @Test(enabled = true)
+ public void testXssWindowCreate() {
+ final String portalName = "XssPortal";
+ final String pageName = "XssPage";
+
+ createPortal(portalName);
+ createPage(portalName, pageName);
+
+ selenium.open("/portal/");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+ clickIfVisible(LINK_PORTAL_HOME);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+ selenium.click(MessageFormat.format(POR_TL_MAIN, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TABLE_PORTALPAGE_ADMIN, pageName, 0) - 1;
+
+ // click on the page layout
+ selenium.click(MessageFormat.format(PAG_TL_LAYOUT, r));
+
+ waitFor(AJAX_LOAD);
+
+ selenium.click("link=Who's online portlet");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.type(INP_WINDOW_NAME, XSS_STR1);
+
+ selenium.click(SUB_LAYOUT_ADD_CENTER);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid window name"));
+
+ }
+
+ @Test(enabled = true)
+ public void testXssPortalProperties() {
+ final String portalName = "XssPropertiesPortal";
+
+ createPortal(portalName);
+
+ // then property it
+
+ selenium.click("link=Admin");
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ clickIfVisible(TAB_PORTALOBJ_ID);
+ clickIfVisible(LINK_PORTALS_ID);
+
+ int r = findTableRow(TABLE_PORTAL_ADMIN, portalName, 0) - 1;
+
+ selenium.click(MessageFormat.format(POR_TL_PROPERTIES, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ // Properties
+
+ selenium.type(INP_PP_PROPNAME, XSS_STR1);
+ selenium.click(SUB_PP_PROPADD);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property name"));
+
+ // redirection
+
+ check(CHK_PP_RES_CHECK, false);
+ waitFor(AJAX_LOAD);
+ selenium.type(INP_PP_RES_INPUT, XSS_STR1);
+ selenium.click(SUB_PP_ERROR_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property path"));
+
+ check(CHK_PPA_RES_CHECK, false);
+ waitFor(AJAX_LOAD);
+ selenium.type(INP_PPA_RES_SELECT, XSS_STR1);
+ selenium.click(SUB_PPA_FORM_UPDATE);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("is an invalid property path"));
+
+ }
+
private void createPortal(String name) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
15 years
JBoss Portal SVN: r13436 - in modules: faces and 36 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-04 23:25:58 -0400 (Thu, 04 Jun 2009)
New Revision: 13436
Added:
modules/faces/
modules/faces/trunk/
modules/faces/trunk/build/
modules/faces/trunk/build/licences/
modules/faces/trunk/build/licences/JBossEULA.txt
modules/faces/trunk/build/misc/
modules/faces/trunk/build/misc/codeguide.html
modules/faces/trunk/build/pom.xml
modules/faces/trunk/faces/
modules/faces/trunk/faces/pom.xml
modules/faces/trunk/faces/src/
modules/faces/trunk/faces/src/main/
modules/faces/trunk/faces/src/main/java/
modules/faces/trunk/faces/src/main/java/org/
modules/faces/trunk/faces/src/main/java/org/jboss/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFInvocation.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFPortalContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFSecurityContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFServerContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFUserContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFWindowContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEvent.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEventEvent.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletHandler.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletListener.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRenderEvent.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestDecoder.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/UIPortlet.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerRenderer.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerTag.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/UIScroller.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/PropertyValue.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/BeanDecorator.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/PropertyDecorator.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicProperty.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicBean.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicProperty.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/facelet/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/facelet/ContextTagHandler.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/BeanContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/JSFBeanContext.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/ManagedBean.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesClassLoader.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesLoaderServlet.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesPortlet.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/ActionEventDispatcher.java
modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/JSFFunctor.java
modules/faces/trunk/faces/src/main/resources/
modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/
modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/META-INF/
modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml
modules/faces/trunk/faces/src/main/resources/portal-faces-war/
modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/
modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/faces-config.xml
modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/web.xml
modules/faces/trunk/faces/src/main/resources/portal-faces-war/index.jsp
modules/faces/trunk/faces/src/test/
modules/faces/trunk/faces/src/test/java/
modules/faces/trunk/faces/src/test/java/org/
modules/faces/trunk/faces/src/test/java/org/jboss/
modules/faces/trunk/faces/src/test/java/org/jboss/portal/
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/ManagedBeanTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/MessageFormatTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant1.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant2.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant3.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/SimpleDynamicBeanTestCase.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBean.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanDecorator.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterface.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanSuperClass.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestDynamicBean.java
modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/Value.java
modules/faces/trunk/faces/src/test/java/util/
modules/faces/trunk/faces/src/test/java/util/JSFFunctorTestCase.java
modules/faces/trunk/pom.xml
Log:
First import of faces module, extracted from Portal main code. Tests do not currently work.
Added: modules/faces/trunk/build/licences/JBossEULA.txt
===================================================================
--- modules/faces/trunk/build/licences/JBossEULA.txt (rev 0)
+++ modules/faces/trunk/build/licences/JBossEULA.txt 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,106 @@
+LICENSE AGREEMENT
+JBOSS(r)
+
+This License Agreement governs the use of the Software Packages and any updates to the Software
+Packages, regardless of the delivery mechanism. Each Software Package is a collective work
+under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to
+the user ("Client") a license to the applicable collective work(s) pursuant to the
+GNU Lesser General Public License v. 2.1 except for the following Software Packages:
+(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant to the
+GNU General Public License v.2;
+
+(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
+
+(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is licensed under the
+(open source) Sleepycat License (if Client does not wish to use the open source version of this database,
+it may purchase a license from Sleepycat Software);
+
+and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public License v.1,
+and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to enter various
+royalty-free patent licenses.
+
+Each of the foregoing licenses is available at http://www.opensource.org/licenses/index.php.
+
+1. The Software. "Software Packages" refer to the various software modules that are created and made available
+for distribution by the JBoss.org open source community at http://www.jboss.org. Each of the Software Packages
+may be comprised of hundreds of software components. The end user license agreement for each component is located in
+the component's source code. With the exception of certain image files identified in Section 2 below,
+the license terms for the components permit Client to copy, modify, and redistribute the component,
+in both source code and binary code forms. This agreement does not limit Client's rights under,
+or grant Client rights that supersede, the license terms of any particular component.
+
+2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others and are protected under copyright
+and other laws. Title to the Software Packages and any component, or to any copy, modification, or merged portion shall
+remain with the aforementioned, subject to the applicable license. The "JBoss" trademark, "Red Hat" trademark, the
+individual Software Package trademarks, and the "Shadowman" logo are registered trademarks of Red Hat and its affiliates
+in the U.S. and other countries. This agreement permits Client to distribute unmodified copies of the Software Packages
+using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the condition that Client follows Red Hat's
+trademark guidelines for those trademarks located at http://www.redhat.com/about/corporate/trademark/. Client must abide by
+these trademark guidelines when distributing the Software Packages, regardless of whether the Software Packages have been modified.
+If Client modifies the Software Packages, then Client must replace all Red Hat trademarks and logos identified at
+http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed or other permission granted.
+Merely deleting the files containing the Red Hat trademarks may corrupt the Software Packages.
+
+3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license for a particular
+component, to the maximum extent permitted under applicable law, the Software Packages and the
+components are provided and licensed "as is" without warranty of any kind, expressed or implied,
+including the implied warranties of merchantability, non-infringement or fitness for a particular purpose.
+Red Hat warrants that the media on which Software Packages may be furnished will be free from defects in
+materials and manufacture under normal use for a period of 30 days from the date of delivery to Client.
+Red Hat does not warrant that the functions contained in the Software Packages will meet Client's requirements
+or that the operation of the Software Packages will be entirely error free or appear precisely as described
+in the accompanying documentation. This warranty extends only to the party that purchases the Services
+pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
+
+4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, the remedies
+described below are accepted by Client as its only remedies. Red Hat's entire liability, and Client's
+exclusive remedies, shall be: If the Software media is defective, Client may return it within 30 days of
+delivery along with a copy of Client's payment receipt and Red Hat, at its option, will replace it or
+refund the money paid by Client for the Software. To the maximum extent permitted by applicable law,
+Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential
+damages, including lost profits or lost savings arising out of the use or inability to use the Software,
+even if Red Hat or such dealer has been advised of the possibility of such damages. In no event shall
+Red Hat's liability under this agreement exceed the amount that Client paid to Red Hat under this
+Agreement during the twelve months preceding the action.
+
+5. Export Control. As required by U.S. law, Client represents and warrants that it:
+(a) understands that the Software Packages are subject to export controls under the
+U.S. Commerce Department's Export Administration Regulations ("EAR");
+
+(b) is not located in a prohibited destination country under the EAR or U.S. sanctions regulations
+(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
+
+(c) will not export, re-export, or transfer the Software Packages to any prohibited destination, entity,
+or individual without the necessary export license(s) or authorizations(s) from the U.S. Government;
+
+(d) will not use or transfer the Software Packages for use in any sensitive nuclear, chemical or
+biological weapons, or missile technology end-uses unless authorized by the U.S. Government by
+regulation or specific license;
+
+(e) understands and agrees that if it is in the United States and exports or transfers the Software
+Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit semi-annual
+reports to the Commerce Department's Bureau of Industry & Security (BIS), which include the name and
+address (including country) of each transferee;
+
+and (f) understands that countries other than the United States may restrict the import, use, or
+export of encryption products and that it shall be solely responsible for compliance with any such
+import, use, or export restrictions.
+
+6. Third Party Programs. Red Hat may distribute third party software programs with the Software Packages
+that are not part of the Software Packages and which Client must install separately. These third party
+programs are subject to their own license terms. The license terms either accompany the programs or
+can be viewed at http://www.redhat.com/licenses/. If Client does not agree to abide by the applicable
+license terms for such programs, then Client may not install them. If Client wishes to install the programs
+on more than one system or transfer the programs to another party, then Client must contact the licensor
+of the programs.
+
+7. General. If any provision of this agreement is held to be unenforceable, that shall not affect the
+enforceability of the remaining provisions. This License Agreement shall be governed by the laws of the
+State of North Carolina and of the United States, without regard to any conflict of laws provisions,
+except that the United Nations Convention on the International Sale of Goods shall not apply.
+
+Copyright 2006 Red Hat, Inc. All rights reserved.
+"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
+All other trademarks are the property of their respective owners.
+
+ Page 1 of 1 18 October 2006
Added: modules/faces/trunk/build/misc/codeguide.html
===================================================================
--- modules/faces/trunk/build/misc/codeguide.html (rev 0)
+++ modules/faces/trunk/build/misc/codeguide.html 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,133 @@
+<html>
+
+<head>
+<style type="text/css">
+pre { border-style:solid; border-width:thin; padding:5px; background-color:#EEEEFF;}
+span.bad { text-decoration:line-through; }
+span.important { font-weight:bold; color:red; }
+</style>
+</head>
+
+<body>
+
+<h2>Coding Conventions</h2>
+
+<h3>Some more general guidelines</h3>
+<ul>
+<li>Fully qualified imports should be used, rather than importing x.y.*.</li>
+<li>Use newlines for opening braces, so that the top and bottom braces can be visually matched.</li>
+<li>Aid visual separation of logical steps by introducing newlines and appropriate comments above them.</li>
+</ul>
+
+
+<h3>A class that conforms to JBoss coding guidelines</h3>
+
+<pre>
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package x;
+
+// <span class="important">Explicit imports</span>
+import a.b.C1; // <span class="important">good</span>
+import a.b.C2;
+import a.b.C3;
+
+// <span class="important">Do not write</span>
+<span class="bad">import a.b.*;</span> // <span class="important">bad</span>
+
+// <span class="important">DO NOT USE "TAB" TO INDENT CODE USE *3* SPACES FOR PORTABILITY AMONG EDITORS</span>
+
+/**
+ * A description of this class.
+ *
+ * @see SomeRelatedClass.
+ *
+ * @version <tt>$Revision: 7755 $</tt>
+ * @author <a href="mailto:{email}">{full name}</a>
+ */
+public class X
+ extends Y
+ implements Z
+{
+ public void startService() throws Exception
+ {
+ // Use the newline for the opening bracket so we can match top
+ // and bottom bracket visually
+
+ Class cls = Class.forName(dataSourceClass);
+ vendorSource = (XADataSource)cls.newInstance();
+
+ // Jump a line between logically distinct <span class="important">steps</span> and add<
+ // line of comment to it
+ cls = vendorSource.getClass();
+
+ // Comment lines <span class="important">always</span> start with an uppercase
+ // except if it is the second line
+ if(properties != null)
+ {
+
+ try
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ for (Iterator i = props.entrySet().iterator(); i.hasNext();)
+ {
+
+ // Get the name and value for the attributes
+ Map.Entry entry = (Map.Entry) i.next();
+ String attributeName = (String) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+
+ // Print the debug message
+ log.debug("Setting attribute '" + attributeName + "' to '" + attributeValue + "'");
+
+ // get the attribute
+ Method setAttribute =
+ cls.getMethod("set" + attributeName, new Class[] { String.class });
+
+ // And set the value
+ setAttribute.invoke(vendorSource, new Object[] { attributeValue });
+ }
+ }
+
+ <span class="bad">// this is a <span class="important">bad</span> comment line because it starts with a lower case</span>
+ vendorSource.getXAConnection().close();
+
+ // Bind in JNDI
+ bind(new InitialContext(), "java:/"+getPoolName(),
+ new Reference(vendorSource.getClass().getName(),
+ getClass().getName(), null));
+
+ // Block must always be delimited explicitely
+ if (0 == 0)
+ <span class="important">{</span>
+ System.out.println(true);
+ <span class="important">}</span>
+
+ }
+}
+</pre>
+</body>
+</html>
Property changes on: modules/faces/trunk/build/misc/codeguide.html
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/build/pom.xml
===================================================================
--- modules/faces/trunk/build/pom.xml (rev 0)
+++ modules/faces/trunk/build/pom.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!--
+ This pom functions as a default configuration. The subproject
+ poms each inherit configuration from this one.
+
+ When adding version information for an artifact please do the following
+ - add a version property for the specific version
+ - add a dependency in the dependencyManagement section which refers to
+ the property
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-parent</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.faces</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Portal JSF Support Parent</name>
+ <description>JBoss Portal JSF Support</description>
+
+
+ <!--JBoss reporitories to be able to grab jboss-portal-parent pom-->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+
+ <!--Sample additional plugin repository. This one is not needed if you don't use maven-antrun-extended-plugin
+ (used in module-c)-->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>java.net maven repository</id>
+ <url>http://download.java.net/maven/2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+</project>
Added: modules/faces/trunk/faces/pom.xml
===================================================================
--- modules/faces/trunk/faces/pom.xml (rev 0)
+++ modules/faces/trunk/faces/pom.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,82 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.faces</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>faces</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal JSF Support</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.common</groupId>
+ <artifactId>common-common</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-portlet</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-bridge</artifactId>
+ <version>trunk-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_12</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.15.B1</version>
+ </dependency>
+ <dependency>
+ <groupId>apache-log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.15</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFInvocation.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFInvocation.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFInvocation.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,284 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
+import org.jboss.portal.common.text.CharBuffer;
+import org.jboss.portal.common.text.FastURLEncoder;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.ContainerURL;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.URLFormat;
+import org.jboss.portal.portlet.bridge.JBossServletContextProvider;
+import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
+import org.jboss.portal.portlet.impl.spi.AbstractRequestContext;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.spi.PortalContext;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.spi.RequestContext;
+import org.jboss.portal.portlet.spi.SecurityContext;
+import org.jboss.portal.portlet.spi.ServerContext;
+import org.jboss.portal.portlet.spi.UserContext;
+import org.jboss.portal.portlet.spi.WindowContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11167 $
+ */
+public class JSFInvocation
+{
+
+ /** . */
+ final HttpServletRequest clientRequest;
+
+ /** . */
+ final HttpServletResponse clientResponse;
+
+ /** . */
+ final FacesContext faces;
+
+ /** . */
+ final UIPortlet uiportlet;
+
+ /** . */
+ final PortalContext portalContext;
+
+ /** . */
+ final RequestContext requestContext;
+
+ /** . */
+ final SecurityContext securityContext;
+
+ /** . */
+ final UserContext userContext;
+
+ /** . */
+ final WindowContext windowContext;
+
+ /** . */
+ final ServerContext serverContext;
+
+ public JSFInvocation(FacesContext faces, UIPortlet uiportlet)
+ {
+ // Get request and response
+ JBossServletContextProvider.BridgeInfo info = JBossServletContextProvider.get();
+ PortletInvocation portletInvocation = info.getInvocation();
+ this.clientRequest = portletInvocation.getDispatchedRequest();
+ this.clientResponse = portletInvocation.getDispatchedResponse();
+ this.faces = faces;
+ this.uiportlet = uiportlet;
+
+ //
+ this.portalContext = new JSFPortalContext(faces, uiportlet);
+ this.requestContext = new AbstractRequestContext(clientRequest);
+ this.securityContext = new JSFSecurityContext(faces);
+ this.windowContext = new JSFWindowContext(faces);
+ this.serverContext = new JSFServerContext(this);
+ this.userContext = new JSFUserContext((JSFServerContext)serverContext, faces);
+ }
+
+ String renderURL(ContainerURL containerURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ ViewHandler vh = faces.getApplication().getViewHandler();
+ String viewId = faces.getViewRoot().getViewId();
+ String clientId = uiportlet.getClientId(faces);
+
+ String actionURL = vh.getActionURL(faces, viewId);
+ actionURL = faces.getExternalContext().encodeActionURL(actionURL);
+
+ CharBuffer url = new CharBuffer();
+ url.append(actionURL);
+
+ //
+ url.append("&").append(clientId).append("=jbp");
+
+ PortletRequestEncoder encoder = new PortletRequestEncoder();
+
+ if (containerURL instanceof ActionURL)
+ {
+ ActionURL actionURL2 = (ActionURL)containerURL;
+ encoder.encodeAction(null, actionURL2.getInteractionState(), actionURL2.getMode(), actionURL2.getWindowState());
+ }
+ else if (containerURL instanceof RenderURL)
+ {
+ RenderURL renderURL = (RenderURL)containerURL;
+ encoder.encodeRender(renderURL.getNavigationalState(), renderURL.getMode(), renderURL.getWindowState());
+ }
+
+ for (Iterator<Map.Entry<String, String[]>> i = encoder.getQueryParameters().entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>)i.next();
+ String name = FastURLEncoder.getUTF8Instance().encode((String)entry.getKey());
+ String[] values = (String[])entry.getValue();
+ for (int j = 0; j < values.length; j++)
+ {
+ String value = values[j];
+ url.append("&").append(name).append('=');
+ FastURLEncoder.getUTF8Instance().encode(value, url);
+ }
+ }
+
+ //
+ return url.asString();
+ }
+
+ public PortletInvocationResponse action(
+ Portlet portlet,
+ Mode mode,
+ WindowState windowState,
+ StateString interactionState) throws PortletInvokerException
+ {
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), this);
+
+ //
+ ActionInvocation action = new ActionInvocation(portletInvocationContext);
+ action.setInteractionState(interactionState);
+
+ if (mode != null)
+ {
+ action.setMode(mode);
+ }
+ else
+ {
+ action.setMode(Mode.VIEW);
+ }
+
+ if (windowState != null)
+ {
+ action.setWindowState(windowState);
+ }
+ else
+ {
+ action.setWindowState(WindowState.NORMAL);
+ }
+
+ //
+ return invoke(portlet, action);
+ }
+
+ public PortletInvocationResponse render(
+ Portlet portlet,
+ Mode mode,
+ WindowState windowState,
+ Map<String, String[]> navState) throws PortletInvokerException
+ {
+
+ PortletInvocationContext portletInvocationContext = new JSFPortletInvocationContext(clientRequest, clientResponse, new MarkupInfo(MediaType.TEXT_HTML, "UTF-8"), this);
+
+ //
+ PortletInvocation render = new RenderInvocation(portletInvocationContext);
+ render.setNavigationalState(ParametersStateString.create(navState));
+
+ if (mode != null)
+ {
+ render.setMode(mode);
+ }
+ else
+ {
+ render.setMode(Mode.VIEW);
+ }
+
+ if (windowState != null)
+ {
+ render.setWindowState(windowState);
+ }
+ else
+ {
+ render.setWindowState(WindowState.NORMAL);
+ }
+
+ //
+ return invoke(portlet, render);
+ }
+
+ private PortletInvocationResponse invoke(
+ Portlet portlet,
+ PortletInvocation invocation) throws PortletInvokerException
+ {
+ //
+ invocation.setPortalContext(portalContext);
+ invocation.setSecurityContext(securityContext);
+ invocation.setUserContext(userContext);
+ invocation.setServerContext(serverContext);
+ invocation.setWindowContext(windowContext);
+
+ //
+ invocation.setTarget(portlet.getContext());
+ PortletInvoker invoker = uiportlet.getPortletInvoker();
+ return invoker.invoke(invocation);
+ }
+
+ private static class JSFPortletInvocationContext extends AbstractPortletInvocationContext
+ {
+
+ private HttpServletRequest clientRequest;
+
+ private HttpServletResponse clientResponse;
+
+ private JSFInvocation invocation;
+
+ public JSFPortletInvocationContext(HttpServletRequest clientRequest, HttpServletResponse clientResponse, MarkupInfo markupInfo, JSFInvocation invocation)
+ {
+ super(markupInfo);
+
+ this.clientRequest = clientRequest;
+ this.clientResponse = clientResponse;
+ this.invocation = invocation;
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return clientResponse;
+ }
+
+ public String renderURL(ContainerURL containerURL, URLFormat urlFormat)
+ {
+ return invocation.renderURL(containerURL, urlFormat.getWantSecure(), urlFormat.getWantAuthenticated(), urlFormat.getWantRelative());
+ }
+ }
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFPortalContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFPortalContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFPortalContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,123 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.spi.PortalContext;
+
+import javax.faces.context.FacesContext;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class JSFPortalContext implements PortalContext
+{
+
+ /** . */
+ private static final Set defaultModes = Collections.unmodifiableSet(Tools.toSet(new Mode[]{Mode.VIEW, Mode.EDIT, Mode.HELP}));
+
+ /** . */
+ private static final Set defaultWindowStates = Collections.unmodifiableSet(Tools.toSet(new WindowState[]{WindowState.NORMAL, WindowState.MINIMIZED, WindowState.MAXIMIZED}));
+
+ /** . */
+ private final FacesContext faces;
+
+ /** . */
+ private final UIPortlet portlet;
+
+ /** . */
+ private Set modes;
+
+ /** . */
+ private Set windowStates;
+
+ public JSFPortalContext(FacesContext faces, UIPortlet portlet)
+ {
+ this.faces = faces;
+ this.portlet = portlet;
+ }
+
+ public String getInfo()
+ {
+ return "JSF/1.0";
+ }
+
+ public Set getWindowStates()
+ {
+ if (windowStates == null)
+ {
+ Set tmp = portlet.getSupportedWindowStates();
+ if (tmp != null)
+ {
+ windowStates = new HashSet(tmp.size());
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ String windowStateName = (String)i.next();
+ WindowState windowState = WindowState.create(windowStateName);
+ windowStates.add(windowState);
+ }
+ }
+ else
+ {
+ windowStates = defaultWindowStates;
+ }
+ }
+ return windowStates;
+ }
+
+ public Set getModes()
+ {
+ if (modes == null)
+ {
+ Set tmp = portlet.getSupportedModes();
+ if (tmp != null)
+ {
+ modes = new HashSet(tmp.size());
+ for (Iterator i = tmp.iterator(); i.hasNext();)
+ {
+ String modeName = (String)i.next();
+ Mode windowState = Mode.create(modeName);
+ modes.add(windowState);
+ }
+ }
+ else
+ {
+ modes = defaultModes;
+ }
+ }
+ return modes;
+ }
+
+ public Map getProperties()
+ {
+ return Collections.EMPTY_MAP;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFSecurityContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFSecurityContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFSecurityContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.portlet.spi.SecurityContext;
+
+import javax.faces.context.FacesContext;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class JSFSecurityContext implements SecurityContext
+{
+
+ /** . */
+ private final FacesContext faces;
+
+ public JSFSecurityContext(FacesContext faces)
+ {
+ this.faces = faces;
+ }
+
+ public boolean isSecure()
+ {
+ return false;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return faces.getExternalContext().getRemoteUser() != null;
+ }
+
+ public String getAuthType()
+ {
+ return faces.getExternalContext().getAuthType();
+ }
+
+ public String getRemoteUser()
+ {
+ return faces.getExternalContext().getRemoteUser();
+ }
+
+ public Principal getUserPrincipal()
+ {
+ return faces.getExternalContext().getUserPrincipal();
+ }
+
+ public boolean isUserInRole(String roleName)
+ {
+ return faces.getExternalContext().isUserInRole(roleName);
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFServerContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFServerContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFServerContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.impl.spi.AbstractServerContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 10090 $
+ */
+public class JSFServerContext extends AbstractServerContext
+{
+
+ /** . */
+ private final JSFInvocation invocation;
+
+ public JSFServerContext(JSFInvocation invocation)
+ {
+ super(invocation.clientRequest, invocation.clientResponse);
+
+ //
+ this.invocation = invocation;
+
+ //
+ /*
+ addResolver(PortletInvocation.INVOCATION_SCOPE, new MapAttributeResolver());
+ addResolver(PortletInvocation.REQUEST_SCOPE, new RequestAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.PRINCIPAL_SCOPE, new PrincipalAttributeResolver(invocation.clientRequest));
+ addResolver(PortletInvocation.REQUEST_PROPERTIES_SCOPE, EmptyAttributeResolver.getInstance());
+ addResolver(PortletInvocation.RESPONSE_PROPERTIES_SCOPE, new MapAttributeResolver());
+ */
+ }
+
+ public HttpServletRequest getClientRequest() throws IllegalStateException
+ {
+ return invocation.clientRequest;
+ }
+
+ public HttpServletResponse getClientResponse() throws IllegalStateException
+ {
+ return invocation.clientResponse;
+ }
+
+ public String renderURL(PortletURL portletURL, Boolean wantSecure, Boolean wantAuthenticated, boolean relative)
+ {
+ return invocation.renderURL(portletURL, wantSecure, wantAuthenticated, relative);
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFUserContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFUserContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFUserContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.jboss.portal.common.invocation.AttributeResolver;
+import org.jboss.portal.common.invocation.resolver.PrincipalAttributeResolver;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.portlet.spi.UserContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11166 $
+ */
+public class JSFUserContext implements UserContext
+{
+
+ /** . */
+ private final FacesContext faces;
+
+ private AttributeResolver principalAttributeResolver;
+
+ public JSFUserContext(JSFServerContext ctx, FacesContext faces)
+ {
+ this.faces = faces;
+ this.principalAttributeResolver = new PrincipalAttributeResolver(ctx.getClientRequest());
+ }
+
+ public String getId()
+ {
+ return null;
+ }
+
+ public Map<String, String> getInformations()
+ {
+ return null;
+ }
+
+ public Locale getLocale()
+ {
+ return faces.getExternalContext().getRequestLocale();
+ }
+
+ public List<Locale> getLocales()
+ {
+ return Tools.toList(faces.getExternalContext().getRequestLocales());
+ }
+
+ public Object getAttribute(String arg0)
+ {
+ return principalAttributeResolver.getAttribute(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1)
+ {
+ principalAttributeResolver.setAttribute(arg0, arg1);
+ }
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFWindowContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFWindowContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/JSFWindowContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.common.util.UUIDGenerator;
+import org.jboss.portal.portlet.spi.WindowContext;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class JSFWindowContext implements WindowContext
+{
+
+ /** . */
+ private static final UUIDGenerator generator = new UUIDGenerator();
+
+ /** . */
+ private final FacesContext faces;
+
+ /** . */
+ private String id;
+
+ public JSFWindowContext(FacesContext faces)
+ {
+ this.faces = faces;
+ this.id = generator.generateKey();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletActionEvent.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletActionEvent.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletActionEvent.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11068 $
+ */
+public class PortletActionEvent extends PortletEvent
+{
+
+ /** . */
+ private final Map<String, String[]> interactionState;
+
+ /** . */
+ private Mode mode;
+
+ /** . */
+ private WindowState windowState;
+
+ PortletActionEvent(UIComponent uiComponent, Map<String, String[]> interactionState, Mode mode, WindowState windowState)
+ {
+ super(uiComponent);
+
+ //
+ if (mode == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (windowState == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.interactionState = interactionState;
+ this.mode = mode;
+ this.windowState = windowState;
+ }
+
+ public Map<String, String[]> getParameterMap()
+ {
+ return interactionState;
+ }
+
+ public String getMode()
+ {
+ return mode.toString();
+ }
+
+ public void setMode(String mode)
+ {
+ if (mode == null)
+ {
+ throw new IllegalArgumentException("No mode provided");
+ }
+ this.mode = Mode.create(mode);
+ }
+
+ public String getWindowState()
+ {
+ return windowState.toString();
+ }
+
+ public void setWindowState(String windowState)
+ {
+ if (mode == null)
+ {
+ throw new IllegalArgumentException("No window state provided");
+ }
+ this.windowState = WindowState.create(windowState);
+ }
+
+ protected PortletInvocationResponse pir;
+
+ void execute(FacesContext faces)
+ {
+ UIPortlet uiportlet = (UIPortlet)getComponent();
+
+ // Get portlet
+ Portlet portlet = uiportlet.getPortlet();
+
+ //
+ JSFInvocation invocation = new JSFInvocation(faces, uiportlet);
+
+ //
+ try
+ {
+ pir = invocation.action(portlet, mode, windowState, ParametersStateString.create(interactionState));
+ if (pir instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse response = (UpdateNavigationalStateResponse)pir;
+
+ //
+ uiportlet.setInternalNavState(((ParametersStateString)response.getNavigationalState()).getParameters());
+
+ //
+ if (response.getWindowState() != null)
+ {
+ uiportlet.setInternalWindowState(response.getWindowState());
+ }
+
+ //
+ if (response.getMode() != null)
+ {
+ uiportlet.setInternalMode(response.getMode());
+ }
+
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEvent.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEvent.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEvent.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.FacesListener;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class PortletEvent extends ActionEvent
+{
+
+ public PortletEvent(UIComponent uiComponent)
+ {
+ super(uiComponent);
+ }
+
+ public boolean isAppropriateListener(FacesListener listener)
+ {
+ return listener instanceof PortletListener;
+ }
+
+ public void processListener(FacesListener listener)
+ {
+ ((PortletListener)listener).processEvent(this);
+ }
+
+ void execute(FacesContext faces)
+ {
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEventEvent.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEventEvent.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletEventEvent.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletEventEvent extends PortletEvent
+{
+ /** . */
+ private final ParameterMap interactionState;
+
+ /** . */
+ private UpdateNavigationalStateResponse.Event event;
+
+ public PortletEventEvent(UIComponent uiComponent, ParameterMap interactionState, UpdateNavigationalStateResponse.Event event)
+ {
+ // FIXME PortletEventEvent constructor
+ super(uiComponent);
+ this.event = event;
+ this.interactionState = interactionState;
+ }
+
+ public UpdateNavigationalStateResponse.Event getEvent()
+ {
+ return event;
+ }
+
+ public Map getParameterMap()
+ {
+ return interactionState;
+ }
+
+}
+
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletHandler.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletHandler.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletHandler.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,116 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRule;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.Metadata;
+import com.sun.facelets.tag.MetadataTarget;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentHandler;
+import org.jboss.portal.common.util.Tools;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 12190 $
+ */
+public class PortletHandler extends ComponentHandler
+{
+ public PortletHandler(ComponentConfig config)
+ {
+ super(config);
+ }
+
+
+ protected MetaRuleset createMetaRuleset(Class type)
+ {
+ MetaRuleset mr = super.createMetaRuleset(type);
+
+ //
+ mr.addRule(new MetaRule()
+ {
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta)
+ {
+ if ("supportedModes".equals(name))
+ {
+ if (attribute.isLiteral())
+ {
+ String s = attribute.getValue();
+ PropertyEditor editor = PropertyEditorManager.findEditor(String[].class);
+ editor.setAsText(s);
+ String[] values = (String[])editor.getValue();
+ final Set set = Tools.toSet(values);
+ return new Metadata()
+ {
+ public void applyMetadata(FaceletContext ctx, Object instance)
+ {
+ UIPortlet portlet = (UIPortlet)instance;
+ portlet.setSupportedModes(set);
+ }
+ };
+ }
+ }
+ if ("supportedWindowStates".equals(name))
+ {
+ if (attribute.isLiteral())
+ {
+ String s = attribute.getValue();
+ PropertyEditor editor = PropertyEditorManager.findEditor(String[].class);
+ editor.setAsText(s);
+ String[] values = (String[])editor.getValue();
+ final Set set = Tools.toSet(values);
+ return new Metadata()
+ {
+ public void applyMetadata(FaceletContext ctx, Object instance)
+ {
+ UIPortlet portlet = (UIPortlet)instance;
+ portlet.setSupportedWindowStates(set);
+ }
+ };
+ }
+ }
+ if ("onClick".equals(name))
+ {
+ final String s = attribute.getValue();
+ return new Metadata()
+ {
+ public void applyMetadata(FaceletContext ctx, Object instance)
+ {
+ UIPortlet portlet = (UIPortlet)instance;
+ portlet.setOnClick(s);
+ }
+ };
+ }
+ return null;
+ }
+ });
+
+ return mr;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletListener.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletListener.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletListener.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface PortletListener extends FacesListener
+{
+ void processEvent(PortletEvent event);
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRenderEvent.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRenderEvent.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRenderEvent.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,101 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11068 $
+ */
+public class PortletRenderEvent extends PortletEvent
+{
+
+ /** . */
+ private final Map<String, String[]> navState;
+
+ /** . */
+ private Mode mode;
+
+ /** . */
+ private WindowState windowState;
+
+ public PortletRenderEvent(UIComponent uiComponent, Map<String, String[]> navState, Mode mode, WindowState windowState)
+ {
+ super(uiComponent);
+
+ //
+ this.navState = navState;
+ this.mode = mode;
+ this.windowState = windowState;
+ }
+
+ public Map getParameterMap()
+ {
+ return navState;
+ }
+
+ public String getMode()
+ {
+ return mode != null ? mode.toString() : null;
+ }
+
+ public void setMode(String mode)
+ {
+ this.mode = mode != null ? Mode.create(mode) : null;
+ }
+
+ public String getWindowState()
+ {
+ return windowState != null ? windowState.toString() : null;
+ }
+
+ public void setWindowState(String windowState)
+ {
+ this.windowState = windowState != null ? WindowState.create(windowState) : null;
+ }
+
+ void execute(FacesContext faces)
+ {
+ UIPortlet uiportlet = (UIPortlet)getComponent();
+ uiportlet.setInternalNavState(navState);
+
+ //
+ if (windowState != null)
+ {
+
+ uiportlet.setInternalWindowState(windowState);
+ }
+
+ //
+ if (mode != null)
+ {
+ uiportlet.setInternalMode(mode);
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestDecoder.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestDecoder.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestDecoder.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,324 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.OpaqueStateString;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This class is a possible implementation for the behavior of a request made to a portlet. Which means that this
+ * implementation does not preclude other implementations.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6549 $
+ */
+public class PortletRequestDecoder
+{
+
+ /** The mask for action. */
+ public static final int ACTION_MASK = 0x00000001;
+
+ /** The mask for render. */
+ public static final int RENDER_MASK = 0x00000002;
+
+ /** The mask for mode. */
+ public static final int MODE_MASK = 0x00000004;
+
+ /** The mask for window state. */
+ public static final int WINDOW_STATE_MASK = 0x00000008;
+
+ /** The mask for opacity. */
+ public static final int OPAQUE_MASK = 0x00000010;
+
+ /** The name of the URL parameter containing the mode. */
+ public static final String MODE_PARAMETER = "mode";
+
+ /** The name of the URL parameter containing the window state. */
+ public static final String WINDOW_STATE_PARAMETER = "windowstate";
+
+ /** The name of the URL parameter containing the interaction state. */
+ public static final String INTERACTION_STATE_PARAMETER = "is";
+
+ /** The name of the URL parameter containing the navigational state. */
+ public static final String NAVIGATIONAL_STATE_PARAMETER = "ns";
+
+ /** The name of the URL parameter containing the meta information. */
+ public static final String META_PARAMETER = "action";
+
+ /** . */
+ public static final int ACTION_TYPE = 0;
+
+ /** . */
+ public static final int RENDER_TYPE = 1;
+
+ /** . */
+ public static final int NAV_TYPE = 2;
+
+ /** . */
+ private Mode mode;
+
+ /** . */
+ private WindowState windowState;
+
+ /** . */
+ private StateString navigationalstate;
+
+ /** . */
+ private StateString interactionState;
+
+ /** . */
+ private ParameterMap form;
+
+ /** . */
+ private int type;
+
+ public void decode(Map queryParams, Map bodyParams) throws IllegalArgumentException
+ {
+ // The meta info from the URL
+ int meta = 0;
+ String[] metaParam = (String[])queryParams.get(META_PARAMETER);
+ if (metaParam != null)
+ {
+ try
+ {
+ meta = Integer.parseInt(metaParam[0], 16);
+ }
+ catch (NumberFormatException ignore)
+ {
+ // If mask is not present then we assume that it can only be a navigation URL (NAV_TYPE)
+ }
+ }
+
+ //
+ if ((meta & (ACTION_MASK | RENDER_MASK)) != 0)
+ {
+ // Check validity
+ if ((meta & (ACTION_MASK | RENDER_MASK)) == (ACTION_MASK | RENDER_MASK))
+ {
+ throw new IllegalArgumentException("Cannot have both action and render in the mask at the same time");
+ }
+
+ //
+ if ((meta & ACTION_MASK) != 0)
+ {
+ type = ACTION_TYPE;
+ }
+ else
+ {
+ type = RENDER_TYPE;
+ }
+
+ // Get the mode from the parameters if it exists
+ if ((meta & MODE_MASK) != 0)
+ {
+ String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ if (modeParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ mode = Mode.create(modeParam[0]);
+ }
+ else
+ {
+ mode = null;
+ }
+
+ // Get the window state from the parameters if it exists
+ if ((meta & WINDOW_STATE_MASK) != 0)
+ {
+ String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ if (windowStateParam == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ windowState = WindowState.create(windowStateParam[0]);
+ }
+ else
+ {
+ windowState = null;
+ }
+
+ //
+ boolean opaque = (meta & OPAQUE_MASK) != 0;
+ if (!opaque)
+ {
+ // Compute the parameters skipping the portlet navigational state that may be encoded as well
+ ParametersStateString query = ParametersStateString.create();
+ for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ int index = 0;
+ String name = (String)entry.getKey();
+ String[] queryValues = (String[])entry.getValue();
+
+ //
+ if (META_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+ else if ((meta & MODE_MASK) != 0 && MODE_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+ else if ((meta & WINDOW_STATE_MASK) != 0 && WINDOW_STATE_PARAMETER.equals(name))
+ {
+ index = 1;
+ }
+
+ // We have interaction param(s) in the query string
+ if (index < queryValues.length)
+ {
+ String[] values = new String[queryValues.length - index];
+ System.arraycopy(queryValues, index, values, 0, values.length);
+ query.setValues(name, values);
+ }
+ }
+
+ // Julien :
+ ParameterMap form = new ParameterMap();
+ if (bodyParams != null)
+ {
+ form.putAll(bodyParams);
+ }
+
+ //
+ if (type == ACTION_TYPE)
+ {
+ this.navigationalstate = null;
+ this.interactionState = query;
+ this.form = form;
+ }
+ else
+ {
+ this.navigationalstate = query;
+ this.interactionState = null;
+ this.form = null;
+ }
+ }
+ else
+ {
+ // Decode the navigational state
+ String[] ns = (String[])queryParams.get(NAVIGATIONAL_STATE_PARAMETER);
+ if (ns != null)
+ {
+ navigationalstate = new OpaqueStateString(ns[0]);
+ }
+ else
+ {
+ navigationalstate = null;
+ }
+
+ // Decode more if we have an action
+ if (type == ACTION_TYPE)
+ {
+ // Decode the interaction state
+ String[] is = (String[])queryParams.get(INTERACTION_STATE_PARAMETER);
+ if (is != null)
+ {
+ interactionState = new OpaqueStateString(is[0]);
+ }
+ else
+ {
+ interactionState = null;
+ }
+
+ //
+ form = new ParameterMap();
+ if (bodyParams != null)
+ {
+ form.putAll(bodyParams);
+ }
+ }
+ else
+ {
+ interactionState = null;
+ form = null;
+ }
+ }
+ }
+ else
+ {
+ // Set to nav type
+ type = NAV_TYPE;
+
+ // Get the mode from the parameters if it exists
+ String[] modeParam = (String[])queryParams.get(MODE_PARAMETER);
+ if (modeParam != null)
+ {
+ mode = Mode.create(modeParam[0]);
+ }
+ else
+ {
+ mode = null;
+ }
+
+ // Get the window state from the parameters if it exists
+ String[] windowStateParam = (String[])queryParams.get(WINDOW_STATE_PARAMETER);
+ if (windowStateParam != null)
+ {
+ windowState = WindowState.create(windowStateParam[0]);
+ }
+ else
+ {
+ windowState = null;
+ }
+ }
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public WindowState getWindowState()
+ {
+ return windowState;
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalstate;
+ }
+
+ public StateString getInteractionState()
+ {
+ return interactionState;
+ }
+
+ public ParameterMap getForm()
+ {
+ return form;
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+}
Property changes on: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestDecoder.java
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/PortletRequestEncoder.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,200 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * This class is designed to provide the encoding in the query string of a URL of the following state : <ul> <li>A set
+ * of parameters</li> <li>A mode value</li> <li>A window state value</li> <li>A invocation type (action or render)</li>
+ * </ul>
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortletRequestEncoder
+{
+
+ /** . */
+ private ParameterMap queryParameters;
+
+ public PortletRequestEncoder(ParameterMap queryParameters)
+ {
+ if (queryParameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.queryParameters = queryParameters;
+ }
+
+ public PortletRequestEncoder()
+ {
+ this(new ParameterMap());
+ }
+
+ public void encodeAction(
+ StateString navigationalState,
+ StateString interactionState,
+ Mode mode,
+ WindowState windowState) throws IllegalArgumentException
+ {
+ queryParameters.clear();
+
+ //
+ int meta = PortletRequestDecoder.ACTION_MASK;
+
+ //
+ if (interactionState != null)
+ {
+ if (interactionState instanceof ParametersStateString)
+ {
+ // we don't need to encode the navigational state in the URL (stored in session)
+ // but we shouldn't throw an exception here because it's needed for template creation in WSRP
+ // so just discard it
+ navigationalState = null;
+
+ // Add the parameters
+ Map<String, String[]> parameters = ((ParametersStateString)interactionState).getParameters();
+ configure(parameters);
+ }
+ else
+ {
+ meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+ // Set interaction state
+ queryParameters.setValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
+
+ // We may have navigational state
+ if (navigationalState != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ }
+ }
+ }
+
+ //
+ configure(meta, mode, windowState);
+ }
+
+ public void encodeRender(
+ StateString navigationalState,
+ Mode mode,
+ WindowState windowState)
+ {
+ queryParameters.clear();
+
+ //
+ if (navigationalState != null)
+ {
+ int meta = PortletRequestDecoder.RENDER_MASK;
+
+ //
+ if (navigationalState instanceof ParametersStateString)
+ {
+ // Add the parameters
+ Map<String, String[]> parameters = ((ParametersStateString)navigationalState).getParameters();
+ configure(parameters);
+ }
+ else
+ {
+ meta |= PortletRequestDecoder.OPAQUE_MASK;
+
+ //
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ }
+
+ //
+ configure(meta, mode, windowState);
+ }
+ else
+ {
+ if (mode != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+ }
+
+ //
+ if (windowState != null)
+ {
+ queryParameters.setValue(PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+ }
+ }
+
+ public ParameterMap getQueryParameters()
+ {
+ return queryParameters;
+ }
+
+ private void configure(Map<String, String[]> parameters)
+ {
+ for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ queryParameters.setValues(name, values);
+ }
+ }
+
+ private void configure(int meta, Mode mode, WindowState windowState)
+ {
+ if (mode != null)
+ {
+ meta |= PortletRequestDecoder.MODE_MASK;
+ setMetaParameter(PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+ }
+ if (windowState != null)
+ {
+ meta |= PortletRequestDecoder.WINDOW_STATE_MASK;
+ setMetaParameter(PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+ }
+ setMetaParameter(PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
+ }
+
+ private void setMetaParameter(String name, String value)
+ {
+ String[] values = queryParameters.getValues(name);
+ if (values == null)
+ {
+ values = new String[]{value};
+ }
+ else
+ {
+ String[] tmp = new String[values.length + 1];
+ System.arraycopy(values, 0, tmp, 1, values.length);
+ tmp[0] = value;
+ values = tmp;
+ }
+ queryParameters.setValues(name, values);
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/UIPortlet.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/UIPortlet.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/portlet/UIPortlet.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,669 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.portlet;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UICommand;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.faces.util.ActionEventDispatcher;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvoker;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.invocation.response.FragmentResponse;
+import org.jboss.portal.portlet.invocation.response.InsufficientPrivilegesResponse;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
+import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 11168 $
+ * @todo: - add validation of initial mode and window state against the supported values - add validation of mode and
+ * window state on portlet events against the supported values - add handling of non expected results from render and
+ * process action - add handling when portlet does not exist (probably show the nested content of the tag as markup)
+ * @todo but less important: - integrate user profile - clean up the facelet portlet handler - make a JSP tag
+ * @todo later: - form rewriting so it can work in a JSF form
+ */
+public class UIPortlet extends UICommand
+{
+
+ /** . */
+ private final ActionEventDispatcher dispatcher = new ActionEventDispatcher(this);
+
+ /** The portlet invoker. */
+ private PortletInvoker portletInvoker;
+
+ /** The portlet id. */
+ private String portletId;
+
+ /** The event listener if not null. */
+ private MethodBinding portletListener;
+
+ /** The supported window states. */
+ private Set supportedWindowStates;
+
+ /** The supported modes. */
+ private Set supportedModes;
+
+ /** The initial window state value if not null, otherwise NORMAL is used. */
+ private String initialWindowState;
+
+ /** The initial mode value if not null, otherwise VIEW is used. */
+ private String initialMode;
+
+ /** . */
+ private String onClick;
+
+ /** The internal nav state. */
+ private Map<String, String[]> internalNavState;
+
+ /** The internal window state value. */
+ private WindowState internalWindowState;
+
+ /** The internal mode value. */
+ private Mode internalMode;
+
+ public PortletInvoker getPortletInvoker()
+ {
+ if (portletInvoker != null)
+ {
+ return portletInvoker;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("portletInvoker");
+ if (vb != null)
+ {
+ return (PortletInvoker)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setPortletInvoker(PortletInvoker portletInvoker)
+ {
+ this.portletInvoker = portletInvoker;
+ }
+
+ public String getPortletId()
+ {
+ if (portletId != null)
+ {
+ return portletId;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("portletId");
+ if (vb != null)
+ {
+ String id = (String)vb.getValue(getFacesContext());
+ if (id == null)
+ {
+ return null;
+ }
+ else
+ {
+ // getValue will return an empty string if the binding exists but is not bound
+ return "".equals(id) ? null : id;
+ }
+ }
+
+ //
+ return null;
+ }
+
+ public void setPortletId(String portletId)
+ {
+ this.portletId = portletId;
+ }
+
+ public Set getSupportedModes()
+ {
+ if (supportedModes != null)
+ {
+ return supportedModes;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("supportedModes");
+ if (vb != null)
+ {
+ return (Set)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setSupportedModes(Set supportedModes)
+ {
+ this.supportedModes = supportedModes;
+ }
+
+ public Set getSupportedWindowStates()
+ {
+ if (supportedWindowStates != null)
+ {
+ return supportedWindowStates;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("supportedWindowStates");
+ if (vb != null)
+ {
+ return (Set)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setSupportedWindowStates(Set supportedWindowStates)
+ {
+ this.supportedWindowStates = supportedWindowStates;
+ }
+
+ public String getInitialWindowState()
+ {
+ if (initialWindowState != null)
+ {
+ return initialWindowState;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("initialWindowState");
+ if (vb != null)
+ {
+ return (String)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setInitialWindowState(String initialWindowState)
+ {
+ this.initialWindowState = initialWindowState;
+ }
+
+ public String getInitialMode()
+ {
+ if (initialMode != null)
+ {
+ return initialMode;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("initialMode");
+ if (vb != null)
+ {
+ return (String)vb.getValue(getFacesContext());
+ }
+
+ //
+ return null;
+ }
+
+ public void setInitialMode(String initialMode)
+ {
+ this.initialMode = initialMode;
+ }
+
+ public String getOnClick()
+ {
+ if (onClick != null)
+ {
+ return onClick;
+ }
+
+ //
+ ValueBinding vb = getValueBinding("onClick");
+ if (vb != null)
+ {
+ onClick = (String)vb.getValue(getFacesContext());
+ return onClick;
+ }
+
+ //
+ return null;
+ }
+
+ public void setOnClick(String onClick)
+ {
+ this.onClick = onClick;
+ }
+
+ WindowState getInternalWindowState()
+ {
+ if (internalWindowState == null)
+ {
+ if (initialWindowState != null)
+ {
+ return WindowState.create(initialWindowState);
+ }
+ else
+ {
+ return WindowState.NORMAL;
+ }
+ }
+ else
+ {
+ return internalWindowState;
+ }
+ }
+
+ void setInternalWindowState(WindowState windowState)
+ {
+ this.internalWindowState = windowState;
+ }
+
+ Mode getInternalMode()
+ {
+ if (internalMode == null)
+ {
+ if (initialMode != null)
+ {
+ return Mode.create(initialMode);
+ }
+ else
+ {
+ return Mode.VIEW;
+ }
+ }
+ else
+ {
+ return internalMode;
+ }
+ }
+
+ void setInternalMode(Mode mode)
+ {
+ this.internalMode = mode;
+ }
+
+ void setInternalNavState(Map<String, String[]> navState)
+ {
+ ValueBinding vb = getValueBinding("renderParameters");
+ if (vb != null)
+ {
+ Map<String, String[]> renderParameters = (Map<String, String[]>)vb.getValue(getFacesContext());
+ renderParameters.clear();
+ renderParameters.putAll(navState);
+ }
+ else
+ {
+ this.internalNavState = navState;
+ }
+ }
+
+ Map<String, String[]> getInternalNavState()
+ {
+ ValueBinding vb = getValueBinding("renderParameters");
+ if (vb != null)
+ {
+ Map<String, String[]> renderParameters = (Map<String, String[]>)vb.getValue(getFacesContext());
+ return ParameterMap.wrap(renderParameters);
+ }
+ else
+ {
+ return internalNavState;
+ }
+ }
+
+ Portlet getPortlet()
+ {
+ String portletId = getPortletId();
+
+ //
+ if (portletId != null)
+ {
+ try
+ {
+ PortletInvoker portletInvoker = getPortletInvoker();
+ return portletInvoker.getPortlet(PortletContext.createPortletContext(portletId));
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ //
+ return null;
+ }
+
+ @Override
+ public String getFamily()
+ {
+ return "org.jboss.portal.core.Portlet";
+ }
+
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException
+ {
+ if (event instanceof PortletEvent)
+ {
+ PortletEvent pevent = (PortletEvent)event;
+
+ //
+ FacesContext faces = getFacesContext();
+
+ //
+ dispatcher.dispatch(faces, pevent);
+
+ //
+ pevent.execute(faces);
+
+ if (pevent instanceof PortletActionEvent)
+ {
+ PortletActionEvent actionEvent = (PortletActionEvent)pevent;
+ if (actionEvent.pir instanceof UpdateNavigationalStateResponse)
+ {
+ UpdateNavigationalStateResponse response = (UpdateNavigationalStateResponse)actionEvent.pir;
+
+ // This is a Hack
+ List<UpdateNavigationalStateResponse.Event> events = response.getEvents();
+ for (UpdateNavigationalStateResponse.Event tmpEvent: events)
+ {
+ queueEvent(new PortletEventEvent(this, ParameterMap.clone(actionEvent.getParameterMap()), tmpEvent));
+ }
+ }
+ }
+ }
+ else
+ {
+ super.broadcast(event);
+ }
+ }
+
+ @Override
+ public Object saveState(FacesContext faces)
+ {
+ String opaqueValue = null;
+ if (internalNavState != null)
+ {
+ opaqueValue = ParametersStateString.create(internalNavState).getStringValue();
+ }
+
+ //
+ Object values[] = new Object[11];
+ values[0] = super.saveState(faces);
+ values[1] = portletId;
+ values[2] = opaqueValue;
+ values[3] = saveAttachedState(faces, portletListener);
+ values[4] = supportedWindowStates;
+ values[5] = supportedModes;
+ values[6] = initialWindowState;
+ values[7] = initialMode;
+ values[8] = internalNavState;
+ values[9] = internalMode;
+ values[10] = onClick;
+ return values;
+ }
+
+ @Override
+ public void restoreState(FacesContext faces, Object state)
+ {
+ Object values[] = (Object[])state;
+ super.restoreState(faces, values[0]);
+ String serializedNavState = (String)values[2];
+
+ //
+ portletId = (String)values[1];
+// internalNavState = serializedNavState != null ? ParametersStateString.create(serializedNavState).getParameters() : null;
+ portletListener = (MethodBinding)restoreAttachedState(faces, values[3]);
+ supportedWindowStates = (Set)values[4];
+ supportedModes = (Set)values[5];
+ initialWindowState = (String)values[6];
+ initialMode = (String)values[7];
+ internalNavState = (ParameterMap)values[8];
+ internalMode = (Mode)values[9];
+ onClick = (String)values[10];
+ }
+
+ @Override
+ public void decode(FacesContext faces)
+ {
+ String clientId = getClientId(faces);
+ ExternalContext externalContext = faces.getExternalContext();
+ String clientIdValue = (String)externalContext.getRequestParameterMap().get(clientId);
+
+ // We have been targeted
+ if ("jbp".equals(clientIdValue))
+ {
+ @SuppressWarnings("unchecked")
+ Map<String, String[]> jsfParams = externalContext.getRequestParameterValuesMap();
+ Map<String, String[]> portletParams = new HashMap<String, String[]>();
+ for (Map.Entry<String, String[]> entry : jsfParams.entrySet())
+ {
+ String name = (String)entry.getKey();
+ if (clientId.equals(name))
+ {
+ // Skip the client id
+ }
+ else
+ {
+ String[] values = ((String[])entry.getValue()).clone();
+ portletParams.put(name, values);
+ }
+ }
+
+ faces.getExternalContext().getRequest();
+
+ // Decode the request
+ PortletRequestDecoder decoder = new PortletRequestDecoder();
+
+ decoder.decode(portletParams, null);
+ Mode mode = decoder.getMode();
+ WindowState windowState = decoder.getWindowState();
+
+ switch (decoder.getType())
+ {
+ case PortletRequestDecoder.RENDER_TYPE :
+
+ PortletRenderEvent prevent = new PortletRenderEvent(this, ((ParametersStateString) decoder
+ .getNavigationalState()).getParameters(), mode, windowState);
+ prevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(prevent);
+
+ break;
+ case PortletRequestDecoder.ACTION_TYPE :
+
+ if (mode == null)
+ {
+ mode = getInternalMode();
+ }
+ if (windowState == null)
+ {
+ windowState = getInternalWindowState();
+ }
+ PortletActionEvent paevent = new PortletActionEvent(this, ((ParametersStateString) decoder
+ .getInteractionState()).getParameters(), mode, windowState);
+ paevent.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ queueEvent(paevent);
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void encodeBegin(FacesContext faces) throws IOException
+ {
+ Portlet portlet = getPortlet();
+
+ //
+ if (portlet != null)
+ {
+ //
+ JSFInvocation invocation = new JSFInvocation(faces, this);
+
+ //
+ try
+ {
+ PortletInvocationResponse pir = invocation.render(
+ portlet,
+ getInternalMode(),
+ getInternalWindowState(),
+ getInternalNavState());
+
+ //
+ if (pir instanceof FragmentResponse)
+ {
+ FragmentResponse fragment = (FragmentResponse)pir;
+ ResponseWriter writer = faces.getResponseWriter();
+ writer.startElement("div", this);
+ writer.writeAttribute("id", "bilto", null);
+ writer.write(fragment.getContent());
+ writer.endElement("div");
+
+ writer.startElement("script", this);
+ writer.write(
+
+ "var isIE = /msie/i.test(navigator.userAgent);\n" +
+
+ "function attachEvent(elm, eventName, eventHandler) {\n" +
+ " if (isIE) {\n" +
+ " elm.attachEvent(\"on\" + eventName, eventHandler);\n" +
+ " } else {\n" +
+ " elm.addEventListener(eventName, eventHandler, false);\n" +
+ " }\n" +
+ "}\n" +
+
+ "function getEventTarget(event) {\n" +
+ " var targetElement = isIE ? event.srcElement : event.target;\n" +
+ " while (targetElement.nodeType == 3 && targetElement.parentNode != null) {\n" +
+ " targetElement = targetElement.parentNode;\n" +
+ " }\n" +
+ " return targetElement;\n" +
+ "}\n" +
+
+ "\n" +
+
+ "function PortletURL(url) {\n" +
+ " this.params = new Object();\n" +
+ " this.url = url;\n" +
+ " this.setParameter = function(name, value) {;\n" +
+ " this.params[name] = value;\n" +
+ " return this;\n" +
+ " }\n" +
+ " this.renderURL = function() {;\n" +
+ " var tmp = this.url;\n" +
+ " for (var i in this.params) {\n" +
+ " tmp = tmp + ('&' + i + '=' + this.params[i]);\n" +
+ " };\n" +
+ " return tmp;\n" +
+ " }\n" +
+
+ // Temporary hack for Sun RI which encodes contextual state on the page
+ " var viewStateId = document.getElementById('javax.faces.ViewState')\n" +
+ " if (viewStateId != null) {\n" +
+ " this.params['javax.faces.ViewState'] = viewStateId.value\n" +
+ " }\n" +
+
+ "}\n" +
+
+ "function fx(event) {\n" +
+ " var target = getEventTarget(event);\n" +
+ " if (target.nodeName == 'INPUT' && target.type == 'submit') {\n" +
+ " var current = target.parentNode;\n" +
+ " while (current.nodeName != 'FORM' && current.nodeName != 'BODY') {\n" +
+ " current = current.parentNode;\n" +
+ " }\n" +
+ " if (current.nodeName == 'FORM') {\n" +
+ " var action = current.action;\n" +
+ " var portletURL = new PortletURL(action);\n" +
+ " (function(url){" + onClick + "})(portletURL);\n" +
+ " current.action = portletURL.renderURL();\n" +
+ " } else {\n" +
+ " // Really can't do nothing for now\n" +
+ " }\n" +
+ " }\n" +
+ " else if (target.nodeName == 'A') {\n" +
+ " var href = target.href;\n" +
+ " var portletURL = new PortletURL(href);\n" +
+ " (function(url){" + onClick + "})(portletURL);\n" +
+ " target.href = portletURL.renderURL();\n" +
+ " }\n" +
+ " \n" +
+ "}\n" +
+
+ "var elt = document.getElementById('bilto');\n" +
+ "attachEvent(elt, 'click', fx);\n"
+ );
+ writer.endElement("script");
+ writer.flush();
+ }
+ else if (pir instanceof InsufficientPrivilegesResponse){
+ ResponseWriter writer = faces.getResponseWriter();
+ writer.startElement("div", this);
+ writer.write("<p class=\"portlet-msg-error\">You don't have the privileges to access this resource.</p>");
+ writer.endElement("div");
+ writer.flush();
+ }
+ }
+ catch (PortletInvokerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ System.out.println("Portlet not found: " + portletId);
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext facesContext) throws IOException
+ {
+ }
+
+ @Override
+ public void encodeEnd(FacesContext facesContext) throws IOException
+ {
+ }
+
+ @Override
+ public String getRendererType()
+ {
+ // Returns null as we handle rendering ourselves
+ return null;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerRenderer.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerRenderer.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerRenderer.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,248 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.scroller;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIForm;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.el.ValueBinding;
+import javax.faces.render.Renderer;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public class ScrollerRenderer extends Renderer
+{
+
+ private final String PREVIOUS = "Previous";
+ private final String NEXT = "Next";
+ private final String FIRST = "First";
+ private final String LAST = "Last";
+
+
+ public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException
+ {
+ // Get Attributes
+ String styleClass = (String)getAttribute(facesContext, component, "styleClass");
+ String datatableId = (String)getAttribute(facesContext, component, "for");
+
+ // Get Form Component
+ UIComponent formComponent = component;
+ while (!(formComponent instanceof UIForm))
+ {
+ formComponent = formComponent.getParent();
+ }
+ String formComponentId = formComponent.getClientId(facesContext);
+
+ // Get Writer
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ // Get UIData
+ String id = getId(datatableId, component.getClientId(facesContext));
+ UIData data = (UIData)findComponent(facesContext.getViewRoot(), facesContext, id);
+
+ int first = data.getFirst();
+ int rowCount = data.getRowCount();
+ int pageSize = data.getRows();
+ if (pageSize <= 0)
+ {
+ pageSize = rowCount;
+ }
+
+ int pages = rowCount / pageSize;
+ if (rowCount % pageSize != 0)
+ {
+ pages++;
+ }
+
+ int currentPage = first / pageSize;
+ if (first >= rowCount - pageSize)
+ {
+ currentPage = pages - 1;
+ }
+
+ int startPage = 0;
+ int endPage = pages;
+
+ if (currentPage > 0)
+ {
+ writeLink(writer, component, formComponentId, component.getClientId(facesContext), PREVIOUS, styleClass);
+ }
+ if (first < rowCount - pageSize)
+ {
+ writeLink(writer, component, formComponentId, component.getClientId(facesContext), NEXT, styleClass);
+ }
+
+ writeHiddenField(writer, component, component.getClientId(facesContext));
+ }
+
+ public void decode(FacesContext facesContext, UIComponent component)
+ {
+ String id = component.getClientId(facesContext);
+ Map parameters = facesContext.getExternalContext().getRequestParameterMap();
+ String response = (String)parameters.get(id);
+
+ String datatableId = (String)getAttribute(facesContext, component, "for");
+
+ // Get UIData
+ String dataId = getId(datatableId, component.getClientId(facesContext));
+ UIData data = (UIData)findComponent(facesContext.getViewRoot(), facesContext, dataId);
+
+ int first = data.getFirst();
+ int rowCount = data.getRowCount();
+ int pageSize = data.getRows();
+ if (pageSize <= 0)
+ {
+ pageSize = rowCount;
+ }
+
+ if (response.equals(PREVIOUS))
+ {
+ first -= pageSize;
+ }
+ else if (response.equals(NEXT))
+ {
+ first += pageSize;
+ }
+
+ if (first < 0)
+ {
+ first = 0;
+ }
+ data.setFirst(first);
+ }
+
+
+ private Object getAttribute(FacesContext facesContext, UIComponent component, String name)
+ {
+ ValueBinding vb = component.getValueBinding(name);
+ if (vb != null)
+ {
+ return vb.getValue(facesContext);
+ }
+ else
+ {
+ return component.getAttributes().get(name);
+ }
+ }
+
+ public String getId(String id, String base)
+ {
+ String separator = "" + NamingContainer.SEPARATOR_CHAR;
+ String[] idSplitted = id.split(separator);
+ String[] baseSplitted = base.split(separator);
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < (baseSplitted.length - idSplitted.length); i++)
+ {
+ buffer.append(baseSplitted[i]);
+ buffer.append(separator);
+ }
+ buffer.append(id);
+ return buffer.toString();
+ }
+
+ private UIComponent findComponent(UIComponent component, FacesContext facesContext, String id)
+ {
+ String componentId = component.getClientId(facesContext);
+ if (componentId.equals(id))
+ {
+ return component;
+ }
+ Iterator it = component.getChildren().iterator();
+ while (it.hasNext())
+ {
+ UIComponent comp = (UIComponent)it.next();
+ UIComponent found = findComponent(comp, facesContext, id);
+ if (found != null)
+ {
+ return found;
+ }
+
+ }
+ return null;
+ }
+
+ private void writeHiddenField(ResponseWriter writer, UIComponent component, String id) throws IOException
+ {
+ writer.startElement("input", component);
+ writer.writeAttribute("type", "hidden", null);
+ writer.writeAttribute("name", id, null);
+ writer.endElement("input");
+ }
+
+ private void writeLink(ResponseWriter writer, UIComponent component, String formComponentId, String id, String value, String styleClass) throws IOException
+ {
+ writer.writeText(" ", null);
+ writer.startElement("input", component);
+ writer.writeAttribute("value", value, null);
+ writer.writeAttribute("type", "submit", null);
+ writer.writeAttribute("onclick", onclickCode(formComponentId, id, value), null);
+ if (styleClass != null)
+ {
+ writer.writeAttribute("class", styleClass, "styleClass");
+ }
+ writer.endElement("input");
+
+ /*
+ writer.writeText(" ", null);
+ writer.startElement("a", component);
+ writer.writeAttribute("href", "#", null);
+ writer.writeAttribute("onclick", onclickCode(formComponentId, id, value), null);
+ if (styleClass != null)
+ {
+ writer.writeAttribute("class", styleClass, "styleClass");
+ }
+ writer.writeText(value, null);
+ writer.endElement("a");
+ */
+ }
+
+ private String onclickCode(String formComponentId, String id, String value)
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("document.forms[");
+ buffer.append("'");
+ buffer.append(formComponentId);
+ buffer.append("']");
+ buffer.append(".elements['");
+ buffer.append(id);
+ buffer.append("'].value='");
+ buffer.append(value);
+ buffer.append("';");
+ buffer.append(" document.forms[");
+ buffer.append("'");
+ buffer.append(formComponentId);
+ buffer.append("'");
+ buffer.append("].submit()");
+ buffer.append("; return false;");
+ return buffer.toString();
+ }
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerTag.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerTag.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/ScrollerTag.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.scroller;
+
+import javax.faces.application.Application;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.webapp.UIComponentTag;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public class ScrollerTag extends UIComponentTag
+{
+
+ private String _for;
+ private String styleClass;
+
+ public String getComponentType()
+ {
+ return "com.jboss.portal.Scroller";
+ }
+
+ public String getRendererType()
+ {
+ return "default";
+ }
+
+ public void setFor(String _for)
+ {
+ this._for = _for;
+ }
+
+ public void setStyleClass(String styleClass)
+ {
+ this.styleClass = styleClass;
+ }
+
+ public void setProperties(UIComponent component)
+ {
+ super.setProperties(component);
+ setString(component, "for", _for);
+ setString(component, "styleClass", styleClass);
+ }
+
+ private void setString(UIComponent component, String attributeName, String attributeValue)
+ {
+ if (attributeValue == null)
+ {
+ return;
+ }
+ if (isValueReference(attributeValue))
+ {
+ setValueBinding(component, attributeName, attributeValue);
+ }
+ else
+ {
+ component.getAttributes().put(attributeName, attributeValue);
+ }
+ }
+
+ private void setValueBinding(UIComponent component, String attributeName, String attributeValue)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ Application app = facesContext.getApplication();
+ ValueBinding vb = app.createValueBinding(attributeValue);
+ component.setValueBinding(attributeName, vb);
+ }
+
+ public void release()
+ {
+ super.release();
+ _for = null;
+ styleClass = null;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/UIScroller.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/UIScroller.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/component/scroller/UIScroller.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.component.scroller;
+
+import javax.faces.component.UIInput;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public class UIScroller extends UIInput
+{
+ public UIScroller()
+ {
+ setRendererType("default");
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/ClassConstantPublisherBean.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/ClassConstantPublisherBean.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/ClassConstantPublisherBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,149 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el;
+
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * An implementation of <code>DynamicBean</code> which exposes all the fields on a class which are public and static.
+ * The properties are read only and cannot be modified. It allows to use constant names from expression language rather
+ * than the constant values directly.
+ * <p/>
+ * <ul> <li>Class objects of type class or interface are supported.</li> <li>Class inheritence is supported, Class
+ * object returned from <code>Class.getSuperClass()</code> is examined.</li> <li>Interface implementation is not yet
+ * supported, Class objects returned from <code>Class.getInterfaces()</code> are not examined.</li> </ul>
+ * <p/>
+ * todo: implement and test interfaces returned by <code>Class.getInterfaces()</code>.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ClassConstantPublisherBean implements DynamicBean
+{
+
+ /** The class name. */
+ private String className;
+
+ /** The cached entries. */
+ private volatile Map entries;
+
+ private static Map getEntries(Class clazz)
+ {
+ Class superClazz = clazz.getSuperclass();
+ Map entries = clazz.getSuperclass() == null ? new HashMap() : getEntries(superClazz);
+
+ //
+ try
+ {
+ Field[] fields = clazz.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++)
+ {
+ Field field = fields[i];
+ final int modifiers = field.getModifiers();
+ if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers))
+ {
+ Object value = field.get(null);
+ entries.put(field.getName(), value);
+ }
+ }
+ }
+ catch (IllegalAccessException e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ return entries;
+ }
+
+ private Map getEntries()
+ {
+ if (entries == null)
+ {
+ try
+ {
+ Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
+ this.entries = getEntries(clazz);
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return entries;
+ }
+
+ public Class getType(Object propertyName) throws IllegalArgumentException
+ {
+ if ("className".equals(propertyName))
+ {
+ return String.class;
+ }
+
+ //
+ Map entries = getEntries();
+ Object value = entries.get(propertyName);
+ return value != null ? value.getClass() : null;
+ }
+
+ public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ {
+ if ("className".equals(propertyName))
+ {
+ return new PropertyValue(className);
+ }
+
+ //
+ Map entries = getEntries();
+ Object value = entries.get(propertyName);
+ return new PropertyValue(value);
+ }
+
+ public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
+ {
+ if ("className".equals(propertyName))
+ {
+ this.className = (String)value;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/DelegatingPropertyResolver.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,402 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.reflect.Modifier;
+import org.jboss.portal.faces.el.decorator.BeanDecorator;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.PropertyResolver;
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A property resolver that provide fine grained configuration of the resolution mechanism.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class DelegatingPropertyResolver extends PropertyResolver
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(DelegatingPropertyResolver.class);
+
+ /** . */
+ private final PropertyResolver delegate;
+
+ /** . */
+ private volatile Map decoratorMap = new HashMap();
+
+ public DelegatingPropertyResolver(PropertyResolver delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public DelegatingPropertyResolver()
+ {
+ this(null);
+ }
+
+ public Class getType(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamicBean = (DynamicBean)base;
+ Class type = dynamicBean.getType(property);
+ if (type != null)
+ {
+ return type;
+ }
+ }
+
+ //
+ GetTypeBeanAction beanAction = new GetTypeBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return beanAction.type;
+ }
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.getType();
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ return delegate.getType(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public boolean isReadOnly(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ //
+ if (delegate != null)
+ {
+ return delegate.isReadOnly(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public Object getValue(final Object base, final Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamicBean = (DynamicBean)base;
+ PropertyValue value = dynamicBean.getValue(property);
+ if (value != null)
+ {
+ return value.getObject();
+ }
+ }
+
+ //
+ GetValueBeanAction beanAction = new GetValueBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return beanAction.value.getObject();
+ }
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.get(base);
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to read the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ return delegate.getValue(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public void setValue(Object base, Object property, Object value) throws EvaluationException, PropertyNotFoundException
+ {
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamic = (DynamicBean)base;
+ if (dynamic.setValue(property, value))
+ {
+ return;
+ }
+ }
+
+ //
+ SetValueBeanAction beanAction = new SetValueBeanAction(base, property, value);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return;
+ }
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isWritableProperty(f))
+ {
+ f.set(base, value);
+ return;
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to write the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ delegate.setValue(base, property, value);
+ return;
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public Class getType(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ if (delegate != null)
+ {
+ return delegate.getType(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
+ }
+
+ public boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ //
+ if (delegate != null)
+ {
+ return delegate.isReadOnly(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
+ }
+
+ public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ //
+ if (delegate != null)
+ {
+ return delegate.getValue(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
+ }
+
+ public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException
+ {
+ //
+ if (delegate != null)
+ {
+ delegate.setValue(base, index, value);
+ }
+
+ //
+ throw createPNFE(base, index);
+ }
+
+ public final synchronized void registerDecorator(Class clazz, BeanDecorator decorator)
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (decorator == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Map copy = new HashMap(decoratorMap);
+ copy.put(clazz.getName(), decorator);
+ decoratorMap = copy;
+ log.debug("Added bean decorator " + clazz.getName() + " in resolver map");
+ }
+
+ private static interface BeanAction
+ {
+ boolean execute(BeanDecorator decorator);
+ }
+
+ private abstract static class AbstractBeanAction implements BeanAction
+ {
+
+ /** . */
+ protected final Object base;
+
+ /** . */
+ protected final Object property;
+
+ public AbstractBeanAction(Object base, Object property)
+ {
+ this.base = base;
+ this.property = property;
+ }
+ }
+
+ private static class GetTypeBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Class type;
+
+ public GetTypeBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ type = decorator.getType(base, property);
+ return type != null;
+ }
+ }
+
+ private static class GetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private PropertyValue value;
+
+ public GetValueBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ value = decorator.getValue(base, property);
+ return value != null;
+ }
+ }
+
+ private static class SetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Object value;
+
+ public SetValueBeanAction(Object base, Object property, Object value)
+ {
+ super(base, property);
+ this.value = value;
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ return decorator.setValue(base, property, value);
+ }
+ }
+
+ private boolean resolveAction(Class clazz, BeanAction action)
+ {
+ BeanDecorator decorator = (BeanDecorator)decoratorMap.get(clazz.getName());
+ if (decorator != null)
+ {
+ if (action.execute(decorator))
+ {
+ return true;
+ }
+ }
+ Class[] itfs = clazz.getInterfaces();
+ for (int i = 0; i < itfs.length; i++)
+ {
+ Class itf = clazz.getInterfaces()[i];
+ if (resolveAction(itf, action))
+ {
+ return true;
+ }
+ }
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null)
+ {
+ if (resolveAction(superClass, action))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private PropertyNotFoundException createPNFE(Object base, int index)
+ {
+ return createPNFE(base, "[" + index + "]");
+ }
+
+ private PropertyNotFoundException createPNFE(Object base, Object propertyName)
+ {
+ return new PropertyNotFoundException("Property " + propertyName + " on object " + base + " was not found");
+ }
+}
Property changes on: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/PropertyValue.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/PropertyValue.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/PropertyValue.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class PropertyValue
+{
+
+ /** . */
+ private final Object object;
+
+ public PropertyValue(Object object)
+ {
+ this.object = object;
+ }
+
+ public Object getObject()
+ {
+ return object;
+ }
+
+ public int hashCode()
+ {
+ return object == null ? 0 : object.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PropertyValue)
+ {
+ PropertyValue that = (PropertyValue)obj;
+ return object == null ? that.object == null : object.equals(that.object);
+ }
+ return false;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.decorator;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public abstract class AbstractBeanDecorator implements BeanDecorator
+{
+
+ public Class getType(Object bean, Object propertyName) throws IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.getType(bean);
+ }
+
+ //
+ return null;
+ }
+
+ public PropertyValue getValue(Object bean, Object propertyName) throws IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ return new PropertyValue(property.getValue(bean));
+ }
+
+ //
+ return null;
+ }
+
+ public boolean setValue(Object bean, Object propertyName, Object propertyValue) throws IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ property.setValue(bean, propertyValue);
+ return true;
+ }
+
+ //
+ return false;
+ }
+
+ protected abstract PropertyDecorator getProperty(Object propertyName);
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.decorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public abstract class AbstractPropertyDecorator implements PropertyDecorator
+{
+
+ /** . */
+ private final Class type;
+
+ public AbstractPropertyDecorator(Class type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.type = type;
+ }
+
+ public final Class getType(Object bean) throws IllegalArgumentException
+ {
+ return type;
+ }
+
+ public boolean setValue(Object bean, Object value) throws IllegalArgumentException
+ {
+ return false;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/BeanDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/BeanDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/BeanDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.decorator;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface BeanDecorator
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the bean is null or the property name is null
+ */
+ Class getType(Object bean, Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @return the property value
+ * @throws IllegalArgumentException if the bean is null or the property is null
+ */
+ PropertyValue getValue(Object bean, Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the bean is null or the property name is null
+ */
+ boolean setValue(Object bean, Object propertyName, Object value) throws IllegalArgumentException;
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/PropertyDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/PropertyDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/PropertyDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.decorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface PropertyDecorator
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param bean the decorated bean
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the bean is null
+ */
+ Class getType(Object bean) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @return the property value
+ * @throws IllegalArgumentException if the bean is null
+ */
+ Object getValue(Object bean) throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the bean is null
+ */
+ boolean setValue(Object bean, Object value) throws IllegalArgumentException;
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.decorator;
+
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class SimpleBeanDecorator extends AbstractBeanDecorator
+{
+
+ private Map properties;
+
+ public SimpleBeanDecorator()
+ {
+ properties = new ConcurrentHashMap();
+ }
+
+ protected PropertyDecorator getProperty(Object propertyName)
+ {
+ return (PropertyDecorator)properties.get(propertyName);
+ }
+
+ public void setProperty(Object propertyName, PropertyDecorator decorator)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (decorator == null)
+ {
+ properties.remove(propertyName);
+ }
+ else
+ {
+ properties.put(propertyName, decorator);
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * Base implementation.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class AbstractDynamicBean implements DynamicBean
+{
+
+ /** @return always null */
+ public Class getType(Object propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
+
+ /** @return always null */
+ public PropertyValue getValue(Object propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
+
+ /** @return always false */
+ public boolean setValue(Object propertyName, Object value)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return false;
+ }
+}
Property changes on: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicProperty.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicProperty.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/AbstractDynamicProperty.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.dynamic;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public abstract class AbstractDynamicProperty implements DynamicProperty
+{
+
+ /** . */
+ private Class type;
+
+ public AbstractDynamicProperty(Class type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.type = type;
+ }
+
+ public final Class getType() throws IllegalArgumentException
+ {
+ return type;
+ }
+
+ public boolean setValue(Object value) throws IllegalArgumentException
+ {
+ return false;
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicBean.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicBean.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * Defines an interface that an object can implement when that object wants to manage itself the resolution of its
+ * properties.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface DynamicBean
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param propertyName the property name
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the property name is null
+ */
+ Class getType(Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param propertyName the property name
+ * @return the property value
+ * @throws IllegalArgumentException if the property is null
+ */
+ PropertyValue getValue(Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param propertyName the property name
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the property name is null
+ */
+ boolean setValue(Object propertyName, Object value) throws IllegalArgumentException;
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicProperty.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicProperty.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/DynamicProperty.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.dynamic;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface DynamicProperty
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the property name is null
+ */
+ Class getType() throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the property is null
+ */
+ Object getValue() throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param value the new property value
+ * @throws IllegalArgumentException if the property name is null
+ */
+ boolean setValue(Object value) throws IllegalArgumentException;
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public abstract class SimpleDynamicBean implements DynamicBean
+{
+
+ public SimpleDynamicBean()
+ {
+ }
+
+ public Class getType(Object propertyName) throws IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.getType();
+ }
+ return null;
+ }
+
+ public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return new PropertyValue(property.getValue());
+ }
+ return null;
+ }
+
+ public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.setValue(value);
+ }
+ return false;
+ }
+
+ /**
+ * Return a dynamic property or null if not found.
+ *
+ * @param propertyName the property name
+ * @return a dynamic property
+ */
+ protected abstract DynamicProperty getProperty(Object propertyName);
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/facelet/ContextTagHandler.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/facelet/ContextTagHandler.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/facelet/ContextTagHandler.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.facelet;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.TagHandler;
+
+import javax.el.ELException;
+import javax.el.VariableMapper;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import java.io.IOException;
+
+/**
+ * Defines a context tag which allow to create use the ui:param tag without requiring to include content. It can be seen
+ * as an immediate ui:include facility which allow to define aliases for the nested content of the tag.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ContextTagHandler extends TagHandler
+{
+
+ public ContextTagHandler(TagConfig tagConfig)
+ {
+ super(tagConfig);
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException
+ {
+ VariableMapper orig = ctx.getVariableMapper();
+ try
+ {
+ this.nextHandler.apply(ctx, parent);
+ }
+ finally
+ {
+ ctx.setVariableMapper(orig);
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/BeanContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/BeanContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/BeanContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,287 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.faces.gui;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.util.ParameterValidation;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13374 $
+ * @since 2.6
+ */
+public abstract class BeanContext
+{
+ protected final static Logger log = Logger.getLogger(BeanContext.class);
+
+ public static final String STATUS = "status";
+ private static final String DEFAULT_RESOURCE_NAME = "Resource";
+ private static final String UNEXPECTED_ERROR = "bean_support_unexpected_error";
+ private static final String CAUSE = "bean_support_cause";
+ private static final String CURRENT_PLACEHOLDER = "###";
+
+ private String resourceName = DEFAULT_RESOURCE_NAME;
+
+ public void setResourceName(String resourceName)
+ {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceName()
+ {
+ return resourceName;
+ }
+
+ /**
+ * Retrieves the value of the parameter which name is given from the JSF request.
+ *
+ * @param key name of the parameter which value we want to retrieve
+ * @return
+ */
+ public abstract String getParameter(String key);
+
+ /**
+ * @param target
+ * @param message
+ * @param severity
+ */
+ protected abstract void createMessage(String target, String message, Object severity);
+
+ protected abstract Object getErrorSeverity();
+
+ protected abstract Object getInfoSeverity();
+
+ protected abstract Locale getLocale();
+
+ public void createErrorMessage(String localizedMessageId, Object... params)
+ {
+ createLocalizedMessage(STATUS, localizedMessageId, getErrorSeverity(), params);
+ }
+
+ public void createTargetedErrorMessage(String target, String localizedMessageId, Object... params)
+ {
+ createLocalizedMessage(target, localizedMessageId, getErrorSeverity(), params);
+ }
+
+ /**
+ * Adds a localized message using the appropriate severity to the identified target in the context. This method
+ * accepts an arbitrary number of arguments to be passed as parameters of localized strings.
+ *
+ * @param target the target in this context that will receive the new message
+ * @param localizedMessageId a resource bundle identifier identifying which the localized string to use as a message
+ * @param severity an object representing the severity of the message (typically FacesMessage.Severity)
+ * @param params additional parameters to be passed to replace tokens in localized strings
+ */
+ protected void createLocalizedMessage(String target, String localizedMessageId, Object severity, Object... params)
+ {
+ createMessage(target, getMessageFromBundle(localizedMessageId, params), severity);
+ }
+
+ public String getMessageFromBundle(String localizedMessageId, Object... params)
+ {
+ return getLocalizedMessage(localizedMessageId, getLocale(), resourceName, params);
+ }
+
+ public static String getLocalizedMessage(String localizationKey, Locale locale, Object... params)
+ {
+ return getLocalizedMessage(localizationKey, locale, DEFAULT_RESOURCE_NAME, params);
+ }
+
+ public static String getLocalizedMessage(String localizationKey, Locale locale, String resourceName, Object... params)
+ {
+ ResourceBundle rb = ResourceBundle.getBundle(resourceName, locale);
+
+ String message;
+ try
+ {
+ message = rb.getString(localizationKey);
+ }
+ catch (MissingResourceException e)
+ {
+ // if the key doesn't exist, return it instead of failing
+ log.info("Couldn't find localization message for key '" + localizationKey + "' in bundle " + resourceName
+ + " for locale " + locale.getDisplayName());
+ return localizationKey;
+ }
+
+ return MessageFormat.format(message, params);
+ }
+
+ public void createErrorMessageFrom(Exception e)
+ {
+ createErrorMessageFrom(STATUS, e);
+ }
+
+ /**
+ * Creates a localized error message targeting the specified object in the context and using the specified error
+ * information. This method looks for two specific resource bundle entries to localize the message, {@link
+ * #UNEXPECTED_ERROR} and {@link #CAUSE}, using the following format for the message: <code>result of {@link
+ * #getLocalizedMessageOrExceptionName(Throwable)} for the exception\n[localized value associated with {@link
+ * #CAUSE}result of {@link #getLocalizedMessageOrExceptionName(Throwable)} for the exception's cause if the cause
+ * exists]
+ *
+ * @param target the contextual object target by the message to be created
+ * @param e the exception that we want to display as an error message
+ */
+ public void createErrorMessageFrom(String target, Exception e)
+ {
+ Throwable cause = e.getCause();
+ String localizedMessage = getLocalizedMessageOrExceptionName(e);
+ String message = localizedMessage + (cause != null ? "\n" + getMessageFromBundle(CAUSE) + getLocalizedMessageOrExceptionName(cause) : "");
+ createMessage(target, message, getErrorSeverity());
+ }
+
+ /**
+ * Retrieves a localized message associated with the specified Throwable.
+ *
+ * @param e the Throwable for which a localized message is to be retrieved
+ * @return the localized message associated with the specified Throwable if it exists or the localized value
+ * associated with the {@link #UNEXPECTED_ERROR} resource bundle entry to which is appended the Throwable
+ * class name.
+ */
+ private String getLocalizedMessageOrExceptionName(Throwable e)
+ {
+ String localizedMessage = e.getLocalizedMessage();
+ if (localizedMessage == null)
+ {
+ localizedMessage = getMessageFromBundle(UNEXPECTED_ERROR) + e.getClass().getName();
+ }
+ return localizedMessage;
+ }
+
+ protected void createInfoMessage(String target, String localizedMessageId)
+ {
+ createLocalizedMessage(target, localizedMessageId, getInfoSeverity());
+ }
+
+ public void createInfoMessage(String localizedMessageId)
+ {
+ createInfoMessage(STATUS, localizedMessageId);
+ }
+
+ /**
+ * Removes the object identified by the specified name(s) from the session. For a JSF backed implementation, this
+ * will allow for the object/bean (defined as session-scoped in <code>faces-config.xml</code>) to be recreated by JSF
+ * when needed.
+ *
+ * @param name name of the object to be removed
+ * @param otherNames additional names of objects to be removed
+ */
+ public void removeFromSession(String name, String... otherNames)
+ {
+ Map<String, Object> sessionMap = getSessionMap();
+ sessionMap.remove(name);
+ if (otherNames != null)
+ {
+ for (String other : otherNames)
+ {
+ sessionMap.remove(other);
+ }
+ }
+ }
+
+ /**
+ * Retrieves the session map where "session" is a concept left up to implementations (for JSF, the session
+ * corresponds quite logically to the HTTP session)
+ *
+ * @return the session map
+ */
+ public abstract Map<String, Object> getSessionMap();
+
+ /**
+ * Replaces the session object identified by the given name by the specified new one. Passing <code>null</code> for
+ * the new value will remove the object reference from the session. If an object was previously assigned to this
+ * name, then only an object of the same type (as defined by {@link Class#isAssignableFrom(Class)}) can be assigned
+ * to this name.
+ *
+ * @param name the name identifying the object to be replaced
+ * @param newValue the new value for the object to be replaced or <code>null</code> if the object is to be removed
+ * @param <T> the type of the object to be replaced
+ * @return the new value for the object or <code>null</code> if the remove semantics is used
+ * @throws IllegalArgumentException if the new value for the identified object is not compatible with the currently
+ * stored value
+ */
+ public <T> T replaceInSession(String name, T newValue)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "replaceInSession");
+ Map<String, Object> sessionMap = getSessionMap();
+
+ // if we passed null, use the remove semantics
+ if (newValue == null)
+ {
+ sessionMap.remove(name);
+ return null;
+ }
+
+ getFromSession(name, newValue.getClass(), sessionMap, "Provided object: " + newValue
+ + " is not compatible with previously assigned '" + name + "' object: " + CURRENT_PLACEHOLDER);
+ sessionMap.put(name, newValue);
+ return newValue;
+ }
+
+ /**
+ * Retrieves the session object associated with the specified name and the expected type.
+ *
+ * @param name name of the session object to be retrieved
+ * @param expectedClass expected class of the object
+ * @param <T> type of the object to be retrieved
+ * @return the session object associated with the specified name
+ * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and does
+ * not match the specified expected class
+ */
+ public <T> T getFromSession(String name, Class<T> expectedClass)
+ {
+ return getFromSession(name, expectedClass, getSessionMap(), "Current object:" + CURRENT_PLACEHOLDER
+ + " is not compatible with expected class " + expectedClass + " for '" + name + "'");
+ }
+
+ /**
+ * @param name name of the session attribute to retrieve
+ * @param expectedClass expected class of the attribute
+ * @param sessionMap the session map to retrieve the attribute from
+ * @param errorMessage the error message that will be used if the attribute value is not of the expected class, in
+ * which {@link #CURRENT_PLACEHOLDER} will be substituted by the current value of the attribute
+ * at runtime
+ * @param <T> the type of the object to be retrieved
+ * @return the value associated with the specified name
+ * @throws IllegalArgumentException if the value associated with the specified name is not <code>null</code> and does
+ * not match the specified expected class
+ */
+ private <T> T getFromSession(String name, Class<T> expectedClass, Map<String, Object> sessionMap, String errorMessage)
+ {
+ Object result = sessionMap.get(name);
+ if (result != null && !expectedClass.isAssignableFrom(result.getClass()))
+ {
+ throw new IllegalArgumentException(errorMessage.replace(CURRENT_PLACEHOLDER, result.toString()));
+ }
+
+ return expectedClass.cast(result);
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/JSFBeanContext.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/JSFBeanContext.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.faces.gui;
+
+import org.jboss.portal.common.util.ParameterValidation;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13413 $
+ * @since 2.6
+ */
+public class JSFBeanContext extends BeanContext
+{
+ public String getParameter(String key)
+ {
+ return getParameter(key, FacesContext.getCurrentInstance());
+ }
+
+ public static String getParameter(String key, FacesContext facesContext)
+ {
+ Map pmap = facesContext.getExternalContext().getRequestParameterMap();
+ return (String)pmap.get(key);
+ }
+
+ public Map<String, Object> getSessionMap()
+ {
+ return JSFBeanContext.getSessionMap(FacesContext.getCurrentInstance());
+ }
+
+ public static Map<String, Object> getSessionMap(FacesContext facesContext)
+ {
+ return facesContext.getExternalContext().getSessionMap();
+ }
+
+ protected void createMessage(String target, String message, Object severity)
+ {
+ outputMessage(target, message, severity);
+ }
+
+ public static void outputMessage(String target, String message, Object severity)
+ {
+ if (ParameterValidation.isNullOrEmpty(target))
+ {
+ target = STATUS;
+ }
+
+ FacesMessage.Severity jsfSeverity;
+ if (severity instanceof FacesMessage.Severity)
+ {
+ jsfSeverity = (FacesMessage.Severity)severity;
+ }
+ else
+ {
+ jsfSeverity = FacesMessage.SEVERITY_ERROR;
+ }
+
+ // Get the component id from the target
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ UIComponent component = viewRoot.findComponent(target);
+ if (component != null)
+ {
+ target = component.getClientId(facesContext);
+ }
+ else
+ {
+ // todo: do something better here
+ log.info("Couldn't resolve component target: " + target);
+ }
+
+ FacesMessage msg = new FacesMessage(jsfSeverity, message, message);
+ facesContext.addMessage(target, msg);
+ }
+
+ public static void outputLocalizedMessage(String target, String localizationKey, Object severity, String resourceName, Object... params)
+ {
+ if(severity == null)
+ {
+ severity = FacesMessage.SEVERITY_ERROR;
+ }
+
+ outputMessage(target, getLocalizedMessage(localizationKey, getRequestLocale(), resourceName, params), severity);
+ }
+
+ protected Object getErrorSeverity()
+ {
+ return FacesMessage.SEVERITY_ERROR;
+ }
+
+ protected Object getInfoSeverity()
+ {
+ return FacesMessage.SEVERITY_INFO;
+ }
+
+ protected Locale getLocale()
+ {
+ return getRequestLocale();
+ }
+
+ public static Locale getRequestLocale()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/ManagedBean.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/ManagedBean.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/gui/ManagedBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,240 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.faces.gui;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.util.ParameterValidation;
+
+import java.util.regex.Pattern;
+
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13413 $
+ * @since 2.6
+ */
+public abstract class ManagedBean
+{
+ protected Logger log = Logger.getLogger(getClass());
+
+ protected BeanContext beanContext;
+ public static final String INVALID_NAME = "INVALID_NAME_ERROR";
+ public static final String INVALID_PATH = "INVALID_PATH_ERROR";
+ public static final String DUPLICATE = "DUPLICATE_ERROR";
+
+ public static interface PropertyValidator
+ {
+ boolean checkForDuplicates();
+
+ String getObjectTypeName();
+
+ boolean isAlreadyExisting(String propertyName);
+
+ String doSimpleChecks(String name);
+
+ ParameterValidation.ValidationErrorHandler getValidationErrorHandler(String name, String targetForErrorMessage);
+
+ Pattern getValidationPattern();
+ }
+
+ private PropertyValidator validator = new DefaultPropertyValidator();
+
+ protected void setValidator(PropertyValidator validator)
+ {
+ this.validator = validator;
+ }
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
+ public String checkNameValidity(String name, String targetForErrorMessage)
+ {
+ return checkNameValidity(name, targetForErrorMessage, validator);
+ }
+
+ public String checkNameValidity(String name, String targetForErrorMessage, PropertyValidator validator)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(validator, "PropertyValidator");
+
+ String objectTypeName = validator.getObjectTypeName();
+ if (ParameterValidation.isNullOrEmpty(name))
+ {
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, name, getLocalizedType(objectTypeName));
+ return null;
+ }
+ else
+ {
+ String original = name;
+ name = validator.doSimpleChecks(name);
+
+ // we got an invalid name after simple checks, fail!
+ if (name == null)
+ {
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, original, getLocalizedType(objectTypeName));
+ return null;
+ }
+
+ // Trim name
+ name = name.trim();
+
+ // "sanitize" name: if it's invalid, return null and output message
+ name = ParameterValidation.sanitizeFromPatternWithHandler(name, validator.getValidationPattern(),
+ validator.getValidationErrorHandler(name, targetForErrorMessage));
+
+ // we got an invalid name, fail!
+ if (name == null)
+ {
+ return null;
+ }
+
+ // Check for duplicate
+ if (validator.checkForDuplicates() && validator.isAlreadyExisting(name))
+ {
+ getDuplicateErrorMessage(name, targetForErrorMessage, objectTypeName);
+ return null;
+ }
+
+ return name;
+ }
+ }
+
+ protected void getDuplicateErrorMessage(String name, String targetForErrorMessage, String objectTypeName)
+ {
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, DUPLICATE, name, getLocalizedType(objectTypeName));
+ }
+
+ private String getLocalizedType(String objectTypeName)
+ {
+ return beanContext.getMessageFromBundle(objectTypeName);
+ }
+
+ protected abstract String getObjectTypeName();
+
+ public abstract boolean isAlreadyExisting(String objectName);
+
+ /**
+ * @param oldValue
+ * @param newValue
+ * @return
+ * @todo public for test cases
+ */
+ public boolean isOldAndNewDifferent(Object oldValue, Object newValue)
+ {
+ oldValue = normalizeStringIfNeeded(oldValue);
+ newValue = normalizeStringIfNeeded(newValue);
+
+ return (oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null);
+ }
+
+ /**
+ * Normalizes String by considering empty String as null as JSF would give either and trim non-null Strings.
+ *
+ * @param value
+ * @return
+ * @todo public for test cases
+ */
+ public Object normalizeStringIfNeeded(Object value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ else
+ {
+ if (value instanceof String)
+ {
+ String stringValue = (String)value;
+ return stringValue.length() == 0 ? null : stringValue.trim();
+ }
+ else
+ {
+ return value;
+ }
+ }
+ }
+
+ protected class MessageValidationHandler extends ParameterValidation.ValidationErrorHandler
+ {
+ private String targetForErrorMessage;
+ private String validatedName;
+ private String objectTypeName;
+ private String errorMessageKey;
+
+ public MessageValidationHandler(String defaultValue, String targetForErrorMessage, String validatedName, String objectTypeName)
+ {
+ this(defaultValue, targetForErrorMessage, validatedName, objectTypeName, INVALID_NAME);
+ }
+
+ public MessageValidationHandler(String defaultValue, String targetForErrorMessage, String validatedName, String objectTypeName, String errorMessageKey)
+ {
+ super(defaultValue);
+ this.targetForErrorMessage = targetForErrorMessage;
+ this.validatedName = validatedName;
+ this.objectTypeName = objectTypeName;
+ this.errorMessageKey = errorMessageKey;
+ }
+
+ protected String internalValidationErrorHandling(String s)
+ {
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, errorMessageKey, validatedName, getLocalizedType(objectTypeName));
+ return null;
+ }
+ }
+
+ protected class DefaultPropertyValidator implements PropertyValidator
+ {
+ public boolean checkForDuplicates()
+ {
+ return true;
+ }
+
+ public String getObjectTypeName()
+ {
+ return ManagedBean.this.getObjectTypeName();
+ }
+
+ public boolean isAlreadyExisting(String propertyName)
+ {
+ return ManagedBean.this.isAlreadyExisting(propertyName);
+ }
+
+ public String doSimpleChecks(String name)
+ {
+ // if name contains . or /, it's invalid for a Portal object
+ return (name.indexOf('.') != -1 || name.indexOf('/') != -1) ? null : name;
+ }
+
+ public ParameterValidation.ValidationErrorHandler getValidationErrorHandler(String name, String targetForErrorMessage)
+ {
+ return new MessageValidationHandler(null, targetForErrorMessage, name, getObjectTypeName());
+ }
+
+ public Pattern getValidationPattern()
+ {
+ return ParameterValidation.XSS_CHECK;
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesClassLoader.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesClassLoader.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesClassLoader.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import org.apache.log4j.Logger;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class FacesClassLoader extends URLClassLoader
+{
+
+ /** . */
+ private final Logger log = Logger.getLogger(FacesClassLoader.class);
+
+ public FacesClassLoader(URL[] urls, ClassLoader classLoader)
+ {
+ super(urls, classLoader);
+ }
+
+ private final Map cache = new HashMap();
+
+ protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException
+ {
+ if (name.startsWith("javax.faces") || name.startsWith("org.apache.myfaces"))
+ {
+ log.debug("Want to load " + name + " locally");
+ return locateClass(name);
+ }
+
+ //
+ try
+ {
+ log.debug("Want to load " + name + " will delegate");
+ return super.loadClass(name, resolve);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.debug("Not found in the parent will try to load " + name + " locally");
+ return locateClass(name);
+ }
+ }
+
+ private Class locateClass(String name) throws ClassNotFoundException
+ {
+ //
+ Class clazz = (Class)cache.get(name);
+
+ //
+ if (clazz == null)
+ {
+ clazz = findClass(name);
+ cache.put(name, clazz);
+ }
+
+ //
+ return clazz;
+ }
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesLoaderServlet.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesLoaderServlet.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesLoaderServlet.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,195 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import org.apache.log4j.Logger;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class FacesLoaderServlet extends HttpServlet
+{
+
+ /** . */
+ private final static Logger log = Logger.getLogger(FacesLoaderServlet.class);
+
+ /** . */
+ private final String servletContextListenerClassName = "org.apache.myfaces.webapp.StartupServletContextListener";
+
+ /** . */
+ private FacesClassLoader loader;
+
+ /** . */
+ private ServletContextListener listener;
+
+ /** . */
+ private Servlet servlet;
+
+ public void init() throws ServletException
+ {
+ try
+ {
+ ServletContext ctx = getServletConfig().getServletContext();
+
+ ArrayList tmp = new ArrayList();
+ File f = new File(ctx.getRealPath("/WEB-INF/lib2/"));
+ File[] libs = f.listFiles();
+ for (int i = 0; i < libs.length; i++)
+ {
+ File lib = libs[i];
+ URL libURL = lib.toURL();
+ log.debug("Added " + libURL + " to faces class loader");
+ tmp.add(libURL);
+ }
+ URL[] urls = (URL[])tmp.toArray(new URL[tmp.size()]);
+
+ //
+ loader = new FacesClassLoader(urls, Thread.currentThread().getContextClassLoader());
+ }
+ catch (Exception e)
+ {
+ throw new ServletException("Cannot find WEB-INF/lib2 directory to load libraries from", e);
+ }
+
+ //
+ if (loader != null)
+ {
+ getServletConfig().getServletContext().setAttribute("FACESCLASSLOADER", loader);
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+
+ //
+ try
+ {
+ // Perform myfaces bootstrap
+ initMyFaces();
+
+ //
+ initFacesServlet();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void destroy()
+ {
+ if (loader != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+
+ //
+ try
+ {
+ //
+ destroyFacesServlet();
+
+ //
+ destroyMyFaces();
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+
+ private void initFacesServlet()
+ {
+ try
+ {
+ Class facesServletClass = loader.loadClass("javax.faces.webapp.FacesServlet");
+ servlet = (Servlet)facesServletClass.newInstance();
+ servlet.init(getServletConfig());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void destroyFacesServlet()
+ {
+ if (servlet != null)
+ {
+ servlet.destroy();
+ }
+ }
+
+ private void initMyFaces()
+ {
+ try
+ {
+ Class bridgeClass = Thread.currentThread().getContextClassLoader().loadClass(servletContextListenerClassName);
+ log.debug("Obtain bridge bootstrap class " + bridgeClass.getName());
+ listener = (ServletContextListener)bridgeClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // It is not an error, this happens when we run with Sun RI
+ log.debug("Bridge bootstrap not available " + servletContextListenerClassName, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Bridge bootstrap not accessible " + servletContextListenerClassName, e);
+ }
+ catch (InstantiationException e)
+ {
+ log.error("Bridge bootstrap not instantiable " + servletContextListenerClassName, e);
+ }
+
+ //
+ if (listener != null)
+ {
+ log.debug("About to initialize the bridge bootstrap");
+ ServletContextEvent event = new ServletContextEvent(getServletConfig().getServletContext());
+ listener.contextInitialized(event);
+ }
+ }
+
+ private void destroyMyFaces()
+ {
+ if (listener != null)
+ {
+ log.debug("About to destroy the bridge bootstrap");
+ ServletContextEvent event = new ServletContextEvent(getServletConfig().getServletContext());
+ listener.contextDestroyed(event);
+ }
+ }
+
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesPortlet.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesPortlet.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/loader/FacesPortlet.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,118 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.loader;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class FacesPortlet implements Portlet
+{
+
+ /** . */
+ private Portlet portlet;
+
+ /** . */
+ private ClassLoader loader;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ try
+ {
+ loader = (ClassLoader)config.getPortletContext().getAttribute("FACESCLASSLOADER");
+ if (loader != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ Class facesServletClass = loader.loadClass("org.apache.myfaces.portlet.MyFacesGenericPortlet");
+ portlet = (Portlet)facesServletClass.newInstance();
+ portlet.init(config);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ if (portlet != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ portlet.processAction(request, response);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void render(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ if (portlet != null)
+ {
+ ClassLoader containerLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(loader);
+ try
+ {
+ portlet.render(request, response);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(containerLoader);
+ }
+ }
+ }
+
+ public void destroy()
+ {
+ if (portlet != null)
+ {
+ portlet.destroy();
+ portlet = null;
+ loader = null;
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/ActionEventDispatcher.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/ActionEventDispatcher.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/ActionEventDispatcher.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.faces.util;
+
+import org.apache.log4j.Logger;
+
+import javax.faces.component.UICommand;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+
+/**
+ * The purpose of this class is to dispatch an event to the action listeners attached to an instance of
+ * <code>UICommand</code> object. It will iterate the set of listeners returned by the method
+ * <code>UICommand.getActionListeners()</code> (SunRI) and the listener evaluated by the method binding returned by the
+ * method <code>getActionListener()</code> (MyFaces). So overally we try to encapsulate the delivery of an action event
+ * in a portable way accross JSF implementations.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ActionEventDispatcher
+{
+
+ /** . */
+ private static final ActionListener[] EMPTY_LISTENERS = new ActionListener[0];
+
+ /** . */
+ private static final Logger log = Logger.getLogger(ActionEventDispatcher.class);
+
+ /** . */
+ private final UICommand command;
+
+ public ActionEventDispatcher(UICommand command)
+ {
+ this.command = command;
+ }
+
+ public void dispatch(final FacesContext faces, final ActionEvent event) throws AbortProcessingException
+ {
+ //
+ ArrayList listeners = new ArrayList();
+
+ if (command.getActionListeners() != null)
+ {
+ listeners.addAll(Arrays.asList(command.getActionListeners()));
+ }
+
+ //
+ if (command.getActionListener() != null)
+ {
+ ActionListener listener = new ActionListener()
+ {
+ public void processAction(ActionEvent actionEvent) throws AbortProcessingException
+ {
+ try
+ {
+ command.getActionListener().invoke(faces, new Object[]{event});
+ }
+ catch (EvaluationException e)
+ {
+ Throwable cause = e.getCause();
+ if (cause != null && cause instanceof AbortProcessingException)
+ {
+ throw (AbortProcessingException)cause;
+ }
+ else
+ {
+ log.error("Was not able to evaluate the method binding", e);
+ }
+ }
+ }
+ };
+ listeners.add(listener);
+ }
+
+ //
+ for (Iterator i = listeners.iterator(); i.hasNext();)
+ {
+ ActionListener listener = (ActionListener)i.next();
+ listener.processAction(event);
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/JSFFunctor.java
===================================================================
--- modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/JSFFunctor.java (rev 0)
+++ modules/faces/trunk/faces/src/main/java/org/jboss/portal/faces/util/JSFFunctor.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,126 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.faces.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Allows to call a parameterized function in JSF EL expressions. See <a href="http://wiki.apache.org/myfaces/Parameters_In_EL_Functions">http://wiki.apache.org/myfaces/Parameters_In_EL_Functions</a>
+ * for more details. A better alternative would be to use JBoss-EL if it was available from the standard JBoss
+ * repository...
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class JSFFunctor implements Map<String, Object>
+{
+
+ /** Removes white spaces and periods from identifiers so that we can assign them to HTML id attributes. */
+ public static final JSFFunctor ID_SANITIZER = new JSFFunctor()
+ {
+ private String recent;
+ private String recentSanitized;
+
+ @Override
+ public Object get(Object parameter)
+ {
+ if (parameter instanceof String)
+ {
+ if (parameter.equals(recent))
+ {
+ return recentSanitized;
+ }
+
+ String id = (String)parameter;
+ recent = id;
+ recentSanitized = id.replace(' ', '_').replace('.', '_');
+ return recentSanitized;
+ }
+ return null;
+ }
+ };
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return false;
+ }
+
+ /**
+ * This is where the functor works. Subclasses need to implement the function logic here, the parameter being the
+ * specified parameter.
+ *
+ * @param parameter the value that will be used to compute the result of the function we want to implement
+ * @return the result of the funtion for the specified value
+ */
+ public abstract Object get(Object parameter);
+
+ public Object put(String key, Object value)
+ {
+ return null;
+ }
+
+ public Object remove(Object key)
+ {
+ return null;
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> m)
+ {
+ }
+
+ public void clear()
+ {
+ }
+
+ public Set<String> keySet()
+ {
+ return null;
+ }
+
+ public Collection<Object> values()
+ {
+ return null;
+ }
+
+ public Set<Entry<String, Object>> entrySet()
+ {
+ return null;
+ }
+}
Added: modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml
===================================================================
--- modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml (rev 0)
+++ modules/faces/trunk/faces/src/main/resources/portal-faces-lib-jar/META-INF/portal.taglib.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,11 @@
+<!DOCTYPE facelet-taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
+ "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib>
+ <namespace>http://www.jboss.com/portal/facelet/common</namespace>
+ <tag>
+ <tag-name>context</tag-name>
+ <handler-class>org.jboss.portal.faces.facelet.ContextTagHandler</handler-class>
+ </tag>
+
+</facelet-taglib>
\ No newline at end of file
Added: modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/faces-config.xml (rev 0)
+++ modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/faces-config.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <component>
+ <component-type>custom1</component-type>
+ <component-class>org.jboss.portal.test.faces.example.UICustom1</component-class>
+ </component>
+ <component>
+ <component-type>custom2</component-type>
+ <component-class>org.jboss.portal.test.faces.example.UICustom2</component-class>
+ </component>
+ <component>
+ <component-type>custom3</component-type>
+ <component-class>org.jboss.portal.test.faces.example.UICustom3</component-class>
+ </component>
+ <managed-bean>
+ <managed-bean-name>custombean</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.test.faces.example.CustomBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Property changes on: modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/faces-config.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/web.xml
===================================================================
--- modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/web.xml (rev 0)
+++ modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/web.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <listener>
+ <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
Property changes on: modules/faces/trunk/faces/src/main/resources/portal-faces-war/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/main/resources/portal-faces-war/index.jsp
===================================================================
--- modules/faces/trunk/faces/src/main/resources/portal-faces-war/index.jsp (rev 0)
+++ modules/faces/trunk/faces/src/main/resources/portal-faces-war/index.jsp 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,31 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
+<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
+<%@ taglib prefix="j" uri="http://www.jboss.org/jsf/component/tags" %>
+<html>
+<head><title>Samples</title></head>
+
+<body>
+<f:view>
+ <h:form>
+ <j:composite
+ type="custom1"
+ data_value="#{custombean.rows}"/>
+ <j:composite
+ type="custom2"
+ input_value="#{custombean.in}"
+ output_value="#{custombean.out}"
+ listener="#{custombean.action}"/>
+ </h:form>
+ <h:form>
+ <j:composite
+ id="abc"
+ type="custom3"
+ data_value="#{custombean.rows}"
+ input_value="#{custombean.in}"
+ output_value="#{custombean.out}"
+ listener="#{custombean.action}"/>
+ </h:form>
+</f:view>
+</body>
+</html>
\ No newline at end of file
Property changes on: modules/faces/trunk/faces/src/main/resources/portal-faces-war/index.jsp
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/ManagedBeanTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/ManagedBeanTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/ManagedBeanTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.faces;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.gui.ManagedBean;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ManagedBeanTestCase extends TestCase
+{
+ private ManagedBean bean;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ bean = new ManagedBean()
+ {
+ @Override
+ protected String getObjectTypeName()
+ {
+ return "test";
+ }
+
+ @Override
+ public boolean isAlreadyExisting(String objectName)
+ {
+ return false;
+ }
+ };
+ }
+
+ public void testNormalizeStringIfNeeded()
+ {
+ assertEquals("foo", bean.normalizeStringIfNeeded("foo"));
+ assertEquals("foo", bean.normalizeStringIfNeeded(" foo "));
+ assertEquals("foo", bean.normalizeStringIfNeeded("\t\nfoo\t"));
+ assertNull(bean.normalizeStringIfNeeded(null));
+ assertEquals(bean, bean.normalizeStringIfNeeded(bean));
+ }
+
+ public void testIsOldAndNewDifferent()
+ {
+ assertTrue(bean.isOldAndNewDifferent("foo", null));
+ assertTrue(bean.isOldAndNewDifferent(null, "foo"));
+ assertFalse(bean.isOldAndNewDifferent(null, null));
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/MessageFormatTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/MessageFormatTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/MessageFormatTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,51 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.test.faces;
+
+import junit.framework.TestCase;
+
+import java.text.MessageFormat;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class MessageFormatTestCase extends TestCase
+{
+ public void testFormat()
+ {
+ String input = "''{0}'' is not a valid URL: {1}";
+ String output = "'foo' is not a valid URL: bar";
+ assertEquals(output, MessageFormat.format(input, new String[] {"foo", "bar"}));
+
+
+ // Don't forget to escape single quotes in localization files if there are parameters to be interpreted
+ input = "Couldn't reload producer configuration. Cause: {0}";
+ output = "Couldnt reload producer configuration. Cause: {0}";
+ assertEquals(output, MessageFormat.format(input, new String[]{"foo"}));
+
+ input = "Couldn''t reload producer configuration. Cause: {0}";
+ output = "Couldn't reload producer configuration. Cause: foo";
+ assertEquals(output, MessageFormat.format(input, new String[]{"foo"}));
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class AbstractBeanDecoratorTestCase extends TestCase
+{
+
+ /** . */
+ private TestBean testBean;
+
+ /** . */
+ private TestBeanDecorator testBeanDecorator;
+
+ protected void setUp() throws Exception
+ {
+ testBean = new TestBean();
+ testBeanDecorator = new TestBeanDecorator(testBean.property);
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ testBean = null;
+ testBeanDecorator = null;
+ }
+
+ public void testGetType()
+ {
+ try
+ {
+ testBeanDecorator.getType(null, testBeanDecorator.property.name);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ testBeanDecorator.getType(testBean, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(Value.class, testBeanDecorator.getType(testBean, testBeanDecorator.property.name));
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ testBeanDecorator.getValue(testBean, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ testBeanDecorator.getValue(null, testBeanDecorator.property.name);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, testBeanDecorator.getValue(testBean, new Object()));
+ assertEquals(new PropertyValue(testBean.property.value), testBeanDecorator.getValue(testBean, testBeanDecorator.property.name));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ testBeanDecorator.setValue(null, testBeanDecorator.property.name, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ testBeanDecorator.setValue(testBean, null, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ Value expectedValue = new Value();
+ assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.property.name, expectedValue));
+ assertEquals(expectedValue, testBean.property.value);
+
+ //
+ assertEquals(true, testBeanDecorator.setValue(testBean, testBeanDecorator.property.name, null));
+ assertEquals(null, testBean.property.value);
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,100 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class AbstractDynamicBeanTestCase extends TestCase
+{
+
+ /** . */
+ private TestDynamicBean testDynamicBean;
+
+ protected void setUp() throws Exception
+ {
+ testDynamicBean = new TestDynamicBean();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ testDynamicBean = null;
+ }
+
+ public void testGetType()
+ {
+ try
+ {
+ testDynamicBean.getType(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, testDynamicBean.getType(new Object()));
+ assertEquals(Value.class, testDynamicBean.getType(testDynamicBean.propertyName));
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ testDynamicBean.getValue(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, testDynamicBean.getValue(new Object()));
+ assertEquals(new PropertyValue(testDynamicBean.propertyValue), testDynamicBean.getValue(testDynamicBean.propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ testDynamicBean.setValue(null, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ Value expectedValue = new Value();
+ assertFalse(testDynamicBean.setValue(new Object(), new Object()));
+ assertTrue(testDynamicBean.setValue(testDynamicBean.propertyName, expectedValue));
+ assertEquals(expectedValue, testDynamicBean.propertyValue);
+ assertTrue(testDynamicBean.setValue(testDynamicBean.propertyName, null));
+ assertEquals(null, testDynamicBean.propertyValue);
+ }
+
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant1.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant1.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant1.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ClassConstant1
+{
+
+ private String PRIVATE_1;
+ private final String PRIVATE_FINAL_1 = "";
+ protected String PROTECTED_1;
+ protected final String PROTECTED_FINAL_1 = "";
+ String PACKAGE_PROTECTED_1;
+ final String PACKAGE_PROTECTED_FINAL_1 = "";
+ public String PUBLIC_1;
+ public final String PUBLIC_FINAL_1 = "";
+
+ static private String STATIC_PRIVATE_1;
+ static private final String STATIC_PRIVATE_FINAL_1 = "";
+ static protected String STATIC_PROTECTED_1;
+ static protected final String STATIC_PROTECTED_FINAL_1 = "";
+ static String STATIC_PACKAGE_PROTECTED_1;
+ static final String STATIC_PACKAGE_PROTECTED_FINAL_1 = "";
+ static public String STATIC_PUBLIC_1 = "CT1_STATIC_PUBLIC_1_VALUE";
+ static public final String STATIC_PUBLIC_FINAL_1 = "CT1_STATIC_PUBLIC_FINAL_1_VALUE";
+
+ private String PRIVATE_2;
+ private final String PRIVATE_FINAL_2 = "";
+ protected String PROTECTED_2;
+ protected final String PROTECTED_FINAL_2 = "";
+ String PACKAGE_PROTECTED_2;
+ final String PACKAGE_PROTECTED_FINAL_2 = "";
+ public String PUBLIC_2;
+ public final String PUBLIC_FINAL_2 = "";
+
+ static private String STATIC_PRIVATE_2;
+ static private final String STATIC_PRIVATE_FINAL_2 = "";
+ static protected String STATIC_PROTECTED_2;
+ static protected final String STATIC_PROTECTED_FINAL_2 = "";
+ static String STATIC_PACKAGE_PROTECTED_2;
+ static final String STATIC_PACKAGE_PROTECTED_FINAL_2 = "";
+ static public String STATIC_PUBLIC_2 = "CT1_STATIC_PUBLIC_2_VALUE";
+ static public final String STATIC_PUBLIC_FINAL_2 = "CT1_STATIC_PUBLIC_FINAL_2_VALUE";
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant2.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant2.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant2.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ClassConstant2 extends ClassConstant1
+{
+
+ private String PRIVATE_2;
+ private final String PRIVATE_FINAL_2 = "";
+ protected String PROTECTED_2;
+ protected final String PROTECTED_FINAL_2 = "";
+ String PACKAGE_PROTECTED_2;
+ final String PACKAGE_PROTECTED_FINAL_2 = "";
+ public String PUBLIC_2;
+ public final String PUBLIC_FINAL_2 = "";
+
+ static private String STATIC_PRIVATE_2;
+ static private final String STATIC_PRIVATE_FINAL_2 = "";
+ static protected String STATIC_PROTECTED_2;
+ static protected final String STATIC_PROTECTED_FINAL_2 = "";
+ static String STATIC_PACKAGE_PROTECTED_2;
+ static final String STATIC_PACKAGE_PROTECTED_FINAL_2 = "";
+ static public String STATIC_PUBLIC_2 = "CT2_STATIC_PUBLIC_2_VALUE";
+ static public final String STATIC_PUBLIC_FINAL_2 = "CT2_STATIC_PUBLIC_FINAL_2_VALUE";
+
+ private String PRIVATE_3;
+ private final String PRIVATE_FINAL_3 = "";
+ protected String PROTECTED_3;
+ protected final String PROTECTED_FINAL_3 = "";
+ String PACKAGE_PROTECTED_3;
+ final String PACKAGE_PROTECTED_FINAL_3 = "";
+ public String PUBLIC_3;
+ public final String PUBLIC_FINAL_3 = "";
+
+ static private String STATIC_PRIVATE_3;
+ static private final String STATIC_PRIVATE_FINAL_3 = "";
+ static protected String STATIC_PROTECTED_3;
+ static protected final String STATIC_PROTECTED_FINAL_3 = "";
+ static String STATIC_PACKAGE_PROTECTED_3;
+ static final String STATIC_PACKAGE_PROTECTED_FINAL_3 = "";
+ static public String STATIC_PUBLIC_3 = "CT2_STATIC_PUBLIC_3_VALUE";
+ static public final String STATIC_PUBLIC_FINAL_3 = "CT2_STATIC_PUBLIC_FINAL_3_VALUE";
+
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant3.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant3.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstant3.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ClassConstant3
+{
+ public static final int INT_0 = 0;
+ public static final int INT_1 = 1;
+ public static final int INT_2 = 2;
+ public static final boolean BOOLEAN_TRUE = true;
+ public static final boolean BOOLEAN_FALSE = false;
+ public static final Integer INTEGER_0 = new Integer(0);
+ public static final Integer INTEGER_1 = new Integer(1);
+ public static final Integer INTEGER_2 = new Integer(2);
+ public static final Boolean BOOLEAN_OBJECT_TRUE = Boolean.TRUE;
+ public static final Boolean BOOLEAN_OBJECT_FALSE = Boolean.FALSE;
+ public static final Object OBJECT = new Object();
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/ClassConstantPublisherBeanTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,387 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.ClassConstantPublisherBean;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class ClassConstantPublisherBeanTestCase extends TestCase
+{
+
+ private DynamicBean bean1;
+ private DynamicBean bean2;
+ private DynamicBean bean3;
+
+ protected void setUp() throws Exception
+ {
+ bean1 = new ClassConstantPublisherBean();
+ bean1.setValue("className", ClassConstant1.class.getName());
+ bean2 = new ClassConstantPublisherBean();
+ bean2.setValue("className", ClassConstant2.class.getName());
+ bean3 = new ClassConstantPublisherBean();
+ bean3.setValue("className", ClassConstant3.class.getName());
+ }
+
+ public void testMeta()
+ {
+ assertEquals(String.class, bean1.getType("className"));
+ assertNotNull(bean1.getValue("className"));
+ assertEquals(ClassConstant1.class.getName(), bean1.getValue("className").getObject());
+ }
+
+ public void testExtendsObject()
+ {
+ assertNull(bean1.getType("PRIVATE_1"));
+ assertNull(bean1.getType("PRIVATE_FINAL_1"));
+ assertNull(bean1.getType("PROTECTED_1"));
+ assertNull(bean1.getType("PROTECTED_FINAL_1"));
+ assertNull(bean1.getType("PACKAGE_PROTECTED_1"));
+ assertNull(bean1.getType("PACKAGE_PROTECTED_FINAL_1"));
+ assertNull(bean1.getType("PUBLIC_1"));
+ assertNull(bean1.getType("PUBLIC_FINAL_1"));
+
+ //
+ assertNull(bean1.getType("STATIC_PRIVATE_1"));
+ assertNull(bean1.getType("STATIC_PRIVATE_FINAL_1"));
+ assertNull(bean1.getType("STATIC_PROTECTED_1"));
+ assertNull(bean1.getType("STATIC_PROTECTED_FINAL_1"));
+ assertNull(bean1.getType("STATIC_PACKAGE_PROTECTED_1"));
+ assertNull(bean1.getType("STATIC_PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean1.getType("STATIC_PUBLIC_1"));
+ assertNotNull(bean1.getType("STATIC_PUBLIC_FINAL_1"));
+
+ //
+ assertNotNull(bean1.getValue("PRIVATE_1"));
+ assertNotNull(bean1.getValue("PRIVATE_FINAL_1"));
+ assertNotNull(bean1.getValue("PROTECTED_1"));
+ assertNotNull(bean1.getValue("PROTECTED_FINAL_1"));
+ assertNotNull(bean1.getValue("PACKAGE_PROTECTED_1"));
+ assertNotNull(bean1.getValue("PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean1.getValue("PUBLIC_1"));
+ assertNotNull(bean1.getValue("PUBLIC_FINAL_1"));
+
+ //
+ assertNotNull(bean1.getValue("STATIC_PRIVATE_1"));
+ assertNotNull(bean1.getValue("STATIC_PRIVATE_FINAL_1"));
+ assertNotNull(bean1.getValue("STATIC_PROTECTED_1"));
+ assertNotNull(bean1.getValue("STATIC_PROTECTED_FINAL_1"));
+ assertNotNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_1"));
+ assertNotNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean1.getValue("STATIC_PUBLIC_1"));
+ assertNotNull(bean1.getValue("STATIC_PUBLIC_FINAL_1"));
+
+ //
+ assertNull(bean1.getValue("PRIVATE_1").getObject());
+ assertNull(bean1.getValue("PRIVATE_FINAL_1").getObject());
+ assertNull(bean1.getValue("PROTECTED_1").getObject());
+ assertNull(bean1.getValue("PROTECTED_FINAL_1").getObject());
+ assertNull(bean1.getValue("PACKAGE_PROTECTED_1").getObject());
+ assertNull(bean1.getValue("PACKAGE_PROTECTED_FINAL_1").getObject());
+ assertNull(bean1.getValue("PUBLIC_1").getObject());
+ assertNull(bean1.getValue("PUBLIC_FINAL_1").getObject());
+
+ //
+ assertNull(bean1.getValue("STATIC_PRIVATE_1").getObject());
+ assertNull(bean1.getValue("STATIC_PRIVATE_FINAL_1").getObject());
+ assertNull(bean1.getValue("STATIC_PROTECTED_1").getObject());
+ assertNull(bean1.getValue("STATIC_PROTECTED_FINAL_1").getObject());
+ assertNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_1").getObject());
+ assertNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_FINAL_1").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_1_VALUE", bean1.getValue("STATIC_PUBLIC_1").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_FINAL_1_VALUE", bean1.getValue("STATIC_PUBLIC_FINAL_1").getObject());
+
+ //
+ assertNull(bean1.getType("PRIVATE_2"));
+ assertNull(bean1.getType("PRIVATE_FINAL_2"));
+ assertNull(bean1.getType("PROTECTED_2"));
+ assertNull(bean1.getType("PROTECTED_FINAL_2"));
+ assertNull(bean1.getType("PACKAGE_PROTECTED_2"));
+ assertNull(bean1.getType("PACKAGE_PROTECTED_FINAL_2"));
+ assertNull(bean1.getType("PUBLIC_2"));
+ assertNull(bean1.getType("PUBLIC_FINAL_2"));
+
+ //
+ assertNull(bean1.getType("STATIC_PRIVATE_2"));
+ assertNull(bean1.getType("STATIC_PRIVATE_FINAL_2"));
+ assertNull(bean1.getType("STATIC_PROTECTED_2"));
+ assertNull(bean1.getType("STATIC_PROTECTED_FINAL_2"));
+ assertNull(bean1.getType("STATIC_PACKAGE_PROTECTED_2"));
+ assertNull(bean1.getType("STATIC_PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean1.getType("STATIC_PUBLIC_2"));
+ assertNotNull(bean1.getType("STATIC_PUBLIC_FINAL_2"));
+
+ //
+ assertNotNull(bean1.getValue("PRIVATE_2"));
+ assertNotNull(bean1.getValue("PRIVATE_FINAL_2"));
+ assertNotNull(bean1.getValue("PROTECTED_2"));
+ assertNotNull(bean1.getValue("PROTECTED_FINAL_2"));
+ assertNotNull(bean1.getValue("PACKAGE_PROTECTED_2"));
+ assertNotNull(bean1.getValue("PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean1.getValue("PUBLIC_2"));
+ assertNotNull(bean1.getValue("PUBLIC_FINAL_2"));
+
+ //
+ assertNotNull(bean1.getValue("STATIC_PRIVATE_2"));
+ assertNotNull(bean1.getValue("STATIC_PRIVATE_FINAL_2"));
+ assertNotNull(bean1.getValue("STATIC_PROTECTED_2"));
+ assertNotNull(bean1.getValue("STATIC_PROTECTED_FINAL_2"));
+ assertNotNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_2"));
+ assertNotNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean1.getValue("STATIC_PUBLIC_2"));
+ assertNotNull(bean1.getValue("STATIC_PUBLIC_FINAL_2"));
+
+ //
+ assertNull(bean1.getValue("PRIVATE_2").getObject());
+ assertNull(bean1.getValue("PRIVATE_FINAL_2").getObject());
+ assertNull(bean1.getValue("PROTECTED_2").getObject());
+ assertNull(bean1.getValue("PROTECTED_FINAL_2").getObject());
+ assertNull(bean1.getValue("PACKAGE_PROTECTED_2").getObject());
+ assertNull(bean1.getValue("PACKAGE_PROTECTED_FINAL_2").getObject());
+ assertNull(bean1.getValue("PUBLIC_2").getObject());
+ assertNull(bean1.getValue("PUBLIC_FINAL_2").getObject());
+
+ //
+ assertNull(bean1.getValue("STATIC_PRIVATE_2").getObject());
+ assertNull(bean1.getValue("STATIC_PRIVATE_FINAL_2").getObject());
+ assertNull(bean1.getValue("STATIC_PROTECTED_2").getObject());
+ assertNull(bean1.getValue("STATIC_PROTECTED_FINAL_2").getObject());
+ assertNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_2").getObject());
+ assertNull(bean1.getValue("STATIC_PACKAGE_PROTECTED_FINAL_2").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_2_VALUE", bean1.getValue("STATIC_PUBLIC_2").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_FINAL_2_VALUE", bean1.getValue("STATIC_PUBLIC_FINAL_2").getObject());
+ }
+
+ public void testExtendsObjectAnotherClass()
+ {
+ assertNull(bean2.getType("PRIVATE_1"));
+ assertNull(bean2.getType("PRIVATE_FINAL_1"));
+ assertNull(bean2.getType("PROTECTED_1"));
+ assertNull(bean2.getType("PROTECTED_FINAL_1"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_1"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_FINAL_1"));
+ assertNull(bean2.getType("PUBLIC_1"));
+ assertNull(bean2.getType("PUBLIC_FINAL_1"));
+
+ //
+ assertNull(bean2.getType("STATIC_PRIVATE_1"));
+ assertNull(bean2.getType("STATIC_PRIVATE_FINAL_1"));
+ assertNull(bean2.getType("STATIC_PROTECTED_1"));
+ assertNull(bean2.getType("STATIC_PROTECTED_FINAL_1"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_1"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_1"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_FINAL_1"));
+
+ //
+ assertNotNull(bean2.getValue("PRIVATE_1"));
+ assertNotNull(bean2.getValue("PRIVATE_FINAL_1"));
+ assertNotNull(bean2.getValue("PROTECTED_1"));
+ assertNotNull(bean2.getValue("PROTECTED_FINAL_1"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_1"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean2.getValue("PUBLIC_1"));
+ assertNotNull(bean2.getValue("PUBLIC_FINAL_1"));
+
+ //
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_1"));
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_FINAL_1"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_1"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_FINAL_1"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_1"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_1"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_1"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_FINAL_1"));
+
+ //
+ assertNull(bean2.getValue("PRIVATE_1").getObject());
+ assertNull(bean2.getValue("PRIVATE_FINAL_1").getObject());
+ assertNull(bean2.getValue("PROTECTED_1").getObject());
+ assertNull(bean2.getValue("PROTECTED_FINAL_1").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_1").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_1").getObject());
+ assertNull(bean2.getValue("PUBLIC_1").getObject());
+ assertNull(bean2.getValue("PUBLIC_FINAL_1").getObject());
+
+ //
+ assertNull(bean2.getValue("STATIC_PRIVATE_1").getObject());
+ assertNull(bean2.getValue("STATIC_PRIVATE_FINAL_1").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_1").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_FINAL_1").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_1").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_1").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_1_VALUE", bean2.getValue("STATIC_PUBLIC_1").getObject());
+ assertEquals("CT1_STATIC_PUBLIC_FINAL_1_VALUE", bean2.getValue("STATIC_PUBLIC_FINAL_1").getObject());
+
+ //
+ assertNull(bean2.getType("PRIVATE_2"));
+ assertNull(bean2.getType("PRIVATE_FINAL_2"));
+ assertNull(bean2.getType("PROTECTED_2"));
+ assertNull(bean2.getType("PROTECTED_FINAL_2"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_2"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_FINAL_2"));
+ assertNull(bean2.getType("PUBLIC_2"));
+ assertNull(bean2.getType("PUBLIC_FINAL_2"));
+
+ //
+ assertNull(bean2.getType("STATIC_PRIVATE_2"));
+ assertNull(bean2.getType("STATIC_PRIVATE_FINAL_2"));
+ assertNull(bean2.getType("STATIC_PROTECTED_2"));
+ assertNull(bean2.getType("STATIC_PROTECTED_FINAL_2"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_2"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_2"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_FINAL_2"));
+
+ //
+ assertNotNull(bean2.getValue("PRIVATE_2"));
+ assertNotNull(bean2.getValue("PRIVATE_FINAL_2"));
+ assertNotNull(bean2.getValue("PROTECTED_2"));
+ assertNotNull(bean2.getValue("PROTECTED_FINAL_2"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_2"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean2.getValue("PUBLIC_2"));
+ assertNotNull(bean2.getValue("PUBLIC_FINAL_2"));
+
+ //
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_2"));
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_FINAL_2"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_2"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_FINAL_2"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_2"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_2"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_2"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_FINAL_2"));
+
+ //
+ assertNull(bean2.getValue("PRIVATE_2").getObject());
+ assertNull(bean2.getValue("PRIVATE_FINAL_2").getObject());
+ assertNull(bean2.getValue("PROTECTED_2").getObject());
+ assertNull(bean2.getValue("PROTECTED_FINAL_2").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_2").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_2").getObject());
+ assertNull(bean2.getValue("PUBLIC_2").getObject());
+ assertNull(bean2.getValue("PUBLIC_FINAL_2").getObject());
+
+ //
+ assertNull(bean2.getValue("STATIC_PRIVATE_2").getObject());
+ assertNull(bean2.getValue("STATIC_PRIVATE_FINAL_2").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_2").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_FINAL_2").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_2").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_2").getObject());
+ assertEquals("CT2_STATIC_PUBLIC_2_VALUE", bean2.getValue("STATIC_PUBLIC_2").getObject());
+ assertEquals("CT2_STATIC_PUBLIC_FINAL_2_VALUE", bean2.getValue("STATIC_PUBLIC_FINAL_2").getObject());
+
+ assertNull(bean2.getType("PRIVATE_3"));
+ assertNull(bean2.getType("PRIVATE_FINAL_3"));
+ assertNull(bean2.getType("PROTECTED_3"));
+ assertNull(bean2.getType("PROTECTED_FINAL_3"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_3"));
+ assertNull(bean2.getType("PACKAGE_PROTECTED_FINAL_3"));
+ assertNull(bean2.getType("PUBLIC_3"));
+ assertNull(bean2.getType("PUBLIC_FINAL_3"));
+
+ //
+ assertNull(bean2.getType("STATIC_PRIVATE_3"));
+ assertNull(bean2.getType("STATIC_PRIVATE_FINAL_3"));
+ assertNull(bean2.getType("STATIC_PROTECTED_3"));
+ assertNull(bean2.getType("STATIC_PROTECTED_FINAL_3"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_3"));
+ assertNull(bean2.getType("STATIC_PACKAGE_PROTECTED_FINAL_3"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_3"));
+ assertNotNull(bean2.getType("STATIC_PUBLIC_FINAL_3"));
+
+ //
+ assertNotNull(bean2.getValue("PRIVATE_3"));
+ assertNotNull(bean2.getValue("PRIVATE_FINAL_3"));
+ assertNotNull(bean2.getValue("PROTECTED_3"));
+ assertNotNull(bean2.getValue("PROTECTED_FINAL_3"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_3"));
+ assertNotNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_3"));
+ assertNotNull(bean2.getValue("PUBLIC_3"));
+ assertNotNull(bean2.getValue("PUBLIC_FINAL_3"));
+
+ //
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_3"));
+ assertNotNull(bean2.getValue("STATIC_PRIVATE_FINAL_3"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_3"));
+ assertNotNull(bean2.getValue("STATIC_PROTECTED_FINAL_3"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_3"));
+ assertNotNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_3"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_3"));
+ assertNotNull(bean2.getValue("STATIC_PUBLIC_FINAL_3"));
+
+ //
+ assertNull(bean2.getValue("PRIVATE_3").getObject());
+ assertNull(bean2.getValue("PRIVATE_FINAL_3").getObject());
+ assertNull(bean2.getValue("PROTECTED_3").getObject());
+ assertNull(bean2.getValue("PROTECTED_FINAL_3").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_3").getObject());
+ assertNull(bean2.getValue("PACKAGE_PROTECTED_FINAL_3").getObject());
+ assertNull(bean2.getValue("PUBLIC_3").getObject());
+ assertNull(bean2.getValue("PUBLIC_FINAL_3").getObject());
+
+ //
+ assertNull(bean2.getValue("STATIC_PRIVATE_3").getObject());
+ assertNull(bean2.getValue("STATIC_PRIVATE_FINAL_3").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_3").getObject());
+ assertNull(bean2.getValue("STATIC_PROTECTED_FINAL_3").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_3").getObject());
+ assertNull(bean2.getValue("STATIC_PACKAGE_PROTECTED_FINAL_3").getObject());
+ assertEquals("CT2_STATIC_PUBLIC_3_VALUE", bean2.getValue("STATIC_PUBLIC_3").getObject());
+ assertEquals("CT2_STATIC_PUBLIC_FINAL_3_VALUE", bean2.getValue("STATIC_PUBLIC_FINAL_3").getObject());
+ }
+
+ public void testValues()
+ {
+ assertNotNull(bean3.getValue("INT_0"));
+ assertNotNull(bean3.getValue("INT_1"));
+ assertNotNull(bean3.getValue("INT_2"));
+ assertNotNull(bean3.getValue("BOOLEAN_TRUE"));
+ assertNotNull(bean3.getValue("BOOLEAN_FALSE"));
+ assertNotNull(bean3.getValue("INTEGER_0"));
+ assertNotNull(bean3.getValue("INTEGER_1"));
+ assertNotNull(bean3.getValue("INTEGER_2"));
+ assertNotNull(bean3.getValue("BOOLEAN_OBJECT_TRUE"));
+ assertNotNull(bean3.getValue("BOOLEAN_OBJECT_FALSE"));
+ assertNotNull(bean3.getValue("OBJECT"));
+
+ //
+ assertEquals(new Integer(0), bean3.getValue("INT_0").getObject());
+ assertEquals(new Integer(1), bean3.getValue("INT_1").getObject());
+ assertEquals(new Integer(2), bean3.getValue("INT_2").getObject());
+ assertEquals(Boolean.TRUE, bean3.getValue("BOOLEAN_TRUE").getObject());
+ assertEquals(Boolean.FALSE, bean3.getValue("BOOLEAN_FALSE").getObject());
+ assertEquals(new Integer(0), bean3.getValue("INTEGER_0").getObject());
+ assertEquals(new Integer(1), bean3.getValue("INTEGER_1").getObject());
+ assertEquals(new Integer(2), bean3.getValue("INTEGER_2").getObject());
+ assertEquals(Boolean.TRUE, bean3.getValue("BOOLEAN_OBJECT_TRUE").getObject());
+ assertEquals(Boolean.FALSE, bean3.getValue("BOOLEAN_OBJECT_FALSE").getObject());
+ assertEquals(ClassConstant3.OBJECT, bean3.getValue("OBJECT").getObject());
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,212 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+
+import javax.faces.el.PropertyNotFoundException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class DelegatingPropertyResolverTestCase extends TestCase
+{
+
+ /** . */
+ private Object propertyName;
+
+ /** . */
+ private Object bean;
+
+ /** . */
+ private TestBean testBean;
+
+ /** . */
+ private TestBeanDecorator testBeanDecorator;
+
+ /** . */
+ private TestBeanDecorator testBeanInterfaceDecorator;
+
+ /** . */
+ private TestBeanDecorator testBeanInterfaceSuperInterfaceDecorator;
+
+ /** . */
+ private TestBeanDecorator testBeanSuperClassDecorator;
+
+ /** . */
+ private TestDynamicBean testDynamicBean;
+
+ /** . */
+ private DelegatingPropertyResolver resolver;
+
+ protected void setUp() throws Exception
+ {
+ propertyName = new Object();
+ bean = new Object();
+ testBean = new TestBean();
+ testBeanDecorator = new TestBeanDecorator(testBean.property);
+ testBeanInterfaceDecorator = new TestBeanDecorator(testBean.interfaceProperty);
+ testBeanInterfaceSuperInterfaceDecorator = new TestBeanDecorator(testBean.interfaceSuperInterfaceProperty);
+ testBeanSuperClassDecorator = new TestBeanDecorator(testBean.superClassProperty);
+ testDynamicBean = new TestDynamicBean();
+ resolver = new DelegatingPropertyResolver();
+ resolver.registerDecorator(TestBean.class, testBeanDecorator);
+ resolver.registerDecorator(TestBeanInterface.class, testBeanInterfaceDecorator);
+ resolver.registerDecorator(TestBeanInterfaceSuperInterface.class, testBeanInterfaceSuperInterfaceDecorator);
+ resolver.registerDecorator(TestBeanSuperClass.class, testBeanSuperClassDecorator);
+ }
+
+ public void testGetType()
+ {
+ try
+ {
+ resolver.getType(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ // TestBean
+ try
+ {
+ resolver.getType(testBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(Value.class, resolver.getType(testBean, testBeanDecorator.property.name));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanInterfaceDecorator.property.name));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name));
+ assertEquals(Value.class, resolver.getType(testBean, testBeanSuperClassDecorator.property.name));
+
+ //
+ try
+ {
+ resolver.getType(testDynamicBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(Value.class, resolver.getType(testDynamicBean, testDynamicBean.propertyName));
+ }
+
+ public void testIsReadOnly()
+ {
+ try
+ {
+ resolver.isReadOnly(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ resolver.getValue(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ //
+ try
+ {
+ resolver.getType(testBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(testBean.property.value, resolver.getValue(testBean, testBeanDecorator.property.name));
+ assertEquals(testBeanInterfaceDecorator.property.value, resolver.getValue(testBean, testBeanInterfaceDecorator.property.name));
+ assertEquals(testBeanInterfaceSuperInterfaceDecorator.property.value, resolver.getValue(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name));
+ assertEquals(testBeanSuperClassDecorator.property.value, resolver.getValue(testBean, testBeanSuperClassDecorator.property.name));
+
+ //
+ try
+ {
+ resolver.getType(testDynamicBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(testDynamicBean.propertyValue, resolver.getValue(testDynamicBean, testDynamicBean.propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ resolver.setValue(bean, propertyName, null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ //
+ try
+ {
+ resolver.setValue(testBean, new Object(), null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ Value propertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanDecorator.property.name, propertyExpectedValue);
+ assertEquals(propertyExpectedValue, testBeanDecorator.property.value);
+ Value interfacePropertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanInterfaceDecorator.property.name, interfacePropertyExpectedValue);
+ assertEquals(interfacePropertyExpectedValue, testBeanInterfaceDecorator.property.value);
+ Value interfaceSuperInterfacePropertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanInterfaceSuperInterfaceDecorator.property.name, interfaceSuperInterfacePropertyExpectedValue);
+ assertEquals(interfaceSuperInterfacePropertyExpectedValue, testBeanInterfaceSuperInterfaceDecorator.property.value);
+ Value superClassPropertyExpectedValue = new Value();
+ resolver.setValue(testBean, testBeanSuperClassDecorator.property.name, superClassPropertyExpectedValue);
+ assertEquals(superClassPropertyExpectedValue, testBeanSuperClassDecorator.property.value);
+
+ //
+ try
+ {
+ resolver.setValue(testDynamicBean, new Object(), null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ resolver.setValue(testDynamicBean, testDynamicBean.propertyName, propertyExpectedValue);
+ assertEquals(propertyExpectedValue, testDynamicBean.propertyValue);
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/SimpleDynamicBeanTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/SimpleDynamicBeanTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/SimpleDynamicBeanTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.PropertyValue;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicProperty;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.el.dynamic.DynamicProperty;
+import org.jboss.portal.faces.el.dynamic.SimpleDynamicBean;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class SimpleDynamicBeanTestCase extends TestCase
+{
+
+ private DynamicBean _bean;
+ private Object _propertyName;
+ private Object _propertyValue;
+
+ protected void setUp() throws Exception
+ {
+ _propertyName = new Object();
+ _propertyValue = new Value();
+ _bean = new SimpleDynamicBean()
+ {
+ protected DynamicProperty getProperty(Object propertyName)
+ {
+ if (_propertyName == propertyName)
+ {
+ return new AbstractDynamicProperty(Value.class)
+ {
+ public Object getValue() throws IllegalArgumentException
+ {
+ return _propertyValue;
+ }
+
+ public boolean setValue(Object value) throws IllegalArgumentException
+ {
+ _propertyValue = value;
+ return true;
+ }
+ };
+ }
+ return null;
+ }
+ };
+ }
+
+ protected void tearDown() throws Exception
+ {
+ _bean = null;
+ }
+
+ public void testGetType()
+ {
+ assertEquals(Value.class, _bean.getType(_propertyName));
+ }
+
+ public void testGetValue()
+ {
+ assertEquals(new PropertyValue(_propertyValue), _bean.getValue(_propertyName));
+ }
+
+ public void testSetValue()
+ {
+ Value expectedValue = new Value();
+ assertTrue(_bean.setValue(_propertyName, expectedValue));
+ assertEquals(expectedValue, _propertyValue);
+
+ //
+ assertTrue(_bean.setValue(_propertyName, null));
+ assertEquals(null, _propertyValue);
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBean.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBean.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class TestBean extends TestBeanSuperClass implements TestBeanInterface
+{
+
+ /** . */
+ Property property;
+
+ /** . */
+ Property interfaceProperty;
+
+ /** . */
+ Property interfaceSuperInterfaceProperty;
+
+ /** . */
+ Property superClassProperty;
+
+ public TestBean()
+ {
+ this.property = new Property();
+ this.interfaceProperty = new Property();
+ this.interfaceSuperInterfaceProperty = new Property();
+ this.superClassProperty = new Property();
+ }
+
+ public class Property
+ {
+
+ /** . */
+ final TestBean bean;
+
+ /** . */
+ final Object name;
+
+ /** . */
+ Value value;
+
+ public Property()
+ {
+ this.bean = TestBean.this;
+ this.name = new Object();
+ this.value = new Value();
+ }
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanDecorator.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanDecorator.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanDecorator.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
+import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
+import org.jboss.portal.faces.el.decorator.PropertyDecorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class TestBeanDecorator extends AbstractBeanDecorator
+{
+
+ /** . */
+ final TestBean.Property property;
+
+ public TestBeanDecorator(TestBean.Property property)
+ {
+ this.property = property;
+ }
+
+ protected PropertyDecorator getProperty(Object propertyName)
+ {
+ if (property.name == propertyName)
+ {
+ return new AbstractPropertyDecorator(Value.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ if (property.bean == bean)
+ {
+ return property.value;
+ }
+ throw new IllegalArgumentException("Not the bean we expected");
+ }
+
+ public boolean setValue(Object bean, Object value) throws IllegalArgumentException
+ {
+ if (property.bean == bean)
+ {
+ property.value = (Value)value;
+ return true;
+ }
+ return false;
+ }
+ };
+ }
+ return null;
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterface.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterface.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterface.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface TestBeanInterface extends TestBeanInterfaceSuperInterface
+{
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanInterfaceSuperInterface.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public interface TestBeanInterfaceSuperInterface
+{
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanSuperClass.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanSuperClass.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestBeanSuperClass.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public class TestBeanSuperClass
+{
+
+}
+
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestDynamicBean.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestDynamicBean.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/TestDynamicBean.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicProperty;
+import org.jboss.portal.faces.el.dynamic.DynamicProperty;
+import org.jboss.portal.faces.el.dynamic.SimpleDynamicBean;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class TestDynamicBean extends SimpleDynamicBean
+{
+
+ /** . */
+ final Object propertyName;
+
+ /** . */
+ Value propertyValue;
+
+ public TestDynamicBean()
+ {
+ this.propertyName = new Object();
+ this.propertyValue = new Value();
+ }
+
+ protected DynamicProperty getProperty(Object propertyName)
+ {
+ if (propertyName == this.propertyName)
+ {
+ return new AbstractDynamicProperty(Value.class)
+ {
+ public Object getValue() throws IllegalArgumentException
+ {
+ return propertyValue;
+ }
+
+ public boolean setValue(Object value) throws IllegalArgumentException
+ {
+ propertyValue = (Value)value;
+ return true;
+ }
+ };
+ }
+ return null;
+ }
+}
Added: modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/Value.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/Value.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/org/jboss/portal/test/faces/el/Value.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 8784 $
+ */
+public class Value
+{
+}
Added: modules/faces/trunk/faces/src/test/java/util/JSFFunctorTestCase.java
===================================================================
--- modules/faces/trunk/faces/src/test/java/util/JSFFunctorTestCase.java (rev 0)
+++ modules/faces/trunk/faces/src/test/java/util/JSFFunctorTestCase.java 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,63 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package util;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.util.JSFFunctor;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class JSFFunctorTestCase extends TestCase
+{
+ private JSFFunctor functor = JSFFunctor.ID_SANITIZER;
+
+ public void testGet()
+ {
+ assertNull(functor.get(null));
+ assertEquals("foo_bar", functor.get("foo bar"));
+ assertEquals("foo_bar", functor.get("foo.bar"));
+ assertEquals("foo______bar", functor.get("foo .bar"));
+ assertEquals("foo_bar_baz_boo", functor.get("foo.bar baz.boo"));
+ }
+
+ public void testSimplePerformance()
+ {
+ for (int i = 0; i < 500000; i++)
+ {
+ assertEquals("foo" + i + "_bar", functor.get("foo" + i + " bar"));
+ }
+ }
+
+ public void testRepeatedPerformance()
+ {
+ for (int i = 0; i < 100000; i++)
+ {
+ assertEquals("foo" + i + "_bar", functor.get("foo" + i + " bar"));
+ assertEquals("foo" + i + "_bar", functor.get("foo" + i + " bar"));
+ assertEquals("foo" + i + "_bar", functor.get("foo" + i + " bar"));
+ assertEquals("foo" + i + "_bar", functor.get("foo" + i + " bar"));
+ }
+ }
+}
Added: modules/faces/trunk/pom.xml
===================================================================
--- modules/faces/trunk/pom.xml (rev 0)
+++ modules/faces/trunk/pom.xml 2009-06-05 03:25:58 UTC (rev 13436)
@@ -0,0 +1,35 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.faces</groupId>
+ <artifactId>module-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal JSF support</name>
+ <version>1.0.0-SNAPSHOT</version>
+ <url>http://www.jboss.org/jbossportal</url>
+
+ <dependencies/>
+
+ <!--Repository definition needed to deploy artifacts into JBoss maven repositories-->
+ <distributionManagement>
+ <repository>
+ <!--Copy the distribution jar file to a local checkout of the maven repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
+ <id>repository.jboss.org</id>
+ <url>file://${jboss.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <modules>
+ <module>build</module>
+ <module>faces</module>
+ </modules>
+
+
+</project>
\ No newline at end of file
15 years
JBoss Portal SVN: r13435 - in branches/Enterprise_Portal_Platform_4_3: core/src/main/org/jboss/portal/core/identity/cache and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-04 16:52:24 -0400 (Thu, 04 Jun 2009)
New Revision: 13435
Modified:
branches/Enterprise_Portal_Platform_4_3/build/build-thirdparty.xml
branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java
branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
Log:
- JBEPP-66:
+ Less optimal implementation of role display name duplicate checking albeit without API changes.
+ Reverted to identity version 1.1.0.
Modified: branches/Enterprise_Portal_Platform_4_3/build/build-thirdparty.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/build/build-thirdparty.xml 2009-06-04 13:11:14 UTC (rev 13434)
+++ branches/Enterprise_Portal_Platform_4_3/build/build-thirdparty.xml 2009-06-04 20:52:24 UTC (rev 13435)
@@ -1,4 +1,26 @@
<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<project name="main.build" default="synchronize" basedir=".">
<!-- Property File definitions -->
@@ -45,7 +67,7 @@
<componentref name="jboss-portal/modules/web" version="1.2.3"/>
<componentref name="jboss-portal/modules/test" version="1.0.4"/>
<componentref name="jboss-portal/modules/portlet" version="trunk-SNAPSHOT"/>
- <componentref name="jboss-portal/modules/identity" version="trunk-SNAPSHOT"/>
+ <componentref name="jboss-portal/modules/identity" version="1.1.0"/>
<componentref name="jboss-portal/modules/cms" version="1.2.5"/>
<componentref name="antlr" version="2.7.6-brew"/>
<componentref name="apache-ant" version="1.6.5"/>
Modified: branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-04 13:11:14 UTC (rev 13434)
+++ branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-04 20:52:24 UTC (rev 13435)
@@ -63,18 +63,6 @@
return ldapRoleModule.findRoleByName(name);
}
- public Role findRoleByDisplayName(String displayName) throws IdentityException, IllegalArgumentException
- {
- Role role = cacheService.findRoleByDisplayName(displayName);
-
- if (role != null)
- {
- return role;
- }
-
- return ldapRoleModule.findRoleByDisplayName(displayName);
- }
-
public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
{
Modified: branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-04 13:11:14 UTC (rev 13434)
+++ branches/Enterprise_Portal_Platform_4_3/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-04 20:52:24 UTC (rev 13435)
@@ -47,8 +47,6 @@
protected ThreadLocal<Map<String, Role>> roleNameCache = new ThreadLocal<Map<String, Role>>();
- protected ThreadLocal<Map<String, Role>> roleDisplayNameCache = new ThreadLocal<Map<String, Role>>();
-
protected ThreadLocal<Map<Object, Role>> roleIdCache = new ThreadLocal<Map<Object, Role>>();
@@ -58,7 +56,6 @@
userIdCache.set(null);
profileCache.set(null);
roleNameCache.set(null);
- roleDisplayNameCache.set(null);
roleIdCache.set(null);
log.debug("Identity cache invalidated");
@@ -100,15 +97,6 @@
return roleNameCache.get();
}
- private Map<String, Role> getRoleDisplayNameCache()
- {
- if (roleDisplayNameCache.get() == null)
- {
- roleDisplayNameCache.set(new HashMap<String, Role>());
- }
- return roleDisplayNameCache.get();
- }
-
private Map<Object, Role> getRoleIdCache()
{
if (roleIdCache.get() == null)
@@ -184,7 +172,6 @@
{
getRoleIdCache().put(role.getId(), role);
getRoleNameCache().put(role.getName(), role);
- getRoleDisplayNameCache().put(role.getDisplayName(), role);
if (log.isDebugEnabled())
{
@@ -200,7 +187,6 @@
{
getRoleIdCache().put(role.getId(), null);
getRoleNameCache().put(role.getName(), null);
- getRoleDisplayNameCache().put(role.getDisplayName(), null);
if (log.isDebugEnabled())
{
@@ -257,18 +243,6 @@
return role;
}
- public Role findRoleByDisplayName(String displayName)
- {
- Role role = getRoleDisplayNameCache().get(displayName);
-
- if (role != null && log.isDebugEnabled())
- {
- log.debug("Role retrieved from cache for display name=" + role.getDisplayName());
- }
-
- return role;
- }
-
public Role findRoleById(Object id)
{
Role role = getRoleIdCache().get(id);
Modified: branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java 2009-06-04 13:11:14 UTC (rev 13434)
+++ branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java 2009-06-04 20:52:24 UTC (rev 13435)
@@ -27,7 +27,11 @@
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
import org.jboss.portal.faces.gui.ManagedBean;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import java.util.Set;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -57,13 +61,25 @@
{
try
{
+ RoleModule roleModule = identityRoleBean.getRoleModule();
if (isDisplay)
{
- return identityRoleBean.getRoleModule().findRoleByDisplayName(objectName) != null;
+ // performance: this could potentially be costly if there are lots of roles...
+ Set roles = roleModule.findRoles();
+ for (Object o : roles)
+ {
+ Role role = (Role)o;
+ if (role.getDisplayName().equals(objectName))
+ {
+ return true;
+ }
+ }
+
+ return false;
}
else
{
- return identityRoleBean.getRoleModule().findRoleByName(objectName) != null;
+ return roleModule.findRoleByName(objectName) != null;
}
}
catch (IdentityException e)
15 years
JBoss Portal SVN: r13434 - in branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78: core/src/main/org/jboss/portal/core/identity/cache and 16 other directories.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-06-04 09:11:14 -0400 (Thu, 04 Jun 2009)
New Revision: 13434
Added:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UserAttributeValidator.java
Removed:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/RoleValidator.java
Modified:
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBeanContainer.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_de.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_pt_BR.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/edit.jsp
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/DynamicUserAttribute.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_fr.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_it.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ja.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_pt_BR.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ru.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/editRole.xhtml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/common/editProfileInfo.xhtml
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_fr.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_it.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
Log:
[JBEPP-78] Merged work on XSS, modified thirdparty to use identity brewed for this patch
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/build/build-thirdparty.xml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -45,7 +45,7 @@
<componentref name="jboss-portal/modules/web" version="1.2.3"/>
<componentref name="jboss-portal/modules/test" version="1.0.4"/>
<componentref name="jboss-portal/modules/portlet" version="2.0.7"/>
- <componentref name="jboss-portal/modules/identity" version="1.1.0"/>
+ <componentref name="jboss-portal/modules/identity" version="1.1.0_JBEPP-78"/>
<componentref name="jboss-portal/modules/cms" version="1.2.5"/>
<componentref name="antlr" version="2.7.6-brew"/>
<componentref name="apache-ant" version="1.6.5"/>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/CachedLDAPRoleModuleWrapper.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,38 +1,39 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
package org.jboss.portal.core.identity.cache;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.ldap.LDAPRoleImpl;
import org.jboss.portal.identity.ldap.LDAPRoleModule;
-import org.jboss.portal.identity.ldap.LDAPRoleImpl;
-import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.IdentityException;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
-import java.util.List;
-import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -62,6 +63,18 @@
return ldapRoleModule.findRoleByName(name);
}
+ public Role findRoleByDisplayName(String displayName) throws IdentityException, IllegalArgumentException
+ {
+ Role role = cacheService.findRoleByDisplayName(displayName);
+
+ if (role != null)
+ {
+ return role;
+ }
+
+ return ldapRoleModule.findRoleByDisplayName(displayName);
+ }
+
public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
{
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core/src/main/org/jboss/portal/core/identity/cache/IdentityCacheService.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,24 +1,25 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
package org.jboss.portal.core.identity.cache;
@@ -46,6 +47,8 @@
protected ThreadLocal<Map<String, Role>> roleNameCache = new ThreadLocal<Map<String, Role>>();
+ protected ThreadLocal<Map<String, Role>> roleDisplayNameCache = new ThreadLocal<Map<String, Role>>();
+
protected ThreadLocal<Map<Object, Role>> roleIdCache = new ThreadLocal<Map<Object, Role>>();
@@ -55,6 +58,7 @@
userIdCache.set(null);
profileCache.set(null);
roleNameCache.set(null);
+ roleDisplayNameCache.set(null);
roleIdCache.set(null);
log.debug("Identity cache invalidated");
@@ -96,6 +100,15 @@
return roleNameCache.get();
}
+ private Map<String, Role> getRoleDisplayNameCache()
+ {
+ if (roleDisplayNameCache.get() == null)
+ {
+ roleDisplayNameCache.set(new HashMap<String, Role>());
+ }
+ return roleDisplayNameCache.get();
+ }
+
private Map<Object, Role> getRoleIdCache()
{
if (roleIdCache.get() == null)
@@ -171,10 +184,11 @@
{
getRoleIdCache().put(role.getId(), role);
getRoleNameCache().put(role.getName(), role);
+ getRoleDisplayNameCache().put(role.getDisplayName(), role);
if (log.isDebugEnabled())
{
- log.debug("Role cached for id=" + role.getId() + "; name=" + role.getName());
+ log.debug("Role cached for id=" + role.getId() + "; name=" + role.getName() + "; display name=" + role.getDisplayName());
}
}
}
@@ -186,10 +200,11 @@
{
getRoleIdCache().put(role.getId(), null);
getRoleNameCache().put(role.getName(), null);
+ getRoleDisplayNameCache().put(role.getDisplayName(), null);
if (log.isDebugEnabled())
{
- log.debug("Role invalidated in cache for id=" + role.getId() + "; name=" + role.getName());
+ log.debug("Role invalidated in cache for id=" + role.getId() + "; name=" + role.getName() + "; display name=" + role.getDisplayName());
}
}
}
@@ -242,6 +257,18 @@
return role;
}
+ public Role findRoleByDisplayName(String displayName)
+ {
+ Role role = getRoleDisplayNameCache().get(displayName);
+
+ if (role != null && log.isDebugEnabled())
+ {
+ log.debug("Role retrieved from cache for display name=" + role.getDisplayName());
+ }
+
+ return role;
+ }
+
public Role findRoleById(Object id)
{
Role role = getRoleIdCache().get(id);
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertiesBean.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,24 +1,25 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
package org.jboss.portal.core.admin.ui;
@@ -32,7 +33,6 @@
import javax.faces.model.SelectItem;
import javax.portlet.PortletConfig;
import javax.portlet.PortletRequest;
-
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
@@ -65,7 +65,7 @@
public ControlPropertiesBean(PortalObjectManagerBean pomgr)
{
this.pomgr = pomgr;
-
+
ResourceBundleManager rbm = new ResourceBundleManager(null, new SimpleResourceBundleFactory(BUNDLE_BASE_NAME, PropertiesInfoBuilder.class.getClassLoader()));
// Load all supported locales
@@ -74,11 +74,11 @@
while (locales.hasMoreElements())
{
Locale locale = locales.nextElement();
- rbm.getResourceBundle(locale);
+ rbm.getResourceBundle(locale);
}
DISPLAY_THE_DEFAULT_ERROR_MESSAGE = rbm.getLocalizedValue("DISPLAY_THE_DEFAULT_ERROR_MESSAGE", "Display the default error message");
- REDIRECT_TO_THE_SPECIFIED_RESOURCE = rbm.getLocalizedValue("REDIRECT_TO_THE_SPECIFIED_RESOURCE", "Redirect to the specified resource");
- REMOVE_THE_RESOURCE_FROM_PAGE = rbm.getLocalizedValue("REMOVE_THE_RESOURCE_FROM_PAGE", "Remove the resource from page");
+ REDIRECT_TO_THE_SPECIFIED_RESOURCE = rbm.getLocalizedValue("REDIRECT_TO_THE_SPECIFIED_RESOURCE", "Redirect to the specified resource");
+ REMOVE_THE_RESOURCE_FROM_PAGE = rbm.getLocalizedValue("REMOVE_THE_RESOURCE_FROM_PAGE", "Remove the resource from page");
portalSelectItems = new HashMap<Locale, List<SelectItem>>();
pageSelectItems = new HashMap<Locale, List<SelectItem>>();
}
@@ -132,7 +132,9 @@
boolean inheritable = object.getType() != PortalObject.TYPE_CONTEXT;
boolean inherited = !object.getDeclaredProperties().containsKey(name);
String value = object.getProperty(name);
- return new ControlPropertyBean(this, info.getPropertyInfo(name), inherited, inheritable, value);
+ ControlPropertyBean bean = new ControlPropertyBean(this, info.getPropertyInfo(name), inherited, inheritable, value);
+ bean.setBeanContext(getBeanContext()); // propagate bean context to chilren beans
+ return bean;
}
public ControlPropertyBean getPageControlAccessDenied()
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,28 +1,31 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
package org.jboss.portal.core.admin.ui;
import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.faces.gui.ManagedBean;
import javax.faces.event.ValueChangeEvent;
@@ -43,6 +46,20 @@
super(container, info, inherited, inheritable, value);
//
this.container = container;
+ setValidator(new DefaultPropertyValidator()
+ {
+ @Override
+ public String doSimpleChecks(String name)
+ {
+ return name; // no-op as we want to allow / and . in paths
+ }
+
+ @Override
+ public ParameterValidation.ValidationErrorHandler getValidationErrorHandler(String name, String targetForErrorMessage)
+ {
+ return new MessageValidationHandler(null, targetForErrorMessage, name, getObjectTypeName(), ManagedBean.INVALID_PATH);
+ }
+ });
}
public void setInherited(boolean inherited)
@@ -69,7 +86,9 @@
public void setValue(Object value)
{
- if (!inherited)
+ // it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
+ String propertyValue = checkNameValidity(value.toString(), null);
+ if (propertyValue != null && !inherited)
{
this.value = value.toString();
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -45,7 +45,7 @@
import org.jboss.portal.core.model.portal.PortalObjectPermission;
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.faces.component.portlet.PortletEventEvent;
-import org.jboss.portal.faces.gui.JSFBeanContext;
+import org.jboss.portal.faces.gui.BeanContext;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
@@ -168,6 +168,8 @@
/** . */
private transient Boolean maximizedStateExists;
+ private transient BeanContext beanContext;
+
// Wired services
public String getNamespace()
@@ -180,6 +182,16 @@
this.namespace = namespace;
}
+ public BeanContext getBeanContext()
+ {
+ return beanContext;
+ }
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
public List getAvailableContentTypes()
{
LinkedList<SelectItem> types = new LinkedList<SelectItem>();
@@ -655,20 +667,20 @@
{
if (pageManager == null)
{
- // it'd be better if propertyAction was injected in faces-config.xml so that we can also inject the shared beanContext
pageManager = new PageManagerBean(layoutService, portletDefinitionInvoker);
- pageManager.setBeanContext(new JSFBeanContext());
+ pageManager.setBeanContext(beanContext);
}
pageManager.page = (Page)selectedObject;
}
//
selectedProperties = new PropertiesBean(this);
+ selectedProperties.setBeanContext(beanContext);
controlProperties = new ControlPropertiesBean(this);
+ controlProperties.setBeanContext(beanContext);
- // it'd be better if propertyAction was injected in faces-config.xml so that we can also inject the shared beanContext
propertyAction = new PropertyAction(this);
- propertyAction.setBeanContext(new JSFBeanContext());
+ propertyAction.setBeanContext(beanContext);
//
theme = new ThemeBean(selectedObject);
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBean.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,17 +22,18 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.faces.gui.ManagedBean;
+
import javax.faces.context.FacesContext;
-import org.jboss.portal.core.model.portal.PortalObject;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
* @version $Revision$
*/
-public class PropertyBean implements Comparable
+public class PropertyBean extends ManagedBean implements Comparable
{
/** . */
@@ -103,23 +104,28 @@
public void setValue(Object value)
{
- this.value = value.toString();
+ // it's currently quite difficult to retrieve the correct target for error messages, send them to "status"
+ String propertyValue = checkNameValidity(value.toString(), null);
+ if (propertyValue != null)
+ {
+ this.value = propertyValue;
- // Need to use the container as it will contain the refreshed object
- PortalObject portalObject = container.getRelatedObject();
+ // Need to use the container as it will contain the refreshed object
+ PortalObject portalObject = container.getRelatedObject();
- //if value is inherited check if updated value is the same - if yes, don't update to keep inheritance
- if (isInherited())
- {
- String parentValue = portalObject.getProperty(getName());
- if (value.equals(parentValue))
+ //if value is inherited check if updated value is the same - if yes, don't update to keep inheritance
+ if (isInherited())
{
- return;
+ String parentValue = portalObject.getProperty(getName());
+ if (value.equals(parentValue))
+ {
+ return;
+ }
}
+
+ //
+ portalObject.setDeclaredProperty(getName(), propertyValue);
}
-
- //
- portalObject.setDeclaredProperty(getName(), value.toString());
}
public int compareTo(Object o)
@@ -142,4 +148,14 @@
{
return "PropertyBean[name=" + info.getName() + ",value=" + value + "]";
}
+
+ protected String getObjectTypeName()
+ {
+ return "PROPERTY_TYPE";
+ }
+
+ public boolean isAlreadyExisting(String objectName)
+ {
+ return false; // no need to check for duplicates here
+ }
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBeanContainer.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBeanContainer.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/PropertyBeanContainer.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -23,6 +23,7 @@
package org.jboss.portal.core.admin.ui;
import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.faces.gui.BeanContext;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -30,7 +31,18 @@
*/
public abstract class PropertyBeanContainer
{
+ private BeanContext beanContext;
+ public BeanContext getBeanContext()
+ {
+ return beanContext;
+ }
+
+ public void setBeanContext(BeanContext beanContext)
+ {
+ this.beanContext = beanContext;
+ }
+
public abstract PortalObject getRelatedObject();
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/main/org/jboss/portal/core/admin/ui/actions/CreateInstanceAction.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -42,15 +42,12 @@
*/
public class CreateInstanceAction extends ManagedBean
{
-
- /** . */
private String instanceId;
- /** . */
private PortletManagerBean portletMgr;
- /** . */
private InstanceManagerBean instanceMgr;
+
private static final String MESSAGE_TARGET = "add_instance_form:instanceId";
protected static final String INSTANCE_TYPE = "INSTANCE_TYPE";
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -325,7 +325,8 @@
COORDINATION_PARAMETER=parameter binding
COORDINATION_ALIAS=alias binding
-INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
+INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '/', '.', '\\', '<', '>', '(', ')', '=' or '%5c'
+INVALID_PATH_ERROR=''{0}'' is an invalid {1} path: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
NO_SELECTED_PORTLET_ERROR=No portlet was selected!
DUPLICATE_ERROR=A {1} named ''{0}'' already exists!
bean_support_unexpected_error=Unexpected error:
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_de.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_de.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_de.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -70,7 +70,6 @@
DESCRIPTION=Beschreibung
REMOTE=Remote
REMOTABLE=Remote-f\u00e4hig
-ACTIONS=Aktionen
CREATE_INSTANCE=Instanz erstellen
PORTLET_DEFINITIONS=Portlet-Definitionen
DETAILS=Details
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_it.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -325,7 +325,7 @@
COORDINATION_PARAMETER=collegamento al parametro
COORDINATION_ALIAS=collegamento all'alias
-INVALID_NAME_ERROR=''{0}'' non \u00e8 un nome valido per {1}: Non pu\u00f2 essere null, vuoto o contenere '\\', '<', '>', '(', ')', '=' o '%5c'
+INVALID_NAME_ERROR=''{0}'' non \u00e8 un nome valido per {1}: Non pu\u00f2 essere null, vuoto o contenere '/', '.', '\\', '<', '>', '(', ')', '=' o '%5c'
NO_SELECTED_PORTLET_ERROR=Non \u00e8 stata selezionata nessuna portlet!
DUPLICATE_ERROR=Esiste gi\u00e0 un {1} chiamato ''{0}''!
bean_support_unexpected_error=Errore inatteso:
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -325,7 +325,7 @@
COORDINATION_PARAMETER=parameter binding
COORDINATION_ALIAS=alias binding
-INVALID_NAME_ERROR=''{0}'' \u00e9 um nome de {1} inv\u00e1lido\: N\u00e3o pode ser nulo, vazio, ou que contenha '\\', '<', '>', '(', ')', '=' ou '%5c'
+INVALID_NAME_ERROR=''{0}'' \u00e9 um nome de {1} inv\u00e1lido\: N\u00e3o pode ser nulo, vazio, ou que contenha '/', '.', '\\', '<', '>', '(', ')', '=' ou '%5c'
NO_SELECTED_PORTLET_ERROR=Nenhum portlet foi selecionado!
DUPLICATE_ERROR=O {1} denominado ''{0}'' j\u00e1 existe\!
bean_support_unexpected_error=Erro inesperado:
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -103,6 +103,11 @@
<property-name>coordinationService</property-name>
<value>#{applicationScope.CoordinationService}</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>portalAction</managed-bean-name>
@@ -128,7 +133,7 @@
</managed-property>
<managed-property>
<property-name>messageTarget</property-name>
- <value>addPageForm:pageName</value>
+ <value>create-page-form:pageName</value>
</managed-property>
<managed-property>
<property-name>listener</property-name>
@@ -182,6 +187,11 @@
<property-name>domainConfigurator</property-name>
<value>#{applicationScope.AuthorizationDomainRegistry.portalobject.configurator}</value>
</managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
</managed-bean>
<!-- The instance manager managed bean -->
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -121,4 +121,6 @@
public static final String CMS_DATE_PATTERN = "CMS_DATE_PATTERN";
public static final String DATE_FORMAT = "dateFormat";
+
+ public static final String CMS_INVALID_PARAMETER = "CMS_INVALID_PARAMETER";
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -48,7 +48,6 @@
import org.jboss.portal.cms.workflow.CMSWorkflowUtil;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.core.cms.command.StreamContentCommand;
-import org.jboss.portal.core.cms.ui.Util;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.identity.AnonymousRole;
import org.jboss.portal.identity.IdentityException;
@@ -62,7 +61,6 @@
import org.jboss.portal.search.impl.jcr.JCRQuery;
import org.jboss.portal.search.impl.jcr.JCRQueryConverter;
import org.jboss.portal.security.PortalPermission;
-import org.jboss.portal.server.ParameterSanitizer;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.workflow.WorkflowException;
@@ -108,8 +106,13 @@
private ApprovePublish approvePublish;
private AuthorizationManager authorizationManager;
private ResourceBundle resources = null;
- private static final Pattern CHECK_FOR_XSS_PATTERN = Pattern.compile("[^<>\\(\\)=]*");
+
+ private static final Pattern CHECK_FOR_XSS_PATTERN = ParameterValidation.XSS_CHECK;
private static final String SLASH = "/";
+ private static final String INVALID_TITLE = "__INVALID_TITLE__";
+ private static final String INVALID_DESCRIPTION = "__INVALID_DESCRIPTION__";
+ private static final String INVALID_LANG = "__INVALID_LANG__";
+ private static final String ERROR_MESSAGE = "error:message";
public void init() throws PortletException
@@ -238,13 +241,13 @@
String sPath = rReq.getParameter("path");
if (sPath != null)
{
- sPath = ParameterSanitizer.sanitizeFromPattern(sPath, CHECK_FOR_XSS_PATTERN, SLASH);
+ sPath = ParameterValidation.sanitizeFromPattern(sPath, CHECK_FOR_XSS_PATTERN, SLASH);
}
String sNavPath = rReq.getParameter("navpath");
if (sNavPath != null)
{
- sNavPath = ParameterSanitizer.sanitizeFromPattern(sNavPath, CHECK_FOR_XSS_PATTERN, SLASH);
+ sNavPath = ParameterValidation.sanitizeFromPattern(sNavPath, CHECK_FOR_XSS_PATTERN, SLASH);
}
if (op == null)
@@ -333,10 +336,10 @@
rRes.setContentType("text/html");
rReq.setAttribute("createpath", sPath);
- String parameter = rReq.getParameter("error:message");
+ String parameter = rReq.getParameter(ERROR_MESSAGE);
if (parameter != null)
{
- rReq.setAttribute("error:message", parameter);
+ rReq.setAttribute(ERROR_MESSAGE, parameter);
}
parameter = rReq.getParameter("error:newcollectionname");
if (parameter != null)
@@ -553,7 +556,7 @@
rRes.setContentType("text/html");
rReq.setAttribute("currpath", sPath);
String language = rReq.getParameter("language");
- ParameterSanitizer.sanitizeFromPattern(language, CHECK_FOR_XSS_PATTERN, "en");
+ ParameterValidation.sanitizeFromPattern(language, CHECK_FOR_XSS_PATTERN, "en");
rReq.setAttribute("language", language);
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/editbinary.jsp");
prd.include(rReq, rRes);
@@ -614,10 +617,10 @@
{
rReq.setAttribute("error:filename", parameter);
}
- parameter = rReq.getParameter("error:message");
+ parameter = rReq.getParameter(ERROR_MESSAGE);
if (parameter != null)
{
- rReq.setAttribute("error:message", parameter);
+ rReq.setAttribute(ERROR_MESSAGE, parameter);
}
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/create.jsp");
@@ -626,7 +629,7 @@
else if (CMSAdminConstants.OP_EDIT.equals(op))
{
String sLanguage = rReq.getParameter("language");
- ParameterSanitizer.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, "en");
+ ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, "en");
String sVersion = rReq.getParameter("version");
@@ -677,6 +680,7 @@
rReq.setAttribute("language", sLanguage);
rReq.setAttribute("title", file.getContent().getTitle());
rReq.setAttribute("description", file.getContent().getDescription());
+ rReq.setAttribute(ERROR_MESSAGE, rReq.getParameter(ERROR_MESSAGE));
javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/edit.jsp");
prd.include(rReq, rRes);
@@ -708,7 +712,7 @@
else if (CMSAdminConstants.OP_EXPORTARCHIVE_PICKUP.equals(op))
{
String sPickupFile = rReq.getParameter("filepath");
- ParameterSanitizer.sanitizeFromPattern(sPickupFile, CHECK_FOR_XSS_PATTERN, SLASH);
+ ParameterValidation.sanitizeFromPattern(sPickupFile, CHECK_FOR_XSS_PATTERN, SLASH);
rRes.setContentType("text/html");
PortletRequestDispatcher prd = null;
@@ -940,7 +944,7 @@
aRes.setRenderParameter("path", aReq.getParameter("destination"));
//used to remember the data already submitted by the user
- aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FOLDERNAME_INVALID);
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_FOLDERNAME_INVALID);
aRes.setRenderParameter("error:newcollectionname", aReq.getParameter("newcollectionname"));
aRes.setRenderParameter("error:newcollectiondescription", aReq.getParameter("newcollectiondescription"));
@@ -962,7 +966,7 @@
aRes.setRenderParameter("path", aReq.getParameter("destination"));
//used to remember the data already submitted by the user
- aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FOLDERNAME_INVALID);
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_FOLDERNAME_INVALID);
aRes.setRenderParameter("error:newcollectionname", aReq.getParameter("newcollectionname"));
aRes.setRenderParameter("error:newcollectiondescription", aReq.getParameter("newcollectiondescription"));
}
@@ -978,16 +982,15 @@
String sTitle = "";
String sLanguage = "";
List fileItems = upload.parseRequest(aReq);
- Iterator itr = fileItems.iterator();
- while (itr.hasNext())
+ for (Object fileItem : fileItems)
{
- FileItem item = (FileItem)itr.next();
+ FileItem item = (FileItem)fileItem;
// check if the current item is a form field or an uploaded file
if (!item.isFormField())
{
String sFilename = item.getName();
- sFilename = ParameterSanitizer.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
+ sFilename = ParameterValidation.sanitizeFromPattern(sFilename, CHECK_FOR_XSS_PATTERN, "");
if (!"".equals(sFilename))
{
@@ -1019,8 +1022,12 @@
String sBasePath = FileUtil.cleanDoubleSlashes(sPath + SLASH + sFilename);
file.setBasePath(sBasePath);
+ sTitle = ParameterValidation.sanitizeFromPattern(sTitle, CHECK_FOR_XSS_PATTERN, "");
content.setTitle(sTitle);
+
+ sDescription = ParameterValidation.sanitizeFromPattern(sDescription, CHECK_FOR_XSS_PATTERN, "");
content.setDescription(sDescription);
+
content.setBasePath(sBasePath + SLASH + new Locale(sLanguage));
content.setBytes(item.get());
file.setContent(new Locale(sLanguage), content);
@@ -1051,7 +1058,7 @@
{
String fieldName = item.getFieldName();
String itemValue = item.getString(aReq.getCharacterEncoding());
- itemValue = ParameterSanitizer.sanitizeFromPattern(itemValue, CHECK_FOR_XSS_PATTERN, "");
+ itemValue = ParameterValidation.sanitizeFromPattern(itemValue, CHECK_FOR_XSS_PATTERN, "");
if ("destination".equals(fieldName))
{
sPath = itemValue;
@@ -1079,7 +1086,8 @@
}
else if (CMSAdminConstants.OP_DOSEARCH.equals(op))
{
- String search = (String)aReq.getParameter("search");
+ String search = aReq.getParameter("search");
+ search = ParameterValidation.sanitizeFromPattern(search, CHECK_FOR_XSS_PATTERN, "");
aRes.setRenderParameter("search", search);
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWSEARCHRESULTS);
@@ -1319,6 +1327,10 @@
{
content.setMimeType("");
}
+
+ sTitle = ParameterValidation.sanitizeFromPattern(sTitle, CHECK_FOR_XSS_PATTERN, "");
+ sDescription = ParameterValidation.sanitizeFromPattern(sDescription, CHECK_FOR_XSS_PATTERN, "");
+
content.setTitle(sTitle);
content.setDescription(sDescription);
content.setBasePath(sBasePath + SLASH + sLanguage);
@@ -1375,8 +1387,14 @@
String sDescription = aReq.getParameter("description");
String sLanguage = aReq.getParameter("language");
+ sFileName = ParameterValidation.sanitizeFromPattern(sFileName, CHECK_FOR_XSS_PATTERN, "");
+ sDirectory = ParameterValidation.sanitizeFromPattern(sDirectory, CHECK_FOR_XSS_PATTERN, SLASH);
+ sTitle = ParameterValidation.sanitizeFromPattern(sTitle, CHECK_FOR_XSS_PATTERN, INVALID_TITLE);
+ sDescription = ParameterValidation.sanitizeFromPattern(sDescription, CHECK_FOR_XSS_PATTERN, INVALID_DESCRIPTION);
+ sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, "en");
+
//Perform server side data validation
- if (sFileName == null || sFileName.trim().length() == 0)
+ if (sFileName == null || INVALID_TITLE.equals(sTitle) || INVALID_DESCRIPTION.equals(sDescription) || sFileName.trim().length() == 0)
{
//Validation Error occurred
//FileName should not be empty
@@ -1386,6 +1404,7 @@
aRes.setRenderParameter("path", sDirectory);
//used to remember the data already submitted by the user
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
aRes.setRenderParameter("error:content", aReq.getParameter("elm1"));
aRes.setRenderParameter("error:description", aReq.getParameter("description"));
aRes.setRenderParameter("error:title", aReq.getParameter("title"));
@@ -1429,11 +1448,11 @@
Boolean bExists = null;
try
{
- if (!CHECK_FOR_XSS_PATTERN.matcher(content.getBasePath()).matches())
- {
- throw new CMSException(content.getBasePath() + " is not a legal path element");
- }
- bExists = (Boolean)CMSService.execute(existsCMD);
+ if (!CHECK_FOR_XSS_PATTERN.matcher(content.getBasePath()).matches())
+ {
+ throw new CMSException(content.getBasePath() + " is not a legal path element");
+ }
+ bExists = (Boolean)CMSService.execute(existsCMD);
}
catch (CMSException cme)
{
@@ -1447,7 +1466,7 @@
aRes.setRenderParameter("path", sDirectory);
//used to remember the data already submitted by the user
- aRes.setRenderParameter("error:message", CMSAdminConstants.CMS_FILENAME_INVALID);
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_FILENAME_INVALID);
aRes.setRenderParameter("error:filename", aReq.getParameter("filename"));
aRes.setRenderParameter("error:content", aReq.getParameter("elm1"));
aRes.setRenderParameter("error:description", aReq.getParameter("description"));
@@ -1480,17 +1499,45 @@
else if (CMSAdminConstants.OP_SAVETEXT.equals(op))
{
String sFilePath = aReq.getParameter("savetopath");
- String sTitle = aReq.getParameter("title");
- String sDescription = aReq.getParameter("description");
- String sLanguage = aReq.getParameter("language");
- String sMakeLive = "off";
- if (aReq.getParameterValues("makelive") != null)
+ if (!"".equals(sFilePath) && CHECK_FOR_XSS_PATTERN.matcher(sFilePath).matches())
{
- sMakeLive = "on";
- }
+ String sTitle = aReq.getParameter("title");
+ String sDescription = aReq.getParameter("description");
+ String sLanguage = aReq.getParameter("language");
- if (!"".equals(sFilePath) && CHECK_FOR_XSS_PATTERN.matcher(sFilePath).matches())
- {
+ // check title and description for XSS injection... If one found, re-display page with old values
+ sTitle = ParameterValidation.sanitizeFromPattern(sTitle, CHECK_FOR_XSS_PATTERN, INVALID_TITLE);
+ boolean invalidTitle = INVALID_TITLE.equals(sTitle);
+
+ sDescription = ParameterValidation.sanitizeFromPattern(sDescription, CHECK_FOR_XSS_PATTERN, INVALID_DESCRIPTION);
+ boolean invalidDesc = INVALID_DESCRIPTION.equals(sDescription);
+
+ sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, INVALID_LANG);
+ boolean invalidLang = INVALID_LANG.equals(sLanguage);
+ if(invalidLang)
+
+ if (invalidTitle || invalidDesc || invalidLang)
+ {
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_EDIT);
+
+ // output error message
+ aRes.setRenderParameter(ERROR_MESSAGE, CMSAdminConstants.CMS_INVALID_PARAMETER);
+
+ aRes.setRenderParameter("path", aReq.getParameter("savetopath"));
+ aRes.setRenderParameter("language", aReq.getParameter("language"));
+
+ return;
+ }
+
+ Locale locale = new Locale(sLanguage);
+
+ String sMakeLive = "off";
+ if (aReq.getParameterValues("makelive") != null)
+ {
+ sMakeLive = "on";
+ }
+
+
String sContent = aReq.getParameter("elm1");
File file = new FileImpl();
@@ -1511,9 +1558,9 @@
content.setTitle(sTitle);
content.setDescription(sDescription);
- content.setBasePath(sFilePath + SLASH + new Locale(sLanguage).getLanguage());
+ content.setBasePath(sFilePath + SLASH + locale.getLanguage());
content.setBytes(sContent.getBytes());
- file.setContent(new Locale(sLanguage), content);
+ file.setContent(locale, content);
boolean bMakeLive = false;
if ("on".equalsIgnoreCase(sMakeLive))
@@ -1542,6 +1589,7 @@
{
String sTarget = aReq.getParameter("destination");
String sLanguage = aReq.getParameter("language");
+ sLanguage = ParameterValidation.sanitizeFromPattern(sLanguage, CHECK_FOR_XSS_PATTERN, "en");
if (sTarget != null)
{
@@ -1721,6 +1769,7 @@
{
String path = aReq.getParameter("path");
String language = aReq.getParameter("language");
+ language = ParameterValidation.sanitizeFromPattern(language, CHECK_FOR_XSS_PATTERN, "en");
String version = aReq.getParameter("version");
//Perform the change in live version here
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -143,6 +143,7 @@
CMS_FILENAME_INVALID=File Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '>', ,'<', '(', ')', '|' or any whitespace character.
CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '>', ,'<', '(', ')', '|' or any whitespace character.
+CMS_INVALID_PARAMETER=A value below is invalid. It may not contain illegal characters such as '\\', '<', '>', '(', ')', '=' or '%5c'.
CMS_MSG_DESTINATION_ALREADY_EXISTS=The command was not performed, because the destination already exists.
CMS_CANT_MOVE_SAME_DESTINATION=You cannot move a folder to the same location
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -32,23 +32,23 @@
CMS_CANCEL = Annuler
-CMS_CONTENT_DIR = R\u00E9pertoire de contenu
+CMS_CONTENT_DIR = R\u00e9pertoire de contenu
-CMS_CONTENT_DIR_USE = Utilisez l'arborescence des dossiers afin de parcourir la structure du r\u00E9pertoire.
+CMS_CONTENT_DIR_USE = Utilisez l'arborescence des dossiers afin de parcourir la structure du r\u00e9pertoire.
CMS_COPY = Copier
-CMS_CREATE = Cr\u00E9er
+CMS_CREATE = Cr\u00e9er
-CMS_CREATED = Cr\u00E9\u00E9
+CMS_CREATED = Cr\u00e9\u00e9
-CMS_CREATED_BY = Cr\u00E9\u00E9 par
+CMS_CREATED_BY = Cr\u00e9\u00e9 par
-CMS_CREATEFILE = Cr\u00E9er un fichier
+CMS_CREATEFILE = Cr\u00e9er un fichier
-CMS_CREATEFILEINDIR = Cr\u00E9er un fichier dans le dossier
+CMS_CREATEFILEINDIR = Cr\u00e9er un fichier dans le dossier
-CMS_CREATEFOLDER = Cr\u00E9er un dossier
+CMS_CREATEFOLDER = Cr\u00e9er un dossier
CMS_DELETE = Supprimer
@@ -56,7 +56,7 @@
CMS_DELETEWARN1 = ATTENTION ! Vous ne pourrez pas annuler cette action.
-CMS_DELETEWARN2 = \u00CAtes vous certain de vouloir supprimer cette ressource ?
+CMS_DELETEWARN2 = \u00cates vous certain de vouloir supprimer cette ressource ?
CMS_DENY = Refuser
@@ -78,35 +78,35 @@
CMS_LANGUAGE = Langue
-CMS_LIVE = Diffusion imm\u00E9diate
+CMS_LIVE = Diffusion imm\u00e9diate
CMS_LIVEVERSION = Version en ligne
-CMS_MAIN_USE = Utilisez le portlet d'administration du CMS afin de modifier le contenu de votre r\u00E9pertoire.
+CMS_MAIN_USE = Utilisez le portlet d'administration du CMS afin de modifier le contenu de votre r\u00e9pertoire.
-CMS_MANAGE = G\u00E9rer le contenu
+CMS_MANAGE = G\u00e9rer le contenu
CMS_MENU = Menu action
-CMS_MODIFIED = Derni\u00E8re modification
+CMS_MODIFIED = Derni\u00e8re modification
CMS_MODIFY = Modifier
-CMS_MOVE = D\u00E9placer
+CMS_MOVE = D\u00e9placer
CMS_NAME = Nom
CMS_PATH = Emplacement
-CMS_PREVIEW = Pr\u00E9visualiser
+CMS_PREVIEW = Pr\u00e9visualiser
-CMS_RESET = R\u00E9initialiser
+CMS_RESET = R\u00e9initialiser
CMS_SEARCH = Rechercher
-CMS_SEARCHNORESULT = Aucun r\u00E9sultat pour cette recherche
+CMS_SEARCHNORESULT = Aucun r\u00e9sultat pour cette recherche
-CMS_SECURE = S\u00E9curiser
+CMS_SECURE = S\u00e9curiser
CMS_SIZE = Taille
@@ -118,23 +118,23 @@
CMS_TYPE = Type
-CMS_UPLOAD = T\u00E9l\u00E9d\u00E9verser
+CMS_UPLOAD = T\u00e9l\u00e9d\u00e9verser
-CMS_UPLOADARCHIVE = T\u00E9l\u00E9d\u00E9verser une archive
+CMS_UPLOADARCHIVE = T\u00e9l\u00e9d\u00e9verser une archive
CMS_VERSION = Version
CMS_VIEW = Visualiser
-CMS_WYSIWYG = \u00C9diteur visuel WYSIWYG
+CMS_WYSIWYG = \u00c9diteur visuel WYSIWYG
TITLE_BROWSE = Navigateur de dossiers
TITLE_COPYCONFIRM = Confirmer la copie
-TITLE_CREATE = Cr\u00E9er un fichier
+TITLE_CREATE = Cr\u00e9er un fichier
-TITLE_CREATECOLLCONFIRM = Confirmer la cr\u00E9ation d'un r\u00E9pertoire
+TITLE_CREATECOLLCONFIRM = Confirmer la cr\u00e9ation d'un r\u00e9pertoire
TITLE_DELETECONFIRM = Confirmer la suppression
@@ -145,17 +145,19 @@
## CMS ADMIN PORTLET
TITLE_HEAD = Administration du CMS
-TITLE_MOVECONFIRM = Confirmer le d\u00E9placement
+TITLE_MOVECONFIRM = Confirmer le d\u00e9placement
-TITLE_SECURECONFIRM = S\u00E9curiser le noeud
+TITLE_SECURECONFIRM = S\u00e9curiser le noeud
-TITLE_UPLOAD = T\u00E9l\u00E9d\u00E9verser un fichier
+TITLE_UPLOAD = T\u00e9l\u00e9d\u00e9verser un fichier
-TITLE_VIEWFILE = Propri\u00E9t\u00E9s du fichier
+TITLE_VIEWFILE = Propri\u00e9t\u00e9s du fichier
-CMS_ACCESS_DENIED=Acc\u00E9s interdit
-CMS_ACCESS_DENIED_DESCRIPTION=Vous n'\u00eates pas autoris\u00E9 \u00e0 acc\u00e9der a ce document
-CMS_ACCESS_DENIED_DESCRIPTION_PATH=Vous n'\u00eates pas autoris\u00E9 \u00e0 acc\u00e9der au document
+CMS_ACCESS_DENIED=Acc\u00e9s interdit
+CMS_ACCESS_DENIED_DESCRIPTION=Vous n'\u00eates pas autoris\u00e9 \u00e0 acc\u00e9der a ce document
+CMS_ACCESS_DENIED_DESCRIPTION_PATH=Vous n'\u00eates pas autoris\u00e9 \u00e0 acc\u00e9der au document
-CMS_MISSING_DOCUMENT=404 - Page non trouv\u00E9e
-CMS_MISSING_DOCUMENT_DESCRIPTION=Le document auquel vous avez tent\u00E9 d'acc\u00E9der est introuvable
+CMS_MISSING_DOCUMENT=404 - Page non trouv\u00e9e
+CMS_MISSING_DOCUMENT_DESCRIPTION=Le document auquel vous avez tent\u00e9 d'acc\u00e9der est introuvable
+
+CMS_INVALID_PARAMETER=Une valeur ci-dessous est invalide car elle contient des caract\u00e8rs invalides '\\', '<', '>', '(', ')', '=' ou '%5c'.
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2009-06-04 13:11:14 UTC (rev 13434)
@@ -116,9 +116,7 @@
<%if(errorMessage != null){%>
<tr>
- <td colspan="2">
- <font color="red">${n:i18n("CMS_FILENAME_INVALID")}</font>
- </td>
+ <td><span style="color: red">${n:i18n("CMS_INVALID_PARAMETER")}></span></td>
</tr>
<%}%>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/edit.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/edit.jsp 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/edit.jsp 2009-06-04 13:11:14 UTC (rev 13434)
@@ -21,6 +21,9 @@
String sVersion = (String)request.getAttribute("version");
String sTitle = (String)request.getAttribute("title");
String sDescription = (String)request.getAttribute("description");
+
+ // for error handling
+ String errorMessage = (String)request.getAttribute("error:message");
%>
<!-- tinyMCE -->
@@ -74,8 +77,20 @@
<tr>
<td height="10"></td>
</tr>
+
+ <%
+ if(errorMessage != null)
+ {
+ %>
+ <tr>
+ <td><span style="color: red">${n:i18n("CMS_INVALID_PARAMETER")}></span></td>
+ </tr>
+ <%
+ }
+ %>
<tr>
- <td>
+ <td></td>
+</tr>
<tr>
<td>
<table>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2009-06-04 13:11:14 UTC (rev 13434)
@@ -75,7 +75,7 @@
if (parser.hasMoreTokens())
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="pathItem"><a href="
<portlet:renderURL>
<portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
@@ -89,7 +89,7 @@
else
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="selected"><%= EntityEncoder.FULL.encode(sPathChunk) %>
</li>
<%
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/pending_items.jsp 2009-06-04 13:11:14 UTC (rev 13434)
@@ -43,7 +43,7 @@
if (parser.hasMoreTokens())
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="pathItem"><a href="
<portlet:renderURL>
<portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
@@ -57,7 +57,7 @@
else
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="selected"><%= sPathChunk %>
</li>
<%
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2009-06-04 13:11:14 UTC (rev 13434)
@@ -72,7 +72,7 @@
if (parser.hasMoreTokens())
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="pathItem"><a href="
<portlet:renderURL>
<portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
@@ -86,7 +86,7 @@
else
{
%>
- <li class="pathSeperator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
+ <li class="pathSeparator"><img src="/portal-admin/img/pathSeparator.png" alt=">"></li>
<li class="selected"><%= EntityEncoder.FULL.encode(sPathChunk) %>
</li>
<%
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/DynamicUserAttribute.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/DynamicUserAttribute.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/DynamicUserAttribute.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui;
-import java.util.HashMap;
-
-import javax.faces.context.FacesContext;
-
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import javax.faces.context.FacesContext;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -42,16 +41,16 @@
/** The managed user bean */
private IdentityUserBean identityUserBean;
-
+
/** The hash map contains all the user attributes */
private HashMap map;
-
+
public DynamicUserAttribute()
{
this.map = new HashMap();
FacesContext ctx = FacesContext.getCurrentInstance();
- this.identityUserBean = (IdentityUserBean) ctx.getApplication().createValueBinding(("#{identityusermgr}"))
- .getValue(ctx);
+ this.identityUserBean = (IdentityUserBean)ctx.getApplication().createValueBinding(("#{identityusermgr}"))
+ .getValue(ctx);
}
public DynamicUserAttribute(String username)
@@ -64,7 +63,7 @@
{
try
{
- return identityUserBean.getPropertyType((String) propertyName);
+ return identityUserBean.getPropertyType((String)propertyName);
}
catch (Exception e)
{
@@ -75,30 +74,34 @@
public PropertyValue getValue(Object propertyName)
{
- Object propertyValue = map.get((String) propertyName);
+ Object propertyValue = map.get(propertyName);
// Trying to fetch user property
if (propertyValue == null)
{
try
{
- propertyValue = identityUserBean.getUserProperty(this.username, (String) propertyName);
+ propertyValue = identityUserBean.getUserProperty(this.username, (String)propertyName);
}
catch (Exception e)
{
// ok on user register
}
}
-
+
return new PropertyValue(identityUserBean.getLocalizedValue((String)propertyName, propertyValue));
}
public boolean setValue(Object propertyName, Object value) throws IllegalArgumentException
{
if (value != null && value instanceof String && ((String)value).trim().length() == 0)
- map.put((String) propertyName, null);
+ {
+ map.put(propertyName, null);
+ }
else
- map.put((String)propertyName, value);
+ {
+ map.put(propertyName, value);
+ }
return true;
}
Copied: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java (from rev 13425, branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java)
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java (rev 0)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/BaseRoleAction.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -0,0 +1,119 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.core.identity.ui.actions;
+
+import org.jboss.portal.core.identity.ui.UIRole;
+import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
+import org.jboss.portal.faces.gui.ManagedBean;
+import org.jboss.portal.identity.IdentityException;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class BaseRoleAction extends ManagedBean
+{
+ /** . */
+ protected UIRole uiRole;
+ /** . */
+ protected IdentityRoleBean identityRoleBean;
+
+ protected final PropertyValidator displayNameValidator = new DisplayNameValidator();
+ private static final String ROLE_DISPLAY_TYPE = "ROLE_DISPLAY_TYPE";
+ private static final String ROLE_TYPE = "ROLE_TYPE";
+
+ protected String getObjectTypeName()
+ {
+ return ROLE_TYPE;
+ }
+
+ public boolean isAlreadyExisting(String objectName)
+ {
+ return isAlreadyExisting(objectName, false);
+ }
+
+ protected boolean isAlreadyExisting(String objectName, boolean isDisplay)
+ {
+ try
+ {
+ if (isDisplay)
+ {
+ return identityRoleBean.getRoleModule().findRoleByDisplayName(objectName) != null;
+ }
+ else
+ {
+ return identityRoleBean.getRoleModule().findRoleByName(objectName) != null;
+ }
+ }
+ catch (IdentityException e)
+ {
+ // due to current design of identity module, findRoleByName throws an exception if the role is not found
+ // instead of returning null as would be traditionally expected... Pb is IdentityException is also used to
+ // wrap HibernateExceptions...
+ if (e.getMessage().contains("No such role"))
+ {
+ // ignore
+ }
+ else
+ {
+ log.error("Error validation rolename", e);
+ beanContext.createErrorMessageFrom(e);
+ }
+ return false;
+ }
+ }
+
+ private class DisplayNameValidator extends DefaultPropertyValidator
+ {
+ public String getObjectTypeName()
+ {
+ return ROLE_DISPLAY_TYPE;
+ }
+
+ public boolean isAlreadyExisting(String propertyName)
+ {
+ return BaseRoleAction.this.isAlreadyExisting(propertyName, true);
+ }
+ }
+
+ public UIRole getUiRole()
+ {
+ return uiRole;
+ }
+
+ public void setUiRole(UIRole uiRole)
+ {
+ this.uiRole = uiRole;
+ }
+
+ public IdentityRoleBean getIdentityRoleBean()
+ {
+ return identityRoleBean;
+ }
+
+ public void setIdentityRoleBean(IdentityRoleBean identityRoleBean)
+ {
+ this.identityRoleBean = identityRoleBean;
+ }
+}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateRoleAction.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -23,52 +23,41 @@
package org.jboss.portal.core.identity.ui.actions;
import org.jboss.portal.core.identity.ui.UIRole;
-import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class CreateRoleAction
+public class CreateRoleAction extends BaseRoleAction
{
-
- /** .*/
- private UIRole uiRole = new UIRole();
-
- /** .*/
- private IdentityRoleBean identityRoleBean;
-
- public UIRole getUiRole()
+ public CreateRoleAction()
{
- return uiRole;
+ uiRole = new UIRole();
}
- public void setUiRole(UIRole uiRole)
+ public String createRole()
{
- this.uiRole = uiRole;
- }
+ String name = this.uiRole.getName();
+ String displayName = this.uiRole.getDisplayName();
+ name = checkNameValidity(name, "create-role-form:rolename");
- public IdentityRoleBean getIdentityRoleBean()
- {
- return identityRoleBean;
- }
+ // check display name validity for XSS injection but check duplicate separately due to limitation to how ManagedBean works
+ displayName = checkNameValidity(displayName, "create-role-form:roledisplayname", displayNameValidator);
- public void setIdentityRoleBean(IdentityRoleBean identityRoleBean)
- {
- this.identityRoleBean = identityRoleBean;
- }
-
- public String createRole()
- {
- try
+ if (name != null && displayName != null)
{
- identityRoleBean.getRoleModule().createRole(this.uiRole.getName(), this.uiRole.getDisplayName());
+ try
+ {
+ identityRoleBean.getRoleModule().createRole(name, displayName);
+ return "roleAdmin";
+ }
+ catch (Exception e)
+ {
+ log.error("An error occurred during role creation", e);
+ beanContext.createErrorMessageFrom(e);
+ }
}
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return "roleAdmin";
- }
+ return null;
+ }
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,18 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-
import org.jboss.logging.Logger;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
@@ -48,6 +36,17 @@
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -57,7 +56,7 @@
/** . */
private List roles = new ArrayList();
-
+
/** . */
private List defaultRoles = null;
@@ -131,7 +130,7 @@
{
this.metaDataService = metaDataService;
}
-
+
public String cancelRegistration()
{
this.uiUser = new IdentityUIUser();
@@ -143,9 +142,11 @@
{
String registrationStatus = "failed";
FacesContext ctx = FacesContext.getCurrentInstance();
- String adminSubscription = (String) ev.getComponent().getId();
+ String adminSubscription = ev.getComponent().getId();
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", ctx.getViewRoot().getLocale());
- if (uiUser.getUsername() != null && uiUser.getPassword() != null)
+ String wUsername = uiUser.getUsername();
+ String wPassword = uiUser.getPassword();
+ if (wUsername != null && wPassword != null)
{
try
{
@@ -162,12 +163,10 @@
else
{
log.warn(User.INFO_USER_REGISTRATION_DATE + " property is mapped in not supported type: "
- + registrationDateClass.toString());
+ + registrationDateClass.toString());
}
// Variables for RegisterService
- String wUsername = uiUser.getUsername();
- String wPassword = uiUser.getPassword();
List wRoles = roles;
Map wProfileMap = this.identityUserBean.getProfileMap(uiUser.getAttribute().getProfileAttributes());
Locale wLocale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
@@ -177,16 +176,16 @@
if (adminSubscription != null && adminSubscription.equals("admin"))
{
registrationStatus = this.registrationService.registerUser(wURL, wUsername, wPassword, wProfileMap, wRoles,
- wLocale, true);
+ wLocale, true);
}
else
{
registrationStatus = this.registrationService.registerUser(wURL, wUsername, wPassword, wProfileMap, wRoles,
- wLocale, false);
+ wLocale, false);
}
}
- catch(CoreIdentityConfigurationException e)
+ catch (CoreIdentityConfigurationException e)
{
registrationStatus = IdentityConstants.REGISTRATION_FAILED;
log.error("", e);
@@ -195,32 +194,32 @@
// cleaning up the user
this.uiUser = new IdentityUIUser();
-
+
if (IdentityConstants.REGISTRATION_PENDING.equals(registrationStatus) && !adminSubscription.equals("admin"))
{
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(bundle.getString("IDENTITY_REGISTER_PENDING_TITLE")));
}
else if (IdentityConstants.REGISTRATION_REGISTERED.equals(registrationStatus) && !adminSubscription.equals("admin"))
{
- FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(bundle.getString("IDENTITY_REGISTER_SUCCESS_TITLE")));
+ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(bundle.getString("IDENTITY_REGISTER_SUCCESS_TITLE")));
}
- else if (adminSubscription.equals("admin") && ! IdentityConstants.REGISTRATION_FAILED.equals(registrationStatus))
+ else if (adminSubscription.equals("admin") && !IdentityConstants.REGISTRATION_FAILED.equals(registrationStatus))
{
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(bundle.getString("IDENTITY_MANAGEMENT_CREATE_USER_CREATED")));
}
else
{
FacesContext.getCurrentInstance().addMessage("status", new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_REGISTRATION"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_REGISTRATION")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_REGISTRATION"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_REGISTRATION")));
}
}
private String getPortalURL()
{
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
- JBossActionRequest request = (JBossActionRequest) ectx.getRequest();
- JBossActionResponse response = (JBossActionResponse) ectx.getResponse();
+ JBossActionRequest request = (JBossActionRequest)ectx.getRequest();
+ JBossActionResponse response = (JBossActionResponse)ectx.getResponse();
ServerInvocationContext invocationContext = request.getControllerContext().getServerInvocation().getServerContext();
PortalNode n = request.getPortalNode();
PortalNodeURL url = response.createRenderURL(n);
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditRoleAction.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,83 +22,70 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
-import java.util.Map;
-
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-
import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.core.identity.ui.UIRole;
-import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
+import org.jboss.portal.identity.IdentityException;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class EditRoleAction
+public class EditRoleAction extends BaseRoleAction
{
- /** .*/
- private String currentRole;
-
- /** .*/
- private UIRole uiRole;
-
- /** .*/
- private IdentityRoleBean identityRoleBean;
-
/** . */
private static final FastURLDecoder decoder = FastURLDecoder.getUTF8Instance();
- public UIRole getUiRole()
- {
- return uiRole;
- }
-
- public void setUiRole(UIRole uiRole)
- {
- this.uiRole = uiRole;
- }
-
- public IdentityRoleBean getIdentityRoleBean()
- {
- return identityRoleBean;
- }
-
- public void setIdentityRoleBean(IdentityRoleBean identityRoleBean)
- {
- this.identityRoleBean = identityRoleBean;
- }
-
public String editRole()
{
- FacesContext ctx = FacesContext.getCurrentInstance();
- ExternalContext ectx = ctx.getExternalContext();
- Map params = ectx.getRequestParameterMap();
- this.currentRole = params.get("currentRole") != null ? decoder.encode((String) params.get("currentRole")) : null;
+ String currentRole = beanContext.getParameter("currentRole");
+ currentRole = (currentRole != null ? decoder.encode(currentRole) : null);
try
{
- this.uiRole = identityRoleBean.getUIRole(this.currentRole);
+ this.uiRole = identityRoleBean.getUIRole(currentRole);
return "editRole";
}
catch (Exception e)
{
- e.printStackTrace();
+ log.error("Couldn't edit role " + currentRole, e);
+ beanContext.createErrorMessageFrom(e);
}
return "roleAdmin";
}
public String updateRole()
{
+ String roleDisplayName = this.uiRole.getDisplayName();
+
+ // Check that the new role is different from the old one
try
{
- identityRoleBean.updateRoleDisplayName(this.uiRole.getName(), this.uiRole.getDisplayName());
+ String roleName = uiRole.getName();
+ UIRole current = identityRoleBean.getUIRole(roleName);
+ if (!isOldAndNewDifferent(current.getDisplayName(), roleDisplayName))
+ {
+ // if the new and old display names are the same, just return
+ return "roleAdmin";
+ }
}
- catch (Exception e)
+ catch (IdentityException e)
{
- e.printStackTrace();
+ log.error("Couldn't get current role " + roleDisplayName);
}
- return "roleAdmin";
- }
+ roleDisplayName = checkNameValidity(roleDisplayName, "edit-role-link:display-name", displayNameValidator); // display names are unique as well
+ if (roleDisplayName != null)
+ {
+ try
+ {
+ identityRoleBean.updateRoleDisplayName(this.uiRole.getName(), roleDisplayName);
+ return "roleAdmin";
+ }
+ catch (Exception e)
+ {
+ beanContext.createErrorMessageFrom(e);
+ }
+ }
+ return null;
+ }
}
Deleted: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/RoleValidator.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/RoleValidator.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/RoleValidator.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,88 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.core.identity.ui.validators;
-
-import java.util.ResourceBundle;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import javax.portlet.PortletContext;
-
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-
-public class RoleValidator implements Validator
-{
- /** The role module */
- private RoleModule roleModule;
-
- /** The logger */
- private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(RoleValidator.class);
-
- public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
- {
- String rolename = (String) value;
- ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", context.getViewRoot().getLocale());
- PortletContext portletContext = (PortletContext) context.getExternalContext().getContext();
- roleModule = (RoleModule) portletContext.getAttribute("RoleModule");
-
- try
- {
- @SuppressWarnings("unused")
- Role u = roleModule.findRoleByName(rolename);
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN")));
- }
- catch (IllegalArgumentException e)
- {
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR")));
- }
- catch (IdentityException e)
- {
- // TODO: Throw a catchable error
- if (e.getMessage().contains("No such role"))
- {
- // ignore
- }
- else
- {
- log.error("Error validation rolename", e);
- throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR")));
- }
- }
- }
-}
Copied: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UserAttributeValidator.java (from rev 13425, branches/Enterprise_Portal_Platform_4_3/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UserAttributeValidator.java)
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UserAttributeValidator.java (rev 0)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UserAttributeValidator.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -0,0 +1,66 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.core.identity.ui.validators;
+
+import org.jboss.portal.common.util.ParameterValidation;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class UserAttributeValidator implements Validator
+{
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
+ {
+ ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", context.getViewRoot().getLocale());
+ ParameterValidation.sanitizeFromPatternWithHandler((String)value, ParameterValidation.XSS_CHECK,
+ new ValidatorExceptionErrorHandler("", bundle));
+ }
+
+ private class ValidatorExceptionErrorHandler extends ParameterValidation.ValidationErrorHandler
+ {
+ private ResourceBundle bundle;
+
+ ValidatorExceptionErrorHandler(String defaultValue, ResourceBundle bundle)
+ {
+ super(defaultValue);
+ this.bundle = bundle;
+ }
+
+ protected String internalValidationErrorHandling(String value)
+ {
+ String message = bundle.getString("INVALID_VALUE_ERROR");
+ message = MessageFormat.format(message, value);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
+ }
+ }
+}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -22,21 +22,24 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.validators;
-import java.util.ResourceBundle;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.core.identity.services.metadata.CoreIdentityConfigurationException;
+import org.jboss.portal.core.identity.services.workflow.RegistrationService;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.portlet.PortletContext;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+import java.util.regex.Pattern;
-import org.jboss.portal.core.identity.services.metadata.CoreIdentityConfigurationException;
-import org.jboss.portal.core.identity.services.workflow.RegistrationService;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.NoSuchUserException;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
@@ -46,7 +49,7 @@
{
/** The username regex */
// private static final String NICKNAME_VALIDATION = "^[a-zA-Z]([a-zA-Z0-9]+(([\\.\\-\\_]?[a-zA-Z0-9]+)+)?)";
-
+
/** The user module */
private UserModule userModule;
@@ -56,14 +59,20 @@
/** The logger */
private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(UsernameValidator.class);
+ // same as ParameterValidation.XSS_CHECK but with \ allowed for directory access...
+ private final Pattern USER_NAME_XSS_CHECK = Pattern.compile("([^<>(\\)=\\\\](?<!%5C))*", Pattern.CASE_INSENSITIVE);
+
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
- String username = (String) value;
ResourceBundle bundle = ResourceBundle.getBundle("conf.bundles.Identity", context.getViewRoot().getLocale());
- PortletContext portletContext = (PortletContext) context.getExternalContext().getContext();
- userModule = (UserModule) portletContext.getAttribute("UserModule");
- registrationService = (RegistrationService) portletContext.getAttribute("RegistrationService");
+ String username = ParameterValidation.sanitizeFromPatternWithHandler((String)value, USER_NAME_XSS_CHECK,
+ new ValidatorExceptionErrorHandler("", bundle));
+ PortletContext portletContext = (PortletContext)context.getExternalContext().getContext();
+ userModule = (UserModule)portletContext.getAttribute("UserModule");
+ registrationService = (RegistrationService)portletContext.getAttribute("RegistrationService");
+
+
// if (username.length() >= 5 && (Pattern.matches(NICKNAME_VALIDATION, username)))
if (username.contains("<") || username.contains(">") || username.contains("\"") || username.contains("\'"))
{
@@ -77,15 +86,15 @@
if (registrationService.checkUsername(username))
{
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")));
}
User u = userModule.findUserByUserName(username);
// User found so this nickname is already taken
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN")));
}
catch (NoSuchUserException e)
{
@@ -94,22 +103,41 @@
catch (IllegalArgumentException e)
{
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
catch (IdentityException e)
{
log.error("Error validation username", e);
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
catch (CoreIdentityConfigurationException e)
{
log.error("Error validation username", e);
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
- bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR"),
+ bundle.getString("IDENTITY_VALIDATION_ERROR_USERNAME_ERROR")));
}
}
+
+ private class ValidatorExceptionErrorHandler extends ParameterValidation.ValidationErrorHandler
+ {
+ private ResourceBundle bundle;
+
+ ValidatorExceptionErrorHandler(String defaultValue, ResourceBundle bundle)
+ {
+ super(defaultValue);
+ this.bundle = bundle;
+ }
+
+ protected String internalValidationErrorHandling(String s)
+ {
+ String message = bundle.getString("IDENTITY_VALIDATION_ERROR_INVALID_USERNAME");
+ message = MessageFormat.format(message, s);
+ throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
+ }
+ }
+
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -116,7 +116,6 @@
IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Assigned roles
IDENTITY_MANAGEMENT_CREATE_ROLE=Create new role
IDENTITY_MANAGEMENT_EDIT_ROLE=Edit role
-IDENTITY_MANAGEMENT_CREATE_ROLE=Create role
IDENTITY_MANAGEMENT_DISABLE=Disable
IDENTITY_MANAGEMENT_DISABLE_USER_DISABLED=User disabled
IDENTITY_MANAGEMENT_ENABLE=Enable
@@ -171,14 +170,19 @@
IDENTITY_VALIDATION_ERROR_REGISTRATION=Failed to register user.
IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN=This username is already taken.
IDENTITY_VALIDATION_ERROR_USERNAME_ERROR=Error while validating the username.
-IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN=This role name is already taken.
-IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR=Error while validating the role name.
+IDENTITY_VALIDATION_ERROR_INVALID_USERNAME=''{0}'' is an invalid username: Cannot be null, empty or contain '<', '>', '(', ')', '=' or '%5c'
IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH=The passwords doesn't match.
IDENTITY_VALIDATION_ERROR_PASSWORD_ERROR=Error while validating password.
IDENTITY_VALIDATION_ERROR_INVALID_EMAIL=Invalid E-Mail address.
IDENTITY_VALIDATION_ERROR_INVALID_PASSWORD=Invalid password
IDENTITY_VALIDATION_ERROR_CAPTCHA_INCORRECT=Captcha incorrect
+ROLE_TYPE=role
+ROLE_DISPLAY_TYPE=role display
+INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '/', '.', '\\', '<', '>', '(', ')', '=' or '%5c'
+INVALID_VALUE_ERROR=''{0}'' is an invalid value: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
+DUPLICATE_ERROR=A {1} named ''{0}'' already exists!
+
# Example usage for dynamic values
IDENTITY_DYNAMIC_VALUE_TEST=test label
IDENTITY_DYNAMIC_VALUE_TEST2=test label2
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_fr.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_fr.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_fr.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -24,7 +24,7 @@
IDENTITY_AIM = Identifiant AIM
-IDENTITY_APPLICATION_NOT_AVAILABLE = Portlet non disponible. V\u00E9rifiez votre configuration et les journaux syst\u00E8me pour plus d'information.
+IDENTITY_APPLICATION_NOT_AVAILABLE = Portlet non disponible. V\u00e9rifiez votre configuration et les journaux syst\u00e8me pour plus d'information.
IDENTITY_BUTTON_CANCEL = Annuler
@@ -32,19 +32,19 @@
IDENTITY_BUTTON_SUBMIT = Soumettre
-IDENTITY_CATEGORY_ADDITIONAL = Information compl\u00E9mentaire
+IDENTITY_CATEGORY_ADDITIONAL = Information compl\u00e9mentaire
-IDENTITY_CATEGORY_ADDITIONAL_EXTRA = (255 caract\u00E8res max.)
+IDENTITY_CATEGORY_ADDITIONAL_EXTRA = (255 caract\u00e8res max.)
-IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE = (Signature de 255 caract\u00E8res max)
+IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE = (Signature de 255 caract\u00e8res max)
-IDENTITY_CATEGORY_GENERAL = Pr\u00E9f\u00E9rences g\u00E9n\u00E9rales
+IDENTITY_CATEGORY_GENERAL = Pr\u00e9f\u00e9rences g\u00e9n\u00e9rales
-IDENTITY_CATEGORY_INSTANT = Comptes de messagerie instantan\u00E9e
+IDENTITY_CATEGORY_INSTANT = Comptes de messagerie instantan\u00e9e
IDENTITY_CATEGORY_PERSONAL = Informations personnelles
-IDENTITY_CREATE_ACCOUNT = Vous pouvez cr\u00E9er un compte.
+IDENTITY_CREATE_ACCOUNT = Vous pouvez cr\u00e9er un compte.
# Example usage for dynamic values
IDENTITY_DYNAMIC_VALUE_TEST = test label
@@ -55,15 +55,15 @@
IDENTITY_EDIT_CHANGE_EMAIL_ERROR = Impossible de changer l'adresse de courriel.
-IDENTITY_EDIT_CHANGE_EMAIL_STATUS_CHANGED = Votre adresse de courriel a \u00E9t\u00E9 mise \u00E0 jour.
+IDENTITY_EDIT_CHANGE_EMAIL_STATUS_CHANGED = Votre adresse de courriel a \u00e9t\u00e9 mise \u00e0 jour.
-IDENTITY_EDIT_CHANGE_EMAIL_STATUS_PENDING = Un courriel a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse indiqu\u00E9e afin d'en confirmer la validit\u00E9.
+IDENTITY_EDIT_CHANGE_EMAIL_STATUS_PENDING = Un courriel a \u00e9t\u00e9 envoy\u00e9 \u00e0 l'adresse indiqu\u00e9e afin d'en confirmer la validit\u00e9.
IDENTITY_EDIT_CHANGE_PASSWORD = Changer mon mot de passe
IDENTITY_EDIT_CHANGE_PASSWORD_ERROR = Impossible de changer votre mot de passe.
-IDENTITY_EDIT_CHANGE_PASSWOR_STATUS = Votre mot de passe a \u00E9t\u00E9 modifi\u00E9.
+IDENTITY_EDIT_CHANGE_PASSWOR_STATUS = Votre mot de passe a \u00e9t\u00e9 modifi\u00e9.
IDENTITY_EDIT_EMAIL_NEW = Nouvelle adresse courriel
@@ -73,39 +73,39 @@
IDENTITY_EDIT_PASSWORD_TITLE = Changer mon mot de passe
-IDENTITY_EDIT_PROFILE_ERROR = Erreur lors de la mise \u00E0 jour de votre profil.
+IDENTITY_EDIT_PROFILE_ERROR = Erreur lors de la mise \u00e0 jour de votre profil.
IDENTITY_EDIT_PROFILE_TITLE = Modifier mon profil
IDENTITY_EMAIL = Courriel
-IDENTITY_ENABLED = Activ\u00E9
+IDENTITY_ENABLED = Activ\u00e9
IDENTITY_EXTRA = Extra
IDENTITY_FAMILYNAME = Nom
-IDENTITY_GIVENNAME = Pr\u00E9nom
+IDENTITY_GIVENNAME = Pr\u00e9nom
IDENTITY_HOMEPAGE = Page web
-IDENTITY_ICQ = Num\u00E9ro Icq
+IDENTITY_ICQ = Num\u00e9ro Icq
-IDENTITY_INTERESTS = Centres d'int\u00E9r\u00EAts
+IDENTITY_INTERESTS = Centres d'int\u00e9r\u00eats
-IDENTITY_LAST_LOGIN = Derni\u00E8re visite
+IDENTITY_LAST_LOGIN = Derni\u00e8re visite
IDENTITY_LOCALE = Langue
-IDENTITY_LOCATION = Lieu de r\u00E9sidence
+IDENTITY_LOCATION = Lieu de r\u00e9sidence
IDENTITY_LOST_PASSWORD = Mot de passe perdu
-IDENTITY_LOST_PASSWORD_DESCRIPTION = Veuillez entrer votre identifiant afin de r\u00E9initialiser votre mot de passe.
+IDENTITY_LOST_PASSWORD_DESCRIPTION = Veuillez entrer votre identifiant afin de r\u00e9initialiser votre mot de passe.
-IDENTITY_LOST_PASSWORD_ERROR = \u00C9chec de r\u00E9initialisation de votre mot de passe.
+IDENTITY_LOST_PASSWORD_ERROR = \u00c9chec de r\u00e9initialisation de votre mot de passe.
-IDENTITY_LOST_PASSWORD_STATUS_404 = Aucun compte trouv\u00E9.
+IDENTITY_LOST_PASSWORD_STATUS_404 = Aucun compte trouv\u00e9.
IDENTITY_LOST_PASSWORD_STATUS_SUCCESSFUL = Vous receverez sous peu via courriel votre nouveau mot de passe.
@@ -115,7 +115,7 @@
IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL = Confirmer l'adresse de courriel
-IDENTITY_MAIL_SUBJECT_LOST_PASSWORD = R\u00E9initialiser mon mot de passe
+IDENTITY_MAIL_SUBJECT_LOST_PASSWORD = R\u00e9initialiser mon mot de passe
IDENTITY_MAIL_SUBJECT_REGISTER = Confirmer mon enregistrement
@@ -125,39 +125,39 @@
IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE = Modifier
-IDENTITY_MANAGEMENT_ACTION_ROLES = R\u00F4les
+IDENTITY_MANAGEMENT_ACTION_ROLES = R\u00f4les
-IDENTITY_MANAGEMENT_APPROVE_ALL = Approuver la s\u00E9lection
+IDENTITY_MANAGEMENT_APPROVE_ALL = Approuver la s\u00e9lection
-IDENTITY_MANAGEMENT_ASSIGN_ROLES = Assigner un r\u00F4le
+IDENTITY_MANAGEMENT_ASSIGN_ROLES = Assigner un r\u00f4le
IDENTITY_MANAGEMENT_COUNT_PENDING_USERS = Comptes en attente d'approbation
-IDENTITY_MANAGEMENT_COUNT_REGISTERED_USERS = Utilisateurs enregistr\u00E9s
+IDENTITY_MANAGEMENT_COUNT_REGISTERED_USERS = Utilisateurs enregistr\u00e9s
-IDENTITY_MANAGEMENT_CREATE_ROLE = Cr\u00E9er un nouveau r\u00F4le
+IDENTITY_MANAGEMENT_CREATE_ROLE = Cr\u00e9er un nouveau r\u00f4le
-IDENTITY_MANAGEMENT_CREATE_USER = Cr\u00E9er un nouveau compte utilisateur
+IDENTITY_MANAGEMENT_CREATE_USER = Cr\u00e9er un nouveau compte utilisateur
-IDENTITY_MANAGEMENT_CREATE_USER_CREATED = Compte cr\u00E9\u00E9
+IDENTITY_MANAGEMENT_CREATE_USER_CREATED = Compte cr\u00e9\u00e9
IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_AUTOMATIC = Automatique - pas de validation par courriel et pas d'approbation
-IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_CUSTOM = Mode d'abonnement personnalis\u00E9
+IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_CUSTOM = Mode d'abonnement personnalis\u00e9
IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL = Validation par courriel et pas d'approbation
IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL_ADMIN = Validation par courriel et approbation par un administrateur
-IDENTITY_MANAGEMENT_DISABLE = D\u00E9sactiver
+IDENTITY_MANAGEMENT_DISABLE = D\u00e9sactiver
-IDENTITY_MANAGEMENT_EDIT_ROLE = Modifier le r\u00F4le
+IDENTITY_MANAGEMENT_EDIT_ROLE = Modifier le r\u00f4le
IDENTITY_MANAGEMENT_ENABLE = Activer
-IDENTITY_MANAGEMENT_ERROR_ACTION_ROLE = Impossible d'effectuer l'op\u00E9ration demand\u00E9e sur ce r\u00F4le. Consultez le journal syst\u00E8me pour plus de d\u00E9tails.
+IDENTITY_MANAGEMENT_ERROR_ACTION_ROLE = Impossible d'effectuer l'op\u00e9ration demand\u00e9e sur ce r\u00f4le. Consultez le journal syst\u00e8me pour plus de d\u00e9tails.
-IDENTITY_MANAGEMENT_ERROR_ACTION_USER = Impossible d'effectuer l'op\u00E9ration demand\u00E9e sur ce compte. Consultez le journal syst\u00E8me pour plus de d\u00E9tails.
+IDENTITY_MANAGEMENT_ERROR_ACTION_USER = Impossible d'effectuer l'op\u00e9ration demand\u00e9e sur ce compte. Consultez le journal syst\u00e8me pour plus de d\u00e9tails.
IDENTITY_MANAGEMENT_MATRIX = Matrice
@@ -169,27 +169,27 @@
IDENTITY_MANAGEMENT_PENDING_REJECT = rejeter
-IDENTITY_MANAGEMENT_REJECT_ALL = Rejeter la s\u00E9lection
+IDENTITY_MANAGEMENT_REJECT_ALL = Rejeter la s\u00e9lection
-IDENTITY_MANAGEMENT_RESET_PASSWORD = R\u00E9initialiser le mot de passe
+IDENTITY_MANAGEMENT_RESET_PASSWORD = R\u00e9initialiser le mot de passe
-IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION = L'utilisateur recevera un nouveau mot de passe al\u00E9atoire envoy\u00E9 via courriel.
+IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION = L'utilisateur recevera un nouveau mot de passe al\u00e9atoire envoy\u00e9 via courriel.
-IDENTITY_MANAGEMENT_RESET_PASSWORD_FOR_USER = R\u00E9initialiser le mot de passe pour l'usager
+IDENTITY_MANAGEMENT_RESET_PASSWORD_FOR_USER = R\u00e9initialiser le mot de passe pour l'usager
-IDENTITY_MANAGEMENT_ROLE = R\u00F4le
+IDENTITY_MANAGEMENT_ROLE = R\u00f4le
-IDENTITY_MANAGEMENT_ROLE_ASSIGNED = R\u00F4les assign\u00E9s
+IDENTITY_MANAGEMENT_ROLE_ASSIGNED = R\u00f4les assign\u00e9s
IDENTITY_MANAGEMENT_ROLE_DISPLAY = Nom courant
-IDENTITY_MANAGEMENT_ROLE_MANAGEMENT = Gestion des r\u00F4les
+IDENTITY_MANAGEMENT_ROLE_MANAGEMENT = Gestion des r\u00f4les
IDENTITY_MANAGEMENT_ROLE_MEMBERS = Membres
IDENTITY_MANAGEMENT_SEARCH_USER = Rechercher
-IDENTITY_MANAGEMENT_SELECT_ALL = Tout s\u00E9lectionner
+IDENTITY_MANAGEMENT_SELECT_ALL = Tout s\u00e9lectionner
IDENTITY_MANAGEMENT_SUBSCRIPTION_ADMIN_MODE = Administrer les modes d'abonnement
@@ -197,17 +197,17 @@
IDENTITY_MANAGEMENT_SUBSCRIPTION_MODES = Modes d'abonnement
-IDENTITY_MANAGEMENT_UNSELECT_ALL = Tout d\u00E9s\u00E9lectionner
+IDENTITY_MANAGEMENT_UNSELECT_ALL = Tout d\u00e9s\u00e9lectionner
-IDENTITY_MANAGEMENT_USER_DELETED = Compte supprim\u00E9
+IDENTITY_MANAGEMENT_USER_DELETED = Compte supprim\u00e9
IDENTITY_MANAGEMENT_USER_MANAGEMENT = Gestion des utilisateurs
IDENTITY_MSNM = Identifiant MSN
-IDENTITY_NOT_LOGGED_IN = Vous n'\u00EAtes pas connect\u00E9.
+IDENTITY_NOT_LOGGED_IN = Vous n'\u00eates pas connect\u00e9.
-IDENTITY_OCCUPATION = M\u00E9tier
+IDENTITY_OCCUPATION = M\u00e9tier
IDENTITY_PASSWORD = Mot de passe
@@ -217,33 +217,33 @@
IDENTITY_REGISTER_PASSWORD_CONFIRM = Confirmation de mot de passe
-IDENTITY_REGISTER_PENDING_TITLE = Un courriel a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse indiqu\u00E9e afin de confirmer votre enregistrement.
+IDENTITY_REGISTER_PENDING_TITLE = Un courriel a \u00e9t\u00e9 envoy\u00e9 \u00e0 l'adresse indiqu\u00e9e afin de confirmer votre enregistrement.
IDENTITY_REGISTER_REQUIRED_INFORMATION = indique un champ obligatoire
IDENTITY_REGISTER_STATUS_TITLE = Statut d'enregistrement
-IDENTITY_REGISTER_SUCCESS_TITLE = Votre compte a \u00E9t\u00E9 cr\u00E9\u00E9 avec succ\u00E8s. Vous pouvez vous connecter.
+IDENTITY_REGISTER_SUCCESS_TITLE = Votre compte a \u00e9t\u00e9 cr\u00e9\u00e9 avec succ\u00e8s. Vous pouvez vous connecter.
-IDENTITY_REGISTER_TITLE = Informations g\u00E9n\u00E9rales
+IDENTITY_REGISTER_TITLE = Informations g\u00e9n\u00e9rales
IDENTITY_REGISTER_TITLE_CONFIRM = Confirmation
IDENTITY_REGISTER_TITLE_CONFIRM_DELETE = Confirmation : supprimer
-IDENTITY_REGISTER_VERIFY_CAPTCHA = V\u00E9rification visuelle
+IDENTITY_REGISTER_VERIFY_CAPTCHA = V\u00e9rification visuelle
-IDENTITY_REGISTRATION_DATE = Enregistr\u00E9 le
+IDENTITY_REGISTRATION_DATE = Enregistr\u00e9 le
-IDENTITY_SECURITY_ANSWER = R\u00E9ponse \u00E0 votre question de s\u00E9curit\u00E9
+IDENTITY_SECURITY_ANSWER = R\u00e9ponse \u00e0 votre question de s\u00e9curit\u00e9
-IDENTITY_SECURITY_QUESTION = Question de s\u00E9curit\u00E9
+IDENTITY_SECURITY_QUESTION = Question de s\u00e9curit\u00e9
IDENTITY_SIGNATURE = Signature
-IDENTITY_SKYPE = Num\u00E9ro Skype
+IDENTITY_SKYPE = Num\u00e9ro Skype
-IDENTITY_THEME = Th\u00E8me
+IDENTITY_THEME = Th\u00e8me
IDENTITY_TIMEZONE = Fuseau horaire
@@ -253,7 +253,7 @@
IDENTITY_VALIDATION_ERROR_INVALID_EMAIL = Adresse de courriel invalide.
-IDENTITY_VALIDATION_ERROR_INVALID_PASSWORD = Mot de passe erron\u00E9.
+IDENTITY_VALIDATION_ERROR_INVALID_PASSWORD = Mot de passe erron\u00e9.
IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH = Vos mots de passe ne correspondent pas.
@@ -262,8 +262,9 @@
IDENTITY_VALIDATION_ERROR_REGISTRATION = Erreur lors de l'enregistrement du compte.
IDENTITY_VALIDATION_ERROR_USERNAME_ERROR = Erreur lors de la validation du nom d'utilisateur.
+IDENTITY_VALIDATION_ERROR_INVALID_USERNAME=''{0}'' est un nom d'utilisateur invalide : Ne peut pas \u00eatre null, vide ou contenir '<', '>', '(', ')', '=' ou '%5c'
-IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN = Ce nom d'utilisateur est d\u00E9j\u00E0 utilis\u00E9.
+IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN = Ce nom d'utilisateur est d\u00e9j\u00e0 utilis\u00e9.
IDENTITY_VERIFICATION_LOGIN = Connexion
@@ -273,17 +274,17 @@
IDENTITY_VERIFICATION_STATUS_FAILED = Impossible de valider cette adresse de courriel.
-IDENTITY_VERIFICATION_STATUS_REGISTER_APPROVAL = Votre adresse de courriel a \u00E9t\u00E9 v\u00E9rifi\u00E9e, mais votre compte doit \u00EAtre approuv\u00E9 par un administrateur.
+IDENTITY_VERIFICATION_STATUS_REGISTER_APPROVAL = Votre adresse de courriel a \u00e9t\u00e9 v\u00e9rifi\u00e9e, mais votre compte doit \u00eatre approuv\u00e9 par un administrateur.
-IDENTITY_VERIFICATION_STATUS_REGISTER_CUSTOM = Votre compte a \u00E9t\u00E9 activ\u00E9. Vous pouvez vous connecter.
+IDENTITY_VERIFICATION_STATUS_REGISTER_CUSTOM = Votre compte a \u00e9t\u00e9 activ\u00e9. Vous pouvez vous connecter.
-IDENTITY_VERIFICATION_STATUS_REGISTER_SUCCESS = Votre compte a \u00E9t\u00E9 activ\u00E9. Vous pouvez vous connecter.
+IDENTITY_VERIFICATION_STATUS_REGISTER_SUCCESS = Votre compte a \u00e9t\u00e9 activ\u00e9. Vous pouvez vous connecter.
-IDENTITY_VERIFICATION_STATUS_VALIDATED = Adresse de courriel valid\u00E9e.
+IDENTITY_VERIFICATION_STATUS_VALIDATED = Adresse de courriel valid\u00e9e.
IDENTITY_VIEW_PROFILE_TITLE = Voir mon profil
-IDENTITY_WARNING_CONFIRM_DELETE_ROLE = Attention ! Vous allez supprimer le r\u00F4le
+IDENTITY_WARNING_CONFIRM_DELETE_ROLE = Attention ! Vous allez supprimer le r\u00f4le
IDENTITY_WARNING_CONFIRM_DELETE_USER = Attention ! Vous allez supprimer le compte
@@ -295,3 +296,9 @@
javax.portlet.title=Utilisateur
javax.faces.component.UIInput.REQUIRED=Valeur requise
+
+ROLE_TYPE=r\u00f4le
+ROLE_DISPLAY_TYPE=affichage r\u00f4le
+DUPLICATE_ERROR=Un {1} nomm\u00e9 ''{0}'' existe d\u00e9j\u00e0!
+INVALID_NAME_ERROR=''{0}'' est un nom invalide pour un {1} : Ne peut pas \u00eatre null, vide ou contenir '/', '.', '\\', '<', '>', '(', ')', '=' ou '%5c'
+INVALID_VALUE_ERROR=''{0}'' est une valeut invalide : Ne peut pas \u00eatre null, vide ou contenir '\\', '<', '>', '(', ')', '=' ou '%5c'
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_it.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_it.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_it.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -116,7 +116,6 @@
IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Ruoli assegnati
IDENTITY_MANAGEMENT_CREATE_ROLE=Crea un nuovo ruolo
IDENTITY_MANAGEMENT_EDIT_ROLE=Modifica il ruolo
-IDENTITY_MANAGEMENT_CREATE_ROLE=Crea il ruolo
IDENTITY_MANAGEMENT_DISABLE=Disabilita
IDENTITY_MANAGEMENT_DISABLE_USER_DISABLED=Utente disabilitato
IDENTITY_MANAGEMENT_ENABLE=Abilita
@@ -171,8 +170,7 @@
IDENTITY_VALIDATION_ERROR_REGISTRATION=Fallita la registrazione dell'utente.
IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN=Il nome utente esiste gi\u00e0.
IDENTITY_VALIDATION_ERROR_USERNAME_ERROR=Errore durante la validazione del nome utente.
-IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN=Il nome del ruolo esiste gi\u00e0.
-IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR=Errore durante la validazione del nome del ruolo.
+IDENTITY_VALIDATION_ERROR_INVALID_USERNAME=''{0}'' non \u00e8 un nome utente valido : Non \u00f2 essere null, vuoto o contenere '<', '>', '(', ')', '=' o '%5c'
IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH=Le passwords non coincidono.
IDENTITY_VALIDATION_ERROR_PASSWORD_ERROR=Errore durante la validazione della password.
IDENTITY_VALIDATION_ERROR_INVALID_EMAIL=Indirizzo e-mail non valido.
@@ -187,3 +185,8 @@
javax.portlet.keywords=amministrazione,utente
javax.faces.component.UIInput.REQUIRED=Il valore \u00e8 richiesto
+
+ROLE_TYPE=ruolo
+INVALID_NAME_ERROR=''{0}'' non \u00e8 un nome valido di {1} : Non \u00f2 essere null, vuoto o contenere '/', '.', '\\', '<', '>', '(', ')', '=' o '%5c'
+INVALID_VALUE_ERROR=''{0}'' non \u00e8 un nome valido : Non \u00f2 essere null, vuoto o contenere '\\', '<', '>', '(', ')', '=' o '%5c'
+DUPLICATE_ERROR=Un valore {1} con nome ''{0}'' esiste gi\u00e0!
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ja.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ja.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ja.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -114,7 +114,6 @@
IDENTITY_MANAGEMENT_ROLE_ASSIGNED=\u30a2\u30b5\u30a4\u30f3\u30ed\u30fc\u30eb
IDENTITY_MANAGEMENT_CREATE_ROLE=\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u306e\u4f5c\u6210
IDENTITY_MANAGEMENT_EDIT_ROLE=\u30ed\u30fc\u30eb\u306e\u7de8\u96c6
-IDENTITY_MANAGEMENT_CREATE_ROLE=\u30ed\u30fc\u30eb\u306e\u4f5c\u6210
IDENTITY_MANAGEMENT_DISABLE=\u7121\u52b9
IDENTITY_MANAGEMENT_DISABLE_USER_DISABLED=\u7121\u52b9\u306b\u306a\u3063\u305f\u30e6\u30fc\u30b6
IDENTITY_MANAGEMENT_ENABLE=\u6709\u52b9
@@ -169,8 +168,6 @@
IDENTITY_VALIDATION_ERROR_REGISTRATION=\u30e6\u30fc\u30b6\u306e\u767b\u9332\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN=\u3053\u306e\u30e6\u30fc\u30b6\u540d\u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059\u3002
IDENTITY_VALIDATION_ERROR_USERNAME_ERROR=\u30e6\u30fc\u30b6\u540d\u306e\u30a8\u30e9\u30fc\u3002
-IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN=\u3053\u306e\u30ed\u30fc\u30eb\u540d\u306f\u65e2\u306b\u4f7f\u308f\u308c\u3066\u3044\u307e\u3059.
-IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR=\u30ed\u30fc\u30eb\u59ea\u306e\u30a8\u30e9\u30fc\u3002
IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH=\u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002
IDENTITY_VALIDATION_ERROR_PASSWORD_ERROR=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u30a8\u30e9\u30fc\u3002
IDENTITY_VALIDATION_ERROR_INVALID_EMAIL=\u7121\u52b9\u306aE\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3067\u3059\u3002
@@ -185,3 +182,6 @@
javax.portlet.keywords=\u7ba1\u7406,\u30e6\u30fc\u30b6
javax.faces.component.UIInput.REQUIRED=\u5fc5\u9808\u5024\u3067\u3059
+
+ROLE_TYPE=\u30ed\u30fc\u30eb\u306e
+INVALID_VALUE_ERROR=''{0}'' is an invalid value: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_pt_BR.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_pt_BR.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_pt_BR.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -21,31 +21,31 @@
# 02110-1301 USA, or see the FSF site: http://www.fsf.org. #
################################################################################
-javax.faces.validator.LengthValidator.MINIMUM= Entrada \u00E9 muito curta (m\u00EDnimo de {0} caracteres).
+javax.faces.validator.LengthValidator.MINIMUM= Entrada \u00e9 muito curta (m\u00ednimo de {0} caracteres).
-IDENTITY_APPLICATION_NOT_AVAILABLE=Porlet n\u00E3o dispon\u00EDvel. Verifique sua configura\u00E7\u00E3o e log de erro para mais informa\u00E7\u00F5es.
+IDENTITY_APPLICATION_NOT_AVAILABLE=Porlet n\u00e3o dispon\u00edvel. Verifique sua configura\u00e7\u00e3o e log de erro para mais informa\u00e7\u00f5es.
IDENTITY_WELCOME=Bem-vindo
IDENTITY_REGISTER=Registrar-se
IDENTITY_LOST_PASSWORD=Esqueceu Senha
-IDENTITY_NOT_LOGGED_IN=Voc\u00EA n\u00E3o est\u00E1 autenticado no portal.
-IDENTITY_CREATE_ACCOUNT=Voc\u00EA pode criar uma conta.
+IDENTITY_NOT_LOGGED_IN=Voc\u00ea n\u00e3o est\u00e1 autenticado no portal.
+IDENTITY_CREATE_ACCOUNT=Voc\u00ea pode criar uma conta.
IDENTITY_BUTTON_SUBMIT=Enviar
IDENTITY_BUTTON_EDIT=Editar
IDENTITY_BUTTON_CANCEL=Cancelar
-IDENTITY_REGISTER_TITLE=Informa\u00E7\u00F5es b\u00E1sicas do usu\u00E1rio
-IDENTITY_REGISTER_TITLE_CONFIRM=Confirma\u00E7\u00E3o
+IDENTITY_REGISTER_TITLE=Informa\u00e7\u00f5es b\u00e1sicas do usu\u00e1rio
+IDENTITY_REGISTER_TITLE_CONFIRM=Confirma\u00e7\u00e3o
IDENTITY_REGISTER_PASSWORD_CONFIRM=Confirme a Senha
IDENTITY_REGISTER_STATUS_TITLE=Status do registro
-IDENTITY_REGISTER_SUCCESS_TITLE=Sua conta foi criada com \u00EAxito. Voc\u00EA pode autenticar-se agora.
-IDENTITY_REGISTER_PENDING_TITLE=Um e-mail foi enviado ao seu endere\u00E7o de e-mail para confirmar o seu registro.
-IDENTITY_REGISTER_REQUIRED_INFORMATION=indica um campo obrigat\u00F3rio.
+IDENTITY_REGISTER_SUCCESS_TITLE=Sua conta foi criada com \u00eaxito. Voc\u00ea pode autenticar-se agora.
+IDENTITY_REGISTER_PENDING_TITLE=Um e-mail foi enviado ao seu endere\u00e7o de e-mail para confirmar o seu registro.
+IDENTITY_REGISTER_REQUIRED_INFORMATION=indica um campo obrigat\u00f3rio.
IDENTITY_LOST_PASSWORD_TITLE=Esqueceu seu dados de login?
-IDENTITY_LOST_PASSWORD_DESCRIPTION=Digite seu usu\u00E1rio para redefinir sua senha.
-IDENTITY_LOST_PASSWORD_ERROR=Falha na redefini\u00E7\u00E3o de senha.
-IDENTITY_LOST_PASSWORD_STATUS_SUCCESSFUL=Voc\u00EA receber\u00E1 um e-mail com sua nova senha.
+IDENTITY_LOST_PASSWORD_DESCRIPTION=Digite seu usu\u00e1rio para redefinir sua senha.
+IDENTITY_LOST_PASSWORD_ERROR=Falha na redefini\u00e7\u00e3o de senha.
+IDENTITY_LOST_PASSWORD_STATUS_SUCCESSFUL=Voc\u00ea receber\u00e1 um e-mail com sua nova senha.
IDENTITY_LOST_PASSWORD_STATUS_404=Nenhuma conta encontrada.
IDENTITY_LOST_PASSWORD_STATUS_TITLE=Esqueceu senha
@@ -53,27 +53,27 @@
IDENTITY_EDIT_PASSWORD_TITLE=Altere a sua senha
IDENTITY_EDIT_PASSWORD_CURRENT=Senha atual
IDENTITY_EDIT_CHANGE_PASSWORD=Alterar senha
-IDENTITY_EDIT_CHANGE_PASSWORD_ERROR=N\u00E3o foi poss\u00EDvel alterar a senha.
+IDENTITY_EDIT_CHANGE_PASSWORD_ERROR=N\u00e3o foi poss\u00edvel alterar a senha.
IDENTITY_EDIT_CHANGE_PASSWOR_STATUS=A senha foi atualizada.
-IDENTITY_EDIT_EMAIL_TITLE=Alterar o seu endere\u00E7o de e-mail
-IDENTITY_EDIT_EMAIL_NEW=Novo endere\u00E7o de e-mail
+IDENTITY_EDIT_EMAIL_TITLE=Alterar o seu endere\u00e7o de e-mail
+IDENTITY_EDIT_EMAIL_NEW=Novo endere\u00e7o de e-mail
IDENTITY_EDIT_CHANGE_EMAIL=Alterar e-mail
-IDENTITY_EDIT_CHANGE_EMAIL_ERROR=N\u00E3o foi poss\u00EDvel alterar o endere\u00E7o de e-mail
-IDENTITY_EDIT_CHANGE_EMAIL_STATUS_PENDING=Uma valida\u00E7\u00E3o de e-mail foi enviada ao seu endere\u00E7o.
-IDENTITY_EDIT_CHANGE_EMAIL_STATUS_CHANGED=Seu endere\u00E7o de e-mail foi alterado.
+IDENTITY_EDIT_CHANGE_EMAIL_ERROR=N\u00e3o foi poss\u00edvel alterar o endere\u00e7o de e-mail
+IDENTITY_EDIT_CHANGE_EMAIL_STATUS_PENDING=Uma valida\u00e7\u00e3o de e-mail foi enviada ao seu endere\u00e7o.
+IDENTITY_EDIT_CHANGE_EMAIL_STATUS_CHANGED=Seu endere\u00e7o de e-mail foi alterado.
IDENTITY_EDIT_PROFILE_TITLE=Editar perfil
IDENTITY_VIEW_PROFILE_TITLE=Visualizar perfil
-IDENTITY_USERNAME=Usu\u00E1rio
+IDENTITY_USERNAME=Usu\u00e1rio
IDENTITY_PASSWORD=Senha
IDENTITY_EMAIL=E-Mail
IDENTITY_GIVENNAME=Primeiro nome
-IDENTITY_FAMILYNAME=\u00DAltimo nome
+IDENTITY_FAMILYNAME=\u00daltimo nome
IDENTITY_SKYPE=Identificador Skype
IDENTITY_LOCATION=Local
-IDENTITY_OCCUPATION=Ocupa\u00E7\u00E3o
+IDENTITY_OCCUPATION=Ocupa\u00e7\u00e3o
IDENTITY_EXTRA=Adicional
IDENTITY_SIGNATURE=Assinatura
IDENTITY_INTERESTS=Interesses
@@ -83,49 +83,49 @@
IDENTITY_MSNM=Identificador MSN messenger
IDENTITY_YIM=Identificador Yahoo
IDENTITY_XMMP=Identificador Xmmp
-IDENTITY_HOMEPAGE=P\u00E1gina inicial
-IDENTITY_TIMEZONE=Fuso hor\u00E1rio
+IDENTITY_HOMEPAGE=P\u00e1gina inicial
+IDENTITY_TIMEZONE=Fuso hor\u00e1rio
IDENTITY_THEME=Tema
-IDENTITY_SECURITY_QUESTION=Pergunta de seguran\u00E7a
-IDENTITY_SECURITY_ANSWER=Resposta de seguran\u00E7a
-IDENTITY_LAST_LOGIN=\u00DAltimo acesso
+IDENTITY_SECURITY_QUESTION=Pergunta de seguran\u00e7a
+IDENTITY_SECURITY_ANSWER=Resposta de seguran\u00e7a
+IDENTITY_LAST_LOGIN=\u00daltimo acesso
IDENTITY_REIGSTRATION_DATE=Data de Registro
IDENTITY_ENABLED=Ativado
-IDENTITY_CATEGORY_GENERAL=Prefer\u00EAncias Gerais
-IDENTITY_CATEGORY_PERSONAL=Informa\u00E7\u00F5es Pessoais
-IDENTITY_CATEGORY_INSTANT=Identidades de Mensagens Instant\u00E2neas
-IDENTITY_CATEGORY_ADDITIONAL=Informa\u00E7\u00F5es Adicionais
+IDENTITY_CATEGORY_GENERAL=Prefer\u00eancias Gerais
+IDENTITY_CATEGORY_PERSONAL=Informa\u00e7\u00f5es Pessoais
+IDENTITY_CATEGORY_INSTANT=Identidades de Mensagens Instant\u00e2neas
+IDENTITY_CATEGORY_ADDITIONAL=Informa\u00e7\u00f5es Adicionais
-IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE=(Assinatura de ,no m\u00E1ximo, 255 caracteres)
-IDENTITY_CATEGORY_ADDITIONAL_EXTRA=(m\u00E1ximo de 255 caracteres)
+IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE=(Assinatura de ,no m\u00e1ximo, 255 caracteres)
+IDENTITY_CATEGORY_ADDITIONAL_EXTRA=(m\u00e1ximo de 255 caracteres)
-IDENTITY_MANAGEMENT_ACTION=A\u00E7\u00F5es
-IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE=Editar usu\u00E1rio
+IDENTITY_MANAGEMENT_ACTION=A\u00e7\u00f5es
+IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE=Editar usu\u00e1rio
IDENTITY_MANAGEMENT_ACTION_ROLES=Perfis
IDENTITY_MANAGEMENT_ACTION_DELETE=Excluir
-IDENTITY_MANAGEMENT_USER_MANAGEMENT=Gerenciamento de usu\u00E1rios
+IDENTITY_MANAGEMENT_USER_MANAGEMENT=Gerenciamento de usu\u00e1rios
IDENTITY_MANAGEMENT_ROLE_MANAGEMENT=Gerenciamento de perfis
-IDENTITY_MANAGEMENT_SEARCH_USER=Pesquisar usu\u00E1rios
-IDENTITY_MANAGEMENT_CREATE_USER=Criar uma nova conta de usu\u00E1rio
-IDENTITY_MANAGEMENT_CREATE_USER_CREATED=Usu\u00E1rio criado
-IDENTITY_MANAGEMENT_USER_DELETED=Usu\u00E1rio exclu\u00EDdo
+IDENTITY_MANAGEMENT_SEARCH_USER=Pesquisar usu\u00e1rios
+IDENTITY_MANAGEMENT_CREATE_USER=Criar uma nova conta de usu\u00e1rio
+IDENTITY_MANAGEMENT_CREATE_USER_CREATED=Usu\u00e1rio criado
+IDENTITY_MANAGEMENT_USER_DELETED=Usu\u00e1rio exclu\u00eddo
IDENTITY_MANAGEMENT_ROLE=Perfil
-IDENTITY_MANAGEMENT_ROLE_DISPLAY=Nome de exibi\u00E7\u00E3o
-IDENTITY_MANAGEMENT_ROLE_MEMBERS=Usu\u00E1rios
-IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Perfis atribu\u00EDdos
+IDENTITY_MANAGEMENT_ROLE_DISPLAY=Nome de exibi\u00e7\u00e3o
+IDENTITY_MANAGEMENT_ROLE_MEMBERS=Usu\u00e1rios
+IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Perfis atribu\u00eddos
IDENTITY_MANAGEMENT_CREATE_ROLE=Criar perfil
IDENTITY_MANAGEMENT_EDIT_ROLE=Editar perfil
IDENTITY_MANAGEMENT_DISABLE=Desabilitar
IDENTITY_MANAGEMENT_DISABLE_USER_DISABLED=Usua\u0155io desabilitado
IDENTITY_MANAGEMENT_ENABLE=Habilitar
-IDENTITY_MANAGEMENT_ENABLE_USER_ENABLED=Usu\u00E1rio habilitado
+IDENTITY_MANAGEMENT_ENABLE_USER_ENABLED=Usu\u00e1rio habilitado
IDENTITY_MANAGEMENT_RESET_PASSWORD=Redefinir senha
-IDENTITY_MANAGEMENT_RESET_PASSWORD_FOR_USER=Redefinir senha para o usu\u00E1rio
-IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION=O usu\u00E1rio receber\u00E1 uma senha aleat\u00F3ria enviada ao seu endere\u00E7o de e-mail.
+IDENTITY_MANAGEMENT_RESET_PASSWORD_FOR_USER=Redefinir senha para o usu\u00e1rio
+IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION=O usu\u00e1rio receber\u00e1 uma senha aleat\u00f3ria enviada ao seu endere\u00e7o de e-mail.
IDENTITY_MANAGEMENT_ASSIGN_ROLES=Atribuir perfis
-IDENTITY_MANAGEMENT_COUNT_PENDING_USERS=Usu\u00E1rios pendentes
-IDENTITY_MANAGEMENT_COUNT_REGISTERED_USERS=Usu\u00E1rios registrados
+IDENTITY_MANAGEMENT_COUNT_PENDING_USERS=Usu\u00e1rios pendentes
+IDENTITY_MANAGEMENT_COUNT_REGISTERED_USERS=Usu\u00e1rios registrados
IDENTITY_MANAGEMENT_APPROVE_ALL=Aprovar selecionados
IDENTITY_MANAGEMENT_REJECT_ALL=Rejeitar selecionados
IDENTITY_MANAGEMENT_SELECT_ALL=Selecionar todos
@@ -141,48 +141,52 @@
IDENTITY_MANAGEMENT_SUBSCRIPTION_MODE=Modo de assinatura
IDENTITY_MANAGEMENT_SUBSCRIPTION_ADMIN_MODE=Administrador Modo de assinatura
IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_CUSTOM=Modo de assinatura personalizado.
-IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_AUTOMATIC=Autom\u00E1tica - nenhuma valida\u00E7\u00E3o de e-mail, nenhuma aprova\u00E7\u00E3o do administrador.
-IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL=Valida\u00E7\u00E3o de e-mail, nenhuma aprova\u00E7\u00E3o do administrador.
-IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL_ADMIN=Valida\u00E7\u00E3o de e-mail, e aprova\u00E7\u00E3o do administrador.
+IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_AUTOMATIC=Autom\u00e1tica - nenhuma valida\u00e7\u00e3o de e-mail, nenhuma aprova\u00e7\u00e3o do administrador.
+IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL=Valida\u00e7\u00e3o de e-mail, nenhuma aprova\u00e7\u00e3o do administrador.
+IDENTITY_MANAGEMENT_DESCRIPTION_SUBSCRIPTION_EMAIL_ADMIN=Valida\u00e7\u00e3o de e-mail, e aprova\u00e7\u00e3o do administrador.
-IDENTITY_REGISTER_VERIFY_CAPTCHA=Digite a imagem de seguran\u00E7a
-IDENTITY_REGISTER_TITLE_CONFIRM_DELETE=Confirma\u00E7\u00E3o\: Excluir
-IDENTITY_WARNING_CONFIRM_DELETE_USER=Aten\u00E7\u00E3o\! Deseja excluir o usu\u00E1rio
-IDENTITY_WARNING_CONFIRM_DELETE_ROLE=Aten\u00E7\u00E3o\! Deseja excluir o perfil
-IDENTITY_REGISTER_CONFIRMATIONEMAIL=Confirme a sua inscri\u00E7\u00E3o
+IDENTITY_REGISTER_VERIFY_CAPTCHA=Digite a imagem de seguran\u00e7a
+IDENTITY_REGISTER_TITLE_CONFIRM_DELETE=Confirma\u00e7\u00e3o\: Excluir
+IDENTITY_WARNING_CONFIRM_DELETE_USER=Aten\u00e7\u00e3o\! Deseja excluir o usu\u00e1rio
+IDENTITY_WARNING_CONFIRM_DELETE_ROLE=Aten\u00e7\u00e3o\! Deseja excluir o perfil
+IDENTITY_REGISTER_CONFIRMATIONEMAIL=Confirme a sua inscri\u00e7\u00e3o
IDENTITY_MAIL_SUBJECT_LOST_PASSWORD=Redefinir a sua senha
-IDENTITY_MAIL_SUBJECT_REGISTER=Confirmar inscri\u00E7\u00E3o
-IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL=Confirmar endere\u00E7o de e-mail
+IDENTITY_MAIL_SUBJECT_REGISTER=Confirmar inscri\u00e7\u00e3o
+IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL=Confirmar endere\u00e7o de e-mail
-IDENTITY_MANAGEMENT_ERROR_ACTION_ROLE=N\u00E3o foi poss\u00EDvel executar a a\u00E7\u00E3o nesse perfil. Por favor, verifique o arquivo de log para mais informa\u00E7\u00F5es.
-IDENTITY_MANAGEMENT_ERROR_ACTION_USER=N\u00E3o foi poss\u00EDvel executar a a\u00E7\u00E3o nesse usu\u00E1rio. Por favor, verifique o arquivo de log para mais informa\u00E7\u00F5es.
+IDENTITY_MANAGEMENT_ERROR_ACTION_ROLE=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o nesse perfil. Por favor, verifique o arquivo de log para mais informa\u00e7\u00f5es.
+IDENTITY_MANAGEMENT_ERROR_ACTION_USER=N\u00e3o foi poss\u00edvel executar a a\u00e7\u00e3o nesse usu\u00e1rio. Por favor, verifique o arquivo de log para mais informa\u00e7\u00f5es.
IDENTITY_VERIFICATION_RETURN=Voltar ao portal
IDENTITY_VERIFICATION_LOGIN=Entrar
-IDENTITY_VERIFICATION_STATUS_EROOR=Erro durante a valida\u00E7\u00E3o de endere\u00E7o de e-mail.
-IDENTITY_VERIFICATION_STATUS_FAILED=N\u00E3o \u00E9 poss\u00EDvel validar o endere\u00E7o de e-mail.
+IDENTITY_VERIFICATION_STATUS_EROOR=Erro durante a valida\u00e7\u00e3o de endere\u00e7o de e-mail.
+IDENTITY_VERIFICATION_STATUS_FAILED=N\u00e3o \u00e9 poss\u00edvel validar o endere\u00e7o de e-mail.
IDENTITY_VERIFICATION_STATUS_VALIDATED=E-mail validado.
-IDENTITY_VERIFICATION_STATUS_REGISTER_SUCCESS=Sua conta foi ativada. Voc\u00EA poder\u00E1 entrar agora.
-IDENTITY_VERIFICATION_STATUS_REGISTER_APPROVAL=Seu endere\u00E7o de e-mail foi validado, mas sua conta precisa ser aprovada pelo administrador.
-IDENTITY_VERIFICATION_STATUS_REGISTER_CUSTOM=Sua conta foi ativada. Voc\u00EA poder\u00E1 entrar agora.
+IDENTITY_VERIFICATION_STATUS_REGISTER_SUCCESS=Sua conta foi ativada. Voc\u00ea poder\u00e1 entrar agora.
+IDENTITY_VERIFICATION_STATUS_REGISTER_APPROVAL=Seu endere\u00e7o de e-mail foi validado, mas sua conta precisa ser aprovada pelo administrador.
+IDENTITY_VERIFICATION_STATUS_REGISTER_CUSTOM=Sua conta foi ativada. Voc\u00ea poder\u00e1 entrar agora.
-IDENTITY_VALIDATION_ERROR_REGISTRATION=Falha no registro do usu\u00E1rio.
-IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN=Esse usu\u00E1rio j\u00E1 est\u00E1 em uso.
-IDENTITY_VALIDATION_ERROR_USERNAME_ERROR=Erro ao validar o usu\u00E1rio.
-IDENTITY_VALIDATION_ERROR_ROLENAME_TAKEN=Esse perfil j\u00E1 est\u00E1 em uso.
-IDENTITY_VALIDATION_ERROR_ROLENAME_ERROR=Erro ao validar o nome do perfil.
-IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH=As senhas n\u00E3o conferem.
-IDENTITY_VALIDATION_ERROR_PASSWORD_ERROR=Erro durante a valida\u00E7\u00E3o de senha.
-IDENTITY_VALIDATION_ERROR_INVALID_EMAIL=E-mail inv\u00E1lido.
-IDENTITY_VALIDATION_ERROR_INVALID_PASSWORD=Senha inv\u00E1lida
-IDENTITY_VALIDATION_ERROR_CAPTCHA_INCORRECT=Imagem de seguran\u00E7a inv\u00E1lida
+IDENTITY_VALIDATION_ERROR_REGISTRATION=Falha no registro do usu\u00e1rio.
+IDENTITY_VALIDATION_ERROR_USERNAME_TAKEN=Esse usu\u00e1rio j\u00e1 est\u00e1 em uso.
+IDENTITY_VALIDATION_ERROR_USERNAME_ERROR=Erro ao validar o usu\u00e1rio.
+IDENTITY_VALIDATION_ERROR_INVALID_USERNAME=''{0}'' \u00e9 um nome do usu\u00e1rio inv\u00e1lido\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '<', '>', '(', ')', '=' ou '%5c'
+IDENTITY_VALIDATION_ERROR_PASSWORD_DOESNT_MATCH=As senhas n\u00e3o conferem.
+IDENTITY_VALIDATION_ERROR_PASSWORD_ERROR=Erro durante a valida\u00e7\u00e3o de senha.
+IDENTITY_VALIDATION_ERROR_INVALID_EMAIL=E-mail inv\u00e1lido.
+IDENTITY_VALIDATION_ERROR_INVALID_PASSWORD=Senha inv\u00e1lida
+IDENTITY_VALIDATION_ERROR_CAPTCHA_INCORRECT=Imagem de seguran\u00e7a inv\u00e1lida
# Example usage for dynamic values
IDENTITY_DYNAMIC_VALUE_TEST=test label
IDENTITY_DYNAMIC_VALUE_TEST2=test label2
-javax.portlet.title=Perfil do Usu\u00E1rio
+javax.portlet.title=Perfil do Usu\u00e1rio
javax.portlet.keywords=management,user
-javax.faces.component.UIInput.REQUIRED=Valor obrigat\u00F3rio
\ No newline at end of file
+javax.faces.component.UIInput.REQUIRED=Valor obrigat\u00f3rio
+
+ROLE_TYPE=perfil
+INVALID_NAME_ERROR=''{0}'' \u00e9 um nome inv\u00e1lido para {1}\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '/', '.', '\\', '<', '>', '(', ')', '=' ou '%5c'
+INVALID_VALUE_ERROR=''{0}'' \u00e9 um nome inv\u00e1lido\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '\\', '<', '>', '(', ')', '=' ou '%5c'
+DUPLICATE_ERROR=Um {1} denominado ''{0}'' j\u00e1 existe\!
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ru.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ru.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-sar/conf/bundles/Identity_ru.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -114,7 +114,6 @@
IDENTITY_MANAGEMENT_ROLE_ASSIGNED=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u043e\u043b\u0438
IDENTITY_MANAGEMENT_CREATE_ROLE=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0440\u043e\u043b\u044c
IDENTITY_MANAGEMENT_EDIT_ROLE=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u043b\u044c
-IDENTITY_MANAGEMENT_CREATE_ROLE=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u043e\u043b\u044c
IDENTITY_MANAGEMENT_DISABLE=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c
IDENTITY_MANAGEMENT_ENABLE=\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c
IDENTITY_MANAGEMENT_RESET_PASSWORD=\u0421\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c
@@ -176,3 +175,6 @@
# Example usage for dynamic values
IDENTITY_DYNAMIC_VALUE_TEST=test label
IDENTITY_DYNAMIC_VALUE_TEST2=test label2
+
+ROLE_TYPE=\u0440\u043e\u043b\u044c
+INVALID_VALUE_ERROR=''{0}'' is an invalid value: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -30,9 +30,9 @@
<application>
<variable-resolver>org.jboss.portal.core.identity.ui.faces.PortletVariableResolver</variable-resolver>
- <property-resolver>org.jboss.portal.core.identity.ui.faces.PortletDelegatingPropertyResolver</property-resolver>
+ <property-resolver>org.jboss.portal.core.identity.ui.faces.PortletDelegatingPropertyResolver</property-resolver>
<view-handler>
- org.jboss.portletbridge.application.PortletViewHandler
+ org.jboss.portletbridge.application.PortletViewHandler
</view-handler>
<state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
<locale-config>
@@ -43,459 +43,480 @@
</locale-config>
<message-bundle>conf.bundles.Identity</message-bundle>
</application>
-
- <managed-bean>
- <managed-bean-name>configurationbean</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.common.ConfigurationBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- <managed-property>
- <property-name>identityUIConfigurationService</property-name>
- <value>#{applicationScope.IdentityUIConfigurationService}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>metadataservice</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.common.MetaDataServiceBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>identityrolemgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- <managed-property>
- <property-name>roleModule</property-name>
- <value>#{applicationScope.RoleModule}</value>
- </managed-property>
- <managed-property>
- <property-name>membershipModule</property-name>
- <value>#{applicationScope.MembershipModule}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>identityusermgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityUserBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- <managed-property>
- <property-name>userModule</property-name>
- <value>#{applicationScope.UserModule}</value>
- </managed-property>
- <managed-property>
- <property-name>userProfileModule</property-name>
- <value>#{applicationScope.UserProfileModule}</value>
- </managed-property>
- <managed-property>
- <property-name>metaDataService</property-name>
- <value>#{metadataservice}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>editprofilemgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditProfileAction</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>identityUserBean</property-name>
- <value>#{identityusermgr}</value>
- </managed-property>
- <managed-property>
- <property-name>validateEmailService</property-name>
- <value>#{applicationScope.ValidateEmailService}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>userregistermgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateUserAction</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>identityUserBean</property-name>
- <value>#{identityusermgr}</value>
- </managed-property>
- <managed-property>
- <property-name>defaultRoles</property-name>
- <value>#{configurationbean.configuration.defaultRoles}</value>
- </managed-property>
- <managed-property>
- <property-name>registrationService</property-name>
- <value>#{applicationScope.RegistrationService}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>assignrolemgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.AssignRoleAction</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>identityUserBean</property-name>
- <value>#{identityusermgr}</value>
- </managed-property>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>useradministrationbean</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.admin.UserAdministrationBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>subscriptionMode</property-name>
- <value>#{configurationbean.configuration.subscriptionMode}</value>
- </managed-property>
- <managed-property>
- <property-name>adminSubscriptionMode</property-name>
- <value>#{configurationbean.configuration.adminSubscriptionMode}</value>
- </managed-property>
- <managed-property>
- <property-name>identityUserBean</property-name>
- <value>#{identityusermgr}</value>
- </managed-property>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
- <managed-property>
- <property-name>registrationService</property-name>
- <value>#{applicationScope.RegistrationService}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>rolemanagementbean</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.admin.RoleManagementBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>editrolemgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditRoleAction</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>lostpasswordmgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.LostPasswordAction</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- <managed-property>
- <property-name>passwordCharacters</property-name>
- <value>#{configurationbean.configuration.passwordGenerationCharacters}</value>
- </managed-property>
- <managed-property>
- <property-name>identityUserBean</property-name>
- <value>#{identityusermgr}</value>
- </managed-property>
- <managed-property>
- <property-name>identityMailService</property-name>
- <value>#{applicationScope.IdentityMailService}</value>
- </managed-property>
- </managed-bean>
- <managed-bean>
- <managed-bean-name>createrolemgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateRoleAction</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
- </managed-bean>
-
- <validator>
- <validator-id>EmailValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.EmailValidator</validator-class>
- </validator>
- <validator>
- <validator-id>UsernameValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.UsernameValidator</validator-class>
- </validator>
+ <!-- bean context for managed beans -->
+ <managed-bean>
+ <managed-bean-name>beanContext</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.faces.gui.JSFBeanContext</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <managed-property>
+ <property-name>resourceName</property-name>
+ <value>conf.bundles.Identity</value>
+ </managed-property>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>configurationbean</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.common.ConfigurationBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <managed-property>
+ <property-name>identityUIConfigurationService</property-name>
+ <value>#{applicationScope.IdentityUIConfigurationService}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>metadataservice</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.common.MetaDataServiceBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>identityrolemgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <managed-property>
+ <property-name>roleModule</property-name>
+ <value>#{applicationScope.RoleModule}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>membershipModule</property-name>
+ <value>#{applicationScope.MembershipModule}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>identityusermgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityUserBean</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ <managed-property>
+ <property-name>userModule</property-name>
+ <value>#{applicationScope.UserModule}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>userProfileModule</property-name>
+ <value>#{applicationScope.UserProfileModule}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>metaDataService</property-name>
+ <value>#{metadataservice}</value>
+ </managed-property>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>editprofilemgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditProfileAction</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>validateEmailService</property-name>
+ <value>#{applicationScope.ValidateEmailService}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>userregistermgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateUserAction</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>defaultRoles</property-name>
+ <value>#{configurationbean.configuration.defaultRoles}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>registrationService</property-name>
+ <value>#{applicationScope.RegistrationService}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>assignrolemgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.AssignRoleAction</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityRoleBean</property-name>
+ <value>#{identityrolemgr}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>useradministrationbean</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.admin.UserAdministrationBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>subscriptionMode</property-name>
+ <value>#{configurationbean.configuration.subscriptionMode}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>adminSubscriptionMode</property-name>
+ <value>#{configurationbean.configuration.adminSubscriptionMode}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityRoleBean</property-name>
+ <value>#{identityrolemgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>registrationService</property-name>
+ <value>#{applicationScope.RegistrationService}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>rolemanagementbean</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.admin.RoleManagementBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>identityRoleBean</property-name>
+ <value>#{identityrolemgr}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>editrolemgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditRoleAction</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>identityRoleBean</property-name>
+ <value>#{identityrolemgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>lostpasswordmgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.LostPasswordAction</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>passwordCharacters</property-name>
+ <value>#{configurationbean.configuration.passwordGenerationCharacters}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityUserBean</property-name>
+ <value>#{identityusermgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>identityMailService</property-name>
+ <value>#{applicationScope.IdentityMailService}</value>
+ </managed-property>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>createrolemgr</managed-bean-name>
+ <managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateRoleAction</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property>
+ <property-name>identityRoleBean</property-name>
+ <value>#{identityrolemgr}</value>
+ </managed-property>
+ <managed-property>
+ <property-name>beanContext</property-name>
+ <property-class>org.jboss.portal.faces.gui.BeanContext</property-class>
+ <value>#{beanContext}</value>
+ </managed-property>
+ </managed-bean>
+
<validator>
- <validator-id>RoleValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.RoleValidator</validator-class>
+ <validator-id>EmailValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.EmailValidator</validator-class>
</validator>
- <validator>
- <validator-id>PasswordValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.PasswordValidator</validator-class>
- </validator>
- <validator>
- <validator-id>CurrentPasswordValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.CurrentPasswordValidator</validator-class>
- </validator>
- <validator>
- <validator-id>CaptchaValidator</validator-id>
- <validator-class>org.jboss.portal.core.identity.ui.validators.CaptchaValidator</validator-class>
- </validator>
-
- <navigation-rule>
- <navigation-case>
- <from-outcome>start</from-outcome>
- <to-view-id>/jsf/index.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <navigation-case>
- <from-outcome>lostPassword</from-outcome>
- <to-view-id>/jsf/lostPassword/lost.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/lostPassword/lost.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>status</from-outcome>
- <to-view-id>/jsf/lostPassword/status.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <navigation-case>
- <from-outcome>register</from-outcome>
- <to-view-id>/jsf/register/register.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/register/register.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>register</from-outcome>
- <to-view-id>/jsf/register/confirm.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/register/confirm.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>revise</from-outcome>
- <to-view-id>/jsf/register/register.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>registered</from-outcome>
- <to-view-id>/jsf/register/success.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <navigation-case>
- <from-outcome>changePassword</from-outcome>
- <to-view-id>/jsf/profile/changePassword.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/profile/changePassword.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>status</from-outcome>
- <to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <navigation-case>
- <from-outcome>changeEmail</from-outcome>
- <to-view-id>/jsf/profile/changeEmail.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/profile/changeEmail.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>status</from-outcome>
- <to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/index.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>editProfile</from-outcome>
- <to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/profile/*</from-view-id>
- <navigation-case>
- <from-outcome>editProfile</from-outcome>
- <to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
-
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-outcome>userAdmin</from-outcome>
- <to-view-id>/jsf/admin/index.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>start</from-outcome>
- <to-view-id>/jsf/admin/index.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-outcome>roleAdmin</from-outcome>
- <to-view-id>/jsf/admin/roles.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/index.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>createUser</from-outcome>
- <to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-outcome>searchUsers</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/index.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>showPendingUsers</from-outcome>
- <to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/pendingUsers.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>confirmPendingAction</from-outcome>
- <to-view-id>/jsf/admin/user/confirmPendingAction.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>cancel</from-outcome>
- <to-view-id>/jsf/admin/index.xthml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/confirmPendingAction.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>revise</from-outcome>
- <to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>success</from-outcome>
- <to-view-id>/jsf/admin/index.xthml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/searchUsers.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>deleteUser</from-outcome>
- <to-view-id>/jsf/admin/user/deleteUser.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>adminChangePassword</from-outcome>
- <to-view-id>/jsf/admin/user/changePassword.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>start</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-outcome>start</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-action>#{editprofilemgr.adminEditProfile}</from-action>
- <from-outcome>editProfile</from-outcome>
- <to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/*</from-view-id>
- <navigation-case>
- <from-action>#{assignrolemgr.assignRoles}</from-action>
- <from-outcome>assignRoles</from-outcome>
- <to-view-id>/jsf/admin/assignRoles.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/createUser.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>register</from-outcome>
- <to-view-id>/jsf/admin/user/registerRoles.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/registerRoles.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>register</from-outcome>
- <to-view-id>/jsf/admin/user/registerConfirm.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/registerConfirm.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>revise</from-outcome>
- <to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>registered</from-outcome>
- <to-view-id>/jsf/admin/index.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>createRole</from-outcome>
- <to-view-id>/jsf/admin/roles/createRole.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>editRole</from-outcome>
- <to-view-id>/jsf/admin/roles/editRole.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>viewMembers</from-outcome>
- <to-view-id>/jsf/admin/roles/roleMembers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>deleteRole</from-outcome>
- <to-view-id>/jsf/admin/roles/deleteRole.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>resetPassword</from-outcome>
- <to-view-id>/jsf/admin/user/resetPassword.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/resetPassword.xhtml</from-view-id>
- <navigation-case>
- <from-action>#{lostpasswordmgr.doomed}</from-action>
- <from-outcome>status</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-action>#{lostpasswordmgr.doomed}</from-action>
- <from-outcome>lostPassword</from-outcome>
- <to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
- <navigation-rule>
- <from-view-id>/jsf/admin/user/changePassword.xhtml</from-view-id>
- <navigation-case>
- <from-outcome>status</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>searchUsers</from-outcome>
- <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
- </navigation-case>
- </navigation-rule>
-
+ <validator>
+ <validator-id>AttributeValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.UserAttributeValidator</validator-class>
+ </validator>
+ <validator>
+ <validator-id>UsernameValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.UsernameValidator</validator-class>
+ </validator>
+ <validator>
+ <validator-id>PasswordValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.PasswordValidator</validator-class>
+ </validator>
+ <validator>
+ <validator-id>CurrentPasswordValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.CurrentPasswordValidator</validator-class>
+ </validator>
+ <validator>
+ <validator-id>CaptchaValidator</validator-id>
+ <validator-class>org.jboss.portal.core.identity.ui.validators.CaptchaValidator</validator-class>
+ </validator>
+
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>start</from-outcome>
+ <to-view-id>/jsf/index.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>lostPassword</from-outcome>
+ <to-view-id>/jsf/lostPassword/lost.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/lostPassword/lost.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/jsf/lostPassword/status.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>register</from-outcome>
+ <to-view-id>/jsf/register/register.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/register/register.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>register</from-outcome>
+ <to-view-id>/jsf/register/confirm.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/register/confirm.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>revise</from-outcome>
+ <to-view-id>/jsf/register/register.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>registered</from-outcome>
+ <to-view-id>/jsf/register/success.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>changePassword</from-outcome>
+ <to-view-id>/jsf/profile/changePassword.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/profile/changePassword.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <navigation-case>
+ <from-outcome>changeEmail</from-outcome>
+ <to-view-id>/jsf/profile/changeEmail.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/profile/changeEmail.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/jsf/profile/viewProfile.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/index.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>editProfile</from-outcome>
+ <to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/profile/*</from-view-id>
+ <navigation-case>
+ <from-outcome>editProfile</from-outcome>
+ <to-view-id>/jsf/profile/editProfileRedirect.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-outcome>userAdmin</from-outcome>
+ <to-view-id>/jsf/admin/index.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>start</from-outcome>
+ <to-view-id>/jsf/admin/index.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-outcome>roleAdmin</from-outcome>
+ <to-view-id>/jsf/admin/roles.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/index.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>createUser</from-outcome>
+ <to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-outcome>searchUsers</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/index.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>showPendingUsers</from-outcome>
+ <to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/pendingUsers.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>confirmPendingAction</from-outcome>
+ <to-view-id>/jsf/admin/user/confirmPendingAction.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>cancel</from-outcome>
+ <to-view-id>/jsf/admin/index.xthml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/confirmPendingAction.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>revise</from-outcome>
+ <to-view-id>/jsf/admin/user/pendingUsers.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>success</from-outcome>
+ <to-view-id>/jsf/admin/index.xthml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/searchUsers.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>deleteUser</from-outcome>
+ <to-view-id>/jsf/admin/user/deleteUser.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>adminChangePassword</from-outcome>
+ <to-view-id>/jsf/admin/user/changePassword.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>start</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-outcome>start</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-action>#{editprofilemgr.adminEditProfile}</from-action>
+ <from-outcome>editProfile</from-outcome>
+ <to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/*</from-view-id>
+ <navigation-case>
+ <from-action>#{assignrolemgr.assignRoles}</from-action>
+ <from-outcome>assignRoles</from-outcome>
+ <to-view-id>/jsf/admin/assignRoles.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/createUser.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>register</from-outcome>
+ <to-view-id>/jsf/admin/user/registerRoles.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/registerRoles.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>register</from-outcome>
+ <to-view-id>/jsf/admin/user/registerConfirm.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/registerConfirm.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>revise</from-outcome>
+ <to-view-id>/jsf/admin/user/createUser.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>registered</from-outcome>
+ <to-view-id>/jsf/admin/index.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>createRole</from-outcome>
+ <to-view-id>/jsf/admin/roles/createRole.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>editRole</from-outcome>
+ <to-view-id>/jsf/admin/roles/editRole.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>viewMembers</from-outcome>
+ <to-view-id>/jsf/admin/roles/roleMembers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/roles.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>deleteRole</from-outcome>
+ <to-view-id>/jsf/admin/roles/deleteRole.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/editProfile.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>resetPassword</from-outcome>
+ <to-view-id>/jsf/admin/user/resetPassword.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/resetPassword.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{lostpasswordmgr.doomed}</from-action>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-action>#{lostpasswordmgr.doomed}</from-action>
+ <from-outcome>lostPassword</from-outcome>
+ <to-view-id>/jsf/admin/editProfile.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/jsf/admin/user/changePassword.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>status</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>searchUsers</from-outcome>
+ <to-view-id>/jsf/admin/user/searchUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
</faces-config>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -22,9 +22,7 @@
<h:form id="create-role-form">
<h:panelGrid columns="3">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE}"/>
- <h:inputText id="rolename" value="#{createrolemgr.uiRole.name}" required="true">
- <f:validator validatorId="RoleValidator"/>
- </h:inputText>
+ <h:inputText id="rolename" value="#{createrolemgr.uiRole.name}" required="true"/>
<h:message for="rolename" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE_DISPLAY}"/>
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/editRole.xhtml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/editRole.xhtml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/admin/roles/editRole.xhtml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -18,18 +18,22 @@
<li class="pathSeparator"><h:graphicImage url="/img/pathSeparator.png" alt=">"/></li>
<li class="selected">
<h:outputText id="rolename" value="#{editrolemgr.uiRole.name}" />
- </li>
+ </li>
</ui:define>
<ui:define name="content">
<h3><h:outputText value="#{bundle.IDENTITY_MANAGEMENT_EDIT_ROLE}"/></h3>
<h:form id="edit-role-link">
- <h:panelGrid columns="2">
+ <h:panelGrid columns="3">
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE}"/>
<h:outputText id="rolename" value="#{editrolemgr.uiRole.name}" />
-
+ <h:message for="rolename" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE_DISPLAY}"/>
- <h:inputText id="display-name" value="#{editrolemgr.uiRole.displayName}"/>
+ <h:inputText id="display-name" value="#{editrolemgr.uiRole.displayName}" required="true"/>
+ <h:message for="display-name" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
</h:panelGrid>
<hr/>
<p style="text-align: right;">
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/common/editProfileInfo.xhtml
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/common/editProfileInfo.xhtml 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-identity/src/resources/portal-identity-war/jsf/common/editProfileInfo.xhtml 2009-06-04 13:11:14 UTC (rev 13434)
@@ -5,199 +5,253 @@
xmlns:c="http://java.sun.com/jstl/core"
class="identity-ui">
- <!-- User Profile -->
- <h:panelGrid columns="2" cellpadding="3">
- <h:panelGroup/>
- <h:panelGroup>
- <ul class="topnav">
- <li id="currentTab">
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_GENERAL}" />
- </li>
- </ul>
- </h:panelGroup>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_TIMEZONE}"/>
- <h:outputText value=" *" rendered="#{metadataservice.timezone.required}" />
- </h:panelGroup>
- <h:selectOneMenu id="timezone" value="#{manager.uiUser.attribute.timezone}" required="#{metadataservice.timezone.required}">
- <f:selectItems value="#{metadataservice.timezone.values}" />
- </h:selectOneMenu>
- <h:panelGroup />
- <h:message for="timezone" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<!-- User Profile -->
+<h:panelGrid columns="2" cellpadding="3">
+<h:panelGroup/>
+<h:panelGroup>
+ <ul class="topnav">
+ <li id="currentTab">
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_GENERAL}"/>
+ </li>
+ </ul>
+</h:panelGroup>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_THEME}"/>
- <h:outputText value=" *" rendered="#{metadataservice.theme.required}" />
- </h:panelGroup>
- <h:selectOneMenu id="theme" value="#{manager.uiUser.attribute.theme}" required="#{metadataservice.theme.required}">
- <f:selectItems value="#{metadataservice.theme.values}" />
- </h:selectOneMenu>
- <h:panelGroup />
- <h:message for="theme" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_TIMEZONE}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.timezone.required}"/>
+</h:panelGroup>
+<h:selectOneMenu id="timezone" value="#{manager.uiUser.attribute.timezone}"
+ required="#{metadataservice.timezone.required}">
+ <f:selectItems value="#{metadataservice.timezone.values}"/>
+</h:selectOneMenu>
+<h:panelGroup/>
+<h:message for="timezone" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_THEME}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.theme.required}"/>
+</h:panelGroup>
+<h:selectOneMenu id="theme" value="#{manager.uiUser.attribute.theme}" required="#{metadataservice.theme.required}">
+ <f:selectItems value="#{metadataservice.theme.values}"/>
+</h:selectOneMenu>
+<h:panelGroup/>
+<h:message for="theme" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_LOCALE}"/>
- <h:outputText value=" *" rendered="#{metadataservice.locale.required}" />
- </h:panelGroup>
- <h:selectOneMenu id="locale" value="#{manager.uiUser.attribute.locale}" required="#{metadataservice.locale.required}">
- <f:selectItems value="#{metadataservice.locale.values}" />
- </h:selectOneMenu>
- <h:panelGroup />
- <h:message for="locale" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
- <h:panelGroup/>
- <h:panelGroup>
- <ul class="topnav">
- <li id="currentTab">
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_PERSONAL}" />
- </li>
- </ul>
- </h:panelGroup>
-
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_GIVENNAME}"/>
- <h:outputText value=" *" rendered="#{metadataservice.givenname.required}" />
- </h:panelGroup>
- <h:inputText id="givenname" value="#{manager.uiUser.attribute.givenname}" required="#{metadataservice.givenname.required}"/>
- <h:panelGroup />
- <h:message for="givenname" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_LOCALE}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.locale.required}"/>
+</h:panelGroup>
+<h:selectOneMenu id="locale" value="#{manager.uiUser.attribute.locale}"
+ required="#{metadataservice.locale.required}">
+ <f:selectItems value="#{metadataservice.locale.values}"/>
+</h:selectOneMenu>
+<h:panelGroup/>
+<h:message for="locale" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_FAMILYNAME}"/>
- <h:outputText value=" *" rendered="#{metadataservice.familyname.required}" />
- </h:panelGroup>
- <h:inputText id="lastname" value="#{manager.uiUser.attribute.familyname}" required="#{metadataservice.familyname.required}"/>
- <h:panelGroup />
- <h:message for="lastname" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup/>
+<h:panelGroup>
+ <ul class="topnav">
+ <li id="currentTab">
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_PERSONAL}"/>
+ </li>
+ </ul>
+</h:panelGroup>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_LOCATION}"/>
- <h:outputText value=" *" rendered="#{metadataservice.location.required}" />
- </h:panelGroup>
- <h:inputText id="location" value="#{manager.uiUser.attribute.location}" required="#{metadataservice.location.required}"/>
- <h:panelGroup />
- <h:message for="location" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
- <h:panelGroup/>
- <h:panelGroup>
- <ul class="topnav">
- <li id="currentTab">
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_INSTANT}" />
- </li>
- </ul>
- </h:panelGroup>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_GIVENNAME}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.givenname.required}"/>
+</h:panelGroup>
+<h:inputText id="givenname" value="#{manager.uiUser.attribute.givenname}"
+ required="#{metadataservice.givenname.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="givenname" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_SKYPE}"/>
- <h:outputText value=" *" rendered="#{metadataservice.skype.required}" />
- </h:panelGroup>
- <h:inputText id="skype" value="#{manager.uiUser.attribute.skype}" required="#{metadataservice.skype.required}"/>
- <h:panelGroup />
- <h:message for="skype" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_FAMILYNAME}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.familyname.required}"/>
+</h:panelGroup>
+<h:inputText id="familyname" value="#{manager.uiUser.attribute.familyname}"
+ required="#{metadataservice.familyname.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="familyname" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_ICQ}"/>
- <h:outputText value=" *" rendered="#{metadataservice.icq.required}" />
- </h:panelGroup>
- <h:inputText id="icq" value="#{manager.uiUser.attribute.icq}" required="#{metadataservice.icq.required}"/>
- <h:panelGroup />
- <h:message for="icq" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_AIM}"/>
- <h:outputText value=" *" rendered="#{metadataservice.aim.required}" />
- </h:panelGroup>
- <h:inputText id="aim" value="#{manager.uiUser.attribute.aim}" required="#{metadataservice.aim.required}"/>
- <h:panelGroup />
- <h:message for="aim" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_MSNM}"/>
- <h:outputText value=" *" rendered="#{metadataservice.msnm.required}" />
- </h:panelGroup>
- <h:inputText id="msnm" value="#{manager.uiUser.attribute.msnm}" required="#{metadataservice.msnm.required}"/>
- <h:panelGroup />
- <h:message for="msnm" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_LOCATION}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.location.required}"/>
+</h:panelGroup>
+<h:inputText id="location" value="#{manager.uiUser.attribute.location}" required="#{metadataservice.location.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="location" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_YIM}"/>
- <h:outputText value=" *" rendered="#{metadataservice.yim.required}" />
- </h:panelGroup>
- <h:inputText id="yim" value="#{manager.uiUser.attribute.yim}" required="#{metadataservice.yim.required}"/>
- <h:panelGroup />
- <h:message for="yim" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup/>
+<h:panelGroup>
+ <ul class="topnav">
+ <li id="currentTab">
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_INSTANT}"/>
+ </li>
+ </ul>
+</h:panelGroup>
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_XMMP}"/>
- <h:outputText value=" *" rendered="#{metadataservice.xmmp.required}" />
- </h:panelGroup>
- <h:inputText id="xmmp" value="#{manager.uiUser.attribute.xmmp}" required="#{metadataservice.xmmp.required}"/>
- <h:panelGroup />
- <h:message for="xmmp" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
- <h:panelGroup/>
- <h:panelGroup>
- <ul class="topnav">
- <li id="currentTab">
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL}" />
- </li>
- </ul>
- </h:panelGroup>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_HOMEPAGE}"/>
- <h:outputText value=" *" rendered="#{metadataservice.homepage.required}" />
- </h:panelGroup>
- <h:inputText id="homepage" value="#{manager.uiUser.attribute.homepage}" required="#{metadataservice.homepage.required}"/>
- <h:panelGroup />
- <h:message for="homepage" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_OCCUPATION}"/>
- <h:outputText value=" *" rendered="#{metadataservice.occupation.required}" />
- </h:panelGroup>
- <h:inputText id="occupation" value="#{manager.uiUser.attribute.occupation}" required="#{metadataservice.occupation.required}"/>
- <h:panelGroup />
- <h:message for="occupation" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_INTERESTS}"/>
- <h:outputText value=" *" rendered="#{metadataservice.interests.required}" />
- </h:panelGroup>
- <h:inputText id="interests" value="#{manager.uiUser.attribute.interests}" required="#{metadataservice.interests.required}"/>
- <h:panelGroup />
- <h:message for="interests" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_SIGNATURE}"/>
- <h:outputText value=" *" rendered="#{metadataservice.signature.required}" />
- </h:panelGroup>
- <h:panelGroup>
- <h:inputTextarea id="signature" value="#{manager.uiUser.attribute.signature}" cols="50" rows="5" required="#{metadataservice.signature.required}"/><br/>
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE}" />
- </h:panelGroup>
- <h:panelGroup />
- <h:message for="signature" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_SKYPE}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.skype.required}"/>
+</h:panelGroup>
+<h:inputText id="skype" value="#{manager.uiUser.attribute.skype}" required="#{metadataservice.skype.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="skype" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
-
- <h:panelGroup>
- <h:outputText value="#{bundle.IDENTITY_EXTRA}"/>
- <h:outputText value=" *" rendered="#{metadataservice.extra.required}" />
- </h:panelGroup>
- <h:panelGroup>
- <h:inputTextarea id="extra" value="#{manager.uiUser.attribute.extra}" cols="50" rows="5" required="#{metadataservice.extra.required}"/><br/>
- <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL_EXTRA}" />
- </h:panelGroup>
- <h:panelGroup />
- <h:message for="extra" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
-
- </h:panelGrid>
-
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_ICQ}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.icq.required}"/>
+</h:panelGroup>
+<h:inputText id="icq" value="#{manager.uiUser.attribute.icq}" required="#{metadataservice.icq.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="icq" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_AIM}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.aim.required}"/>
+</h:panelGroup>
+<h:inputText id="aim" value="#{manager.uiUser.attribute.aim}" required="#{metadataservice.aim.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="aim" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_MSNM}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.msnm.required}"/>
+</h:panelGroup>
+<h:inputText id="msnm" value="#{manager.uiUser.attribute.msnm}" required="#{metadataservice.msnm.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="msnm" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_YIM}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.yim.required}"/>
+</h:panelGroup>
+<h:inputText id="yim" value="#{manager.uiUser.attribute.yim}" required="#{metadataservice.yim.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="yim" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_XMMP}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.xmmp.required}"/>
+</h:panelGroup>
+<h:inputText id="xmmp" value="#{manager.uiUser.attribute.xmmp}" required="#{metadataservice.xmmp.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="xmmp" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+<h:panelGroup/>
+<h:panelGroup>
+ <ul class="topnav">
+ <li id="currentTab">
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL}"/>
+ </li>
+ </ul>
+</h:panelGroup>
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_HOMEPAGE}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.homepage.required}"/>
+</h:panelGroup>
+<h:inputText id="homepage" value="#{manager.uiUser.attribute.homepage}"
+ required="#{metadataservice.homepage.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="homepage" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_OCCUPATION}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.occupation.required}"/>
+</h:panelGroup>
+<h:inputText id="occupation" value="#{manager.uiUser.attribute.occupation}"
+ required="#{metadataservice.occupation.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="occupation" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_INTERESTS}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.interests.required}"/>
+</h:panelGroup>
+<h:inputText id="interests" value="#{manager.uiUser.attribute.interests}"
+ required="#{metadataservice.interests.required}">
+ <f:validator validatorId="AttributeValidator"/>
+</h:inputText>
+<h:panelGroup/>
+<h:message for="interests" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_SIGNATURE}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.signature.required}"/>
+</h:panelGroup>
+<h:panelGroup>
+ <h:inputTextarea id="signature" value="#{manager.uiUser.attribute.signature}" cols="50" rows="5"
+ required="#{metadataservice.signature.required}">
+ <f:validator validatorId="AttributeValidator"/>
+ </h:inputTextarea><br/>
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL_SIGNATURE}"/>
+</h:panelGroup>
+<h:panelGroup/>
+<h:message for="signature" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+
+
+<h:panelGroup>
+ <h:outputText value="#{bundle.IDENTITY_EXTRA}"/>
+ <h:outputText value=" *" rendered="#{metadataservice.extra.required}"/>
+</h:panelGroup>
+<h:panelGroup>
+ <h:inputTextarea id="extra" value="#{manager.uiUser.attribute.extra}" cols="50" rows="5"
+ required="#{metadataservice.extra.required}">
+ <f:validator validatorId="AttributeValidator"/>
+ </h:inputTextarea><br/>
+ <h:outputText value="#{bundle.IDENTITY_CATEGORY_ADDITIONAL_EXTRA}"/>
+</h:panelGroup>
+<h:panelGroup/>
+<h:message for="extra" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error"
+ warnClass="portlet-msg-alert"/>
+
+</h:panelGrid>
+
</div>
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -178,5 +178,5 @@
org.jboss.portal.object.name.admin.WSRP=WSRP
-INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '\\', '<', '>', '(', ')', '=' or '%5c'
+INVALID_NAME_ERROR=''{0}'' is an invalid {1} name: Cannot be null, empty or contain '/', '.', '\\', '<', '>', '(', ')', '=' or '%5c'
DUPLICATE_ERROR=A {1} named ''{0}'' already exists!
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_fr.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_fr.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -147,4 +147,4 @@
consumers_table_reload=Recharger consommateurs
CONSUMER_TYPE=Consommateur
DUPLICATE_ERROR=Un {1} nomm\u00e9 ''{0}'' existe d\u00e9j\u00e0!
-INVALID_NAME_ERROR=''{0}'' est un nom invalide pour un {1} : Ne peut pas \u00eatre null, vide ou contenir '\\', '<', '>', '(', ')', '=' ou '%5c'
\ No newline at end of file
+INVALID_NAME_ERROR=''{0}'' est un nom invalide pour un {1} : Ne peut pas \u00eatre null, vide ou contenir '/', '.', '\\', '<', '>', '(', ')', '=' ou '%5c'
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_it.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_it.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_it.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -178,5 +178,5 @@
org.jboss.portal.object.name.admin.WSRP=WSRP
-INVALID_NAME_ERROR=''{0}'' non \u00e8 un nome valido di {1} : Non \u00f2 essere null, vuoto o contenere '\\', '<', '>', '(', ')', '=' o '%5c'
+INVALID_NAME_ERROR=''{0}'' non \u00e8 un nome valido di {1} : Non \u00f2 essere null, vuoto o contenere '/', '.', '\\', '<', '>', '(', ')', '=' o '%5c'
DUPLICATE_ERROR=Un valore {1} con nome ''{0}'' esiste gi\u00e0!
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/Resource_pt_BR.properties 2009-06-04 13:11:14 UTC (rev 13434)
@@ -76,7 +76,7 @@
edit_consumer_cache = Expira\u00e7\u00e3o do cache\:
edit_consumer_cache_seconds = (segundos antes de expirar)
edit_consumer_endpoint = Configura\u00e7\u00e3o do endpoint\:
-edit_consumer_endpoint_wsdl = Usar WSDL?
+edit_consumer_endpoint_wsdl = Utilizar WSDL?
edit_consumer_endpoint_sd = URL do Service Description\:
edit_consumer_endpoint_m = URL do Markup\:
edit_consumer_endpoint_r = URL do Registro\:
@@ -109,8 +109,8 @@
# Producer configuration screen
producer_config_title = Configura\u00e7\u00e3o do Produtor
-producer_config_sd_requires_reg = O acesso \u00e0 descri\u00e7\u00e3o completa do servi\u00e7o exige que os consumidores estejam registados.
-producer_config_strict = Utilize compatibilidade estrita ao WSRP.
+producer_config_sd_requires_reg = O acesso \u00e0 descri\u00e7\u00e3o completa do servi\u00e7o exige que os consumidores estejam registrados.
+producer_config_strict = Utilizar compatibilidade estrita ao WSRP.
producer_config_requires_reg = Registro obrigat\u00f3rio. Modificar essa informa\u00e7\u00e3o invalidar\u00e1 os registros dos consumidores.
producer_config_reg_policy = Nome da classe de pol\u00edtica do registro\:
producer_config_reg_prop_validator = Nome da classe de valida\u00e7\u00e3o da propriedade do registro\:
@@ -169,5 +169,5 @@
org.jboss.portal.object.name.admin.WSRP=WSRP
-INVALID_NAME_ERROR=''{0}'' \u00e9 um nome inv\u00e1lido para {1}\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '\\', '<', '>', '(', ')', '=' ou '%5c'
+INVALID_NAME_ERROR=''{0}'' \u00e9 um nome inv\u00e1lido para {1}\: n\u00e3o deve ser nulo, vazio ou conter os caracteres '/', '.', '\\', '<', '>', '(', ')', '=' ou '%5c'
DUPLICATE_ERROR=Um {1} denominado ''{0}'' j\u00e1 existe\!
\ No newline at end of file
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/BeanContext.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -23,11 +23,13 @@
package org.jboss.portal.faces.gui;
+import org.apache.log4j.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
@@ -37,13 +39,26 @@
*/
public abstract class BeanContext
{
+ protected final static Logger log = Logger.getLogger(BeanContext.class);
+
public static final String STATUS = "status";
- private static final String RESOURCE_NAME = "Resource";
+ private static final String DEFAULT_RESOURCE_NAME = "Resource";
private static final String UNEXPECTED_ERROR = "bean_support_unexpected_error";
private static final String CAUSE = "bean_support_cause";
private static final String CURRENT_PLACEHOLDER = "###";
+ private String resourceName = DEFAULT_RESOURCE_NAME;
+ public void setResourceName(String resourceName)
+ {
+ this.resourceName = resourceName;
+ }
+
+ public String getResourceName()
+ {
+ return resourceName;
+ }
+
/**
* Retrieves the value of the parameter which name is given from the JSF request.
*
@@ -65,37 +80,76 @@
protected abstract Locale getLocale();
- public void createErrorMessage(String message, Object... params)
+ public void createErrorMessage(String localizedMessageId, Object... params)
{
- createLocalizedMessage(STATUS, message, getErrorSeverity(), params);
+ createLocalizedMessage(STATUS, localizedMessageId, getErrorSeverity(), params);
}
- public void createTargetedErrorMessage(String target, String message, Object... params)
+ public void createTargetedErrorMessage(String target, String localizedMessageId, Object... params)
{
- createLocalizedMessage(target, message, getErrorSeverity(), params);
+ createLocalizedMessage(target, localizedMessageId, getErrorSeverity(), params);
}
- protected void createLocalizedMessage(String target, String message, Object severity, Object... params)
+ /**
+ * Adds a localized message using the appropriate severity to the identified target in the context. This method
+ * accepts an arbitrary number of arguments to be passed as parameters of localized strings.
+ *
+ * @param target the target in this context that will receive the new message
+ * @param localizedMessageId a resource bundle identifier identifying which the localized string to use as a message
+ * @param severity an object representing the severity of the message (typically FacesMessage.Severity)
+ * @param params additional parameters to be passed to replace tokens in localized strings
+ */
+ protected void createLocalizedMessage(String target, String localizedMessageId, Object severity, Object... params)
{
- createMessage(target, getMessageFromBundle(message, params), severity);
+ createMessage(target, getMessageFromBundle(localizedMessageId, params), severity);
}
- public String getMessageFromBundle(String message, Object... params)
+ public String getMessageFromBundle(String localizedMessageId, Object... params)
{
- return getLocalizedMessage(message, getLocale(), params);
+ return getLocalizedMessage(localizedMessageId, getLocale(), resourceName, params);
}
public static String getLocalizedMessage(String localizationKey, Locale locale, Object... params)
{
- ResourceBundle rb = ResourceBundle.getBundle(RESOURCE_NAME, locale);
- return MessageFormat.format(rb.getString(localizationKey), params);
+ return getLocalizedMessage(localizationKey, locale, DEFAULT_RESOURCE_NAME, params);
}
+ public static String getLocalizedMessage(String localizationKey, Locale locale, String resourceName, Object... params)
+ {
+ ResourceBundle rb = ResourceBundle.getBundle(resourceName, locale);
+
+ String message;
+ try
+ {
+ message = rb.getString(localizationKey);
+ }
+ catch (MissingResourceException e)
+ {
+ // if the key doesn't exist, return it instead of failing
+ log.info("Couldn't find localization message for key '" + localizationKey + "' in bundle " + resourceName
+ + " for locale " + locale.getDisplayName());
+ return localizationKey;
+ }
+
+ return MessageFormat.format(message, params);
+ }
+
public void createErrorMessageFrom(Exception e)
{
createErrorMessageFrom(STATUS, e);
}
+ /**
+ * Creates a localized error message targeting the specified object in the context and using the specified error
+ * information. This method looks for two specific resource bundle entries to localize the message, {@link
+ * #UNEXPECTED_ERROR} and {@link #CAUSE}, using the following format for the message: <code>result of {@link
+ * #getLocalizedMessageOrExceptionName(Throwable)} for the exception\n[localized value associated with {@link
+ * #CAUSE}result of {@link #getLocalizedMessageOrExceptionName(Throwable)} for the exception's cause if the cause
+ * exists]
+ *
+ * @param target the contextual object target by the message to be created
+ * @param e the exception that we want to display as an error message
+ */
public void createErrorMessageFrom(String target, Exception e)
{
Throwable cause = e.getCause();
@@ -104,6 +158,14 @@
createMessage(target, message, getErrorSeverity());
}
+ /**
+ * Retrieves a localized message associated with the specified Throwable.
+ *
+ * @param e the Throwable for which a localized message is to be retrieved
+ * @return the localized message associated with the specified Throwable if it exists or the localized value
+ * associated with the {@link #UNEXPECTED_ERROR} resource bundle entry to which is appended the Throwable
+ * class name.
+ */
private String getLocalizedMessageOrExceptionName(Throwable e)
{
String localizedMessage = e.getLocalizedMessage();
@@ -114,14 +176,14 @@
return localizedMessage;
}
- protected void createInfoMessage(String target, String message)
+ protected void createInfoMessage(String target, String localizedMessageId)
{
- createLocalizedMessage(target, message, getInfoSeverity());
+ createLocalizedMessage(target, localizedMessageId, getInfoSeverity());
}
- public void createInfoMessage(String message)
+ public void createInfoMessage(String localizedMessageId)
{
- createInfoMessage(STATUS, message);
+ createInfoMessage(STATUS, localizedMessageId);
}
/**
@@ -179,7 +241,7 @@
}
getFromSession(name, newValue.getClass(), sessionMap, "Provided object: " + newValue
- + " is not compatible with previously assigned '" + name + "' object: " + CURRENT_PLACEHOLDER);
+ + " is not compatible with previously assigned '" + name + "' object: " + CURRENT_PLACEHOLDER);
sessionMap.put(name, newValue);
return newValue;
}
@@ -197,7 +259,7 @@
public <T> T getFromSession(String name, Class<T> expectedClass)
{
return getFromSession(name, expectedClass, getSessionMap(), "Current object:" + CURRENT_PLACEHOLDER
- + " is not compatible with expected class " + expectedClass + " for '" + name + "'");
+ + " is not compatible with expected class " + expectedClass + " for '" + name + "'");
}
/**
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/JSFBeanContext.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -23,6 +23,8 @@
package org.jboss.portal.faces.gui;
+import org.jboss.portal.common.util.ParameterValidation;
+
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -39,17 +41,37 @@
{
public String getParameter(String key)
{
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ return getParameter(key, FacesContext.getCurrentInstance());
+ }
+
+ public static String getParameter(String key, FacesContext facesContext)
+ {
+ Map pmap = facesContext.getExternalContext().getRequestParameterMap();
return (String)pmap.get(key);
}
public Map<String, Object> getSessionMap()
{
- return FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+ return JSFBeanContext.getSessionMap(FacesContext.getCurrentInstance());
}
+ public static Map<String, Object> getSessionMap(FacesContext facesContext)
+ {
+ return facesContext.getExternalContext().getSessionMap();
+ }
+
protected void createMessage(String target, String message, Object severity)
{
+ outputMessage(target, message, severity);
+ }
+
+ public static void outputMessage(String target, String message, Object severity)
+ {
+ if (ParameterValidation.isNullOrEmpty(target))
+ {
+ target = STATUS;
+ }
+
FacesMessage.Severity jsfSeverity;
if (severity instanceof FacesMessage.Severity)
{
@@ -71,13 +93,23 @@
else
{
// todo: do something better here
- System.out.println("Couldn't resolve component target: " + target);
+ log.info("Couldn't resolve component target: " + target);
}
FacesMessage msg = new FacesMessage(jsfSeverity, message, message);
facesContext.addMessage(target, msg);
}
+ public static void outputLocalizedMessage(String target, String localizationKey, Object severity, String resourceName, Object... params)
+ {
+ if(severity == null)
+ {
+ severity = FacesMessage.SEVERITY_ERROR;
+ }
+
+ outputMessage(target, getLocalizedMessage(localizationKey, getRequestLocale(), resourceName, params), severity);
+ }
+
protected Object getErrorSeverity()
{
return FacesMessage.SEVERITY_ERROR;
@@ -90,6 +122,11 @@
protected Locale getLocale()
{
+ return getRequestLocale();
+ }
+
+ public static Locale getRequestLocale()
+ {
return FacesContext.getCurrentInstance().getExternalContext().getRequestLocale();
}
}
Modified: branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java
===================================================================
--- branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-06-04 11:12:17 UTC (rev 13433)
+++ branches/Enterprise_Portal_Platform_4_3_GA_CP01_JBEPP-78/faces/src/main/org/jboss/portal/faces/gui/ManagedBean.java 2009-06-04 13:11:14 UTC (rev 13434)
@@ -26,7 +26,9 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.util.ParameterValidation;
+import java.util.regex.Pattern;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -38,8 +40,31 @@
protected BeanContext beanContext;
public static final String INVALID_NAME = "INVALID_NAME_ERROR";
+ public static final String INVALID_PATH = "INVALID_PATH_ERROR";
public static final String DUPLICATE = "DUPLICATE_ERROR";
+ public static interface PropertyValidator
+ {
+ boolean checkForDuplicates();
+
+ String getObjectTypeName();
+
+ boolean isAlreadyExisting(String propertyName);
+
+ String doSimpleChecks(String name);
+
+ ParameterValidation.ValidationErrorHandler getValidationErrorHandler(String name, String targetForErrorMessage);
+
+ Pattern getValidationPattern();
+ }
+
+ private PropertyValidator validator = new DefaultPropertyValidator();
+
+ protected void setValidator(PropertyValidator validator)
+ {
+ this.validator = validator;
+ }
+
public void setBeanContext(BeanContext beanContext)
{
this.beanContext = beanContext;
@@ -47,19 +72,37 @@
public String checkNameValidity(String name, String targetForErrorMessage)
{
+ return checkNameValidity(name, targetForErrorMessage, validator);
+ }
+
+ public String checkNameValidity(String name, String targetForErrorMessage, PropertyValidator validator)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(validator, "PropertyValidator");
+
+ String objectTypeName = validator.getObjectTypeName();
if (ParameterValidation.isNullOrEmpty(name))
{
- beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, name, getLocalizedType());
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, name, getLocalizedType(objectTypeName));
return null;
}
else
{
+ String original = name;
+ name = validator.doSimpleChecks(name);
+
+ // we got an invalid name after simple checks, fail!
+ if (name == null)
+ {
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, original, getLocalizedType(objectTypeName));
+ return null;
+ }
+
// Trim name
name = name.trim();
// "sanitize" name: if it's invalid, return null and output message
- name = ParameterValidation.sanitizeFromPatternWithHandler(name, ParameterValidation.XSS_CHECK,
- new MessageValidationHandler(null, targetForErrorMessage, name));
+ name = ParameterValidation.sanitizeFromPatternWithHandler(name, validator.getValidationPattern(),
+ validator.getValidationErrorHandler(name, targetForErrorMessage));
// we got an invalid name, fail!
if (name == null)
@@ -68,9 +111,9 @@
}
// Check for duplicate
- if (isAlreadyExisting(name))
+ if (validator.checkForDuplicates() && validator.isAlreadyExisting(name))
{
- beanContext.createTargetedErrorMessage(targetForErrorMessage, DUPLICATE, name, getLocalizedType());
+ getDuplicateErrorMessage(name, targetForErrorMessage, objectTypeName);
return null;
}
@@ -78,11 +121,16 @@
}
}
- private String getLocalizedType()
+ protected void getDuplicateErrorMessage(String name, String targetForErrorMessage, String objectTypeName)
{
- return beanContext.getMessageFromBundle(getObjectTypeName());
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, DUPLICATE, name, getLocalizedType(objectTypeName));
}
+ private String getLocalizedType(String objectTypeName)
+ {
+ return beanContext.getMessageFromBundle(objectTypeName);
+ }
+
protected abstract String getObjectTypeName();
public abstract boolean isAlreadyExisting(String objectName);
@@ -128,22 +176,65 @@
}
}
- private class MessageValidationHandler extends ParameterValidation.ValidationErrorHandler
+ protected class MessageValidationHandler extends ParameterValidation.ValidationErrorHandler
{
private String targetForErrorMessage;
private String validatedName;
+ private String objectTypeName;
+ private String errorMessageKey;
- private MessageValidationHandler(String defaultValue, String targetForErrorMessage, String validatedName)
+ public MessageValidationHandler(String defaultValue, String targetForErrorMessage, String validatedName, String objectTypeName)
{
+ this(defaultValue, targetForErrorMessage, validatedName, objectTypeName, INVALID_NAME);
+ }
+
+ public MessageValidationHandler(String defaultValue, String targetForErrorMessage, String validatedName, String objectTypeName, String errorMessageKey)
+ {
super(defaultValue);
this.targetForErrorMessage = targetForErrorMessage;
this.validatedName = validatedName;
+ this.objectTypeName = objectTypeName;
+ this.errorMessageKey = errorMessageKey;
}
protected String internalValidationErrorHandling(String s)
{
- beanContext.createTargetedErrorMessage(targetForErrorMessage, INVALID_NAME, validatedName, getLocalizedType());
+ beanContext.createTargetedErrorMessage(targetForErrorMessage, errorMessageKey, validatedName, getLocalizedType(objectTypeName));
return null;
}
}
+
+ protected class DefaultPropertyValidator implements PropertyValidator
+ {
+ public boolean checkForDuplicates()
+ {
+ return true;
+ }
+
+ public String getObjectTypeName()
+ {
+ return ManagedBean.this.getObjectTypeName();
+ }
+
+ public boolean isAlreadyExisting(String propertyName)
+ {
+ return ManagedBean.this.isAlreadyExisting(propertyName);
+ }
+
+ public String doSimpleChecks(String name)
+ {
+ // if name contains . or /, it's invalid for a Portal object
+ return (name.indexOf('.') != -1 || name.indexOf('/') != -1) ? null : name;
+ }
+
+ public ParameterValidation.ValidationErrorHandler getValidationErrorHandler(String name, String targetForErrorMessage)
+ {
+ return new MessageValidationHandler(null, targetForErrorMessage, name, getObjectTypeName());
+ }
+
+ public Pattern getValidationPattern()
+ {
+ return ParameterValidation.XSS_CHECK;
+ }
+ }
}
15 years
JBoss Portal SVN: r13433 - modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-06-04 07:12:17 -0400 (Thu, 04 Jun 2009)
New Revision: 13433
Modified:
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java
Log:
Removed getAdminRoles method
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java 2009-06-04 10:16:06 UTC (rev 13432)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java 2009-06-04 11:12:17 UTC (rev 13433)
@@ -103,12 +103,5 @@
*/
Set findRoles() throws IdentityException;
- /**
- * Get all the administrator roles
- *
- * @return the role names
- */
- Set<String> getAdminRoles() throws IdentityException;
-
}
15 years
JBoss Portal SVN: r13432 - in modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity: db and 1 other directories.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-06-04 06:16:06 -0400 (Thu, 04 Jun 2009)
New Revision: 13432
Modified:
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
Log:
[JBEPP-78] Added findRoleByDisplayName method
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java 2009-06-04 09:57:20 UTC (rev 13431)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/RoleModule.java 2009-06-04 10:16:06 UTC (rev 13432)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.identity;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-
import java.util.Set;
/**
@@ -44,6 +41,14 @@
Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
/**
+ * Retrieves a role by its display name
+ *
+ * @param displayName the display name of the Role to be retrieved
+ * @return the role associated to the specified display name
+ */
+ Role findRoleByDisplayName(String displayName) throws IdentityException, IllegalArgumentException;
+
+ /**
* Retrieve a collection of role from the role names.
*
* @param names the role names
@@ -98,5 +103,12 @@
*/
Set findRoles() throws IdentityException;
+ /**
+ * Get all the administrator roles
+ *
+ * @return the role names
+ */
+ Set<String> getAdminRoles() throws IdentityException;
+
}
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2009-06-04 09:57:20 UTC (rev 13431)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2009-06-04 10:16:06 UTC (rev 13432)
@@ -21,25 +21,23 @@
*/
package org.jboss.portal.identity.db;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.db.HibernateRoleImpl;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.db.HibernateUserImpl;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.identity.service.RoleModuleService;
-import org.hibernate.SessionFactory;
-import org.hibernate.Session;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.service.RoleModuleService;
import javax.naming.InitialContext;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
-import java.util.Iterator;
-import java.util.HashSet;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet </a>
@@ -52,44 +50,44 @@
{
/** . */
- private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(HibernateRoleModuleImpl.class);
- /** . */
- protected SessionFactory sessionFactory;
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(HibernateRoleModuleImpl.class);
+ /** . */
+ protected SessionFactory sessionFactory;
- /** . */
- protected String sessionFactoryJNDIName;
+ /** . */
+ protected String sessionFactoryJNDIName;
- public void start() throws Exception
- {
- //
- sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
+ public void start() throws Exception
+ {
+ //
+ sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
- super.start();
- }
+ super.start();
+ }
- public void stop() throws Exception
- {
+ public void stop() throws Exception
+ {
- //
- sessionFactory = null;
+ //
+ sessionFactory = null;
- super.stop();
- }
+ super.stop();
+ }
// public SessionFactory getSessionFactory()
// {
// return sessionFactory;
// }
- public String getSessionFactoryJNDIName()
- {
- return sessionFactoryJNDIName;
- }
+ public String getSessionFactoryJNDIName()
+ {
+ return sessionFactoryJNDIName;
+ }
- public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
- {
- this.sessionFactoryJNDIName = sessionFactoryJNDIName;
- }
+ public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
+ {
+ this.sessionFactoryJNDIName = sessionFactoryJNDIName;
+ }
public Role findRoleByName(String name) throws IdentityException
@@ -122,6 +120,36 @@
}
}
+ public Role findRoleByDisplayName(String displayName) throws IdentityException
+ {
+ if (displayName != null)
+ {
+ try
+ {
+ Session session = getCurrentSession();
+ Criteria criteria = session.createCriteria(HibernateRoleImpl.class);
+ criteria.add(Restrictions.eq("displayName", displayName));
+ criteria.setCacheable(true);
+ HibernateRoleImpl role = (HibernateRoleImpl)criteria.uniqueResult();
+ if (role == null)
+ {
+ throw new IdentityException("No such role " + displayName);
+ }
+ return role;
+ }
+ catch (HibernateException e)
+ {
+ String message = "Cannot find role by display name " + displayName;
+ log.error(message, e);
+ throw new IdentityException(message, e);
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+ }
+
public Set findRolesByNames(String[] names) throws IdentityException
{
if (names != null)
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2009-06-04 09:57:20 UTC (rev 13431)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/src/main/java/org/jboss/portal/identity/ldap/LDAPRoleModuleImpl.java 2009-06-04 10:16:06 UTC (rev 13432)
@@ -22,12 +22,10 @@
******************************************************************************/
package org.jboss.portal.identity.ldap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.identity.IdentityConfiguration;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.Role;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -39,12 +37,13 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.Role;
-
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -79,8 +78,8 @@
throw new IdentityException("No such role " + name);
}
SearchResult res = (SearchResult)sr.iterator().next();
- DirContext ctx = (DirContext)res.getObject();
- return createRoleInstance(res.getAttributes(),ctx.getNameInNamespace());
+ DirContext ctx = (DirContext)res.getObject();
+ return createRoleInstance(res.getAttributes(), ctx.getNameInNamespace());
}
catch (NoSuchElementException e)
@@ -94,6 +93,47 @@
throw new IdentityException("No role found with name: " + name);
}
+ public Role findRoleByDisplayName(String displayName) throws IdentityException, IllegalArgumentException
+ {
+ try
+ {
+ log.debug("findRoleByDisplayName(): display name = " + displayName);
+
+ if (displayName == null)
+ {
+ throw new IdentityException("Role name canot be null");
+ }
+
+
+ String filter = "(".concat(getDisplayNameAttributeID()).concat("=").concat(displayName).concat(")");
+ log.debug("Search filter: " + filter);
+
+ List sr = searchRoles(filter, null);
+ if (sr.size() > 1)
+ {
+ throw new IdentityException("Found more than one role with display name: " + displayName + "" +
+ "Posible data inconsistency");
+ }
+ if (sr.size() == 0)
+ {
+ throw new IdentityException("No such role " + displayName);
+ }
+ SearchResult res = (SearchResult)sr.iterator().next();
+ DirContext ctx = (DirContext)res.getObject();
+ return createRoleInstance(res.getAttributes(), ctx.getNameInNamespace());
+
+ }
+ catch (NoSuchElementException e)
+ {
+ log.debug("No role found with display name: " + displayName, e);
+ }
+ catch (NamingException e)
+ {
+ throw new IdentityException("Role search failed.", e);
+ }
+ throw new IdentityException("No role found with display name: " + displayName);
+ }
+
public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
{
if (names == null)
@@ -110,11 +150,11 @@
{
String name = names[i];
filter.append("(")
- .append(getRidAttributeID())
- .append("=")
- .append(name)
- .append(") ");
- }
+ .append(getRidAttributeID())
+ .append("=")
+ .append(name)
+ .append(") ");
+ }
filter.append(")");
List sr = searchRoles(filter.toString(), null);
@@ -122,8 +162,8 @@
for (Iterator iterator = sr.iterator(); iterator.hasNext();)
{
SearchResult res = (SearchResult)iterator.next();
- DirContext ctx = (DirContext)res.getObject();
- roles.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ DirContext ctx = (DirContext)res.getObject();
+ roles.add(createRoleInstance(res.getAttributes(), ctx.getNameInNamespace()));
}
}
catch (Exception e)
@@ -222,7 +262,7 @@
}
}
- Role resultRole = findRoleByName(name);
+ Role resultRole = findRoleByName(name);
fireRoleCreatedEvent(resultRole.getId(), resultRole.getName());
@@ -308,8 +348,8 @@
while (iter.hasNext())
{
SearchResult res = (SearchResult)iter.next();
- DirContext ctx = (DirContext)res.getObject();
- rf.add(createRoleInstance(res.getAttributes(),ctx.getNameInNamespace()));
+ DirContext ctx = (DirContext)res.getObject();
+ rf.add(createRoleInstance(res.getAttributes(), ctx.getNameInNamespace()));
}
}
catch (NoSuchElementException e)
@@ -324,8 +364,8 @@
}
/**
- * This method should be used by over modules to perform searches. It will allow role module
- * implementation to apply proper filter and search scope from the configuration
+ * This method should be used by over modules to perform searches. It will allow role module implementation to apply
+ * proper filter and search scope from the configuration
*
* @param filter that will be concatenated with proper role search filter from the module
* @return
@@ -377,5 +417,4 @@
}
-
}
15 years
JBoss Portal SVN: r13431 - in modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78: build and 2 other directories.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-06-04 05:57:20 -0400 (Thu, 04 Jun 2009)
New Revision: 13431
Modified:
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/build/pom.xml
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/pom.xml
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/pom.xml
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/sso/pom.xml
Log:
[JBEPP-78] Change pom versions
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/build/pom.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/build/pom.xml 2009-06-04 09:52:07 UTC (rev 13430)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/build/pom.xml 2009-06-04 09:57:20 UTC (rev 13431)
@@ -18,7 +18,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.portal.identity</groupId>
<artifactId>module-parent</artifactId>
- <version>1.1.0</version>
+ <version>1.1.0_JBEPP-78</version>
<packaging>pom</packaging>
<name>JBoss Portal Identity</name>
<url>http://www.jboss.com/products/jbossmc</url>
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/pom.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/pom.xml 2009-06-04 09:52:07 UTC (rev 13430)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/identity/pom.xml 2009-06-04 09:57:20 UTC (rev 13431)
@@ -4,7 +4,7 @@
<groupId>org.jboss.portal.identity</groupId>
<artifactId>module-parent</artifactId>
<relativePath>../build/pom.xml</relativePath>
- <version>1.1.0</version>
+ <version>1.1.0_JBEPP-78</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>identity-identity</artifactId>
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/pom.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/pom.xml 2009-06-04 09:52:07 UTC (rev 13430)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/pom.xml 2009-06-04 09:57:20 UTC (rev 13431)
@@ -5,7 +5,7 @@
<artifactId>module-aggregator</artifactId>
<packaging>pom</packaging>
<name>JBoss Portal Identity Module</name>
- <version>1.1.0</version>
+ <version>1.1.0_JBEPP-78</version>
<url>http://labs.jboss.com/jbossportal</url>
<dependencies/>
Modified: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/sso/pom.xml
===================================================================
--- modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/sso/pom.xml 2009-06-04 09:52:07 UTC (rev 13430)
+++ modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/sso/pom.xml 2009-06-04 09:57:20 UTC (rev 13431)
@@ -4,7 +4,7 @@
<groupId>org.jboss.portal.identity</groupId>
<artifactId>module-parent</artifactId>
<relativePath>../build/pom.xml</relativePath>
- <version>1.1.0</version>
+ <version>1.1.0_JBEPP-78</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>identity-sso</artifactId>
15 years
JBoss Portal SVN: r13430 - modules/identity/branches.
by portal-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2009-06-04 05:52:07 -0400 (Thu, 04 Jun 2009)
New Revision: 13430
Added:
modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78/
Log:
[JBEPP-78] Branch for patch
Copied: modules/identity/branches/JBP_IDENTITY_1_1_0_JBEPP-78 (from rev 13429, modules/identity/tags/JBP_IDENTITY_1_1_0)
15 years
JBoss Portal SVN: r13429 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2009-06-03 19:13:30 -0400 (Wed, 03 Jun 2009)
New Revision: 13429
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerRuntimeOptionInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/RuntimeOptionInfo.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
modules/portlet/trunk/releaseLibs.sh
Log:
- Now allowing access to runtime container options via PortletInfo.getRuntimeOptionsInfo() and RuntimeOptionInfo class.
- Will need to add related tests.
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/aspects/portlet/RequestAttributeConversationInterceptor.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -22,33 +22,33 @@
******************************************************************************/
package org.jboss.portal.portlet.aspects.portlet;
+import org.jboss.portal.common.util.UUIDGenerator;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletInvokerException;
+import org.jboss.portal.portlet.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.container.ContainerPortletInvoker;
+import org.jboss.portal.portlet.container.PortletContainer;
+import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
-import org.jboss.portal.portlet.invocation.EventInvocation;
import org.jboss.portal.portlet.invocation.ResourceInvocation;
-import org.jboss.portal.portlet.PortletInvokerInterceptor;
+import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.invocation.response.UpdateNavigationalStateResponse;
-import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
-import org.jboss.portal.portlet.container.PortletContainer;
-import org.jboss.portal.portlet.container.ContainerPortletInvoker;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.PortletInvokerException;
-import org.jboss.portal.common.util.UUIDGenerator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Collections;
-import java.util.List;
+import java.util.Comparator;
import java.util.Enumeration;
+import java.util.HashMap;
import java.util.LinkedList;
-import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -66,8 +66,8 @@
ContainerPortletInfo containerInfo = (ContainerPortletInfo)container.getInfo();
//
- Map<String, ContainerOptionInfo> options = containerInfo.getOptions();
- ContainerOptionInfo scopingOption = options.get("javax.portlet.actionScopedRequestAttributes");
+ Map<String, RuntimeOptionInfo> options = containerInfo.getRuntimeOptionsInfo();
+ RuntimeOptionInfo scopingOption = options.get(RuntimeOptionInfo.JAVAX_PORTLET_ACTION_SCOPED_REQUEST_ATTRIBUTES);
//
int maxScope = 0;
@@ -77,7 +77,7 @@
//
List<String> values = scopingOption.getValues();
- if (values.size() >= 3 && "numberOfCachedScopes".equals(values.get(1)))
+ if (values.size() >= 3 && RuntimeOptionInfo.NUMBER_OF_CACHED_SCOPES.equals(values.get(1)))
{
try
{
@@ -249,7 +249,7 @@
// Make a first can
int size = 0;
- for (Enumeration e = session.getAttributeNames();e.hasMoreElements();)
+ for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();)
{
String name = (String)e.nextElement();
if (name.startsWith("org.jboss.portal.portlet.conversation."))
@@ -262,7 +262,7 @@
if (size >= maxScope)
{
LinkedList<Conversation> allConversations = null;
- for (Enumeration e = session.getAttributeNames();e.hasMoreElements();)
+ for (Enumeration e = session.getAttributeNames(); e.hasMoreElements();)
{
String name = (String)e.nextElement();
if (name.startsWith("org.jboss.portal.portlet.conversation."))
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -55,6 +55,7 @@
import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
@@ -165,7 +166,7 @@
private final Map<String, ContainerPortletInfo> portlets;
/** . */
- private final Map<String, ContainerOptionInfo> applicationOptions;
+ private final Map<String, RuntimeOptionInfo> applicationOptions;
/** . */
private final Map<Mode, ContainerModeInfo> customModes;
@@ -187,7 +188,7 @@
this.events = new LinkedHashMap<QName, ContainerEventInfo>();
this.publicParameters = new LinkedHashMap<String, ContainerParameterInfo>();
this.portlets = new LinkedHashMap<String, ContainerPortletInfo>();
- this.applicationOptions = new HashMap<String, ContainerOptionInfo>();
+ this.applicationOptions = new HashMap<String, RuntimeOptionInfo>();
this.customModes = new HashMap<Mode, ContainerModeInfo>();
this.customWindowStates = new HashMap<WindowState, ContainerWindowStateInfo>();
}
@@ -414,7 +415,7 @@
}
//
- Map<String, ContainerOptionInfo> applicationOptions = build(tmp.getContainerRuntimeOptions().values());
+ Map<String, RuntimeOptionInfo> applicationOptions = build(tmp.getContainerRuntimeOptions().values());
if (applicationOptions != null)
{
this.applicationOptions.putAll(applicationOptions);
@@ -675,10 +676,10 @@
}
//
- Map<String, ContainerOptionInfo> options = build(portletMD.getContainerRuntimeOptions().values());
+ Map<String, RuntimeOptionInfo> options = build(portletMD.getContainerRuntimeOptions().values());
if (options != null)
{
- for (Map.Entry<String, ContainerOptionInfo> entry : applicationOptions.entrySet())
+ for (Map.Entry<String, RuntimeOptionInfo> entry : applicationOptions.entrySet())
{
if (!options.containsKey(entry.getKey()))
{
@@ -731,24 +732,24 @@
return containerPortletInfo;
}
- private Map<String, ContainerOptionInfo> build(Collection<ContainerRuntimeMetaData> optionsMD)
+ private Map<String, RuntimeOptionInfo> build(Collection<ContainerRuntimeMetaData> optionsMD)
{
- Map<String, ContainerOptionInfo> options = null;
+ Map<String, RuntimeOptionInfo> options = null;
for (ContainerRuntimeMetaData containerRuntimeMD : optionsMD)
{
- ContainerOptionInfo optionInfo = build(containerRuntimeMD);
+ RuntimeOptionInfo optionInfo = build(containerRuntimeMD);
if (options == null)
{
- options = new HashMap<String, ContainerOptionInfo>();
+ options = new HashMap<String, RuntimeOptionInfo>();
}
options.put(optionInfo.getName(), optionInfo);
}
return options;
}
- private ContainerOptionInfo build(ContainerRuntimeMetaData containerRuntimeMD)
+ private ContainerRuntimeOptionInfo build(ContainerRuntimeMetaData containerRuntimeMD)
{
- return new ContainerOptionInfo(containerRuntimeMD.getName(), Collections.unmodifiableList(containerRuntimeMD.getValues()));
+ return new ContainerRuntimeOptionInfo(containerRuntimeMD.getName(), Collections.unmodifiableList(containerRuntimeMD.getValues()));
}
private ContainerNavigationInfo buildContainerNavigationInfo(PortletMetaData portletMD)
Deleted: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -1,55 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.info;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ContainerOptionInfo
-{
-
- /** . */
- private final String name;
-
- /** . */
- private final List<String> values;
-
- public ContainerOptionInfo(String name, List<String> values)
- {
- this.name = name;
- this.values = values;
- }
-
- public String getName()
- {
- return name;
- }
-
- public List<String> getValues()
- {
- return values;
- }
-}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -24,12 +24,13 @@
import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
/**
* For now implementation that use the portlet container directly.
@@ -84,7 +85,7 @@
private final List<String> filterRefs;
/** . */
- private final Map<String, ContainerOptionInfo> options;
+ private final Map<String, RuntimeOptionInfo> options;
public ContainerPortletInfo(
ContainerCapabilitiesInfo capabilities,
@@ -130,7 +131,7 @@
Map<String, String> initParameters,
Boolean remotable,
ResourceBundleManager bundleManager,
- Map<String, ContainerOptionInfo> options)
+ Map<String, RuntimeOptionInfo> options)
{
this.attachments = new HashMap<Class, Object>();
this.capabilities = capabilities;
@@ -157,7 +158,7 @@
}
return type.cast(attachments.get(type));
}
-
+
public <T> void setAttachment(Class<T> type, T object)
{
if (type == null)
@@ -184,9 +185,9 @@
return applicationName;
}
- public Map<String, ContainerOptionInfo> getOptions()
+ public Map<String, RuntimeOptionInfo> getRuntimeOptionsInfo()
{
- return options;
+ return Collections.unmodifiableMap(options);
}
public ResourceBundleManager getBundleManager()
Copied: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerRuntimeOptionInfo.java (from rev 13338, modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerOptionInfo.java)
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerRuntimeOptionInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerRuntimeOptionInfo.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerRuntimeOptionInfo implements RuntimeOptionInfo
+{
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final List<String> values;
+
+ public ContainerRuntimeOptionInfo(String name, List<String> values)
+ {
+ this.name = name;
+ this.values = values;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public List<String> getValues()
+ {
+ return Collections.unmodifiableList(values);
+ }
+}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -27,7 +27,7 @@
import org.jboss.portal.portlet.impl.info.ContainerParameterInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerOptionInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
import javax.portlet.PortletConfig;
import javax.portlet.PortletContext;
@@ -86,10 +86,10 @@
//
ParameterMap tmp = null;
- for (ContainerOptionInfo option : portletInfo.getOptions().values())
+ for (RuntimeOptionInfo option : portletInfo.getRuntimeOptionsInfo().values())
{
String name = option.getName();
- if (PortletContextImpl.SUPPORTED_OPTIONS.contains(name))
+ if (RuntimeOptionInfo.SUPPORTED_OPTIONS.contains(name))
{
if (tmp == null)
{
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -22,8 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
+import org.jboss.portal.portlet.spi.PortalContext;
import javax.portlet.PortletContext;
import javax.portlet.PortletRequestDispatcher;
@@ -32,9 +33,9 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Set;
-import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -49,11 +50,9 @@
/** . */
private ContainerPortletApplicationInfo info;
- /** . */
- public static final Set<String> SUPPORTED_OPTIONS = Collections.unmodifiableSet(Tools.toSet(
- "javax.portlet.actionScopedRequestAttributes",
- "javax.portlet.escapeXml",
- "javax.portlet.servletDefaultSessionScope"));
+ private static final String VERSION = PortalContext.VERSION.getName().replace(" ", "") + "/"
+ + PortalContext.VERSION.getMajor() + "." + PortalContext.VERSION.getMinor() + "."
+ + PortalContext.VERSION.getQualifier();
public PortletContextImpl(ServletContext servletContext)
{
@@ -62,7 +61,7 @@
public String getServerInfo()
{
- return "JBossPortletContainer/" + 2 + "." + 0;
+ return VERSION;
}
public PortletRequestDispatcher getRequestDispatcher(String path)
@@ -197,6 +196,6 @@
public Enumeration<String> getContainerRuntimeOptions()
{
- return Collections.enumeration(SUPPORTED_OPTIONS);
+ return Collections.enumeration(RuntimeOptionInfo.SUPPORTED_OPTIONS);
}
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.info;
+import java.util.Map;
+
/**
* Runtime meta data for a portlet.
*
@@ -104,4 +106,11 @@
* @throws IllegalArgumentException if the parameter type is null
*/
<T> T getAttachment(Class<T> type) throws IllegalArgumentException;
+
+ /**
+ * Retrieves the runtime container options set by the associated portlet, if any.
+ *
+ * @return the runtime container options set by the associated portlet, if any
+ */
+ Map<String, RuntimeOptionInfo> getRuntimeOptionsInfo();
}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/RuntimeOptionInfo.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/RuntimeOptionInfo.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/RuntimeOptionInfo.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -0,0 +1,53 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.portal.portlet.info;
+
+import org.jboss.portal.common.util.Tools;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public interface RuntimeOptionInfo
+{
+ String JAVAX_PORTLET_ACTION_SCOPED_REQUEST_ATTRIBUTES = "javax.portlet.actionScopedRequestAttributes";
+ String NUMBER_OF_CACHED_SCOPES = "numberOfCachedScopes";
+ String JAVAX_PORTLET_ESCAPE_XML = "javax.portlet.escapeXml";
+ String JAVAX_PORTLET_SERVLET_DEFAULT_SESSION_SCOPE = "javax.portlet.servletDefaultSessionScope";
+
+ String ORG_JBOSS_PORTLETCONTAINER_REMOTABLE = "org.jboss.portletcontainer.remotable";
+
+ Set<String> SUPPORTED_OPTIONS = Collections.unmodifiableSet(Tools.toSet(
+ JAVAX_PORTLET_ACTION_SCOPED_REQUEST_ATTRIBUTES,
+ JAVAX_PORTLET_ESCAPE_XML,
+ JAVAX_PORTLET_SERVLET_DEFAULT_SESSION_SCOPE,
+ ORG_JBOSS_PORTLETCONTAINER_REMOTABLE));
+
+ String getName();
+
+ List<String> getValues();
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2009-06-03 23:13:30 UTC (rev 13429)
@@ -24,7 +24,10 @@
import org.jboss.portal.portlet.info.CapabilitiesInfo;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.RuntimeOptionInfo;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5448 $
@@ -104,4 +107,9 @@
}
return null;
}
+
+ public Map<String, RuntimeOptionInfo> getRuntimeOptionsInfo()
+ {
+ throw new UnsupportedOperationException("Implement me");
+ }
}
Modified: modules/portlet/trunk/releaseLibs.sh
===================================================================
--- modules/portlet/trunk/releaseLibs.sh 2009-06-03 15:57:20 UTC (rev 13428)
+++ modules/portlet/trunk/releaseLibs.sh 2009-06-03 23:13:30 UTC (rev 13429)
@@ -25,9 +25,9 @@
echo "Releasing to Portal thirdparty"
fi
-cp bridge/target/portlet-bridge-2.1.0-SNAPSHOT.jar $loc/portal-portlet-bridge-lib.jar
-cp controller/target/portlet-controller-2.1.0-SNAPSHOT.jar $loc/portal-portlet-controller-lib.jar
-cp federation/target/portlet-federation-2.1.0-SNAPSHOT.jar $loc/portal-portlet-federation-lib.jar
-cp management/target/portlet-management-2.1.0-SNAPSHOT.jar $loc/portal-portlet-management-lib.jar
-cp portlet/target/portlet-portlet-2.1.0-SNAPSHOT.jar $loc/portal-portlet-lib.jar
-cp samples/target/portlet-samples-2.1.0-SNAPSHOT.jar $loc/portal-portlet-samples-lib.jar
+cp bridge/target/portlet-bridge-trunk-SNAPSHOT.jar $loc/portal-portlet-bridge-lib.jar
+cp controller/target/portlet-controller-trunk-SNAPSHOT.jar $loc/portal-portlet-controller-lib.jar
+cp federation/target/portlet-federation-trunk-SNAPSHOT.jar $loc/portal-portlet-federation-lib.jar
+cp management/target/portlet-management-trunk-SNAPSHOT.jar $loc/portal-portlet-management-lib.jar
+cp portlet/target/portlet-portlet-trunk-SNAPSHOT.jar $loc/portal-portlet-lib.jar
+cp samples/target/portlet-samples-trunk-SNAPSHOT.jar $loc/portal-portlet-samples-lib.jar
15 years
JBoss Portal SVN: r13428 - in branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium: cms and 2 other directories.
by portal-commits@lists.jboss.org
Author: vrockai
Date: 2009-06-03 11:57:20 -0400 (Wed, 03 Jun 2009)
New Revision: 13428
Modified:
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java
Log:
[selenium] - xss
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/IdentityAdminTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -17,6 +17,10 @@
+ private static final String LNK_MEMBERS = "link=Members";
+
+ private static final String LNK_ADMIN = "link=Admin";
+
/** prefix for locator properties */
public String casePfx = "iden.man.";
@@ -204,7 +208,7 @@
logout();
// trying to log in with disabled account
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LINK_LOGIN);
@@ -483,16 +487,148 @@
}
/**
- * @deprecated
- * Test many users creates 25 users. The test is disabled.
+ * Xss testing of user creating dialog. XSS string is passed to user name input, the form is submitted and text indicating incorrect username input is asserted.
+ * The page is realoaded and XSS string is passed to user e-mail input, the form is submitted and text indicating incorrect user e-mail input is asserted.
*/
- @Test(enabled = false)
- public void testManyUsers() {
- for (int i = 0; i < 25; i++) {
- createUser("user0" + i + "", "useruser", "user0" + i + "" + "@portal.com");
- }
+ //TODO Q: password can be anystring?
+ //TODO Q: what about serach input?
+ @Test(enabled = true)
+ public void testUserCreateXss() {
+ openAndWait(ADR_PORTAL);
+ clickAndWait(LNK_ADMIN);
+ clickAndWait(LNK_MEMBERS);
+ clickAndWait(LNK_CREATE_USER);
+
+ selenium.type(INP_USERNAME, XSS_STR1);
+ clickAndWait(SUB_CREATE_USER);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid username"));
+
+ openAndWait(ADR_PORTAL);
+
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_CREATE_USER);
+
+ selenium.type(INP_USERNAME, "user");
+ selenium.type(INP_USEREMAIL, XSS_STR1);
+
+ clickAndWait(SUB_CREATE_USER);
+
+ Assert.assertTrue(selenium.isTextPresent("Invalid E-Mail address."));
+
}
+
+ /**
+ *
+ */
+ @Test(enabled = true)
+ public void testRoleCreateXss() {
+ openAndWait(ADR_PORTAL);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+ clickIfVisible(LNK_ROLE_CREATE);
+
+ selenium.type(INP_ROLENAME, XSS_STR1);
+ selenium.type(INP_ROLEDISNAME,"diddi");
+ clickAndWait(SUB_ROLE_CREATE);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role name"));
+
+ openAndWait(ADR_PORTAL);
+
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_ADMIN);
+ clickIfVisible(LNK_MEMBERS);
+ clickIfVisible(LNK_ROLETAB);
+ clickIfVisible(LNK_ROLEMAIN);
+ clickIfVisible(LNK_ROLE_CREATE);
+
+ selenium.type(INP_ROLENAME, "rolee");
+ selenium.type(INP_ROLEDISNAME, XSS_STR1);
+
+ clickAndWait(SUB_ROLE_CREATE);
+
+ Assert.assertTrue(selenium.isTextPresent("is an invalid role display name"));
+ }
+
+ /**
+ *
+ */
+ @Test(enabled = true, dependsOnMethods = {"testEditUser"})
+ public void testEditUserXss() {
+ final String userName = "editXssMe";
+ final String userPass = "editXssPass";
+ final String userMail = "editXssMe(a)redhat.com";
+ createUser(userName, userPass, userMail);
+ goToEdit(userName, userMail);
+
+ testInput(INP_EDIT_USER_EMAIL, XSS_STR1, SUB_EDIT_PROF, "Invalid E-Mail address.");
+
+ //firstname
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:givenname')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //lastname
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:familyname')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //location
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:location')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //skype
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:skype')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //icq
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:icq')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //aim
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:aim')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //msn
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:msnm')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //yahoo
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:yim')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //xmmp
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:xmmp')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //homepage
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:homepage')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //occup
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:occupation')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //hobby
+ goToEdit(userName, userMail);
+ testInput("//input[contains(@id,'profile-form:interests')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //sign
+ goToEdit(userName, userMail);
+ testInput("//textarea[contains(@id,'profile-form:signature')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+ //extra
+ goToEdit(userName, userMail);
+ testInput("//textarea[contains(@id,'profile-form:extra')]", XSS_STR1, SUB_EDIT_PROF, "is an invalid value");
+
+ deleteUser(userName, userMail);
+ }
+ private void goToEdit(String userName, String userMail){
+ searchUser(userName, userMail);
+
+ int r = findTableRow(TBL_USERLIST, userName, 0);
+ selenium.click(MessageFormat.format(LNK_T_USRLIST_EDIT, r - 1));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ }
+
+ private void testInput(String inpLoc, String inpStr, String subLoc, String mes){
+ selenium.type(inpLoc, inpStr);
+ clickAndWait(subLoc);
+ Assert.assertTrue(selenium.isTextPresent(mes));
+ }
+
/**
* Test search user count is responsible for the search functions for users..
* The test creates 95 users named man0us - man94us.
@@ -598,10 +734,10 @@
selenium.open("/portal/auth/portal/default");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_USERTAB);
@@ -638,9 +774,9 @@
selenium.open("/portal/auth/portal/default");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_USERMAIN);
@@ -661,15 +797,15 @@
void searchUser(String userName, String userMail) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_USERTAB);
clickIfVisible(LNK_USERMAIN);
clickIfVisible(LNK_USERMANG_MAIN);
-
+ clickIfVisible("//a[contains(@id,'user-temp-form1:user-managment-link')]");
selenium.click(LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -707,9 +843,9 @@
private void deleteUser(String username, String email) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_USERTAB);
@@ -717,6 +853,7 @@
clickIfVisible(LNK_USERMAIN);
clickIfVisible(LNK_USERMANG_MAIN);
clickIfVisible(LNK_USERMANG_MAIN2);
+ clickIfVisible("//a[contains(@id,'user-temp-form1:user-managment-link')]");
selenium.click(LNK_SEARCH_USER);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -738,18 +875,18 @@
private void clickUntilMembers() {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
}
private void createRole(String roleName, String roleDisplayName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_ROLETAB);
@@ -774,9 +911,9 @@
private void deleteRole(String roleName) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_ROLETAB);
@@ -799,9 +936,9 @@
private void searchSimple(String name, String count) {
selenium.open("/portal/");
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Admin");
+ selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
- selenium.click("link=Members");
+ selenium.click(LNK_MEMBERS);
selenium.waitForPageToLoad(PAGE_LOAD);
clickIfVisible(LNK_USERTAB);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/JBossPortalSeleniumTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -41,11 +41,13 @@
protected final String LINK_LOGOUT = getLoc(casePfx + "link.logout", "link=Logout");
protected final String SUBMIT_LOGIN = getLoc(casePfx + "submit.login", "login");
- protected final String ADDR_PORTAL = getLoc(casePfx + "addr.portal", "/portal/");
+ protected final String ADR_PORTAL = getLoc(casePfx + "addr.portal", "/portal/");
protected final String FRAME_LOGIN_CONTENT = getLoc(casePfx + "frame.login.content", "login-content");
protected final String LINK_LOGIN = getLoc(casePfx + "link.login", "link=Login");
protected final String INPUT_PASSWORD = getLoc(casePfx + "input.password", "j_password");
protected final String INPUT_USERNAME = getLoc(casePfx + "input.username", "j_username");
+
+ protected final String XSS_STR1 = getMess("portal.xxs.1", "/Dave</option><script>alert(document.cookie);</script>");
protected static Properties propsLoc;
protected static Properties propsMes;
@@ -373,7 +375,7 @@
* the password
*/
public void login(String username, String password) {
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LINK_LOGIN);
@@ -396,7 +398,7 @@
* Logs out from JBoss portal application.
*/
public void logout() {
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isElementPresent(LINK_LOGOUT));
selenium.click(LINK_LOGOUT);
@@ -410,7 +412,7 @@
*/
// TODO refactoring needed - use function logout()
public void logoutIfPossible() {
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
if (selenium.isElementPresent(LINK_LOGOUT)) {
selenium.click(LINK_LOGOUT);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/UserLoginTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -4,7 +4,6 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
-
/**
* Testcase responsible for testing of login form.
*
@@ -13,43 +12,42 @@
@Test(groups = { "login" }, enabled = true)
public class UserLoginTestCase extends JBossPortalSeleniumTestCase {
-
- /** prefix for locator properties = user.login.*/
+
+ /** prefix for locator properties = user.login. */
public final String casePfx = "user.login.";
-
- private final String ADR_PORTAL = getLoc(casePfx+"adr.portal","/portal");
- private final String FRM_MAIN = getLoc(casePfx+"frm.main","relative=up");
- private final String SUB_CANCEL = getLoc(casePfx+"sub.portal","cancel");
- private final String LNK_LOGOUT = getLoc(casePfx+"lnk.logout","link=Logout");
- private final String SUB_LOGIN = getLoc(casePfx+"saub.login","login-submit");
- private final String INP_PASSWORD = getLoc(casePfx+"inp.password","xpath=id('j_password')");
- private final String INP_USERNAME = getLoc(casePfx+"inp.username","xpath=id('j_username')");
- private final String FRM_LOGINFORM = getLoc(casePfx+"frm.login","login-content");
- private final String LNK_LOGIN = getLoc(casePfx+"lnk.login","link=Login");
-
+
+ private final String ADR_PORTAL = getLoc(casePfx + "adr.portal", "/portal");
+ private final String FRM_MAIN = getLoc(casePfx + "frm.main", "relative=up");
+ private final String SUB_CANCEL = getLoc(casePfx + "sub.portal", "cancel");
+ private final String LNK_LOGOUT = getLoc(casePfx + "lnk.logout", "link=Logout");
+ private final String SUB_LOGIN = getLoc(casePfx + "saub.login", "login-submit");
+ private final String INP_PASSWORD = getLoc(casePfx + "inp.password", "xpath=id('j_password')");
+ private final String INP_USERNAME = getLoc(casePfx + "inp.username", "xpath=id('j_username')");
+ private final String FRM_LOGINFORM = getLoc(casePfx + "frm.login", "login-content");
+ private final String LNK_LOGIN = getLoc(casePfx + "lnk.login", "link=Login");
+
@AfterClass(enabled = true)
- private void logoutIfNeeded()
- {
+ private void logoutIfNeeded() {
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
-
- if (selenium.isElementPresent(LNK_LOGOUT)){
+
+ if (selenium.isElementPresent(LNK_LOGOUT)) {
selenium.click(LNK_LOGOUT);
selenium.waitForPageToLoad(PAGE_LOAD);
}
}
-
/**
* Test default user login.
*
- * Login as user/user and check if the message with login information appears.
+ * Login as user/user and check if the message with login information
+ * appears.
*/
@Test(enabled = true, description = "login as default user 'user' with password 'user'.")
public void testDefaultUserLogin() {
final String loginName = "user";
final String loginPass = "user";
-
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -61,7 +59,7 @@
waitForElement(INP_USERNAME);
waitForElement(INP_PASSWORD);
-
+
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM element for username doesn't exist.");
selenium.type(INP_USERNAME, loginName);
@@ -73,7 +71,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
- Assert.assertTrue(selenium.isTextPresent("Logged in as: "+loginName), "\"Logged in as\" message missing.");
+ Assert.assertTrue(selenium.isTextPresent("Logged in as: " + loginName), "\"Logged in as\" message missing.");
Assert.assertTrue(selenium.isElementPresent(LNK_LOGOUT), "Expected DOM element for login link does not exist.");
Assert.assertEquals(selenium.getText(LNK_LOGOUT), "Logout", "Logout has wrong label.");
@@ -86,13 +84,14 @@
/**
* Test admin login.
*
- * Login as admin/admin and check if the message with login information appears.
+ * Login as admin/admin and check if the message with login information
+ * appears.
*/
@Test(enabled = true, description = "login as admin user 'admin' with password 'admin'.")
public void testAdminLogin() {
final String loginName = "admin";
final String loginPass = "admin";
-
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
waitForElement(LNK_LOGIN);
@@ -104,7 +103,7 @@
waitForElement(INP_USERNAME);
waitForElement(INP_PASSWORD);
-
+
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM element for username doesn't exist.");
selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM element for password doesn't exist.");
@@ -112,7 +111,7 @@
selenium.fireEvent(INP_PASSWORD, "keydown");
selenium.click(SUB_LOGIN);
- //waitFor(AJAX_LOAD);
+ // waitFor(AJAX_LOAD);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("Logged in as: admin"), "\"Logged in as\" message missing.");
@@ -134,7 +133,7 @@
public void testUserLoginCancel() {
final String loginName = "saki";
final String loginPass = "paki";
-
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -148,7 +147,7 @@
waitForElement(INP_USERNAME);
waitForElement(INP_PASSWORD);
-
+
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM element for username doesn't exist.");
selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM element for password doesn't exist.");
@@ -162,7 +161,7 @@
Assert.assertFalse(selenium.isTextPresent("Logged in as:"), "\"Logged in as:\" message with no user logged in is missing.");
}
-
+
/**
* Test false name login.
*
@@ -172,7 +171,7 @@
public void testFalseNameLogin() {
final String loginName = "us2er";
final String loginPass = "user";
-
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -184,20 +183,19 @@
waitForElement(INP_USERNAME);
waitForElement(INP_PASSWORD);
-
+
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM element for username doesn't exist.");
selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM element for password doesn't exist.");
selenium.type(INP_PASSWORD, loginPass);
selenium.fireEvent(INP_PASSWORD, "keydown");
selenium.click(SUB_LOGIN);
-
+
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertTrue(selenium.isTextPresent("The user doesn't exist or the password is incorrect "), "\"Logged in as\" message missing.");
}
-
-
+
/**
* Test false password login.
*
@@ -207,7 +205,7 @@
public void testFalsePasswordLogin() {
final String loginName = "user";
final String loginPass = "us2er";
-
+
selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -219,7 +217,7 @@
waitForElement(INP_USERNAME);
waitForElement(INP_PASSWORD);
-
+
Assert.assertTrue(selenium.isElementPresent(INP_USERNAME), "Expected input DOM element for username doesn't exist.");
selenium.type(INP_USERNAME, loginName);
Assert.assertTrue(selenium.isElementPresent(INP_PASSWORD), "Expected input DOM element for password doesn't exist.");
@@ -232,4 +230,52 @@
Assert.assertTrue(selenium.isTextPresent("The user doesn't exist or the password is incorrect "), "\"Logged in as\" message missing.");
}
+ /**
+ * Test xss attacks on login form. Xss attack string is wirtten into
+ * password field for "user" and it is asserted, that "wrong password"
+ * message is present. Xss attack string is wirtten into userGname field for
+ * "user" and it is asserted, that "wrong password" message is present.
+ *
+ * Try to login with user/us2er and check that you are not logged in.
+ */
+ @Test(enabled = true, description = "xss attack")
+ public void testXssAttack() {
+ final String loginName = "user";
+ final String loginPass = "us2er";
+
+ selenium.open(ADR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LNK_LOGIN);
+ selenium.selectFrame(FRM_LOGINFORM);
+
+ waitForElement(INP_USERNAME);
+ waitForElement(INP_PASSWORD);
+
+ selenium.type(INP_USERNAME, loginName);
+ selenium.type(INP_PASSWORD, XSS_STR1);
+ selenium.fireEvent(INP_PASSWORD, "keydown");
+ selenium.click(SUB_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("The user doesn't exist or the password is incorrect"));
+
+ selenium.open(ADR_PORTAL);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ selenium.click(LNK_LOGIN);
+ selenium.selectFrame(FRM_LOGINFORM);
+
+ waitForElement(INP_USERNAME);
+ waitForElement(INP_PASSWORD);
+
+ selenium.type(INP_USERNAME, XSS_STR1);
+ selenium.type(INP_PASSWORD, loginPass);
+ selenium.fireEvent(INP_PASSWORD, "keydown");
+ selenium.click(SUB_LOGIN);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+ Assert.assertTrue(selenium.isTextPresent("The user doesn't exist or the password is incorrect"));
+
+ Assert.assertTrue(selenium.isTextPresent("The user doesn't exist or the password is incorrect "), "\"Logged in as\" message missing.");
+ }
+
}
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/assert.properties 2009-06-03 15:57:20 UTC (rev 13428)
@@ -2,6 +2,10 @@
selenium.timeout.ajax=3000
selenium.timeout.elem=220
+portal.xxs.1=/Dave</option><script>alert(document.cookie);</script>
+#portal.xxs.2=
+#portal.xxs.3=
+
iden.man.chk.role=Create new role
cms.sec.denied=You are not allowed to access the resource
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSArchiveUploadTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -90,7 +90,7 @@
"archive was accepted for processing afte cancelling the upload");
Assert.assertFalse(selenium.isElementPresent("link=archive"), "not uploaded (upload cancelled) archive found #1");
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
Assert.assertFalse(selenium.isElementPresent("link=archive"), "not uploaded (upload cancelled) archive found #2");
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSDirectoryTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -69,7 +69,7 @@
selenium.click("cancel");
// really creating
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
@@ -131,7 +131,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// really deleting
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -152,7 +152,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assuring that the deletition was processed
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click("link=Admin");
selenium.waitForPageToLoad(PAGE_LOAD);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/cms/CMSFileWorkflowTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -88,7 +88,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// saving
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -165,7 +165,7 @@
public void testCreateFilePreview() {
String name = "file2preview";
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -278,7 +278,7 @@
Assert.assertTrue(selenium.isElementPresent("link=fileToMove"));
// really moving file
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -372,7 +372,7 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// really creating and approving
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -417,7 +417,7 @@
private void createFile(String name, String content) {
// save and approve
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
selenium.click(LNK_ADMIN);
selenium.waitForPageToLoad(PAGE_LOAD);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/EndtoEndPortalAdminTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -23,27 +23,28 @@
/** prefix for locator properties = portal.e2e. */
public static String casePfx = "portal.e2e.";
-
- private final String SUB_POR_PROPS_UPDATE = getLoc(casePfx + "sub.por.props.update", "//input[contains(@id,'common-manage-prop-form:update')]");
- private final String SUB_POR_PROPERTY = getLoc(casePfx + "sub.por.property", "//input[contains(@id,'common-edit-prop-form:add-property')]");
- private final String INP_POR_PROPERTY = getLoc(casePfx + "inp.por.property", "//input[contains(@id,'common-edit-prop-form:property')]");
- private final String SUB_POR_LISTENER = getLoc(casePfx + "sub.por.listener", "//input[contains(@id,'edit-prop-form:update')]");
- private final String SEL_POR_LISTENER = getLoc(casePfx + "sel.por.listener", "//select[contains(@id,'edit-prop-form:listener')]");
- private final String SUB_PAL = getLoc(casePfx + "sub.pal", "//input[contains(@id,'common-edit-page-error-form:update')]");
- private final String INP_PAL_PR = getLoc(casePfx + "inp.pal.pr", "//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
- private final String SEL_PAL_PN = getLoc(casePfx + "sel.pal.pn", "//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
- private final String SEL_PAL_PI = getLoc(casePfx + "sel.pal.pi", "//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
- private final String SEL_PAL_PE = getLoc(casePfx + "sel.pal.pe", "//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
- private final String SEL_PAL_PC = getLoc(casePfx + "sel.pal.pc", "//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
- private final String SEL_PAL_PA = getLoc(casePfx + "sel.pal.pa", "//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
- private final String SUB_POL = getLoc(casePfx + "sub.pol", "//input[contains(@id,'common-edit-portal-error-form:update')]");
- private final String INP_POL_PR = getLoc(casePfx + "inp.pol.pr", "//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
- private final String SEL_POL_PN = getLoc(casePfx + "sel.pol.pn", "//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
- private final String SEL_POL_PI = getLoc(casePfx + "sel.pol.pi", "//select[contains(@id,'common-edit-portal-error-form:portal-internal-select')]");
- private final String SEL_POL_PE = getLoc(casePfx + "sel.pol.pe", "//select[contains(@id,'common-edit-portal-error-form:portal-error-select')]");
- private final String SEL_POL_PU = getLoc(casePfx + "sel.pol.pu", "//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
- private final String SEL_POL_PA = getLoc(casePfx + "sel.pol.pa", "//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
+ private final String SEL_PREDEF_PROP = getLoc(casePfx + "sel.predef.prop", "//select[contains(@id,'predefined-properties:predefinedProperty')]");
+ private final String SUB_POR_PROPS_UPDATE = getLoc(casePfx + "sub.por.props.update", "//input[contains(@id,'common-manage-prop-form:update')]");
+ private final String SUB_POR_PROPERTY = getLoc(casePfx + "sub.por.property", "//input[contains(@id,'common-edit-prop-form:add-property')]");
+ private final String INP_POR_PROPERTY = getLoc(casePfx + "inp.por.property", "//input[contains(@id,'common-edit-prop-form:property')]");
+ private final String SUB_POR_LISTENER = getLoc(casePfx + "sub.por.listener", "//input[contains(@id,'edit-prop-form:update')]");
+ private final String SEL_POR_LISTENER = getLoc(casePfx + "sel.por.listener", "//select[contains(@id,'edit-prop-form:listener')]");
+ private final String SUB_PAL = getLoc(casePfx + "sub.pal", "//input[contains(@id,'common-edit-page-error-form:update')]");
+ private final String INP_PAL_PR = getLoc(casePfx + "inp.pal.pr", "//input[contains(@id,'common-edit-page-error-form:page-res-select')]");
+ private final String SEL_PAL_PN = getLoc(casePfx + "sel.pal.pn", "//select[contains(@id,'common-edit-page-error-form:page-not-found-select')]");
+ private final String SEL_PAL_PI = getLoc(casePfx + "sel.pal.pi", "//select[contains(@id,'common-edit-page-error-form:page-internal-select')]");
+ private final String SEL_PAL_PE = getLoc(casePfx + "sel.pal.pe", "//select[contains(@id,'common-edit-page-error-form:page-error-select')]");
+ private final String SEL_PAL_PC = getLoc(casePfx + "sel.pal.pc", "//select[contains(@id,'common-edit-page-error-form:page-control-select')]");
+ private final String SEL_PAL_PA = getLoc(casePfx + "sel.pal.pa", "//select[contains(@id,'common-edit-page-error-form:page-access-select')]");
+ private final String SUB_POL = getLoc(casePfx + "sub.pol", "//input[contains(@id,'common-edit-portal-error-form:update')]");
+ private final String INP_POL_PR = getLoc(casePfx + "inp.pol.pr", "//input[contains(@id,'common-edit-portal-error-form:portal-res-input')]");
+ private final String SEL_POL_PN = getLoc(casePfx + "sel.pol.pn", "//select[contains(@id,'common-edit-portal-error-form:portal-not-found-select')]");
+ private final String SEL_POL_PI = getLoc(casePfx + "sel.pol.pi", "//select[contains(@id,'common-edit-portal-error-form:portal-internal-select')]");
+ private final String SEL_POL_PE = getLoc(casePfx + "sel.pol.pe", "//select[contains(@id,'common-edit-portal-error-form:portal-error-select')]");
+ private final String SEL_POL_PU = getLoc(casePfx + "sel.pol.pu", "//select[contains(@id,'common-edit-portal-error-form:portal-unavail-select')]");
+ private final String SEL_POL_PA = getLoc(casePfx + "sel.pol.pa", "//select[contains(@id,'common-edit-portal-error-form:portal-access-select')]");
+
private final String ADR_PORTAL = getLoc(casePfx + "adr.home", "/portal");
public final String SEL_PORTLET_TYPE = getLoc(casePfx + "sel.portlet.type", "//select[contains(@id,'windowForm:instanceId')]");
private final String SUB_LAYOUT_ADD_CENTER = getLoc(casePfx + "sub.layout.add.center", "//input[contains(@id,'layoutForm:a_center')]");
@@ -211,15 +212,22 @@
}
- @Test(enabled = true, description = "Usecase for managing portals - listeners and properties.")
+ /**
+ * Test for managing portal listeners. Manage portals screen is loaded and
+ * "test_listener" is submited as a listener for this context. The screen is
+ * loaded again and it is asserted, that previously selected listener is
+ * still selected. The selection is changed to "user_listener", page is
+ * loaded again and "user_listener" is asserted to be the selected listener.
+ */
+ @Test(enabled = true, description = "Usecase for managing portals - listeners.")
public void testManagePortalListernersUsecase() {
int r = -1;
- //createPortal(portalManName);
+ // createPortal(portalManName);
// addPage(portalManName,page1ManName);
// - Verify that you can add listener
goToProperties();
-
+
selenium.select(SEL_POR_LISTENER, "label=test_listener");
selenium.click(SUB_POR_LISTENER);
selenium.waitForPageToLoad(PAGE_LOAD);
@@ -235,14 +243,18 @@
Assert.assertEquals(selenium.getSelectedLabel(SEL_POR_LISTENER), "user_listener", "Previously selected label not being the current label.");
}
- @Test(enabled = true, description = "Usecase for managing portals - listeners and properties.")
+ /**
+ * Test for managing portal properties. Manage portals screen is loaded and
+ * it is asserted that the property table is not present on the screen - no
+ * property was added before the test. Then a custom property "dragadrop" is added, the page is reloaded and it is asserted, that "dragadrop" is present in properties table.
+ *
+ */
+ @Test(enabled = true, description = "Usecase for managing portals - properties.")
public void testManagePortalPropertiesUsecase() {
int r = -1;
goToProperties();
// - assert no property is added
- // r = countTableRows(TAB_PROPERTIES);
- // Assert.assertTrue(r==0,"Property table is not empty.");
Assert.assertFalse(selenium.isElementPresent(TAB_PROPERTIES));
// - add d&d prop
@@ -256,7 +268,6 @@
goToProperties();
// - assert d&d is added
- //selenium.setSpeed("5000");
r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
Assert.assertTrue(r > -1, "Previously added property drag&drop not found in the property table");
@@ -274,6 +285,8 @@
// - assert partial refresh is added
r = findTableRow(TAB_PROPERTIES, "partialRef", 0) - 1;
Assert.assertTrue(r > -1, "Previously added property partial refresh not found in the property table");
+ r = findTableRow(TAB_PROPERTIES, "partialicek", 0) - 1;
+ Assert.assertTrue(r > -1, "Previously added property partial refresh not found in the property table");
// - delete d&d prop
r = findTableRow(TAB_PROPERTIES, "dragadrop", 0) - 1;
@@ -293,6 +306,25 @@
// - assert partial refresh is not added
Assert.assertFalse(selenium.isElementPresent(TAB_PROPERTIES));
+ goToProperties();
+ // add original drag and drop
+ selectIfNotSelected(SEL_PREDEF_PROP, "Drag and drop");
+ selenium.click(SUB_POR_PROPERTY);
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ r = findTableRow(TAB_PROPERTIES, "Drag and drop", 0) - 1;
+ Assert.assertTrue(r > -1, "Predefined property drag and drop was not found in property table.");
+
+ goToProperties();
+
+ r = findTableRow(TAB_PROPERTIES, "Drag and drop", 0) - 1;
+ selenium.click(MessageFormat.format(TAB_PROP_DEL, r));
+ selenium.waitForPageToLoad(PAGE_LOAD);
+
+ goToProperties();
+
+ Assert.assertFalse(selenium.isElementPresent(TAB_PROPERTIES));
+
}
@Test(enabled = true, description = "Usecase for managing portals - error handling.")
@@ -318,18 +350,18 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assert RED handling
- logout();
- login("user","user");
+ logout();
+ login("user", "user");
openAndAssert("/portal/auth/portal/admin", "ACCESS_DENIED");
openAndAssert("/portal/auth/portal/admin", "View permission not granted has denied access");
logout();
- login("admin","admin");
-
+ login("admin", "admin");
+
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "ERROR");
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "Powered by JBoss Portal");
openAndAssert("/portal/portal/default/Test/Exception+test/ExceptionPortletWindow?op=ioexception&action=1", "ERROR");
openAndAssert("/portal/portal/default/Test/Exception+test/ExceptionPortletWindow?op=ioexception&action=1", "Cause: java.io.IOException");
-
+
// select ERR handling
goToProperties();
selectIfNotSelected(SEL_POL_PA, LAB_ERR);
@@ -342,12 +374,12 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assert ERR handling
- logout();
- login("user","user");
+ logout();
+ login("user", "user");
openAndAssert("http://localhost:8080/portal/auth/portal/admin", "HTTP Status 403 - ");
logout();
- login("admin","admin");
-
+ login("admin", "admin");
+
openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "HTTP Status 500");
openAndAssert("/portal/portal/default/Test/Exception+test/ExceptionPortletWindow?op=ioexception&action=1", "HTTP Status 500 -");
@@ -397,21 +429,21 @@
selenium.waitForPageToLoad(PAGE_LOAD);
// assert REM handling
- openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "ERROR",false);
- openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "Powered by JBoss Portal",false);
+ openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "ERROR", false);
+ openAndAssert("/portal/auth/portal/default/Test/Exception+test/ExceptionPortletWindow?op=error&action=1", "Powered by JBoss Portal", false);
}
- private void openAndAssert(String add, String ass){
+ private void openAndAssert(String add, String ass) {
openAndAssert(add, ass, true);
}
-
+
private void openAndAssert(String add, String ass, boolean b) {
selenium.open(add);
selenium.waitForPageToLoad(PAGE_LOAD);
if (b)
- Assert.assertTrue(selenium.isTextPresent(ass), "Text: {\"" + ass + "\"} not found on the page");
+ Assert.assertTrue(selenium.isTextPresent(ass), "Text: {\"" + ass + "\"} not found on the page");
else
- Assert.assertFalse(selenium.isTextPresent(ass), "Text: {\"" + ass + "\"} was found on the page");
+ Assert.assertFalse(selenium.isTextPresent(ass), "Text: {\"" + ass + "\"} was found on the page");
}
private void goToProperties() {
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/portal/PortletInstancesTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -598,7 +598,7 @@
}
private void goToPI() {
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_ADMIN);
clickIfVisible(LINK_TAB_PI);
Modified: branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java 2009-06-03 04:25:33 UTC (rev 13427)
+++ branches/JBoss_Portal_Branch_2_7/testsuite/ui-tests/src/org/jboss/portal/test/selenium/sso/CASSeleniumTestCase.java 2009-06-03 15:57:20 UTC (rev 13428)
@@ -206,7 +206,7 @@
*/
@Test(enabled = false)
public void logoutIfPossible() {
- selenium.open(ADDR_PORTAL);
+ selenium.open(ADR_PORTAL);
selenium.waitForPageToLoad(PAGE_LOAD);
if (selenium.isElementPresent(LINK_LOGOUT)) {
selenium.click(LINK_LOGOUT);
15 years