Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 703675 Details for
Bug 826995
Problem when an old bundle version is deleted
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
CLI script to tell you what UPDATE SQL to execute to fix
BZ826995.js (text/plain), 2.26 KB, created by
John Mazzitelli
on 2013-02-27 21:48:57 UTC
(
hide
)
Description:
CLI script to tell you what UPDATE SQL to execute to fix
Filename:
MIME Type:
Creator:
John Mazzitelli
Created:
2013-02-27 21:48:57 UTC
Size:
2.26 KB
patch
obsolete
>function getAllBundles() { > var bundleCriteria = new BundleCriteria(); > bundleCriteria.clearPaging(); > var types = BundleManager.findBundlesByCriteria(bundleCriteria); > > if (types.size() == 0) { > println("No bundles to process."); > return null; > } > > return types; >} > >function getAllBundleVersions(bid) { > var bundleVersionCriteria = new BundleVersionCriteria(); > bundleVersionCriteria.addFilterBundleId(bid); > bundleVersionCriteria.clearPaging(); > var bvs = BundleManager.findBundleVersionsByCriteria(bundleVersionCriteria); > > if (bvs.size() == 0) { > return null; > } > > return bvs; >} > >var bundles = getAllBundles(); >if (bundles != null) { > var updateSql = new java.util.ArrayList(); > > var iter1 = bundles.iterator(); > while (iter1.hasNext()) { > var bundle = iter1.next(); > println("______"); > println("Bundle: " + bundle.getName() + " (" + bundle.getId() + ")"); > var bundleVersions = getAllBundleVersions(bundle.getId()); > if (bundleVersions != null) { > var ordered = new java.util.TreeMap(); > var iter2 = bundleVersions.iterator(); > while (iter2.hasNext()) { > var bundleVersion = iter2.next(); > var comparableVersion = new org.apache.maven.artifact.versioning.ComparableVersion(bundleVersion.getVersion()); > ordered.put(comparableVersion, bundleVersion); > } > > var expectedNext = 0; > var iter3 = ordered.values().iterator(); > while (iter3.hasNext()) { > var orderedBundleVersion = iter3.next(); > println("Bundle Version: " + orderedBundleVersion.getVersion() + " [" + orderedBundleVersion.getVersionOrder() + "] (" + orderedBundleVersion.getId() + ")"); > if (orderedBundleVersion.getVersionOrder() != expectedNext) { > var sql = "UPDATE RHQ_BUNDLE_VERSION SET VERSION_ORDER=" + expectedNext + " WHERE ID=" + orderedBundleVersion.getId(); > updateSql.add(sql); > println(sql); > } > expectedNext++; > } > } > } > > println(""); > println("========"); > println("Execute these SQL UPDATE statements:"); > println("========"); > println(""); > > var iter4 = updateSql.iterator(); > while (iter4.hasNext()) { > var sql = iter4.next(); > println(sql); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 826995
:
603086
|
603087
|
603088
|
703675