summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java14
-rw-r--r--modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java3
-rw-r--r--modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java12
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties2
-rw-r--r--modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties2
10 files changed, 39 insertions, 4 deletions
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
index 686f0fd..b454fad 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java
@@ -18,8 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -140,11 +142,19 @@ public class RolesDataSource extends RPCDataSource<Role, RoleCriteria> {
@Override
protected void executeAdd(Record recordToAdd, final DSRequest request, final DSResponse response) {
- Role roleToAdd = copyValues(recordToAdd);
+ final Role roleToAdd = copyValues(recordToAdd);
roleService.createRole(roleToAdd, new AsyncCallback<Role>() {
public void onFailure(Throwable caught) {
- throw new RuntimeException(caught);
+ if (caught.getMessage() != null
+ && caught.getMessage().contains("javax.persistence.EntityExistsException")) {
+ Map<String, String> errorMessages = new HashMap<String, String>();
+ errorMessages.put(Field.NAME,
+ MSG.view_adminRoles_failCreateRoleWithExistingName(roleToAdd.getName()));
+ sendValidationErrorResponse(request, response, errorMessages);
+ } else {
+ throw new RuntimeException(caught);
+ }
}
public void onSuccess(Role addedRole) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
index 0f0e5a8..c1d0dd7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java
@@ -215,7 +215,8 @@ public class UsersDataSource extends RPCDataSource<Subject, SubjectCriteria> {
String message = caught.getMessage();
if (message != null && message.contains("javax.persistence.EntityExistsException")) {
Map<String, String> errorMessages = new HashMap<String, String>();
- errorMessages.put(Field.NAME, "A user named [" + newSubject.getName() + "] already exists.");
+ errorMessages.put(Field.NAME,
+ MSG.view_adminUsers_failCreateUserWithExistingName(newSubject.getName()));
sendValidationErrorResponse(request, response, errorMessages);
} else {
throw new RuntimeException(caught);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
index 7001a56..47e2b6a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/AbstractRecordEditor.java
@@ -301,7 +301,17 @@ public abstract class AbstractRecordEditor<DS extends RPCDataSource> extends Loc
message = new Message(conciseMessage, detailedMessage);
CoreGUI.goToView(getListViewPath(), message, true);
} else if (response.getStatus() == RPCResponse.STATUS_VALIDATION_ERROR) {
- Message message = new Message(MSG.widget_recordEditor_error_operationInvalidValues(),
+ String causes = null;
+ if (response.getErrors() != null && !response.getErrors().isEmpty()) {
+ // prepare detailed error message
+ StringBuffer sb = new StringBuffer();
+ for (Object cause : response.getErrors().values()) {
+ sb.append(cause);
+ sb.append('\n');
+ }
+ causes = sb.toString();
+ }
+ Message message = new Message(MSG.widget_recordEditor_error_operationInvalidValues(), causes,
Message.Severity.Error);
CoreGUI.getMessageCenter().notify(message);
} else {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 4002fc7..20fada6 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -446,6 +446,7 @@ view_adminConfig_systemSettings = System Settings
view_adminContent_contentSources = Content Sources
view_adminRoles_assignedGroups = Assigned Resource Groups
view_adminRoles_assignedSubjects = Assigned Subjects
+view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please use another name.
view_adminRoles_failLdap = Failed to determine if LDAP configured - assuming no LDAP.
view_adminRoles_failLdapGroups = Failed to retrieve available LDAP groups - assuming no LDAP groups.
view_adminRoles_failLdapGroupsRole = Failed to load LDAP groups available for role.
@@ -537,6 +538,7 @@ view_adminTopology_partitionEvents = Partition Events
view_adminTopology_remoteAgentInstall = Remote Agent Install
view_adminTopology_servers = Servers
view_adminUsersDetails_dataTypeName = user
+view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Administration
view_admin_configuration = Configuration
view_admin_content = Content
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index ac127b4..f90e510 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -465,6 +465,7 @@ view_adminConfig_systemSettings = Systémová nastavení
view_adminContent_contentSources = Zdroje obsahů
view_adminRoles_assignedGroups = Přiřazené skupiny zdrojů
view_adminRoles_assignedSubjects = Přiřazené subjekty
+view_adminRoles_failCreateRoleWithExistingName = Nepodařilo se vytvořit roli s existujícím jménem [{0}]. Použíjte prosím jiné jméno.
view_adminRoles_failLdap = Nepodařilo se určit je-li LDAP nastaven - předpokládám, že LDAP není přítomen.
view_adminRoles_failLdapGroups = Nepodařilo se získat informace o LDAP skupinách - předpokládám, že LDAP není přítomen.
view_adminRoles_failLdapGroupsRole = Nepodařilo se získat informace o LDAP skupinách pro roli.
@@ -556,6 +557,7 @@ view_adminTopology_partitionEvents = Události rozdělení
view_adminTopology_remoteAgentInstall = Instalace vzdáleného agenta
view_adminTopology_servers = Servery
view_adminUsersDetails_dataTypeName = uživatel
+view_adminUsers_failCreateUserWithExistingName = Nepodařilo se vytvořit uživatele s existujícím jménem [{0}]. Použíjte prosím jiné jméno.
view_admin_administration = Administrace
view_admin_configuration = Konfigurace
view_admin_content = Obsah
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 7f3fafa..08c11c8 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -430,6 +430,7 @@ view_adminConfig_systemSettings = Systemeinstellungen
view_adminContent_contentSources = Quellen für Inhalte
view_adminRoles_assignedGroups = Zugewiesene Ressourcen-Gruppen
view_adminRoles_assignedSubjects = Zugewisene Benutzer
+##view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please use another name.
view_adminRoles_failLdap = Konnte nicht ermitteln, ob LDAP konfiguriert ist - gehe von keiner LDAP-Konfiguration aus.
view_adminRoles_failLdapGroups = Konnte de LDAP-Gruppen nicht laden. Annahme ist, dass es keine gibt.
view_adminRoles_failLdapGroupsRole = Konnte die LDAP-Gruppen für die Rolle nicht laden.
@@ -504,6 +505,7 @@ view_adminTopology_partitionEvents = Partitionierungs-Ereignisse
view_adminTopology_remoteAgentInstall = Installation entfernter Agenten
view_adminTopology_servers = Server
view_adminUsersDetails_dataTypeName = Benutzer
+##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Verwaltung
view_admin_configuration = Konfiguration
view_admin_content = Inhalte
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index ad760f9..b10c816 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -444,6 +444,7 @@ view_adminConfig_systemSettings = システム設定
view_adminContent_contentSources = コンテントソース
view_adminRoles_assignedGroups = 割り当てられたリソースグループ
view_adminRoles_assignedSubjects = 割り当てられたSubjects
+##view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please use another name.
view_adminRoles_failLdap = LDAPが構成されたかどうかの決定に失敗しました - LDAPが無いことを仮定します
view_adminRoles_failLdapGroups = 利用可能なLDAPグループを読み出すのに失敗しました - LDAPグループが無いことを仮定します
view_adminRoles_failLdapGroupsRole = ロールのために利用可能なLDAPグループをロードするのに失敗しました
@@ -535,6 +536,7 @@ view_adminTopology_partitionEvents = イベントの分類
view_adminTopology_remoteAgentInstall = リモートエージェントのインストール
view_adminTopology_servers = サーバー
view_adminUsersDetails_dataTypeName = ユーザー
+##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = 管理
view_admin_configuration = 構成
view_admin_content = コンテント
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 4241b3f..e7462f3 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -450,6 +450,7 @@ view_adminConfig_systemSettings = Propriedades de Sistema
view_adminContent_contentSources = Fontes de Conte\u00FAdo
view_adminRoles_assignedGroups = Grupos de Recursos Associados
view_adminRoles_assignedSubjects = Perfis Associados
+##view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please Use another name.
view_adminRoles_failLdap = Falha ao determinar se o LDAP foi configurado - assumindo como LDAP n\u00E3o configurado.
view_adminRoles_failLdapGroups = Falha ao recuperar os grupos dispon\u00EDveis no LDAP - assumindo como LDAP sem grupos.
view_adminRoles_failLdapGroupsRole = Falha ao carregar grupos do LDAP dispon\u00EDveis para o perfil.
@@ -540,6 +541,7 @@ view_adminTopology_partitionEvents = Eventos na Parti\u00E7\u00E3o
view_adminTopology_remoteAgentInstall = Instala\u00E7\u00E3o Remota de Agentes
view_adminTopology_servers = Servidores
view_adminUsersDetails_dataTypeName = usu\u00E1rio
+##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Administra\u00E7\u00E3o
view_admin_configuration = Configura\u00E7\u00E3o
view_admin_content = Conte\u00FAdo
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index d74907e..3bb95c0 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -436,6 +436,7 @@
#view_adminContent_contentSources = Content Sources
#view_adminRoles_assignedGroups = Assigned Resource Groups
#view_adminRoles_assignedSubjects = Assigned Subjects
+##view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please use another name.
#view_adminRoles_failLdap = Failed to determine if LDAP configured - assuming no LDAP.
#view_adminRoles_failLdapGroups = Failed to retrieve available LDAP groups - assuming no LDAP groups.
#view_adminRoles_failLdapGroupsRole = Failed to load LDAP groups available for role.
@@ -527,6 +528,7 @@
#view_adminTopology_remoteAgentInstall = Remote Agent Install
#view_adminTopology_servers = Servers
#view_adminUsersDetails_dataTypeName = user
+##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
#view_admin_administration = Administration
#view_admin_configuration = Configuration
#view_admin_content = Content
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 56e6d59..69c9081 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -438,6 +438,7 @@ view_adminConfig_systemSettings = \u7cfb\u7edf\u8bbe\u7f6e
view_adminContent_contentSources = Content\u6e90
view_adminRoles_assignedGroups = \u5206\u914d\u7684\u8d44\u6e90\u7ec4
view_adminRoles_assignedSubjects = \u5206\u914d\u7684\u4e3b\u9898
+##view_adminRoles_failCreateRoleWithExistingName = Failed to create role with existing name [{0}]. Please Use another name.
view_adminRoles_failLdap = \u65e0\u6cd5\u786e\u5b9aLDAP - \u5047\u5b9a\u6ca1\u6709LDAP.
view_adminRoles_failLdapGroups = \u67e5\u8be2\u6709\u6548LDAP\u7ec4\u5931\u8d25 - \u5047\u5b9a\u65e0DAP\u7ec4.
view_adminRoles_failLdapGroupsRole = \u52a0\u8f7dLDAP\u7ec4\u89d2\u8272\u5931\u8d25.
@@ -527,6 +528,7 @@ view_adminTopology_partitionEvents = Partition\u4e8b\u4ef6
view_adminTopology_remoteAgentInstall = \u8fdc\u7a0b\u4ee3\u7406\u5b89\u88c5
view_adminTopology_servers = \u670d\u52a1\u5668
view_adminUsersDetails_dataTypeName = user
+##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = \u7ba1\u7406
view_admin_configuration = \u914d\u7f6e
view_admin_content = Content