[rhq] 7 commits - etc/eclipse-tools modules/enterprise
by Jay Shaughnessy
etc/eclipse-tools/maven/RHQ | 2
modules/enterprise/gui/coregui/pom.xml | 17 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java | 24 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 99 ++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java | 66 ++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java | 120 ++++------
7 files changed, 170 insertions(+), 161 deletions(-)
New commits:
commit 11226063e918f7bd9fc622afc2189d1c32d3f359
Merge: a36991e... f439da6...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 16 12:39:12 2010 -0400
Merge branch 'master' into master-jay
diff --cc modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
index 759f569,08f3290..41aff20
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@@ -222,11 -220,11 +223,11 @@@ public class OverviewView extends Locat
if (dynamic) {
StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", "Group Definition");
GroupDefinition groupDefinition = group.getGroupDefinition();
- // TODO (ips): Make this a link to the group def.
- groupDefinitionItem.setValue(groupDefinition.getName());
+ String groupDefinitionUrl = LinkManager.getGroupDefinitionLink(groupDefinition.getId());
+ groupDefinitionItem.setValue("<a href=\"" + groupDefinitionUrl + "\">" + groupDefinition.getName() + "</a>");
formItems.add(groupDefinitionItem);
}
-
+
generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
addMember(generalPropsForm);
commit a36991e58dbc6623c8a0d027d30b5c6bfb927ffb
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 16 12:37:58 2010 -0400
Made OverviewView and EnhancedDynamicForm Locatable
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
index 02592c8..b0f5042 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/EnhancedDynamicForm.java
@@ -22,7 +22,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.form;
-import com.google.gwt.core.client.JavaScriptObject;
+import java.util.ArrayList;
+import java.util.List;
+
import com.google.gwt.user.client.Timer;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.FormItemIfFunction;
@@ -38,8 +40,7 @@ import com.smartgwt.client.widgets.form.fields.events.ItemHoverHandler;
import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-import java.util.ArrayList;
-import java.util.List;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
/**
* A subclass of SmartGWT's DynamicForm widget that provides the following additional feature:
@@ -51,13 +52,9 @@ import java.util.List;
*
* @author Ian Springer
*/
-public class EnhancedDynamicForm extends DynamicForm {
- public EnhancedDynamicForm(JavaScriptObject jsObj) {
- super(jsObj);
- }
-
- public EnhancedDynamicForm() {
- super();
+public class EnhancedDynamicForm extends LocatableDynamicForm {
+ public EnhancedDynamicForm(String locatorId) {
+ super(locatorId);
}
@Override
@@ -78,9 +75,8 @@ public class EnhancedDynamicForm extends DynamicForm {
final TogglableTextItem togglableTextItem = (TogglableTextItem) item;
togglableTextItemNames.add(togglableTextItem.getName());
- final StaticTextItem staticTextItem =
- new StaticTextItem(getStaticTextItemName(togglableTextItem.getName()),
- togglableTextItem.getTitle());
+ final StaticTextItem staticTextItem = new StaticTextItem(getStaticTextItemName(togglableTextItem
+ .getName()), togglableTextItem.getTitle());
staticTextItem.setAttribute("editing", false);
staticTextItem.setTextBoxStyle("editableText");
@@ -147,7 +143,7 @@ public class EnhancedDynamicForm extends DynamicForm {
itemsList.add(togglableTextItem);
} else {
itemsList.add(item);
- }
+ }
}
super.setItems((FormItem[]) itemsList.toArray(new FormItem[itemsList.size()]));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index b51bc00..128dff8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -108,14 +108,15 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
protected List<TwoLevelTab> createTabs() {
List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
- summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), "Summary", "/images/icons/Service_up_16.png");
+ summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), "Summary",
+ "/images/icons/Service_up_16.png");
summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), "Overview", null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), "Timeline", null);
summaryTab.registerSubTabs(summaryOverview, summaryTimeline);
tabs.add(summaryTab);
monitoringTab = new TwoLevelTab(getTabSet().extendLocatorId("Monitoring"), "Monitoring",
- "/images/icons/Monitor_grey_16.png");
+ "/images/icons/Monitor_grey_16.png");
monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), "Graphs", null);
monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), "Tables", null);
monitorTraits = new SubTab(monitoringTab.extendLocatorId("Traits"), "Traits", null);
@@ -126,14 +127,14 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
tabs.add(monitoringTab);
inventoryTab = new TwoLevelTab(getTabSet().extendLocatorId("Inventory"), "Inventory",
- "/images/icons/Inventory_grey_16.png");
+ "/images/icons/Inventory_grey_16.png");
inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), "Members", null);
inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), "Connection Settings", null);
inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn);
tabs.add(inventoryTab);
operationsTab = new TwoLevelTab(getTabSet().extendLocatorId("Operations"), "Operations",
- "/images/icons/Operation_grey_16.png");
+ "/images/icons/Operation_grey_16.png");
this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), "History", null);
this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), "Scheduled", null);
operationsTab.registerSubTabs(this.opHistory, this.opSched);
@@ -146,7 +147,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
tabs.add(alertsTab);
configurationTab = new TwoLevelTab(getTabSet().extendLocatorId("Configuration"), "Configuration",
- "/images/icons/Configure_grey_16.png");
+ "/images/icons/Configure_grey_16.png");
this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), "Current", null);
this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), "History", null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
@@ -172,7 +173,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
// summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
- this.summaryOverview.setCanvas(new OverviewView(this.groupComposite));
+ this.summaryOverview.setCanvas(new OverviewView(this.summaryTab.extendLocatorId("Overview"),
+ this.groupComposite));
int groupId = this.groupComposite.getResourceGroup().getId();
@@ -187,19 +189,19 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
//this.inventoryConn.setCanvas(new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
this.opHistory.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.opSched.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.alertHistory.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.alertDef.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.configCurrent.setCanvas(new FullHTMLPane("/rhq/group/configuration/viewCurrent-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.configHistory
- .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
+ .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
this.eventHistory.setCanvas(EventCompositeHistoryView.get(groupComposite));
@@ -214,11 +216,12 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// Only enable "Call Time" and "Traits" subtabs for groups that implement them.
this.monitoringTab.setSubTabEnabled(this.monitorTraits.getLocatorId(), hasTraits(this.groupComposite));
- this.monitoringTab.setSubTabEnabled(this.monitorCallTime.getLocatorId(), facets.contains(ResourceTypeFacet.CALL_TIME));
+ this.monitoringTab.setSubTabEnabled(this.monitorCallTime.getLocatorId(), facets
+ .contains(ResourceTypeFacet.CALL_TIME));
// Inventory>Connection Settings subtab is only enabled for compat groups that define conn props.
this.inventoryTab.setSubTabEnabled(this.inventoryConn.getLocatorId(), groupCategory == GroupCategory.COMPATIBLE
- && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
// Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
// TODO (ips): Break out mixed groups into a separate view.
@@ -230,8 +233,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// Configuration tab is only enabled for compatible groups of a type that supports the Configuration facet
// and when the current user has the CONFIGURE_READ permission.
- getTabSet().setTabEnabled(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION)
- && this.permissions.isConfigureRead());
+ getTabSet().setTabEnabled(this.configurationTab,
+ facets.contains(ResourceTypeFacet.CONFIGURATION) && this.permissions.isConfigureRead());
// Events tab is only enabled for compatible groups of a type that supports the Events facet.
getTabSet().setTabEnabled(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT));
@@ -245,17 +248,17 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
criteria.addFilterVisible(null);
GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceGroupComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group composite for group with id "
- + groupId, caught);
- }
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to load group composite for group with id " + groupId, caught);
+ }
- public void onSuccess(PageList<ResourceGroupComposite> result) {
- groupComposite = result.get(0);
- loadResourceType(groupComposite, viewPath);
- }
- });
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ groupComposite = result.get(0);
+ loadResourceType(groupComposite, viewPath);
+ }
+ });
}
private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath) {
@@ -266,29 +269,27 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// Load the fully fetched ResourceType.
ResourceType groupType = group.getResourceType();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- groupType.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content,
- ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.measurements,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- group.setResourceType(type);
- GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
- new AsyncCallback<Set<Permission>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
- }
-
- public void onSuccess(Set<Permission> result) {
- ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
- updateTabContent(groupComposite);
- selectTab(getTabName(), getSubTabName(), viewPath);
- }
- });
- }
- });
+ groupType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.measurements, ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ group.setResourceType(type);
+ GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
+ new AsyncCallback<Set<Permission>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
+ }
+
+ public void onSuccess(Set<Permission> result) {
+ ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
+ updateTabContent(groupComposite);
+ selectTab(getTabName(), getSubTabName(), viewPath);
+ }
+ });
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
index 41de300..759f569 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@ -18,13 +18,17 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail.summary;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
+
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
@@ -36,22 +40,19 @@ import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
* The group Inventory>Overview subtab.
*
* @author Ian Springer
*/
-public class OverviewView extends VLayout {
+public class OverviewView extends LocatableVLayout {
private ResourceGroupGWTServiceAsync resourceGroupService = GWTServiceLookup.getResourceGroupService();
private ResourceGroupComposite groupComposite;
- public OverviewView(ResourceGroupComposite groupComposite) {
- super();
+ public OverviewView(String locatorId, ResourceGroupComposite groupComposite) {
+ super(locatorId);
this.groupComposite = groupComposite;
}
@@ -65,7 +66,7 @@ public class OverviewView extends VLayout {
spacer.setHeight(15);
addMember(spacer);
- final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm();
+ final EnhancedDynamicForm generalPropsForm = new EnhancedDynamicForm(this.extendLocatorId("General"));
List<FormItem> formItems = new ArrayList<FormItem>();
@@ -91,9 +92,9 @@ public class OverviewView extends VLayout {
group.setName(newName);
OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change name of Resource group with id "
- + group.getId()
- + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change name of Resource group with id " + group.getId() + " from \""
+ + oldName + "\" to \"" + newName + "\".", caught);
// We failed to update it on the Server, so change back the ResourceGroup and the form item
// to the original value.
group.setName(oldName);
@@ -101,9 +102,9 @@ public class OverviewView extends VLayout {
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Name of Resource group with id "
- + group.getId() + " was changed from \""
- + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Name of Resource group with id " + group.getId() + " was changed from \""
+ + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
}
});
}
@@ -128,7 +129,7 @@ public class OverviewView extends VLayout {
final FormItem descriptionItem = (dynamic) ? new StaticTextItem() : new TogglableTextItem();
descriptionItem.setName("description");
- descriptionItem.setTitle("Description");
+ descriptionItem.setTitle("Description");
descriptionItem.setValue(group.getDescription());
if (descriptionItem instanceof TogglableTextItem) {
final TogglableTextItem togglableDescriptionItem = (TogglableTextItem) descriptionItem;
@@ -141,9 +142,9 @@ public class OverviewView extends VLayout {
group.setDescription(newDescription);
OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change description of Resource group with id "
- + group.getId()
- + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change description of Resource group with id " + group.getId() + " from \""
+ + oldDescription + "\" to \"" + newDescription + "\".", caught);
// We failed to update it on the Server, so change back the ResourceGroup and the form item
// to the original value.
group.setDescription(oldDescription);
@@ -151,9 +152,10 @@ public class OverviewView extends VLayout {
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Description of Resource group with id "
- + group.getId() + " was changed from \""
- + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Description of Resource group with id " + group.getId()
+ + " was changed from \"" + oldDescription + "\" to \"" + newDescription + "\".",
+ Message.Severity.Info));
}
});
}
@@ -176,9 +178,9 @@ public class OverviewView extends VLayout {
group.setLocation(newLocation);
OverviewView.this.resourceGroupService.updateResourceGroup(group, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change location of Resource group with id "
- + group.getId()
- + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change location of Resource group with id " + group.getId() + " from \""
+ + oldLocation + "\" to \"" + newLocation + "\".", caught);
// We failed to update it on the Server, so change back the ResourceGroup and the form item
// to the original value.
group.setLocation(oldLocation);
@@ -186,9 +188,10 @@ public class OverviewView extends VLayout {
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Location of Resource group with id "
- + group.getId() + " was changed from \""
- + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Location of Resource group with id " + group.getId()
+ + " was changed from \"" + oldLocation + "\" to \"" + newLocation + "\".",
+ Message.Severity.Info));
}
});
}
@@ -223,7 +226,7 @@ public class OverviewView extends VLayout {
groupDefinitionItem.setValue(groupDefinition.getName());
formItems.add(groupDefinitionItem);
}
-
+
generalPropsForm.setItems(formItems.toArray(new FormItem[formItems.size()]));
addMember(generalPropsForm);
@@ -231,9 +234,10 @@ public class OverviewView extends VLayout {
spacer = new HLayout();
spacer.setHeight(10);
addMember(spacer);
-
+
HTMLFlow note = new HTMLFlow();
- note.setContents("<b>*</b> Dynamic group names and descriptions are managed, and therefore are not editable.");
+ note
+ .setContents("<b>*</b> Dynamic group names and descriptions are managed, and therefore are not editable.");
note.setAlign(Alignment.CENTER);
addMember(note);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e4bb9fd..65ed1be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -112,7 +112,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), "Summary",
- "/images/icons/Service_up_16.png");
+ "/images/icons/Service_up_16.png");
summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), "Overview", null);
summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), "Dashboard", null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), "Timeline", null);
@@ -190,17 +190,20 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
((TwoLevelTab) top).getLayout().destroyViews();
}
- this.summaryOverview.setCanvas(new OverviewView(this.resourceComposite));
+ this.summaryOverview.setCanvas(new OverviewView(this.summaryTab.extendLocatorId("OverviewView"),
+ this.resourceComposite));
this.summaryDashboard.setCanvas(new DashboardView(this.resourceComposite));
this.summaryTimeline.setCanvas(new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id="
+ resource.getId()));
this.monitorGraphs.setCanvas(new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource));
this.monitorTables.setCanvas(new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()));
- this.monitorTraits.setCanvas(new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()));
+ this.monitorTraits
+ .setCanvas(new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()));
this.monitorAvail.setCanvas(new FullHTMLPane("/rhq/resource/monitor/availabilityHistory-plain.xhtml?id="
+ resource.getId()));
- this.monitorSched.setCanvas(new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()));
+ this.monitorSched
+ .setCanvas(new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()));
this.monitorCallTime.setCanvas(new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
+ resource.getId()));
@@ -256,12 +259,14 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
monitoringTab.setSubTabEnabled(monitorTraits.getLocatorId(), hasTraits(this.resourceComposite));
monitoringTab.setSubTabEnabled(monitorCallTime.getLocatorId(), facets.contains(ResourceTypeFacet.CALL_TIME));
- inventoryTab.setSubTabEnabled(inventoryConn.getLocatorId(), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ inventoryTab.setSubTabEnabled(inventoryConn.getLocatorId(), facets
+ .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
ResourceType type = this.resourceComposite.getResource().getResourceType();
inventoryTab.setSubTabEnabled(inventoryChildren.getLocatorId(), !type.getChildResourceTypes().isEmpty());
getTabSet().setTabEnabled(this.operationsTab, facets.contains(ResourceTypeFacet.OPERATION));
- getTabSet().setTabEnabled(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead());
+ getTabSet().setTabEnabled(this.configurationTab,
+ facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead());
getTabSet().setTabEnabled(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT));
getTabSet().setTabEnabled(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT));
}
@@ -303,11 +308,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
final Resource resource = resourceComposite.getResource();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
resource.getResourceType().getId(),
- EnumSet.of(
- ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.content,
- ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.measurements,
+ EnumSet.of(ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.content,
+ ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.measurements,
ResourceTypeRepository.MetadataType.events,
ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
index ac2abc2..4cf2119 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/OverviewView.java
@@ -59,13 +59,11 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
private ResourceComposite resourceComposite;
-
- public OverviewView(ResourceComposite resourceComposite) {
- super();
+ public OverviewView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId);
this.resourceComposite = resourceComposite;
}
-
@Override
protected void onDraw() {
super.onDraw();
@@ -78,7 +76,6 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
}
}
-
public void onResourceSelected(ResourceComposite resourceComposite) {
this.resourceComposite = resourceComposite;
@@ -86,45 +83,41 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
// Load metric defs.
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- try {
- buildForm(type);
- loadTraitValues();
- } catch (Exception e) {
- SC.say("Form load failure");
- e.printStackTrace();
- }
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ try {
+ buildForm(type);
+ loadTraitValues();
+ } catch (Exception e) {
+ SC.say("Form load failure");
+ e.printStackTrace();
}
- });
+ }
+ });
}
private void loadTraitValues() {
final Resource resource = resourceComposite.getResource();
- GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(
- resource.getId(),
- DisplayType.SUMMARY,
- new AsyncCallback<List<MeasurementDataTrait>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load traits for " + resource + ".",
- caught);
- }
+ GWTServiceLookup.getMeasurementDataService().findCurrentTraitsForResource(resource.getId(),
+ DisplayType.SUMMARY, new AsyncCallback<List<MeasurementDataTrait>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load traits for " + resource + ".", caught);
+ }
- public void onSuccess(List<MeasurementDataTrait> result) {
- // TODO: Implement this method.
- for (MeasurementDataTrait trait : result) {
- String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
- FormItem item = getItem(formId);
+ public void onSuccess(List<MeasurementDataTrait> result) {
+ // TODO: Implement this method.
+ for (MeasurementDataTrait trait : result) {
+ String formId = trait.getName().replaceAll("\\.", "_").replaceAll(" ", "__");
+ FormItem item = getItem(formId);
- if (item != null) {
- setValue(formId, trait.getValue());
- }
+ if (item != null) {
+ setValue(formId, trait.getValue());
}
- markForRedraw();
}
+ markForRedraw();
}
- );
+ });
}
@@ -172,9 +165,9 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
resource.setName(newName);
OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change name of Resource with id "
- + resource.getId()
- + " from \"" + oldName + "\" to \"" + newName + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change name of Resource with id " + resource.getId() + " from \"" + oldName
+ + "\" to \"" + newName + "\".", caught);
// We failed to update it on the Server, so change back the Resource and the form item to
// the original value.
resource.setName(oldName);
@@ -182,9 +175,9 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Name of Resource with id "
- + resource.getId() + " was changed from \""
- + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Name of Resource with id " + resource.getId() + " was changed from \""
+ + oldName + "\" to \"" + newName + "\".", Message.Severity.Info));
}
});
}
@@ -207,9 +200,9 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
resource.setDescription(newDescription);
OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change description of Resource with id "
- + resource.getId()
- + " from \"" + oldDescription + "\" to \"" + newDescription + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change description of Resource with id " + resource.getId() + " from \""
+ + oldDescription + "\" to \"" + newDescription + "\".", caught);
// We failed to update it on the Server, so change back the Resource and the form item to
// the original value.
resource.setDescription(oldDescription);
@@ -217,9 +210,10 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Description of Resource with id "
- + resource.getId() + " was changed from \""
- + oldDescription + "\" to \"" + newDescription + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Description of Resource with id " + resource.getId()
+ + " was changed from \"" + oldDescription + "\" to \"" + newDescription + "\".",
+ Message.Severity.Info));
}
});
}
@@ -242,9 +236,9 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
resource.setLocation(newLocation);
OverviewView.this.resourceService.updateResource(resource, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to change location of Resource with id "
- + resource.getId()
- + " from \"" + oldLocation + "\" to \"" + newLocation + "\".", caught);
+ CoreGUI.getErrorHandler().handleError(
+ "Failed to change location of Resource with id " + resource.getId() + " from \""
+ + oldLocation + "\" to \"" + newLocation + "\".", caught);
// We failed to update it on the Server, so change back the Resource and the form item to
// the original value.
resource.setLocation(oldLocation);
@@ -252,9 +246,9 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
}
public void onSuccess(Void result) {
- CoreGUI.getMessageCenter().notify(new Message("Location of Resource with id "
- + resource.getId() + " was changed from \""
- + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
+ CoreGUI.getMessageCenter().notify(
+ new Message("Location of Resource with id " + resource.getId() + " was changed from \""
+ + oldLocation + "\" to \"" + newLocation + "\".", Message.Severity.Info));
}
});
}
@@ -262,7 +256,6 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
}
formItems.add(locationItem);
-
StaticTextItem versionItem = new StaticTextItem("version", "Version");
formItems.add(versionItem);
@@ -275,16 +268,16 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
StaticTextItem item = new StaticTextItem(id, trait.getDisplayName());
item.setTooltip(trait.getDescription());
formItems.add(item);
-// item.setValue("?");
+ // item.setValue("?");
}
-// SectionItem section = new SectionItem("Summary", "Summary");
-// section.setTitle("Summary");
-// section.setDefaultValue("Summary");
-// section.setCanCollapse(true);
-// section.setCellStyle("HidablePlainSectionHeader");
-// section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
-// formItems.add(0, section);
+ // SectionItem section = new SectionItem("Summary", "Summary");
+ // section.setTitle("Summary");
+ // section.setDefaultValue("Summary");
+ // section.setCanCollapse(true);
+ // section.setCellStyle("HidablePlainSectionHeader");
+ // section.setItemIds(itemIds.toArray(new String[itemIds.size()]));
+ // formItems.add(0, section);
formItems.add(new SpacerItem());
setItems(formItems.toArray(new FormItem[formItems.size()]));
@@ -295,8 +288,7 @@ public class OverviewView extends EnhancedDynamicForm implements ResourceSelectL
setValue("location", resource.getLocation());
setValue("version", (resource.getVersion() != null) ? resource.getVersion() : "<i>none</i>");
Resource parentResource = resource.getParentResource();
- setValue("parent", parentResource != null ?
- ("<a href=\"#Resource/" + parentResource.getId() + "\">" +
- parentResource.getName() + "</a>") : "<i>none</i>");
+ setValue("parent", parentResource != null ? ("<a href=\"#Resource/" + parentResource.getId() + "\">"
+ + parentResource.getName() + "</a>") : "<i>none</i>");
}
}
commit 423339c8a5cae0b627d196751b5a0cf37f3630ed
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 16 12:36:29 2010 -0400
There seems to be an OS-specific issue when handling the runTarget if
it contains url parameters. On linux it needs to be single-quoted but on
Win the quotes don't get eaten. Added OS-activated profile to handle the
difference.
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 950ce71..c8dce21 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -32,6 +32,7 @@
<gwt-plugin.localWorkers>2</gwt-plugin.localWorkers>
<coreGuiParams></coreGuiParams>
+ <coreGuiRunTarget>'http://localhost:7080/coregui/CoreGUI.html${coreGuiParams}'</coreGuiRunTarget>
</properties>
@@ -237,7 +238,7 @@
<inplace>false</inplace>
<!-- <logLevel>INFO' -bindAddress 0.0.0.0 -logLevel 'INFO</logLevel> -->
<logLevel>INFO</logLevel>
- <runTarget>http://localhost:7080/coregui/CoreGUI.html${coreGuiParams}</runTarget>
+ <runTarget>${coreGuiRunTarget}</runTarget>
<extraJvmArgs>${gwt-plugin.extraJvmArgs}</extraJvmArgs>
<localWorkers>${gwt-plugin.localWorkers}</localWorkers>
<draftCompile>true</draftCompile>
@@ -416,6 +417,18 @@
</build>
</profile>
+ <!-- Change the runTarget to not have single quotes. The quotes work for linux but not win -->
+ <profile>
+ <activation>
+ <os>
+ <family>Windows</family>
+ </os>
+ </activation>
+ <properties>
+ <coreGuiRunTarget>http://localhost:7080/coregui/CoreGUI.html${coreGuiParams}</coreGuiRunTarget>
+ </properties>
+ </profile>
+
</profiles>
commit c01f40557f67bb7ed93e746a8196e453fca34a6f
Merge: 0367592... b8d2720...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Sep 15 16:12:35 2010 -0400
Merge branch 'master' into master-jay
commit 03675928109b9eb3cfa398401db4c6a8dfbbdeb6
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Sep 15 16:09:30 2010 -0400
take away the empty property setting, the pom no defines the empty default
diff --git a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
index a523723..6f5b7c2 100644
--- a/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
+++ b/etc/eclipse-tools/maven/RHQ Maven Build - Run GWT DevMode-JPDA.launch
@@ -6,6 +6,6 @@
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${env_var:M2_HOME}/bin/${MAVEN_EXE}"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-o -Dmaven.test.skip=true gwt:debug -DcoreGuiParams="/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-o -Dmaven.test.skip=true gwt:debug"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/modules/enterprise/gui/coregui}"/>
</launchConfiguration>
commit 381de84c3db865e761a48acea6cba0f7787e6f2a
Merge: 09a697d... bf86450...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Sep 15 13:43:56 2010 -0400
Merge branch 'master' into master-jay
commit 09a697d7b10f12837cd5e752b0e7601ae91d5922
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Sep 15 13:42:40 2010 -0400
initialize coreGuiParams to ""
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 4e9532b..950ce71 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -30,6 +30,8 @@
in your settings.xml -->
<gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M</gwt-plugin.extraJvmArgs>
<gwt-plugin.localWorkers>2</gwt-plugin.localWorkers>
+
+ <coreGuiParams></coreGuiParams>
</properties>
13 years, 9 months
[rhq] Branch 'perftest' - 2 commits - modules/helpers
by Heiko W. Rupp
modules/helpers/perftest-support/pom.xml | 4 -
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java | 27 +++++++++-
2 files changed, 27 insertions(+), 4 deletions(-)
New commits:
commit 56427b65ec70c91507814392d203ed99e750cdb2
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Sep 16 17:36:51 2010 +0200
Set the correct database type factory for the database in use.
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
index 4ff7700..cc23514 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
@@ -26,11 +26,14 @@ import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.sql.Connection;
+import java.sql.SQLException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseDataSourceConnection;
import org.dbunit.database.IDatabaseConnection;
+import org.dbunit.dataset.datatype.IDataTypeFactory;
import org.rhq.helpers.perftest.support.FileFormat;
import org.rhq.helpers.perftest.support.Importer;
import org.rhq.helpers.perftest.support.Input;
@@ -73,14 +76,14 @@ public class DatabaseSetupInterceptor implements IInvokedMethodListener {
IDatabaseConnection connection = new DatabaseDataSourceConnection(new InitialContext(),
"java:/RHQDS");
+ setDatabaseType(connection);
+
FileFormat format = state.format();
Input input = format.getInput(streamProvider);
try {
-LOG.warn("--- 1") ;
Importer.run(connection, input);
-LOG.warn("--- 2");
} finally {
input.close();
}
@@ -89,6 +92,26 @@ LOG.warn("--- 2");
}
}
+ private void setDatabaseType(IDatabaseConnection connection) throws SQLException {
+ DatabaseConfig config = connection.getConfig();
+ String name = connection.getConnection().getMetaData().getDatabaseProductName().toLowerCase();
+ int major = connection.getConnection().getMetaData().getDatabaseMajorVersion();
+ IDataTypeFactory type = null;
+ if (name.contains("postgres")) {
+ type = new org.dbunit.ext.postgresql.PostgresqlDataTypeFactory();
+ } else if (name.contains("oracle")) {
+ if (major>=10) {
+ type = new org.dbunit.ext.oracle.Oracle10DataTypeFactory();
+ } else {
+ type = new org.dbunit.ext.oracle.OracleDataTypeFactory();
+ }
+ }
+ if (type!=null) {
+ LOG.info("setting db type for dbunit to " + type.getClass().getCanonicalName());
+ config.setProperty("http://www.dbunit.org/properties/datatypeFactory",type);
+ }
+ }
+
public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
//nothing to do
}
commit dbc07c9e98e9ce2b4b0c557253619ebd46771929
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Sep 16 17:35:39 2010 +0200
Bump dbunit version
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 2dbe9c9..f4e8538 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -14,7 +14,7 @@
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
- <version>2.4.7</version>
+ <version>2.4.8</version>
<exclusions>
<exclusion>
<artifactId>junit</artifactId>
@@ -88,5 +88,5 @@
</plugin>
</plugins>
</build>
-
+
</project>
\ No newline at end of file
13 years, 9 months
[rhq] Branch 'perftest' - modules/enterprise modules/helpers
by Heiko W. Rupp
dev/null |binary
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java | 4 -
modules/enterprise/server/jar/src/test/resources/perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip |binary
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/Importer.java | 24 ++++----
modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java | 28 ++++++----
5 files changed, 32 insertions(+), 24 deletions(-)
New commits:
commit b41d4dee1254e12dd2205595aa067c41b7e1dcae
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Sep 16 17:13:23 2010 +0200
Move the data .zip into the perftest/ directory, to make it more obvious what this is for.
Use a JNDI based connection provider instead of a JDBC based one.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 2335887..327b659 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -33,10 +33,10 @@ import org.testng.annotations.Test;
*/
@Test(groups = "PERF")
@Listeners({ DatabaseSetupInterceptor.class })
-@JdbcConnectionProviderMethod("getConnection") //defined in AbstractEJB3Test
+//@JdbcConnectionProviderMethod("getConnection") //defined in AbstractEJB3Test
public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
- @DatabaseState(url = "AvailabilityInsertPurgeTest-testOne-data.xml.zip")
+ @DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip")
public void testOne() throws Exception {
startTiming();
diff --git a/modules/enterprise/server/jar/src/test/resources/AvailabilityInsertPurgeTest-testOne-data.xml.zip b/modules/enterprise/server/jar/src/test/resources/AvailabilityInsertPurgeTest-testOne-data.xml.zip
deleted file mode 100644
index 811c952..0000000
Binary files a/modules/enterprise/server/jar/src/test/resources/AvailabilityInsertPurgeTest-testOne-data.xml.zip and /dev/null differ
diff --git a/modules/enterprise/server/jar/src/test/resources/perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip b/modules/enterprise/server/jar/src/test/resources/perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip
new file mode 100644
index 0000000..811c952
Binary files /dev/null and b/modules/enterprise/server/jar/src/test/resources/perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip differ
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/Importer.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/Importer.java
index 00724fe..44eb8f3 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/Importer.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/Importer.java
@@ -31,18 +31,18 @@ import org.rhq.helpers.perftest.support.dbunit.DbUnitUtil;
/**
* Utility method to import the data previously produced by the {@link Exporter}.
- *
+ *
* @author Lukas Krejci
*/
public class Importer {
-
+
private Importer() {
-
+
}
-
+
/**
* Imports the data from the input into a database using the provided JDBC connection.
- *
+ *
* @param jdbcConnection
* @param input
* @throws Exception
@@ -50,22 +50,22 @@ public class Importer {
public static void run(Connection jdbcConnection, Input input) throws Exception {
run(new DatabaseConnection(jdbcConnection), input);
}
-
+
public static void run(Properties settings, Input input) throws Exception {
run(DbUnitUtil.getConnection(settings), input);
}
-
- private static void run(IDatabaseConnection connection, Input input) throws Exception {
+
+ public static void run(IDatabaseConnection connection, Input input) throws Exception {
ReplacementDataSet dataSet = new ReplacementDataSet(new StreamingDataSet(input.getProducer()));
dataSet.addReplacementObject(Settings.NULL_REPLACEMENT, null);
-
+
DatabaseOperation.DELETE_ALL.execute(connection, dataSet);
input.close();
-
+
dataSet = new ReplacementDataSet(new StreamingDataSet(input.getProducer()));
dataSet.addReplacementObject(Settings.NULL_REPLACEMENT, null);
-
- DatabaseOperation.INSERT.execute(connection, dataSet);
+
+ DatabaseOperation.INSERT.execute(connection, dataSet);
}
}
diff --git a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
index 605caf6..4ff7700 100644
--- a/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
+++ b/modules/helpers/perftest-support/src/main/java/org/rhq/helpers/perftest/support/testng/DatabaseSetupInterceptor.java
@@ -29,6 +29,8 @@ import java.sql.Connection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.dbunit.database.DatabaseDataSourceConnection;
+import org.dbunit.database.IDatabaseConnection;
import org.rhq.helpers.perftest.support.FileFormat;
import org.rhq.helpers.perftest.support.Importer;
import org.rhq.helpers.perftest.support.Input;
@@ -39,14 +41,16 @@ import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestResult;
+import javax.naming.InitialContext;
+
/**
* An {@link IInvokedMethodListener method listener} that performs the database setup
* for appropriately annotated test methods.
- * To add database setup support to a test class, annotate the class with
+ * To add database setup support to a test class, annotate the class with
* <code>
* @Listeners({org.rhq.helpers.perftest.support.testng.DatabaseSetupInterceptor.class})
* </code>
- *
+ *
* @author Lukas Krejci
*/
public class DatabaseSetupInterceptor implements IInvokedMethodListener {
@@ -55,24 +59,28 @@ public class DatabaseSetupInterceptor implements IInvokedMethodListener {
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {
DatabaseState state = getRequiredDatabaseState(method);
-
+
if (state == null) {
return;
}
-
- Method connectionProviderMethod = getConnectionProviderMethod(method, state);
-
+
+// Method connectionProviderMethod = getConnectionProviderMethod(method, state);
+
try {
InputStreamProvider streamProvider = getInputStreamProvider(state.url(), state.storage(), method);
- Object classInstance = method.getTestMethod().getInstances()[0];
- Connection connection = (Connection) connectionProviderMethod.invoke(classInstance, (Object[]) null);
+// Object classInstance = method.getTestMethod().getInstances()[0];
+// Connection connection = (Connection) connectionProviderMethod.invoke(classInstance, (Object[]) null);
+ IDatabaseConnection connection = new DatabaseDataSourceConnection(new InitialContext(),
+ "java:/RHQDS");
FileFormat format = state.format();
-
- Input input = format.getInput(streamProvider);
+
+ Input input = format.getInput(streamProvider);
try {
+LOG.warn("--- 1") ;
Importer.run(connection, input);
+LOG.warn("--- 2");
} finally {
input.close();
}
13 years, 9 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 14 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java | 5 ++-
2 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit f439da6dd89dbbad0a4f57cad5038a555136d54d
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Sep 16 11:12:39 2010 -0400
make the group def name on the group Summary>Overview subtab a link to the corresponding group def
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 0df613d..073ef0c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -30,7 +30,6 @@ public class LinkManager {
private static boolean GWT = true;
public static String getResourceLink(int resourceId) {
-
if (GWT) {
return "#Resource/" + resourceId + "/Summary/Overview";
} else {
@@ -38,12 +37,19 @@ public class LinkManager {
}
}
- public static String getResourceGroupLink(int resouceGroupId) {
+ public static String getResourceGroupLink(int groupId) {
+ if (GWT) {
+ return "#ResourceGroup/" + groupId;
+ } else {
+ return "/rhq/group/inventory/view.xhtml?groupId=" + groupId;
+ }
+ }
+ public static String getGroupDefinitionLink(int groupDefinitionId) {
if (GWT) {
- return "#ResourceGroup/" + resouceGroupId;
+ return "#Inventory/Groups/DynaGroup%20Manager/" + groupDefinitionId;
} else {
- return "/rhq/group/inventory/view.xhtml?groupId=" + resouceGroupId;
+ return "/rhq/definition/group/view.xhtml?groupDefinitionId=" + groupDefinitionId;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
index 41de300..08f3290 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/OverviewView.java
@@ -30,6 +30,7 @@ import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.components.form.EnhancedDynamicForm;
import org.rhq.enterprise.gui.coregui.client.components.form.TogglableTextItem;
import org.rhq.enterprise.gui.coregui.client.components.form.ValueUpdatedHandler;
@@ -219,8 +220,8 @@ public class OverviewView extends VLayout {
if (dynamic) {
StaticTextItem groupDefinitionItem = new StaticTextItem("groupDefinition", "Group Definition");
GroupDefinition groupDefinition = group.getGroupDefinition();
- // TODO (ips): Make this a link to the group def.
- groupDefinitionItem.setValue(groupDefinition.getName());
+ String groupDefinitionUrl = LinkManager.getGroupDefinitionLink(groupDefinition.getId());
+ groupDefinitionItem.setValue("<a href=\"" + groupDefinitionUrl + "\">" + groupDefinition.getName() + "</a>");
formItems.add(groupDefinitionItem);
}
13 years, 9 months
[rhq] Branch 'perftest' - modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit aeda2d8b8d41cc1f3906c0c5e1c461c55655d05b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Sep 16 16:51:38 2010 +0200
Convert to valid JPA
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 4c0e5ef..288cf69 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -1033,7 +1033,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
try {
- Query q = em.createQuery("SELECT count(*) FROM Availability");
+ Query q = em.createQuery("SELECT count(a) FROM Availability a");
long count = (Long) q.getSingleResult();
return count;
} finally {
@@ -1137,7 +1137,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
/**
* Convenience method for persisting availability. Availability data can no longer be directly merged
- * by the EntityManager because it does not update the corresponding currentAvailability data on the
+ * by the EntityManager because it does not update the corresponding currentAvailability data on the
* Resource entity. This method will update the necessary objects for you.
*/
private void persistAvailability(Availability... availabilities) {
13 years, 9 months
[rhq] 5 commits - modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/roles/RolesDataSource.java | 29 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java | 15
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java | 96 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 242 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java | 12
6 files changed, 223 insertions(+), 187 deletions(-)
New commits:
commit ad8060db3499243b1b59b15d72aec9940a6e150c
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 16 03:39:43 2010 -0400
refinement of CRUD functionality for group definitions:
* expose several more fields in the group definition datasource
* mark group definition datasource fields required as appropriate
* add form validation and halt create/update workflow until errors are resolved
* push the create/update functionality into the datasource impl
* update the details-form to use the create/update functionality on the datasource
* add hooks to return to the list view after create/update
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
index c373dd7..a95e0e6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -18,13 +18,19 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSourceField;
+import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
+import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
@@ -55,17 +61,31 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
private GroupDefinitionDataSource() {
super();
- DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
- idDataField.setPrimaryKey(true);
- idDataField.setCanEdit(false);
+ DataSourceField idField = new DataSourceIntegerField("id", "ID");
+ idField.setPrimaryKey(true);
+ idField.setCanEdit(false);
DataSourceTextField nameField = new DataSourceTextField("name", "Name");
+ nameField.setRequired(true);
+
DataSourceTextField descriptionField = new DataSourceTextField("description", "Description");
+
DataSourceTextField expressionField = new DataSourceTextField("expression", "Expression");
+ expressionField.setRequired(true);
+
+ DataSourceTextField recursiveField = new DataSourceTextField("recursive", "Recursive");
+ recursiveField.setType(FieldType.BOOLEAN);
+
+ /*
+ DataSourceTextField recalculationIntervalField = new DataSourceTextField("recalculationInterval",
+ "Recalculation Interval");
+ */
+
DataSourceTextField nextCalculationTimeField = new DataSourceTextField("nextCalculationTime",
"Next Calculation Time");
- setFields(idDataField, nameField, descriptionField, expressionField, nextCalculationTimeField);
+ setFields(idField, nameField, descriptionField, expressionField, recursiveField, /*recalculationIntervalField,*/
+ nextCalculationTimeField);
}
@@ -91,8 +111,71 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
}
@Override
+ protected void executeAdd(final DSRequest request, final DSResponse response) {
+ JavaScriptObject data = request.getData();
+ final ListGridRecord record = new ListGridRecord(data);
+ final GroupDefinition newGroupDefinition = copyValues(record);
+ final String name = newGroupDefinition.getName();
+
+ GWTServiceLookup.getResourceGroupService().createGroupDefinition(newGroupDefinition,
+ new AsyncCallback<GroupDefinition>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Map<String, String> errors = new HashMap<String, String>();
+ errors.put("name", "A group definition with this name already exists.");
+ response.setErrors(errors);
+ response.setStatus(RPCResponse.STATUS_VALIDATION_ERROR);
+ processResponse(request.getRequestId(), response);
+ }
+
+ @Override
+ public void onSuccess(GroupDefinition result) {
+ CoreGUI.getErrorHandler().handleError("Successfully created group definition '" + name + "'");
+ response.setData(new Record[] { copyValues(result) });
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
+ protected void executeUpdate(final DSRequest request, final DSResponse response) {
+ final ListGridRecord record = getEditedRecord(request);
+ final GroupDefinition updatedGroupDefinition = copyValues(record);
+ final String name = updatedGroupDefinition.getName();
+
+ GWTServiceLookup.getResourceGroupService().updateGroupDefinition(updatedGroupDefinition,
+ new AsyncCallback<Void>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failure saving group definition '" + name + "'", caught);
+ }
+
+ @Override
+ public void onSuccess(Void result) {
+ CoreGUI.getErrorHandler().handleError("Successfully saved group definition '" + name + "'");
+ response.setData(new Record[] { copyValues(updatedGroupDefinition) });
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ @Override
public GroupDefinition copyValues(ListGridRecord from) {
- return null; // TODO: Implement this method.
+ GroupDefinition groupDefinition = new GroupDefinition();
+ String[] attributes = from.getAttributes();
+ for (String nextAttribute : attributes) {
+ System.out.println("ListGridRecord attribute: " + nextAttribute);
+ }
+ groupDefinition.setId(from.getAttributeAsInt("id"));
+ groupDefinition.setName(from.getAttributeAsString("name"));
+ groupDefinition.setDescription(from.getAttributeAsString("description"));
+ groupDefinition.setExpression(from.getAttributeAsString("expression"));
+ groupDefinition.setRecursive(from.getAttributeAsBoolean("recursive"));
+ groupDefinition.setRecalculationInterval(Long.valueOf(from.getAttributeAsString("recalculationInterval")));
+ // modifiedTime, createdTime, and lastCalculationTime are updated by GroupDefinitionManagerBean only
+ // nextCalculationTime is a non-persistent, derived field
+
+ return groupDefinition;
}
@Override
@@ -102,11 +185,12 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
record.setAttribute("name", from.getName());
record.setAttribute("description", from.getDescription());
record.setAttribute("expression", from.getExpression());
+ record.setAttribute("recursive", from.isRecursive());
record.setAttribute("recalculationInterval", from.getRecalculationInterval());
record.setAttribute("modifiedTime", from.getModifiedTime());
record.setAttribute("createdTime", from.getCreatedTime());
record.setAttribute("lastCalculationTime", from.getLastCalculationTime());
- record.setAttribute("nextCalculationTime", from.getNextCalculationTime());
+ record.setAttribute("nextCalculationTime", from.getNextCalculationTime()); // derived
// record.setAttribute("managedResourceGroups", from.getManagedResourceGroups());
return record;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index 328794e..7b5ea42 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -23,17 +23,19 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.types.DSOperationType;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.IButton;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
-import com.smartgwt.client.widgets.form.fields.ResetItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
import com.smartgwt.client.widgets.form.fields.SpinnerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
@@ -44,8 +46,8 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.FormUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -58,6 +60,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
private ViewId viewId;
+ // editable form
+ private TextItem id;
private TextItem name;
private TextAreaItem description;
private CheckboxItem recursive;
@@ -65,14 +69,14 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
private TextAreaItem expression;
private SpinnerItem recalculationInterval;
+ // read-only form
+ private StaticTextItem idStatic;
private StaticTextItem nameStatic;
private StaticTextItem descriptionStatic;
private StaticTextItem recursiveStatic;
private StaticTextItem expressionStatic;
private StaticTextItem recalculationIntervalStatic;
- private boolean formBuilt = false;
-
private GroupDefinitionDataSource dataSource;
public SingleGroupDefinitionView(String locatorId) {
@@ -85,7 +89,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
this.dataSource = GroupDefinitionDataSource.getInstance();
setPadding(10);
- setOverflow(Overflow.AUTO);
+ setOverflow(Overflow.VISIBLE);
+ setWidth(5);
buildForm();
@@ -95,42 +100,69 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
public void setGroupDefinition(GroupDefinition groupDefinition) {
this.groupDefinition = groupDefinition;
- if (groupDefinition == null) {
- clearFormValues();
- } else {
- name.setValue(groupDefinition.getName());
- nameStatic.setValue(groupDefinition.getName());
+ // form setup
+ id.setValue(groupDefinition.getId());
+ idStatic.setValue(groupDefinition.getId());
+
+ name.setValue(groupDefinition.getName());
+ nameStatic.setValue(groupDefinition.getName());
- recursive.setValue(groupDefinition.isRecursive() ? "Yes" : "No");
- recursiveStatic.setValue(groupDefinition.isRecursive() ? "Yes" : "No");
+ recursive.setValue(groupDefinition.isRecursive());
+ recursiveStatic.setValue(groupDefinition.isRecursive());
- description.setValue(groupDefinition.getDescription());
- descriptionStatic.setValue(groupDefinition.getDescription());
+ description.setValue(groupDefinition.getDescription());
+ descriptionStatic.setValue(groupDefinition.getDescription());
- recalculationInterval.setValue(groupDefinition.getRecalculationInterval());
- recalculationIntervalStatic.setValue(groupDefinition.getRecalculationInterval());
+ recalculationInterval.setValue(groupDefinition.getRecalculationInterval());
+ recalculationIntervalStatic.setValue(groupDefinition.getRecalculationInterval());
- expression.setValue(groupDefinition.getExpression());
- expressionStatic.setValue(groupDefinition.getExpression());
+ expression.setValue(groupDefinition.getExpression());
+ expressionStatic.setValue(groupDefinition.getExpression());
- ButtonItem saveButton = new ButtonItem("save", "Save");
- ResetItem resetButton = new ResetItem("reset", "Reset");
+ final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("GroupDefinitionForm"));
+ form.setFields(id, idStatic, name, nameStatic, description, descriptionStatic, expression, expressionStatic,
+ recursive, recursiveStatic, recalculationInterval, recalculationIntervalStatic);
+ form.setNumCols(2);
+ form.setDataSource(dataSource);
+ form.setHiliteRequiredFields(true);
+ form.setRequiredTitleSuffix(" <span style=\"color: red;\">* </span>:");
+ if (groupDefinition.getId() == 0) {
+ form.setSaveOperationType(DSOperationType.ADD);
+ } else {
+ form.setSaveOperationType(DSOperationType.UPDATE);
+ }
- saveButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- createOrUpdate();
+ // button setup
+ IButton saveButton = new LocatableIButton(this.extendLocatorId("Save"), "Save");
+ saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent) {
+ if (form.validate()) {
+ //createOrUpdate();
+ form.saveData(new DSCallback() {
+ @Override
+ public void execute(DSResponse response, Object rawData, DSRequest request) {
+ History.back();
+ }
+ });
}
- });
+ }
+ });
+
+ IButton resetButton = new LocatableIButton(this.extendLocatorId("Reset"), "Reset");
+ resetButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.events.ClickEvent clickEvent) {
+ form.reset();
+ }
+ });
- LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("GroupDefinitionForm"));
- form.setFields(name, nameStatic, recursive, recursiveStatic, description, descriptionStatic,
- recalculationInterval, recalculationIntervalStatic, expression, expressionStatic, saveButton,
- resetButton);
- form.setNumCols(4);
+ HLayout buttonLayout = new HLayout(10); // margin between members
+ buttonLayout.setMargin(10); // margin around layout widget
+ buttonLayout.addMember(saveButton);
+ buttonLayout.addMember(resetButton);
- addMember(form);
- formBuilt = true;
- }
+ // canvas setup
+ addMember(form);
+ addMember(buttonLayout);
markForRedraw();
}
@@ -176,98 +208,40 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
markForRedraw();
}
- public void createOrUpdate() {
- groupDefinition.setName(FormUtility.getStringSafely(name));
- groupDefinition.setDescription(FormUtility.getStringSafely(description));
- groupDefinition.setRecursive("Yes".equals(recursive.getValue()));
- groupDefinition.setExpression(FormUtility.getStringSafely(expression));
- groupDefinition.setRecalculationInterval(Long.valueOf(FormUtility.getStringSafely(recalculationInterval, "0")));
-
- final String name = groupDefinition.getName();
- if (groupDefinitionId == 0) {
- GWTServiceLookup.getResourceGroupService().createGroupDefinition(groupDefinition,
- new AsyncCallback<GroupDefinition>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure to create group definition '" + name + "'",
- caught);
- }
-
- @Override
- public void onSuccess(GroupDefinition result) {
- CoreGUI.getErrorHandler().handleError("Successfully created group definition '" + name + "'");
- History.back();
- }
- });
- } else {
- GWTServiceLookup.getResourceGroupService().updateGroupDefinition(groupDefinition,
- new AsyncCallback<Void>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failure saving group definition '" + name + "'", caught);
- }
-
- @Override
- public void onSuccess(Void result) {
- CoreGUI.getErrorHandler().handleError("Successfully saved group definition '" + name + "'");
- History.back();
- }
- });
- }
- }
-
- public void clearFormValues() {
- name.clearValue();
- description.clearValue();
- recursive.clearValue();
- expression.clearValue();
- recalculationInterval.clearValue();
-
- nameStatic.clearValue();
- descriptionStatic.clearValue();
- recursiveStatic.clearValue();
- expressionStatic.clearValue();
- recalculationIntervalStatic.clearValue();
-
- markForRedraw();
- }
-
private void buildForm() {
- if (!formBuilt) {
-
- name = new TextItem("name", "Name");
- name.setWidth(400);
- name.setDefaultValue("");
- nameStatic = new StaticTextItem("nameStatic", "Name");
-
- description = new TextAreaItem("description", "Description");
- description.setWidth(400);
- description.setHeight(50);
- description.setDefaultValue("");
- descriptionStatic = new StaticTextItem("descriptionStatic", "Description");
-
- recursive = new CheckboxItem("recursive", "Recursive");
- recursive.setValueMap("Yes", "No");
- recursive.setDefaultValue("Yes");
- recursiveStatic = new StaticTextItem("recursiveStatic", "Recursive");
-
- expression = new TextAreaItem("expression", "Expression");
- expression.setWidth(400);
- expression.setHeight(150);
- expression.setDefaultValue("");
- expressionStatic = new StaticTextItem("expressionStatic", "Expression");
-
- recalculationInterval = new SpinnerItem("recalculationInterval", "Recalculation Interval");
- recalculationInterval.setWrapTitle(false);
- recalculationInterval.setMin(0);
- recalculationInterval.setDefaultValue(0);
- recalculationIntervalStatic = new StaticTextItem("recalculationIntervalStatic", "Recalculation Interval");
-
- templateSelector = new SelectItem();
- templateSelector.setValueMap(getTemplates());
-
- formBuilt = true;
- }
+ id = new TextItem("id", "ID");
+ id.setVisible(false);
+ idStatic = new StaticTextItem("idStatic", "ID");
+ idStatic.setVisible(false);
+
+ name = new TextItem("name", "Name");
+ name.setWidth(400);
+ name.setDefaultValue("");
+ nameStatic = new StaticTextItem("nameStatic", "Name");
+
+ description = new TextAreaItem("description", "Description");
+ description.setWidth(400);
+ description.setHeight(50);
+ description.setDefaultValue("");
+ descriptionStatic = new StaticTextItem("descriptionStatic", "Description");
+
+ recursive = new CheckboxItem("recursive", "Recursive");
+ recursiveStatic = new StaticTextItem("recursiveStatic", "Recursive");
+
+ expression = new TextAreaItem("expression", "Expression");
+ expression.setWidth(400);
+ expression.setHeight(150);
+ expression.setDefaultValue("");
+ expressionStatic = new StaticTextItem("expressionStatic", "Expression");
+
+ recalculationInterval = new SpinnerItem("recalculationInterval", "Recalculation Interval");
+ recalculationInterval.setWrapTitle(false);
+ recalculationInterval.setMin(0);
+ recalculationInterval.setDefaultValue(0);
+ recalculationIntervalStatic = new StaticTextItem("recalculationIntervalStatic", "Recalculation Interval");
+
+ templateSelector = new SelectItem();
+ templateSelector.setValueMap(getTemplates());
}
public static LinkedHashMap<String, String> getTemplates() {
@@ -345,12 +319,18 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
}
public void onSuccess(PageList<GroupDefinition> result) {
- GroupDefinition existingGroupDefinition = result.get(0);
- setGroupDefinition(existingGroupDefinition);
- if (hasEditPermission) {
- switchToEditMode();
+ if (result.size() == 0) {
+ CoreGUI.getErrorHandler().handleError(
+ "No group definition exists with id=" + groupDefinitionId);
+ History.back();
} else {
- switchToViewMode();
+ GroupDefinition existingGroupDefinition = result.get(0);
+ setGroupDefinition(existingGroupDefinition);
+ if (hasEditPermission) {
+ switchToEditMode();
+ } else {
+ switchToViewMode();
+ }
}
}
});
commit 888dfe3a0fe5e171e108a5d7fb5e619d17e64888
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 16 03:36:10 2010 -0400
remove dead code, buildRecords already exists on the RPCDataSource component
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 bdfe27e..9af7064 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,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.admin.roles;
-import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -73,8 +72,6 @@ public class RolesDataSource extends RPCDataSource<Role> {
}
public void executeFetch(final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
-
RoleCriteria criteria = new RoleCriteria();
criteria.setPageControl(getPageControl(request));
@@ -120,7 +117,6 @@ public class RolesDataSource extends RPCDataSource<Role> {
public void onSuccess(Role result) {
CoreGUI.getMessageCenter().notify(
new Message("Role [" + result.getName() + "] added", Message.Severity.Info));
- ListGridRecord record = new ListGridRecord();
response.setData(new Record[] { copyValues(result) });
processResponse(request.getRequestId(), response);
}
@@ -191,14 +187,4 @@ public class RolesDataSource extends RPCDataSource<Role> {
to.setAttribute("entity", from);
return to;
}
-
- public ListGridRecord[] buildRecords(Collection<Role> roles) {
- ListGridRecord[] roleRecords = new ListGridRecord[roles.size()];
- int i = 0;
- for (Role role : roles) {
- ListGridRecord record = copyValues(role);
- roleRecords[i++] = record;
- }
- return roleRecords;
- }
}
commit fbdf98e530f549f4f3f30d514b8e712c0d03a882
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 16 03:35:51 2010 -0400
remove getEditedRecord from Roles/UsersDataSource, leveraging the RPCDataSource common impl
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 3b9aafb..bdfe27e 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
@@ -32,7 +32,6 @@ import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
-import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.auth.Subject;
@@ -193,20 +192,6 @@ public class RolesDataSource extends RPCDataSource<Role> {
return to;
}
- private ListGridRecord getEditedRecord(DSRequest request) {
- // Retrieving values before edit
- JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
- // Creating new record for combining old values with changes
- ListGridRecord newRecord = new ListGridRecord();
- // Copying properties from old record
- JSOHelper.apply(oldValues, newRecord.getJsObj());
- // Retrieving changed values
- JavaScriptObject data = request.getData();
- // Apply changes
- JSOHelper.apply(data, newRecord.getJsObj());
- return newRecord;
- }
-
public ListGridRecord[] buildRecords(Collection<Role> roles) {
ListGridRecord[] roleRecords = new ListGridRecord[roles.size()];
int i = 0;
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 0fa21cf..af9acd6 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
@@ -32,7 +32,6 @@ import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.rpc.RPCResponse;
import com.smartgwt.client.types.FieldType;
-import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.form.validator.LengthRangeValidator;
import com.smartgwt.client.widgets.form.validator.MatchesFieldValidator;
import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -253,18 +252,4 @@ public class UsersDataSource extends RPCDataSource<Subject> {
return to;
}
- private ListGridRecord getEditedRecord(DSRequest request) {
- // Retrieving values before edit
- JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
- // Creating new record for combining old values with changes
- ListGridRecord newRecord = new ListGridRecord();
- // Copying properties from old record
- JSOHelper.apply(oldValues, newRecord.getJsObj());
- // Retrieving changed values
- JavaScriptObject data = request.getData();
- // Apply changes
- JSOHelper.apply(data, newRecord.getJsObj());
- return newRecord;
- }
-
}
commit 6d3e8fc6b72f84efa69005497fcbb058528147f6
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 16 03:34:44 2010 -0400
add RPCDataSource method for getting the in-flight edits from the DSRequest
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index cb2768f..dd5e77b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -23,6 +23,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
+import com.google.gwt.core.client.JavaScriptObject;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
@@ -30,6 +31,7 @@ import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.DSDataFormat;
import com.smartgwt.client.types.DSProtocol;
+import com.smartgwt.client.util.JSOHelper;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.util.PageControl;
@@ -224,4 +226,18 @@ public abstract class RPCDataSource<T> extends DataSource {
addField(field);
}
}
+
+ public ListGridRecord getEditedRecord(DSRequest request) {
+ // Retrieving values before edit
+ JavaScriptObject oldValues = request.getAttributeAsJavaScriptObject("oldValues");
+ // Creating new record for combining old values with changes
+ ListGridRecord newRecord = new ListGridRecord();
+ // Copying properties from old record
+ JSOHelper.apply(oldValues, newRecord.getJsObj());
+ // Retrieving changed values
+ JavaScriptObject data = request.getData();
+ // Apply changes
+ JSOHelper.apply(data, newRecord.getJsObj());
+ return newRecord;
+ }
}
commit a0f4c0d3702eae637735186647aa7090e3911dcf
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Sep 15 17:42:41 2010 -0400
capture all exception messages from errors in ResourceGroupGWTService
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
index 46c965c..b2ec813 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGroupGWTServiceImpl.java
@@ -24,9 +24,9 @@ import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.util.exception.ThrowableUtil;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
-import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.definition.GroupDefinitionManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -69,8 +69,8 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
public void deleteResourceGroups(int[] groupIds) {
try {
groupManager.deleteResourceGroups(getSessionSubject(), groupIds);
- } catch (ResourceGroupDeleteException e) {
- throw new RuntimeException(e.getMessage());
+ } catch (Throwable t) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
@@ -84,7 +84,7 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
return SerialUtility.prepare(results, "ResourceGroupService.createGroupDefinition");
} catch (Throwable t) {
- throw new RuntimeException(t.getMessage());
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
@@ -92,7 +92,7 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
try {
definitionManager.updateGroupDefinition(getSessionSubject(), groupDefinition);
} catch (Throwable t) {
- throw new RuntimeException(t.getMessage());
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
@@ -102,7 +102,7 @@ public class ResourceGroupGWTServiceImpl extends AbstractGWTServiceImpl implemen
definitionManager.removeGroupDefinition(getSessionSubject(), nextGroupDefinitionId);
}
} catch (Throwable t) {
- throw new RuntimeException(t.getMessage());
+ throw new RuntimeException(ThrowableUtil.getAllMessages(t));
}
}
13 years, 9 months
[rhq] 3 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java | 109 ++++++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertDefinitionGWTService.java | 34 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 24 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertDefinitionGWTServiceImpl.java | 70 ++++++
6 files changed, 210 insertions(+), 35 deletions(-)
New commits:
commit 14fd401a427a68a17cbf7f4e4356d66387b73ef7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 15 17:34:02 2010 -0400
start using the gwt service for alert defs
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
index f986562..fcb018d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsView.java
@@ -26,15 +26,21 @@ package org.rhq.enterprise.gui.coregui.client.alert.definitions;
import java.util.ArrayList;
import java.util.EnumSet;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceComposite;
+import org.rhq.core.domain.resource.composite.ResourcePermission;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository.MetadataType;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
/**
* @author John Mazzitelli
@@ -44,10 +50,12 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
public static final String CRITERIA_RESOURCE_ID = "resourceId";
private Resource resource;
+ private ResourcePermission permissions;
- public ResourceAlertDefinitionsView(String locatorId, Resource resource) {
+ public ResourceAlertDefinitionsView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId, "Alert Definitions");
- this.resource = resource;
+ this.resource = resourceComposite.getResource();
+ this.permissions = resourceComposite.getResourcePermission();
// make sure we loaded all the type info we'll need. if one of these is null, either the type
// doesn't have it or we haven't loaded it yet. since we can't know for sure if it was loaded, we have to ask.
@@ -87,8 +95,7 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
@Override
protected boolean isAllowedToModifyAlertDefinitions() {
- // TODO: see if user can modify alerts on this resource
- return true;
+ return this.permissions.isAlert();
}
@Override
@@ -98,39 +105,99 @@ public class ResourceAlertDefinitionsView extends AbstractAlertDefinitionsView {
@Override
protected void enableButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id = record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+ GWTServiceLookup.getAlertDefinitionService().enableAlertDefinitions(alertDefIds, new AsyncCallback<Integer>() {
+ @Override
+ public void onSuccess(Integer result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + result + "] alert definitions enabled", Severity.Info));
+ ResourceAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to enable alert definitions", caught);
+ }
+ });
}
@Override
protected void disableButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id = record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+ GWTServiceLookup.getAlertDefinitionService().disableAlertDefinitions(alertDefIds, new AsyncCallback<Integer>() {
+ @Override
+ public void onSuccess(Integer result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + result + "] alert definitions disabled", Severity.Info));
+ ResourceAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to disable alert definitions", caught);
+ }
+ });
}
@Override
protected void deleteButtonPressed(ListGridRecord[] selection) {
- // TODO Auto-generated method stub
- String str = "this is not implemented yet but you selected";
+ if (selection.length == 0) {
+ return;
+ }
+
+ Integer[] alertDefIds = new Integer[selection.length];
+ int i = 0;
for (ListGridRecord record : selection) {
- str += ": " + record.getAttribute("name");
+ Integer id = record.getAttributeAsInt(AbstractAlertDefinitionsDataSource.FIELD_ID);
+ alertDefIds[i++] = id;
}
- SC.say(str);
+ GWTServiceLookup.getAlertDefinitionService().removeAlertDefinitions(alertDefIds, new AsyncCallback<Integer>() {
+ @Override
+ public void onSuccess(Integer result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("[" + result + "] alert definitions deleted", Severity.Info));
+ ResourceAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to delete alert definitions", caught);
+ }
+ });
}
@Override
protected void commitAlertDefinition(AlertDefinition alertDefinition) {
- System.out.println("=======================================>" + alertDefinition);
- // TODO call into server SLSB to store alert def
- // AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
- // alertDefinitionManager.updateAlertDefinition(subject, alertDef.getId(), alertDef, true);
+ GWTServiceLookup.getAlertDefinitionService().updateAlertDefinition(alertDefinition.getId(), alertDefinition,
+ true, new AsyncCallback<AlertDefinition>() {
+ @Override
+ public void onSuccess(AlertDefinition result) {
+ CoreGUI.getMessageCenter().notify(new Message("Alert definition is updated", Severity.Info));
+ ResourceAlertDefinitionsView.this.refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to update alert definition", caught);
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index e4bb9fd..c9f1104 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -112,7 +112,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
List<TwoLevelTab> tabs = new ArrayList<TwoLevelTab>();
summaryTab = new TwoLevelTab(getTabSet().extendLocatorId("Summary"), "Summary",
- "/images/icons/Service_up_16.png");
+ "/images/icons/Service_up_16.png");
summaryOverview = new SubTab(summaryTab.extendLocatorId("Overview"), "Overview", null);
summaryDashboard = new SubTab(summaryTab.extendLocatorId("Dashboard"), "Dashboard", null);
summaryTimeline = new SubTab(summaryTab.extendLocatorId("Timeline"), "Timeline", null);
@@ -197,10 +197,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
this.monitorGraphs.setCanvas(new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource));
this.monitorTables.setCanvas(new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()));
- this.monitorTraits.setCanvas(new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()));
+ this.monitorTraits
+ .setCanvas(new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()));
this.monitorAvail.setCanvas(new FullHTMLPane("/rhq/resource/monitor/availabilityHistory-plain.xhtml?id="
+ resource.getId()));
- this.monitorSched.setCanvas(new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()));
+ this.monitorSched
+ .setCanvas(new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()));
this.monitorCallTime.setCanvas(new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id="
+ resource.getId()));
@@ -225,7 +227,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 4) user can search alert history by: date alert was fired, alert priority, or alert definition
this.alertHistory.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertHistory-plain.xhtml?id="
+ resource.getId()));
- this.alertDef.setCanvas(new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("Def"), resource));
+ this.alertDef.setCanvas(new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("AlertDef"),
+ resourceComposite));
this.alertDelete.setCanvas(new FullHTMLPane("/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id="
+ resource.getId()));
@@ -256,12 +259,14 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
monitoringTab.setSubTabEnabled(monitorTraits.getLocatorId(), hasTraits(this.resourceComposite));
monitoringTab.setSubTabEnabled(monitorCallTime.getLocatorId(), facets.contains(ResourceTypeFacet.CALL_TIME));
- inventoryTab.setSubTabEnabled(inventoryConn.getLocatorId(), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ inventoryTab.setSubTabEnabled(inventoryConn.getLocatorId(), facets
+ .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
ResourceType type = this.resourceComposite.getResource().getResourceType();
inventoryTab.setSubTabEnabled(inventoryChildren.getLocatorId(), !type.getChildResourceTypes().isEmpty());
getTabSet().setTabEnabled(this.operationsTab, facets.contains(ResourceTypeFacet.OPERATION));
- getTabSet().setTabEnabled(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead());
+ getTabSet().setTabEnabled(this.configurationTab,
+ facets.contains(ResourceTypeFacet.CONFIGURATION) && permissions.isConfigureRead());
getTabSet().setTabEnabled(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT));
getTabSet().setTabEnabled(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT));
}
@@ -303,11 +308,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
final Resource resource = resourceComposite.getResource();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
resource.getResourceType().getId(),
- EnumSet.of(
- ResourceTypeRepository.MetadataType.children,
- ResourceTypeRepository.MetadataType.content,
- ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.measurements,
+ EnumSet.of(ResourceTypeRepository.MetadataType.children, ResourceTypeRepository.MetadataType.content,
+ ResourceTypeRepository.MetadataType.operations, ResourceTypeRepository.MetadataType.measurements,
ResourceTypeRepository.MetadataType.events,
ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
new ResourceTypeRepository.TypeLoadedCallback() {
commit 5a56ceb783f95a857fdf174e9d77d598c60344f6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 15 17:33:47 2010 -0400
add the lookup method for the new alert def service
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 9965430..373f87c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -36,6 +36,10 @@ public class GWTServiceLookup {
public static final String SESSION_NAME = "RHQ_Sesssion";
+ public static AlertDefinitionGWTServiceAsync getAlertDefinitionService() {
+ return secure(AlertDefinitionGWTServiceAsync.Util.getInstance());
+ }
+
public static ConfigurationGWTServiceAsync getConfigurationService() {
return secure(ConfigurationGWTServiceAsync.Util.getInstance());
}
@@ -124,9 +128,6 @@ public class GWTServiceLookup {
return secure(ClusterGWTServiceAsync.Util.getInstance());
}
-
-
-
private static <T> T secure(Object sdt) {
if (!(sdt instanceof ServiceDefTarget))
return null;
commit 0487a6aa2c203ff991e72ecfeacb235dcf11fb96
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Sep 15 17:20:04 2010 -0400
add alert def manager gwt service
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index aa2b040..8db747c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -48,6 +48,7 @@
<entry-point class='org.rhq.enterprise.gui.coregui.client.SearchGUI'/>
<servlet path="/AlertGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AlertGWTServiceImpl"/>
+ <servlet path="/AlertDefinitionGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AlertDefinitionGWTServiceImpl"/>
<servlet path="/AuthorizationGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AuthorizationGWTServiceImpl"/>
<servlet path="/AvailabilityGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.AvailabilityGWTServiceImpl"/>
<servlet path="/BundleGWTService" class="org.rhq.enterprise.gui.coregui.server.gwt.BundleGWTServiceImpl"/>
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertDefinitionGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertDefinitionGWTService.java
new file mode 100644
index 0000000..e309eea
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AlertDefinitionGWTService.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+
+public interface AlertDefinitionGWTService extends RemoteService {
+ AlertDefinition updateAlertDefinition(int alertDefinitionId, AlertDefinition alertDefinition,
+ boolean updateInternals) throws Exception;
+
+ int enableAlertDefinitions(Integer[] alertDefinitionIds) throws Exception;
+
+ int disableAlertDefinitions(Integer[] alertDefinitionIds) throws Exception;
+
+ int removeAlertDefinitions(Integer[] alertDefinitionIds) throws Exception;
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertDefinitionGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertDefinitionGWTServiceImpl.java
new file mode 100644
index 0000000..169b758
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AlertDefinitionGWTServiceImpl.java
@@ -0,0 +1,70 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.enterprise.gui.coregui.client.gwt.AlertDefinitionGWTService;
+import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
+import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+public class AlertDefinitionGWTServiceImpl extends AbstractGWTServiceImpl implements AlertDefinitionGWTService {
+ private static final long serialVersionUID = 1L;
+
+ private AlertDefinitionManagerLocal alertDefManager = LookupUtil.getAlertDefinitionManager();
+
+ public AlertDefinition updateAlertDefinition(int alertDefinitionId, AlertDefinition alertDefinition,
+ boolean updateInternals) throws Exception {
+ try {
+ AlertDefinition results = alertDefManager.updateAlertDefinition(getSessionSubject(), alertDefinitionId,
+ alertDefinition, updateInternals);
+ return SerialUtility.prepare(results, "updateAlertDefinition");
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public int enableAlertDefinitions(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ int results = alertDefManager.enableAlertDefinitions(getSessionSubject(), alertDefinitionIds);
+ return results;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public int disableAlertDefinitions(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ int results = alertDefManager.disableAlertDefinitions(getSessionSubject(), alertDefinitionIds);
+ return results;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+
+ public int removeAlertDefinitions(Integer[] alertDefinitionIds) throws Exception {
+ try {
+ int results = alertDefManager.removeAlertDefinitions(getSessionSubject(), alertDefinitionIds);
+ return results;
+ } catch (Exception e) {
+ throw new RuntimeException(ThrowableUtil.getAllMessages(e));
+ }
+ }
+}
\ No newline at end of file
13 years, 9 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UsersDataSource.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
New commits:
commit 695b267b435bfed82b1d2384b618085766950fce
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Sep 15 17:20:31 2010 -0400
update users datasource to expose factive property
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 470b144..0fa21cf 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
@@ -97,13 +97,14 @@ public class UsersDataSource extends RPCDataSource<Subject> {
DataSourceTextField department = new DataSourceTextField("department", "Department", 100, false);
+ DataSourceTextField enabled = new DataSourceTextField("factive", "Enabled");
+ enabled.setType(FieldType.BOOLEAN);
+
setFields(idDataField, usernameField, firstName, lastName, password, passwordVerify, phone, emailAddress,
- department);
+ department, enabled);
}
public void executeFetch(final DSRequest request, final DSResponse response) {
- final long start = System.currentTimeMillis();
-
SubjectCriteria criteria = new SubjectCriteria();
criteria.setPageControl(getPageControl(request));
criteria.fetchRoles(true);
@@ -228,6 +229,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
to.setDepartment(from.getAttributeAsString("department"));
to.setPhoneNumber(from.getAttributeAsString("phoneNumber"));
to.setEmailAddress(from.getAttributeAsString("emailAddress"));
+ to.setFactive(from.getAttributeAsBoolean("factive"));
to.setRoles((Set<Role>) from.getAttributeAsObject("roles"));
return to;
@@ -243,6 +245,7 @@ public class UsersDataSource extends RPCDataSource<Subject> {
to.setAttribute("department", from.getDepartment());
to.setAttribute("phoneNumber", from.getPhoneNumber());
to.setAttribute("emailAddress", from.getEmailAddress());
+ to.setAttribute("factive", from.getFactive());
to.setAttribute("roles", from.getRoles());
13 years, 9 months
[rhq] modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 44 ++++++++--
2 files changed, 39 insertions(+), 6 deletions(-)
New commits:
commit 48805cca6b617fdc1c0f49e5a2b47fcae748b703
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Sep 15 17:19:42 2010 -0400
create new users in the 'enabled' state
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
index 279fa33..9ea9467 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/users/UserEditView.java
@@ -197,6 +197,7 @@ public class UserEditView extends LocatableVLayout implements BookmarkableView {
private void editNewInternal() {
subject = new Subject();
+ subject.setFactive(true);
ListGridRecord r = dataSource.copyValues(subject);
editRecord(r);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index 6bafa7b..328794e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -19,7 +19,9 @@
package org.rhq.enterprise.gui.coregui.client.inventory.groups.definitions;
import java.util.LinkedHashMap;
+import java.util.Set;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.form.fields.ButtonItem;
@@ -33,12 +35,12 @@ import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceGroupDefinitionCriteria;
import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.LinkManager;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -71,6 +73,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
private boolean formBuilt = false;
+ private GroupDefinitionDataSource dataSource;
+
public SingleGroupDefinitionView(String locatorId) {
this(locatorId, null);
}
@@ -78,6 +82,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
public SingleGroupDefinitionView(String locatorId, GroupDefinition groupDefinition) {
super(locatorId);
+ this.dataSource = GroupDefinitionDataSource.getInstance();
+
setPadding(10);
setOverflow(Overflow.AUTO);
@@ -165,6 +171,8 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
expressionStatic.show();
recalculationIntervalStatic.show();
+ viewId.getBreadcrumbs().get(0).setDisplayName("Viewing '" + nameStatic.getValue().toString() + "'");
+
markForRedraw();
}
@@ -251,8 +259,9 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
recalculationInterval = new SpinnerItem("recalculationInterval", "Recalculation Interval");
recalculationInterval.setWrapTitle(false);
+ recalculationInterval.setMin(0);
recalculationInterval.setDefaultValue(0);
- recalculationIntervalStatic = new StaticTextItem("recalculationInterval", "Recalculation Interval");
+ recalculationIntervalStatic = new StaticTextItem("recalculationIntervalStatic", "Recalculation Interval");
templateSelector = new SelectItem();
templateSelector.setValueMap(getTemplates());
@@ -314,26 +323,35 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
return results.toString();
}
- private void lookupDetails(final int groupDefinitionId) {
+ private void lookupDetails(final int groupDefinitionId, final boolean hasEditPermission) {
ResourceGroupDefinitionCriteria criteria = new ResourceGroupDefinitionCriteria();
criteria.addFilterId(groupDefinitionId);
if (groupDefinitionId == 0) {
GroupDefinition newGroupDefinition = new GroupDefinition();
setGroupDefinition(newGroupDefinition);
- switchToEditMode();
+ if (hasEditPermission) {
+ switchToEditMode();
+ } else {
+ switchToViewMode();
+ }
} else {
GWTServiceLookup.getResourceGroupService().findGroupDefinitionsByCriteria(criteria,
new AsyncCallback<PageList<GroupDefinition>>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
"Failure loading group definition[id=" + groupDefinitionId + "]", caught);
+ History.back();
}
public void onSuccess(PageList<GroupDefinition> result) {
GroupDefinition existingGroupDefinition = result.get(0);
setGroupDefinition(existingGroupDefinition);
- switchToEditMode();
+ if (hasEditPermission) {
+ switchToEditMode();
+ } else {
+ switchToViewMode();
+ }
}
});
}
@@ -343,7 +361,21 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
public void renderView(ViewPath viewPath) {
groupDefinitionId = viewPath.getCurrentAsInt();
viewId = viewPath.getCurrent();
- lookupDetails(groupDefinitionId);
+ GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Could not determine whether user had MANAGE_INVENTORY permission, defaulting to view-only mode",
+ caught);
+ lookupDetails(groupDefinitionId, false);
+ }
+
+ @Override
+ public void onSuccess(Set<Permission> result) {
+ lookupDetails(groupDefinitionId, result.contains(Permission.MANAGE_INVENTORY));
+ }
+ });
+
}
}
13 years, 9 months
[rhq] 2 commits - modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java | 11 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java | 2 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java | 6 +----
3 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit dc486e85b51d9487f4594d96b3eaf371fdd5d548
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Sep 15 15:54:18 2010 -0400
use singleton pattern for GroupDefinitionDataSource
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
index 8d9fba7..c373dd7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionDataSource.java
@@ -43,7 +43,16 @@ public class GroupDefinitionDataSource extends RPCDataSource<GroupDefinition> {
private ResourceGroupGWTServiceAsync groupService = GWTServiceLookup.getResourceGroupService();
- public GroupDefinitionDataSource() {
+ private static GroupDefinitionDataSource INSTANCE;
+
+ public static GroupDefinitionDataSource getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new GroupDefinitionDataSource();
+ }
+ return INSTANCE;
+ }
+
+ private GroupDefinitionDataSource() {
super();
DataSourceField idDataField = new DataSourceIntegerField("id", "ID");
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
index ce31dd5..d6d78e5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionListView.java
@@ -45,7 +45,7 @@ public class GroupDefinitionListView extends TableSection {
setHeaderIcon(headerIcon);
- setDataSource(new GroupDefinitionDataSource());
+ setDataSource(GroupDefinitionDataSource.getInstance());
}
@Override
commit bd7459d658837d7a5525519def8ec2cb33a990a8
Author: Joseph Marques <joseph(a)redhat.com>
Date: Wed Sep 15 15:53:48 2010 -0400
instead of explicitly going to the master view, go backwards in the history
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
index d96880d..6bafa7b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/SingleGroupDefinitionView.java
@@ -188,8 +188,7 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
@Override
public void onSuccess(GroupDefinition result) {
CoreGUI.getErrorHandler().handleError("Successfully created group definition '" + name + "'");
- String listViewLink = LinkManager.getHubGroupDefinitionsLink();
- CoreGUI.goToView(listViewLink.substring(1));
+ History.back();
}
});
} else {
@@ -203,8 +202,7 @@ public class SingleGroupDefinitionView extends LocatableVLayout implements Bookm
@Override
public void onSuccess(Void result) {
CoreGUI.getErrorHandler().handleError("Successfully saved group definition '" + name + "'");
- String listViewLink = LinkManager.getHubGroupDefinitionsLink();
- CoreGUI.goToView(listViewLink.substring(1));
+ History.back();
}
});
}
13 years, 9 months