modules/core/dbutils/pom.xml
| 2
modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
| 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 6 +
modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackage.java
| 2
modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
| 37 ++++++++++
modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageListItemComposite.java
| 25 ++++++
6 files changed, 72 insertions(+), 2 deletions(-)
New commits:
commit 0cff8a728b7aa64f718bae546ac1d30dcb2939b6
Author: Sayli Karmarkar <skarmark(a)redhat.com>
Date: Mon Feb 1 02:41:43 2010 -0500
1753 - DB changes, domain model changes and query updates to introduce release and
epoch into RHQ Package model along with version
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 1053bb4..28d6925 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -22,7 +22,7 @@
<properties>
<scm.module.path>modules/core/dbutils/</scm.module.path>
- <db.schema.version>2.77.2</db.schema.version>
+ <db.schema.version>2.78</db.schema.version>
</properties>
<dependencies>
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 d1ae3ad..83a2e6c 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/content-schema.xml
@@ -147,6 +147,8 @@
<column name="SHORT_DESCRIPTION" size="10000"
type="CLOB" required="false"/>
<column name="LONG_DESCRIPTION" size="50000"
type="CLOB" required="false"/>
<column name="VERSION" size="500"
type="VARCHAR2" required="true"/>
+ <column name="RELEASE" size="255" type="VARCHAR2"
required="false"/>
+ <column name="EPOCH" size="255" type="VARCHAR2"
required="false"/>
<column name="DISPLAY_VERSION" size="500"
type="VARCHAR2" required="false"/>
<column name="FILE_NAME" size="255"
type="VARCHAR2" required="false"/>
<column name="FILE_SIZE" type="LONG"
required="false"/>
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 dd16274..5f37657 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -3014,6 +3014,12 @@
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION"
column="snmp_oid"/>
<schema-deleteColumn table="RHQ_ALERT_NOTIFICATION"
column="email_address"/>
</schemaSpec>
+ <schemaSpec version="2.78">
+ <schema-addColumn table="RHQ_PACKAGE_VERSION"
column="RELEASE" columnType="VARCHAR2" precision="255"/>
+ <schema-alterColumn table="RHQ_PACKAGE_VERSION"
column="RELEASE" nullable="TRUE" />
+ <schema-addColumn table="RHQ_PACKAGE_VERSION"
column="EPOCH" columnType="VARCHAR2" precision="255"/>
+ <schema-alterColumn table="RHQ_PACKAGE_VERSION"
column="EPOCH" nullable="TRUE" />
+ </schemaSpec>
</dbupgrade>
</target>
</project>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackage.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackage.java
index 5889e09..59bdb13 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackage.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/InstalledPackage.java
@@ -53,7 +53,7 @@ import org.rhq.core.domain.resource.Resource;
@NamedQuery(name = InstalledPackage.QUERY_FIND_BY_RESOURCE_ID_AND_PKG_VER_ID, query =
"SELECT ip FROM InstalledPackage AS ip WHERE ip.resource.id = :resourceId AND
ip.packageVersion.id = :packageVersionId"),
@NamedQuery(name = InstalledPackage.QUERY_FIND_BY_RESOURCE_AND_PACKAGE, query =
"SELECT ip FROM InstalledPackage AS ip WHERE ip.resource.id = :resourceId AND
ip.packageVersion.generalPackage.id = :packageId "),
@NamedQuery(name = InstalledPackage.QUERY_FIND_BY_RESOURCE_AND_PACKAGE_VER, query =
"SELECT ip FROM InstalledPackage AS ip WHERE ip.resource.id = :resourceId AND
ip.packageVersion.id = :packageVersionId "),
- @NamedQuery(name = InstalledPackage.QUERY_FIND_PACKAGE_LIST_ITEM_COMPOSITE, query =
"SELECT new org.rhq.core.domain.content.composite.PackageListItemComposite(ip.id,
gp.name, pt.displayName, ip.packageVersion.version, ip.installationDate ) "
+ @NamedQuery(name = InstalledPackage.QUERY_FIND_PACKAGE_LIST_ITEM_COMPOSITE, query =
"SELECT new org.rhq.core.domain.content.composite.PackageListItemComposite(ip.id,
gp.name, pt.displayName, ip.packageVersion.version, ip.packageVersion.release,
ip.packageVersion.epoch, ip.installationDate ) "
+ " FROM InstalledPackage ip JOIN ip.resource res LEFT JOIN
ip.packageVersion pv LEFT JOIN pv.generalPackage gp LEFT JOIN gp.packageType pt "
+ "WHERE res.id = :resourceId "
+ " AND (:packageTypeFilterId = pt.id OR :packageTypeFilterId is null)
"
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
index 69ad4eb..b4d2cfc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/content/PackageVersion.java
@@ -284,6 +284,12 @@ public class PackageVersion implements Serializable {
@Column(name = "VERSION", nullable = false)
private String version;
+
+ @Column(name = "RELEASE", nullable = true)
+ private String release;
+
+ @Column(name = "EPOCH", nullable = true)
+ private String epoch;
@Column(name = "DISPLAY_VERSION", nullable = true)
private String displayVersion;
@@ -417,7 +423,26 @@ public class PackageVersion implements Serializable {
public void setVersion(String version) {
this.version = version;
}
+
+
+ public String getRelease() {
+ return release;
+ }
+
+ public void setRelease(String release) {
+ this.release = release;
+ }
+ public String getEpoch() {
+ return epoch;
+ }
+
+ public void setEpoch(String epoch) {
+ this.epoch = epoch;
+ }
+
+
+
/**
* A version string suitable for displaying to a user. It may or may not be the same
as {#getVersion()}.
*/
@@ -736,6 +761,8 @@ public class PackageVersion implements Serializable {
toString.append("PackageVersion[");
toString.append("package=").append(generalPackage).append(",");
toString.append("version=").append(version).append(",");
+ toString.append("release=").append(release).append(",");
+ toString.append("epoch=").append(epoch).append(",");
toString.append("architecture=").append(architecture);
toString.append("]");
@@ -769,7 +796,15 @@ public class PackageVersion implements Serializable {
if ((version != null) ? (!version.equals(that.version)) : (that.version != null))
{
return false;
}
+
+ if ((release != null) ? (!release.equals(that.release)) : (that.release != null))
{
+ return false;
+ }
+ if ((epoch != null) ? (!epoch.equals(that.epoch)) : (that.epoch != null)) {
+ return false;
+ }
+
return true;
}
@@ -778,6 +813,8 @@ public class PackageVersion implements Serializable {
int result;
result = ((generalPackage != null) ? generalPackage.hashCode() : 0);
result = (31 * result) + ((version != null) ? version.hashCode() : 0);
+ result = (31 * result) + ((release != null) ? release.hashCode() : 0);
+ result = (31 * result) + ((epoch != null) ? epoch.hashCode() : 0);
result = (31 * result) + ((architecture != null) ? architecture.hashCode() : 0);
return result;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageListItemComposite.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageListItemComposite.java
index 95a193e..5dbef5c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageListItemComposite.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/content/composite/PackageListItemComposite.java
@@ -36,6 +36,8 @@ public class PackageListItemComposite implements Serializable {
private final String packageName;
private final String packageTypeName;
private final String version;
+ private final String release;
+ private final String epoch;
private final Long timestamp;
// Constructors --------------------------------------------
@@ -46,6 +48,8 @@ public class PackageListItemComposite implements Serializable {
this.packageTypeName = packageTypeName;
this.version = version;
this.timestamp = null;
+ this.release = null;
+ this.epoch = null;
}
public PackageListItemComposite(int id, String packageName, String packageTypeName,
String version, Long timestamp) {
@@ -54,6 +58,19 @@ public class PackageListItemComposite implements Serializable {
this.packageTypeName = packageTypeName;
this.version = version;
this.timestamp = timestamp;
+ this.release = null;
+ this.epoch = null;
+ }
+
+ public PackageListItemComposite(int id, String packageName, String packageTypeName,
String version, String release,
+ String epoch, Long timestamp) {
+ this.id = id;
+ this.packageName = packageName;
+ this.packageTypeName = packageTypeName;
+ this.version = version;
+ this.release = release;
+ this.epoch = epoch;
+ this.timestamp = timestamp;
}
// Public --------------------------------------------
@@ -73,6 +90,14 @@ public class PackageListItemComposite implements Serializable {
public String getVersion() {
return version;
}
+
+ public String getRelease() {
+ return release;
+ }
+
+ public String getEpoch() {
+ return epoch;
+ }
public Long getTimestamp() {
return timestamp;