modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
| 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 1
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
| 21 +-
modules/core/domain/src/main/java/org/rhq/core/domain/drift/JPADrift.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
| 45 +++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
| 10 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/AlertDefinitionTemplateTypeView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/DriftDefinitionTemplateTypeView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/MetricTemplateTypeView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselMemberView.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
| 14 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplateDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
| 16 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
| 73 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
| 48 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizard.java
| 51 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
| 32 +---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
| 32 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
| 17 +-
23 files changed, 216 insertions(+), 177 deletions(-)
New commits:
commit 1c2862f3392862f2a3e379cb28a80911c8028852
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:52:10 2011 -0400
A post 4.2 TODO for Table
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index 8d6e3a4..2fa8985 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -228,6 +228,8 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
this.flexRowDisplay = flexRowDisplay;
}
+ // TODO: I think this should just be a simple getter. Returning the canvas before
we're initialized is likely
+ // a bad thing. -Jay. Will do after the 4.2 release as it doesn't seem to bite us
at the moment.
/**
* Returns the encompassing canvas that contains all content for this table
component.
* This content includes the list grid, the buttons, etc.
@@ -407,7 +409,6 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
drawFooter();
}
-
if (!autoFetchData && (initialCriteria != null)) {
refresh();
}
@@ -1073,7 +1074,6 @@ public class Table<DS extends RPCDataSource> extends
LocatableHLayout implements
field.setHidden(true);
}
-
// -------------- Inner utility classes ------------- //
/**
commit f86c826a01b08f27ccae0c1b5c7ad174d950a459
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:51:58 2011 -0400
[BZ 749432 - Drift detail view navigation issues]
Provide a temporary solution for navigating to Drift detail from various
places in the drift gui. As it stands the DriftSnapshotView does not
offer support for proper Master-Detail and this is complicated by the
various ways in which the SnapshotView is embedded into the gui, at the
resource and template levels. The basic fallout is that the backButton
for the drift detail page is not going to bring you back to the snapshot
page, but rather that page's parent view.
My plan is to hopefully embed the detail view into the snapshot view (via
expanding rows), making the whole navigation issue moot. But that is post
RHQ 4.2
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 4bc881d..1985cd4 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
@@ -25,6 +25,7 @@ package org.rhq.enterprise.gui.coregui.client;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.enterprise.gui.coregui.client.admin.roles.RolesView;
+import
org.rhq.enterprise.gui.coregui.client.admin.templates.DriftDefinitionTemplateTypeView;
import org.rhq.enterprise.gui.coregui.client.admin.users.UsersView;
import org.rhq.enterprise.gui.coregui.client.components.table.StringIDTableSection;
@@ -395,7 +396,7 @@ public class LinkManager {
}
}
- public static String getAdminTemplatesEditLink(String viewName, String typeId) {
+ public static String getAdminTemplatesEditLink(String viewName, int typeId) {
if (GWT) {
return "#Administration/Configuration/" + viewName + "/"
+ typeId;
} else {
@@ -516,15 +517,51 @@ public class LinkManager {
return "#Resource/" + resourceId + "/Drift/Definitions/" +
driftDefId + "/Edit";
}
- public static String getDriftHistoryLink(int resourceId, int driftDefId, String
driftId) {
+ public static String getDriftCarouselDriftLink(int resourceId, int driftDefId, String
driftId) {
if (!driftId.startsWith(StringIDTableSection.ID_PREFIX)) {
driftId = StringIDTableSection.ID_PREFIX + driftId;
}
- return "#Resource/" + resourceId + "/Drift/Definitions/" +
driftDefId + "/History/" + driftId;
+ return "#Resource/" + resourceId + "/Drift/Definitions/" +
driftDefId + "/Drift/" + driftId;
}
- public static String getDriftSnapshotLink(int resourceId, int driftDefId, int
version) {
+ public static String getDriftCarouselSnapshotLink(int resourceId, int driftDefId, int
version) {
return "#Resource/" + resourceId + "/Drift/Definitions/" +
driftDefId + "/Snapshot/" + version;
}
+ public static String getDriftCarouselSnapshotDriftLink(int resourceId, int
driftDefId, int version, String driftId) {
+ if (!driftId.startsWith(StringIDTableSection.ID_PREFIX)) {
+ driftId = StringIDTableSection.ID_PREFIX + driftId;
+ }
+
+ // TODO: for now, just make this the same as the carousel drift link. The
downside is that the back button
+ // will bring us back to the carousel and not the snapshot view. Eventually would
like another
+ // master-detail relationship here, but it's hairy to get this working.
+ //
+ // return "#Resource/" + resourceId + "/Drift/Definitions/" +
driftDefId + "/Snapshot/" + version + "/" + driftId;
+
+ return getDriftCarouselDriftLink(resourceId, driftDefId, driftId);
+ }
+
+ public static String getDriftTemplateLink(int typeId, int templateId) {
+ String result =
getAdminTemplatesEditLink(DriftDefinitionTemplateTypeView.VIEW_ID.getName(), typeId);
+
+ return result + "/" + templateId;
+ }
+
+ public static String getDriftTemplateSnapshotLink(int typeId, int templateId) {
+ String result = getDriftTemplateLink(typeId, templateId);
+
+ return result + "/Snapshot";
+ }
+
+ public static String getDriftTemplateSnapshotDriftLink(int typeId, int templateId,
String driftId) {
+ String result = getDriftTemplateSnapshotLink(typeId, templateId);
+
+ if (!driftId.startsWith(StringIDTableSection.ID_PREFIX)) {
+ driftId = StringIDTableSection.ID_PREFIX + driftId;
+ }
+
+ return result + "/" + driftId;
+ }
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/AlertDefinitionTemplateTypeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/AlertDefinitionTemplateTypeView.java
index 0c495b5..a4da48b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/AlertDefinitionTemplateTypeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/AlertDefinitionTemplateTypeView.java
@@ -71,7 +71,7 @@ public class AlertDefinitionTemplateTypeView extends
ResourceTypeTreeView {
return LinkManager.getAdminTemplatesLink(VIEW_ID.getName());
}
- return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(), typeId);
+ return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(),
Integer.valueOf(typeId));
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/DriftDefinitionTemplateTypeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/DriftDefinitionTemplateTypeView.java
index 72f11a2..ea18a4e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/DriftDefinitionTemplateTypeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/DriftDefinitionTemplateTypeView.java
@@ -74,7 +74,7 @@ public class DriftDefinitionTemplateTypeView extends
ResourceTypeTreeView {
return LinkManager.getAdminTemplatesLink(VIEW_ID.getName());
}
- return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(), typeId);
+ return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(),
Integer.valueOf(typeId));
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/MetricTemplateTypeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/MetricTemplateTypeView.java
index 6296c42..858bc8d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/MetricTemplateTypeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/MetricTemplateTypeView.java
@@ -69,7 +69,7 @@ public class MetricTemplateTypeView extends ResourceTypeTreeView {
return LinkManager.getAdminTemplatesLink(VIEW_ID.getName());
}
- return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(), typeId);
+ return LinkManager.getAdminTemplatesEditLink(VIEW_ID.getName(),
Integer.valueOf(typeId));
}
@Override
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
index d8371db..7872a0c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ResourceAlertDefinitionsDataSource.java
@@ -94,8 +94,7 @@ public class ResourceAlertDefinitionsDataSource extends
AbstractAlertDefinitions
} else {
if (parentId != null && parentId.intValue() != 0) {
record.setAttribute(FIELD_PARENT, LinkManager.getAdminTemplatesEditLink(
- AlertDefinitionTemplateTypeView.VIEW_ID.getName(),
String.valueOf(this.resource.getResourceType()
- .getId()))
+ AlertDefinitionTemplateTypeView.VIEW_ID.getName(),
this.resource.getResourceType().getId())
+ "/" + parentId);
record.setLinkText(MSG.view_alert_definition_for_type());
} else {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselMemberView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselMemberView.java
index fbf4123..47b5d3d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselMemberView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselMemberView.java
@@ -103,7 +103,7 @@ public class DriftCarouselMemberView extends DriftHistoryView
implements Carouse
Integer resourceId =
record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
Integer driftDefId =
record.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_DEF_ID);
String driftId = getId(record);
- String url = LinkManager.getDriftHistoryLink(resourceId, driftDefId,
driftId);
+ String url = LinkManager.getDriftCarouselDriftLink(resourceId,
driftDefId, driftId);
CoreGUI.goToView(url);
}
}
@@ -149,7 +149,7 @@ public class DriftCarouselMemberView extends DriftHistoryView
implements Carouse
public void updateTitleCanvas(String titleString) {
int resourceId = getContext().getResourceId();
String imageHtml = Canvas.imgHTML(ImageManager.getViewIcon());
- String link = LinkManager.getDriftSnapshotLink(resourceId,
changeSet.getDriftDefinitionId(), changeSet
+ String link = LinkManager.getDriftCarouselSnapshotLink(resourceId,
changeSet.getDriftDefinitionId(), changeSet
.getVersion());
StringBuilder sb = new StringBuilder();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
index 7239ef6..4489472 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftCarouselView.java
@@ -72,7 +72,7 @@ public class DriftCarouselView extends BookmarkableCarousel implements
DetailsVi
private boolean hasWriteAccess;
private Integer maxCarouselEndFilter;
private ArrayList<Record> selectedRecords = new ArrayList<Record>();
- private boolean useHistoryDetailsView;
+ private boolean useDriftDetailsView;
private DriftGWTServiceAsync driftService = GWTServiceLookup.getDriftService();
@@ -397,16 +397,16 @@ public class DriftCarouselView extends BookmarkableCarousel
implements DetailsVi
return true;
}
- // this class is somewhat unusual in that it is a detail view for the drift defs list
view, but also a pseudo-
- // master view for snapshot and drift detail views. It's "pseudo" in
that there is no master-detail infrastructure
+ // this class is somewhat unusual in that it is a detail view for the drift defs list
view, but also a pseudo-master
+ // view for snapshot and drift detail views. It's "pseudo" in that
there is no master-detail infrastructure
// like that found in TableSection. The following paths must be handled (starting at
the ^):
- // #Resource/10001/Drift/Definitions/10001/History/driftId
+ // #Resource/10001/Drift/Definitions/10001/Drift/driftId
// #Resource/10001/Drift/Definitions/10001/Snapshot/version
// ^
@Override
public void renderView(ViewPath viewPath) {
if (!viewPath.isEnd() && !viewPath.isNextEnd()) {
- this.useHistoryDetailsView = !viewPath.isNextEnd() &&
"History".equals(viewPath.getNext().getPath());
+ this.useDriftDetailsView = !viewPath.isNextEnd() &&
"Drift".equals(viewPath.getNext().getPath());
}
super.renderView(viewPath);
@@ -414,8 +414,8 @@ public class DriftCarouselView extends BookmarkableCarousel implements
DetailsVi
@Override
public Canvas getDetailsView(String id) {
- if (this.useHistoryDetailsView) {
- return new DriftDetailsView(extendLocatorId("History"), id);
+ if (this.useDriftDetailsView) {
+ return new DriftDetailsView(extendLocatorId("Drift"), id);
}
return new DriftSnapshotView(extendLocatorId("Snapshot"), null,
context.getResourceId(), driftDefId, Integer
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
index 69335e3..71ffeca 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionDataSource.java
@@ -108,8 +108,8 @@ public class DriftDefinitionDataSource extends
RPCDataSource<DriftDefinitionComp
public void onRecordClick(RecordClickEvent event) {
switch (entityContext.getType()) {
case Resource:
-
CoreGUI.goToView(LinkManager.getDriftSnapshotLink(entityContext.getResourceId(),
event.getRecord()
- .getAttributeAsInt(ATTR_ID), 0));
+
CoreGUI.goToView(LinkManager.getDriftCarouselSnapshotLink(entityContext.getResourceId(),
event
+ .getRecord().getAttributeAsInt(ATTR_ID), 0));
break;
default:
throw new IllegalArgumentException("Entity Type not
supported");
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplateDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplateDataSource.java
index 034a039..ffcbf5e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplateDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplateDataSource.java
@@ -115,7 +115,7 @@ public class DriftDefinitionTemplateDataSource extends
if (event.getRecord().getAttributeAsBoolean(ATTR_IS_PINNED)) {
CoreGUI.goToView(LinkManager.getAdminTemplatesEditLink(DriftDefinitionTemplateTypeView.VIEW_ID
- .getName(), String.valueOf(resourceTypeId))
+ .getName(), resourceTypeId)
+ "/" + event.getRecord().getAttribute(ATTR_ID) +
"/Snapshot");
}
}
@@ -157,7 +157,7 @@ public class DriftDefinitionTemplateDataSource extends
public void onRecordClick(RecordClickEvent event) {
CoreGUI.goToView(LinkManager.getAdminTemplatesEditLink(DriftDefinitionTemplateTypeView.VIEW_ID
- .getName(), String.valueOf(resourceTypeId))
+ .getName(), resourceTypeId)
+ "/" + event.getRecord().getAttribute(ATTR_ID) +
"/Edit");
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
index 0d61047..8b0e4d5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
@@ -54,6 +54,7 @@ public class DriftDefinitionTemplatesView extends
TableSection<DriftDefinitionTe
private boolean hasWriteAccess;
private DriftDefinitionTemplateDataSource dataSource;
private boolean useSnapshotDetailsView;
+ private String snapshotDriftDetailsId;
static {
DriftCategory[] categoryValues = DriftCategory.values();
@@ -147,10 +148,7 @@ public class DriftDefinitionTemplatesView extends
TableSection<DriftDefinitionTe
}
private void add() {
-
- DriftAddDefinitionWizard wizard = new
DriftAddDefinitionWizard(EntityContext.forSubsystemView(), this.type,
- this);
- wizard.startWizard();
+ DriftAddDefinitionWizard.showWizard(EntityContext.forTemplate(type.getId()),
this);
// we can refresh the table buttons immediately since the wizard is a dialog,
the
// user can't access enabled buttons anyway.
@@ -192,6 +190,11 @@ public class DriftDefinitionTemplatesView extends
TableSection<DriftDefinitionTe
// one we're dealing with. The default is the editor.
if (!viewPath.isEnd()) {
this.useSnapshotDetailsView = !viewPath.isNextEnd() &&
"Snapshot".equals(viewPath.getNext().getPath());
+ snapshotDriftDetailsId = null;
+ if (viewPath.viewsLeft() > 1) {
+ snapshotDriftDetailsId =
viewPath.getViewForIndex(viewPath.getCurrentIndex() + 2).getPath().substring(
+ "0id_".length());
+ }
}
super.renderView(viewPath);
@@ -200,7 +203,10 @@ public class DriftDefinitionTemplatesView extends
TableSection<DriftDefinitionTe
@Override
public Canvas getDetailsView(Integer driftTemplateId) {
if (this.useSnapshotDetailsView) {
- return new
DriftDefinitionTemplateSnapshotView(extendLocatorId("TemplateSnapshot"),
driftTemplateId);
+ if (null == snapshotDriftDetailsId) {
+ return new
DriftDefinitionTemplateSnapshotView(extendLocatorId("TemplateSnapshot"),
driftTemplateId);
+ }
+ return new
DriftDetailsView(extendLocatorId("TemplateSnapshotDrift"),
snapshotDriftDetailsId);
}
return new
DriftDefinitionTemplateEditView(extendLocatorId("TemplateEdit"),
driftTemplateId, hasWriteAccess);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
index f95cf77..801b258 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftHistoryView.java
@@ -158,7 +158,7 @@ public class DriftHistoryView extends
StringIDTableSection<DriftDataSource> {
Integer resourceId = record.getAttributeAsInt(AncestryUtil.RESOURCE_ID);
Integer driftDefId =
record.getAttributeAsInt(DriftDataSource.ATTR_CHANGESET_DEF_ID);
String driftId = getId(record);
- String url = LinkManager.getDriftHistoryLink(resourceId, driftDefId,
driftId);
+ String url = LinkManager.getDriftCarouselDriftLink(resourceId,
driftDefId, driftId);
String formattedValue = TimestampCellFormatter.format(value);
return SeleniumUtility.getLocatableHref(url, formattedValue, null);
}
@@ -166,77 +166,8 @@ public class DriftHistoryView extends
StringIDTableSection<DriftDataSource> {
}
protected void setupTableInteractions(final boolean hasWriteAccess) {
-
- /*
- * TODO add ack
- *
- TableActionEnablement singleTargetEnablement = hasWriteAccess ?
TableActionEnablement.ANY
- : TableActionEnablement.NEVER;
-
- addTableAction("AcknowledgeDrift", MSG.common_button_ack(),
MSG.view_drift_ack_confirm(),
- new AbstractTableAction(singleTargetEnablement) {
- public void executeAction(ListGridRecord[] selection, Object actionValue)
{
- acknowledge(selection);
- }
- });
-
- addTableAction("AcknowledgeAll", MSG.common_button_ack_all(),
MSG.view_drift_ack_confirm_all(),
- new TableAction() {
- public boolean isEnabled(ListGridRecord[] selection) {
- ListGrid grid = getListGrid();
- ResultSet resultSet = (null != grid) ? grid.getResultSet() : null;
- return (hasWriteAccess && grid != null && resultSet
!= null && !resultSet.isEmpty());
- }
-
- public void executeAction(ListGridRecord[] selection, Object actionValue)
{
- acknowledgeAll();
- }
- });
- *
- *
- */
- }
-
- /*
- * TODO add ack
- *
- private void acknowledge(ListGridRecord[] records) {
- final int[] alertIds = new int[records.length];
- for (int i = 0, selectionLength = records.length; i < selectionLength; i++) {
- ListGridRecord record = records[i];
- Integer alertId = record.getAttributeAsInt(DriftDataSource.ATTR_ID);
- alertIds[i] = alertId;
- }
-
- GWTServiceLookup.getDriftService().acknowledgeDrifts(alertIds, new
AsyncCallback<Integer>() {
- public void onSuccess(Integer resultCount) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_drift_ack_success(String.valueOf(resultCount)),
Message.Severity.Info));
- refresh();
- }
-
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.view_drift_ack_failure(Arrays.toString(alertIds)),
caught);
- }
- });
- }
-
- private void acknowledgeAll() {
- GWTServiceLookup.getDriftService().acknowledgeDriftsByContext(context, new
AsyncCallback<Integer>() {
- public void onSuccess(Integer resultCount) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_drift_ack_success(String.valueOf(resultCount)),
Message.Severity.Info));
- refresh();
- }
-
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_drift_ack_failure_all(),
caught);
- }
- });
+ // currently no buttons, etc
}
- *
- *
- */
@Override
public Canvas getDetailsView(String driftId) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
index 570f6f0..e0996eb 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftSnapshotView.java
@@ -32,6 +32,8 @@ import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.ExpansionMode;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.DoubleClickEvent;
+import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.HoverCustomizer;
import com.smartgwt.client.widgets.grid.ListGrid;
@@ -70,8 +72,9 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
*
* @author Jay Shaughnessy
*/
+// TODO: Make this extend an abstract table so we can set up true master-detail
+//public class DriftSnapshotView extends
StringIDTableSection<DriftSnapshotDataSource> {
public class DriftSnapshotView extends Table<DriftSnapshotDataSource> {
-
private static final String DEFAULT_TITLE = MSG.view_drift_table_snapshot();
private Integer templateId;
@@ -81,6 +84,7 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
private boolean hasWriteAccess;
private String templateChangeSetId;
+ private int templateResourceTypeId;
protected DriftSnapshotDataSource dataSource;
protected DriftSnapshotListGrid listGrid;
@@ -159,6 +163,7 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
} else {
DriftDefinitionTemplateCriteria templateCriteria = new
DriftDefinitionTemplateCriteria();
templateCriteria.addFilterId(templateId);
+ templateCriteria.fetchResourceType(true);
DriftGWTServiceAsync driftService = GWTServiceLookup.getDriftService();
driftService.findDriftDefinitionTemplatesByCriteria(templateCriteria,
@@ -172,6 +177,7 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
String templateName = template.getName();
String title =
MSG.view_drift_table_title_templateSnapshot(templateName);
setTitleString(title);
+ templateResourceTypeId = template.getResourceType().getId();
DriftSnapshotView.super.onDraw();
}
});
@@ -288,6 +294,23 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
getListGrid().setFields(dataSourceFields.toArray(new
ListGridField[dataSourceFields.size()]));
super.configureTable();
+
+ // TODO: when we have true detail support then we'll want to remove this.
+ setListGridDoubleClickHandler(new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(DoubleClickEvent event) {
+ ListGrid listGrid = (ListGrid) event.getSource();
+ ListGridRecord[] selectedRows = listGrid.getSelection();
+ if (selectedRows != null && selectedRows.length == 1) {
+ String driftId = getId(selectedRows[0]);
+ String link = (null == templateId) ?
LinkManager.getDriftCarouselSnapshotDriftLink(resourceId,
+ driftDefId, version, driftId) :
LinkManager.getDriftTemplateSnapshotDriftLink(
+ templateResourceTypeId, templateId, driftId);
+ CoreGUI.goToView(link);
+
+ }
+ }
+ });
}
@Override
@@ -302,9 +325,12 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
return new CellFormatter() {
public String format(Object value, ListGridRecord record, int i, int
i1) {
String driftId = getId(record);
- String url = LinkManager.getDriftHistoryLink(resourceId,
driftDefId, driftId);
+ String link = (null == templateId) ?
LinkManager.getDriftCarouselSnapshotDriftLink(resourceId,
+ driftDefId, version, driftId) :
LinkManager.getDriftTemplateSnapshotDriftLink(
+ templateResourceTypeId, templateId, driftId);
+
String formattedValue = TimestampCellFormatter.format(value);
- return SeleniumUtility.getLocatableHref(url, formattedValue,
null);
+ return SeleniumUtility.getLocatableHref(link, formattedValue,
null);
}
};
} else {
@@ -488,4 +514,20 @@ public class DriftSnapshotView extends
Table<DriftSnapshotDataSource> {
return (i < 0) ? path.trim() : path.substring(++i).trim();
}
+ // TODO: Make this extend an abstract table so we can set up true master-detail
+
+ /*
+ @Override
+ public void renderView(ViewPath viewPath) {
+ viewPath.next();
+ super.renderView(viewPath);
+ }
+
+
+ @Override
+ public Canvas getDetailsView(String driftId) {
+ return new DriftDetailsView(extendLocatorId("Details"), driftId);
+ }
+ */
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
index c9c3a2f..5521ef5 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/AlertDefinitionReportView.java
@@ -175,7 +175,7 @@ public class AlertDefinitionReportView extends
Table<AlertDefinitionReportView.D
} else {
int typeId =
result.get(0).getResourceType().getId();
CoreGUI.goToView(LinkManager.getAdminTemplatesEditLink(
-
AlertDefinitionTemplateTypeView.VIEW_ID.getName(), String.valueOf(typeId))
+
AlertDefinitionTemplateTypeView.VIEW_ID.getName(), typeId)
+ "/" + templateId);
}
}
commit 0ff9441b2962ccb0fc0aca0d718ffe2e4983d13e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:41:13 2011 -0400
Coregui: add ability to get the current viewpath index. Without this
viewsLeft() and getViewForIndex() are not very useful.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
index 47b1f91..e448610 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
@@ -53,7 +53,7 @@ public class ViewPath {
public String getParentViewPath() {
return getPathToIndex(this.index - 1);
}
-
+
public ViewPath next() {
index++;
return this;
@@ -75,6 +75,10 @@ public class ViewPath {
}
}
+ public int getCurrentIndex() {
+ return index;
+ }
+
public String getPathToCurrent() {
return getPathToIndex(this.index);
}
@@ -102,13 +106,12 @@ public class ViewPath {
return !(isEnd() || providedViewId == null ||
!getCurrent().equals(providedViewId));
}
-
public boolean isNext(ViewId providedViewId) {
return ((index + 1) < viewPath.size() && providedViewId != null
&& getNext().equals(providedViewId));
}
public boolean isNextEnd() {
- return viewPath.size() <= index+1;
+ return viewPath.size() <= index + 1;
}
public int viewsLeft() {
@@ -135,4 +138,3 @@ public class ViewPath {
return path;
}
}
-
commit c5574b13b03dfa82f38b0aa1a579149416507e3e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:39:54 2011 -0400
Fix subtle caching issues suffered by the drift template wizards because
of the way we were gathering a type's drift def templates. Now always
gather this through the typerepository mechanism, which has been updated
to handle things correctly.
- also, fix the message supplied for a successful template pinning
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizard.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizard.java
index ee9016a..cb59f03 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizard.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftAddDefinitionWizard.java
@@ -19,12 +19,12 @@
package org.rhq.enterprise.gui.coregui.client.drift.wizard;
import java.util.ArrayList;
+import java.util.EnumSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.drift.DriftDefinitionTemplate;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
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.util.message.Message;
/**
@@ -42,7 +43,7 @@ public class DriftAddDefinitionWizard extends
AbstractDriftAddDefinitionWizard {
private Table<?> table;
- public DriftAddDefinitionWizard(EntityContext context, ResourceType type,
Table<?> table) {
+ protected DriftAddDefinitionWizard(EntityContext context, ResourceType type,
Table<?> table) {
super(context, type);
this.table = table;
@@ -110,7 +111,7 @@ public class DriftAddDefinitionWizard extends
AbstractDriftAddDefinitionWizard {
break;
- case SubsystemView:
+ case ResourceTemplate:
GWTServiceLookup.getDriftService().createTemplate(getType().getId(),
getNewDriftDefinition(),
new AsyncCallback<DriftDefinitionTemplate>() {
public void onSuccess(DriftDefinitionTemplate result) {
@@ -150,30 +151,8 @@ public class DriftAddDefinitionWizard extends
AbstractDriftAddDefinitionWizard {
throw new IllegalArgumentException("Entity not found ["
+ context + "]");
}
- final Resource resource = result.get(0);
-
- // bypass type cache because this is infrequent and we don't need
to cache the
- // drift def templates
- ResourceTypeCriteria rtc = new ResourceTypeCriteria();
- rtc.addFilterId(resource.getResourceType().getId());
- rtc.fetchDriftDefinitionTemplates(true);
-
GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(rtc,
- new AsyncCallback<PageList<ResourceType>>() {
- public void onSuccess(PageList<ResourceType> result) {
- if (result.isEmpty()) {
- throw new IllegalArgumentException("Resource
Type not found ["
- + resource.getResourceType().getId() +
"]");
- }
-
- DriftAddDefinitionWizard wizard = new
DriftAddDefinitionWizard(context, result.get(0),
- table);
- wizard.startWizard();
- }
-
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.widget_typeTree_loadFail(), caught);
- }
- });
+ Resource resource = result.get(0);
+ showWizard(context, resource.getResourceType().getId(), table);
}
public void onFailure(Throwable caught) {
@@ -183,11 +162,29 @@ public class DriftAddDefinitionWizard extends
AbstractDriftAddDefinitionWizard {
break;
+ case ResourceTemplate:
+ showWizard(context, context.getResourceTypeId(), table);
+
+ break;
+
default:
throw new IllegalArgumentException("Entity Context Type not supported
[" + context + "]");
}
}
+ private static void showWizard(final EntityContext context, int resourceTypeId, final
Table<?> table) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceTypeId,
+ EnumSet.of(ResourceTypeRepository.MetadataType.driftDefinitionTemplates),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
+ DriftAddDefinitionWizard wizard = new
DriftAddDefinitionWizard(context, type, table);
+ wizard.startWizard();
+ }
+ });
+ }
+
@Override
public void cancel() {
super.cancel();
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
index 77fd037..2a24e9b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/wizard/DriftPinTemplateWizard.java
@@ -19,11 +19,11 @@
package org.rhq.enterprise.gui.coregui.client.drift.wizard;
import java.util.ArrayList;
+import java.util.EnumSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.criteria.DriftDefinitionCriteria;
-import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.drift.DriftDefinition;
import org.rhq.core.domain.drift.DriftDefinitionTemplate;
import org.rhq.core.domain.resource.Resource;
@@ -33,6 +33,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.wizard.WizardStep;
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.util.message.Message;
/**
@@ -104,15 +105,15 @@ public class DriftPinTemplateWizard extends
AbstractDriftPinTemplateWizard {
public void onSuccess(Void result) {
CoreGUI.getMessageCenter().notify(
- new
Message(MSG.view_drift_wizard_addTemplate_success(template.getName()),
+ new
Message(MSG.view_drift_wizard_pinTemplate_success(template.getName()),
Message.Severity.Info));
getView().closeDialog();
DriftPinTemplateWizard.this.table.refresh();
}
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(
- MSG.view_drift_wizard_addDef_failure(template.getName()),
caught);
+
CoreGUI.getErrorHandler().handleError(MSG.view_drift_wizard_addDef_failure(template.getName()),
+ caught);
getView().closeDialog();
}
});
@@ -146,25 +147,12 @@ public class DriftPinTemplateWizard extends
AbstractDriftPinTemplateWizard {
final DriftDefinition driftDef = result.get(0);
final Resource resource = driftDef.getResource();
- // bypass type cache because this is infrequent and we don't need
to cache the
- // drift def templates
- ResourceTypeCriteria rtc = new ResourceTypeCriteria();
- rtc.addFilterId(resource.getResourceType().getId());
- rtc.fetchDriftDefinitionTemplates(true);
-
GWTServiceLookup.getResourceTypeGWTService().findResourceTypesByCriteria(rtc,
- new AsyncCallback<PageList<ResourceType>>() {
-
- public void onFailure(Throwable caught) {
-
CoreGUI.getErrorHandler().handleError(MSG.widget_typeTree_loadFail(), caught);
- }
-
- public void onSuccess(PageList<ResourceType> result) {
- if (result.isEmpty()) {
- throw new IllegalArgumentException("Resource
Type not found ["
- + resource.getResourceType().getId() +
"]");
- }
+
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
+
EnumSet.of(ResourceTypeRepository.MetadataType.driftDefinitionTemplates),
+ new ResourceTypeRepository.TypeLoadedCallback() {
- DriftPinTemplateWizard wizard = new
DriftPinTemplateWizard(result.get(0), driftDef,
+ public void onTypesLoaded(ResourceType type) {
+ DriftPinTemplateWizard wizard = new
DriftPinTemplateWizard(type, driftDef,
snapshotVersion, table);
wizard.startWizard();
}
commit 1cc7902d28a21522f6f6be97351b57576374db51
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:31:21 2011 -0400
Coregui: Add the ability for the ResourceType cache to provide non-cached
data. This means for non-cached metadata types we'll always call to the db.
This is basically a convenience such that we can make a single call through
this mechanism to gather all the needed data for a type. Whether it
merges cached and uncached data remains a black box to the caller.
- set driftDefinitionTemplates as non-cached metadata because the drift
templates available on a type can change as user-defined templates come
and go.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 6a38d89..2b3dbb1 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -57,8 +57,29 @@ public class ResourceTypeRepository {
private static ResourceTypeGWTServiceAsync resourceTypeService =
GWTServiceLookup.getResourceTypeGWTService();
+ /**
+ * The following MetadadaTypes are not cached and will always be queried from the
database:<br/>
+ * driftDefinitionTemplates
+ *
+ * @author Jay Shaughnessy
+ */
public enum MetadataType {
- children, operations, measurements, content, events,
pluginConfigurationDefinition, resourceConfigurationDefinition, subCategory, parentTypes,
processScans, productVersions, driftDefinitionTemplates
+ children, operations, measurements, content, events,
pluginConfigurationDefinition, resourceConfigurationDefinition, subCategory, parentTypes,
processScans, productVersions, driftDefinitionTemplates(
+ false);
+
+ private boolean isCachedMetadata;
+
+ private MetadataType() {
+ this.isCachedMetadata = true;
+ }
+
+ private MetadataType(boolean isCachedMetadata) {
+ this.isCachedMetadata = isCachedMetadata;
+ }
+
+ public boolean isCachedMetadata() {
+ return isCachedMetadata;
+ }
}
public static class Cache {
@@ -248,8 +269,7 @@ public class ResourceTypeRepository {
criteria.fetchDriftDefinitionTemplates(true);
break;
default:
- Log.error("Metadata type [" + metadataType.name()
- + "] not incorporated into ResourceType criteria.");
+ Log.error("Metadata type [" + metadataType.name() + "] not
incorporated into ResourceType criteria.");
}
}
@@ -375,7 +395,11 @@ public class ResourceTypeRepository {
if (typeCacheLevel.containsKey(type.getId())) {
typeCacheLevel.get(type.getId()).addAll(metadataTypes);
} else {
- typeCacheLevel.put(type.getId(),
EnumSet.copyOf(metadataTypes));
+ for (MetadataType metadataType : metadataTypes) {
+ if (metadataType.isCachedMetadata) {
+ typeCacheLevel.put(type.getId(),
EnumSet.copyOf(metadataTypes));
+ }
+ }
}
}
}
commit 8024dda4197413cbec3e2041fce49873a8e303f3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:26:54 2011 -0400
Add optional fetch for DriftDefinitionTemplate.resourceType
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
index ce1c017..d4ff131 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
@@ -29,6 +29,7 @@ public class DriftDefinitionTemplateCriteria extends Criteria {
private String filterName;
private Integer filterResourceTypeId;
+ private boolean fetchResourceType;
private boolean fetchDriftDefinitions;
public DriftDefinitionTemplateCriteria() {
@@ -40,19 +41,23 @@ public class DriftDefinitionTemplateCriteria extends Criteria {
return DriftDefinitionTemplate.class;
}
- public void addFilterId(Integer id) {
- filterId = id;
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
}
- public void addFilterName(String name) {
- filterName = name;
+ public void addFilterName(String filterName) {
+ this.filterName = filterName;
}
- public void addFilterResourceTypeId(Integer resourceTypeId) {
- filterResourceTypeId = resourceTypeId;
+ public void addFilterResourceTypeId(Integer filterResourceTypeId) {
+ this.filterResourceTypeId = filterResourceTypeId;
}
- public void fetchDriftDefinitions(boolean fetchDefinitions) {
- fetchDriftDefinitions = fetchDefinitions;
+ public void fetchResourceType(boolean fetchResourceType) {
+ this.fetchResourceType = fetchResourceType;
+ }
+
+ public void fetchDriftDefinitions(boolean fetchDriftDefinitions) {
+ this.fetchDriftDefinitions = fetchDriftDefinitions;
}
}
commit 01811717506e1d7b61c74f1dd5c64f7b9df44dc7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Oct 27 11:25:27 2011 -0400
Drift - Make JPADrift.changeSet not null. This field should never be
null so define it that way. For a while nulls were allowed but that is
no longer the case as every drift should refer to either a pinned template's
change set or a drift definition's change set.
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
index 76613d2..d6975d5 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -728,7 +728,7 @@
<column name="CTIME" type="LONG"
required="true"/>
<column name="CATEGORY" type="VARCHAR2"
size="20" required="true"/>
<column name="DRIFT_SET_ID" type="INTEGER"
required="false" references="RHQ_DRIFT_SET"/>
- <column name="DRIFT_CHANGE_SET_ID" type="INTEGER"
required="false" references="RHQ_DRIFT_CHANGE_SET"/>
+ <column name="DRIFT_CHANGE_SET_ID" type="INTEGER"
required="true" references="RHQ_DRIFT_CHANGE_SET"/>
<!-- the file path not including the base directory -->
<column name="PATH" type="VARCHAR2" size="1024"
required="true"/>
<!-- the same as PATH less [/]filename.ext. Redundant storage for the purpose
of strict directory search.
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index bd040c6..9221532 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3617,6 +3617,7 @@
<schema-addColumn table="RHQ_DRIFT"
column="PATH_DIRECTORY" columnType="VARCHAR2"
precision="1024" />
<schema-alterColumn table="RHQ_DRIFT"
column="PATH_DIRECTORY" nullable="FALSE" />
<schema-addColumn table="RHQ_DRIFT"
column="DRIFT_CHANGE_SET_ID" columnType="INTEGER" />
+ <schema-alterColumn table="RHQ_DRIFT"
column="DRIFT_CHANGE_SET_ID" nullable="FALSE" />
<schema-addColumn table="RHQ_DRIFT"
column="DRIFT_SET_ID" columnType="INTEGER"/>
<schema-directSQL>
<statement desc="Creating RHQ_DRIFT foreign key relation to
RHQ_DRIFT_CHANGE_SET">
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/JPADrift.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/JPADrift.java
index acfc55d..049dc6f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/drift/JPADrift.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/drift/JPADrift.java
@@ -84,8 +84,8 @@ public class JPADrift implements Serializable,
Drift<JPADriftChangeSet, JPADrift
@Enumerated(EnumType.STRING)
private String directory;
- @JoinColumn(name = "DRIFT_CHANGE_SET_ID", referencedColumnName =
"ID", nullable = true)
- @ManyToOne(fetch = FetchType.LAZY, optional = true)
+ @JoinColumn(name = "DRIFT_CHANGE_SET_ID", referencedColumnName =
"ID", nullable = false)
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
private JPADriftChangeSet changeSet;
@JoinColumn(name = "OLD_DRIFT_FILE", referencedColumnName =
"HASH_ID", nullable = true)
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 8c7b506..882d22e 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -233,11 +233,14 @@ public class JPADriftServerBean implements JPADriftServerLocal {
for (Drift<?, ?> drift : changeSet.getDrifts()) {
JPADrift jpaDrift = new JPADrift(jpaChangeSet, drift.getPath(),
drift.getCategory(), toJPADriftFile(drift
.getOldDriftFile()), toJPADriftFile(drift.getNewDriftFile()));
+
driftSet.addDrift(jpaDrift);
}
+ entityManager.persist(jpaChangeSet);
+
entityManager.persist(driftSet);
+
jpaChangeSet.setInitialDriftSet(driftSet);
- entityManager.persist(jpaChangeSet);
return jpaChangeSet.getId();
}
@@ -322,9 +325,9 @@ public class JPADriftServerBean implements JPADriftServerLocal {
+ "]. Change set cannot be saved.");
return false;
}
- // Commenting out the following line for now. We want to set the
- // version to the value specified in the headers, but we also
- // want to get the latest version we have in the database so
that
+ // TODO: Commenting out the following line for now. We want to
set the
+ // version to the value specified in the headers, but we may want
to also
+ // validate it against the latest version we have in the database
so that
// we can make sure that the agent is in sync with the server.
//
//int version = getChangeSetVersion(resource, config);
@@ -370,7 +373,11 @@ public class JPADriftServerBean implements JPADriftServerLocal {
for (FileEntry entry : reader) {
JPADriftFile newDriftFile =
getDriftFile(entry.getNewSHA(), emptyDriftFiles);
String path = FileUtil.useForwardSlash(entry.getFile());
- driftSet.addDrift(new JPADrift(null, path,
entry.getType(), null, newDriftFile));
+ // A Drift always has a changeSet. Note that in this code
section the changeset is
+ // always going to be set to a DriftDefinition's
changeSet. But that is not always the
+ // case, it could also be set to a
DriftDefinitionTemplate's changeSet.
+ driftSet.addDrift(new JPADrift(driftChangeSet, path,
entry.getType(), null,
+ newDriftFile));
}
entityManager.persist(driftSet);
driftChangeSet.setInitialDriftSet(driftSet);