From: <jma...@rh...> - 2009-07-16 04:20:43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [4420] skeleton impl for testing purposes for new criteria object; </title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>4420</dd> <dt>Author</dt> <dd>jmarques</dd> <dt>Date</dt> <dd>2009-07-15 23:20:31 -0500 (Wed, 15 Jul 2009)</dd> </dl> <h3>Log Message</h3> <pre>skeleton impl for testing purposes for new criteria object; </pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomaincriteriaCriteriajava">rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerBeanjava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerLocaljava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java</a></li> <li><a href="#rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerRemotejava">rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerRemote.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoredomainsrcmainjavaorgrhqcoredomaincriteriaCriteriajava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java (4419 => 4420)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java 2009-07-16 04:03:54 UTC (rev 4419) +++ rhq/trunk/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java 2009-07-16 04:20:31 UTC (rev 4420) </span><span class="lines">@@ -22,6 +22,7 @@ </span><span class="cx"> */ package org.rhq.core.domain.criteria; </span><span class="add">+import java.io.Serializable; </span><span class="cx"> import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; </span><span class="lines">@@ -34,7 +35,10 @@ </span><span class="cx"> /** * @author Joseph Marques */ </span><span class="rem">-public abstract class Criteria { </span><span class="add">+public abstract class Criteria implements Serializable { + + private static final long serialVersionUID = 1L; + </span><span class="cx"> private List<Field> filterFields; private List<Field> fetchFields; private List<Field> sortFields; </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerBeanjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java (4419 => 4420)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java 2009-07-16 04:03:54 UTC (rev 4419) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerBean.java 2009-07-16 04:20:31 UTC (rev 4420) </span><span class="lines">@@ -57,6 +57,7 @@ </span><span class="cx"> import org.rhq.core.domain.alert.notification.SubjectNotification; import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.authz.Permission; </span><span class="add">+import org.rhq.core.domain.criteria.AlertCriteria; </span><span class="cx"> import org.rhq.core.domain.measurement.MeasurementSchedule; import org.rhq.core.domain.measurement.MeasurementUnits; import org.rhq.core.domain.measurement.util.MeasurementConverter; </span><span class="lines">@@ -853,6 +854,26 @@ </span><span class="cx"> } catch (Exception e) { throw new FetchException(e.getMessage()); } </span><span class="add">+ } </span><span class="cx"> </span><span class="add">+ @SuppressWarnings("unchecked") + public PageList<Alert> findAlerts(Subject subject, AlertCriteria criteria, PageControl pc) throws FetchException { + try { + QueryGenerator generator = new QueryGenerator(criteria, pc); + if (authorizationManager.isInventoryManager(subject) == false) { + generator.setAuthorizationResourceFragment(AuthorizationTokenType.RESOURCE, "definition.resource", + subject.getId()); + } + + Query query = generator.getQuery(entityManager); + Query countQuery = generator.getCountQuery(entityManager); + + long count = (Long) countQuery.getSingleResult(); + List<Alert> alerts = query.getResultList(); + + return new PageList<Alert>(alerts, (int) count, pc); + } catch (Exception e) { + throw new FetchException(e.getMessage()); + } </span><span class="cx"> } } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerLocaljava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java (4419 => 4420)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java 2009-07-16 04:03:54 UTC (rev 4419) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerLocal.java 2009-07-16 04:20:31 UTC (rev 4420) </span><span class="lines">@@ -27,6 +27,7 @@ </span><span class="cx"> import org.rhq.core.domain.alert.AlertDefinition; import org.rhq.core.domain.alert.AlertPriority; import org.rhq.core.domain.auth.Subject; </span><span class="add">+import org.rhq.core.domain.criteria.AlertCriteria; </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.server.exception.FetchException; </span><span class="lines">@@ -85,4 +86,6 @@ </span><span class="cx"> PageList<Alert> findAlerts(Subject subject, Alert criteria, AlertPriority priority, int[] resourceIds, long beginTime, long endTime, PageControl pc) throws FetchException; </span><span class="add">+ + PageList<Alert> findAlerts(Subject subject, AlertCriteria criteria, PageControl pc) throws FetchException; </span><span class="cx"> } \ No newline at end of file </span></pre></div> <a id="rhqtrunkmodulesenterpriseserverjarsrcmainjavaorgrhqenterpriseserveralertAlertManagerRemotejava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerRemote.java (4419 => 4420)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerRemote.java 2009-07-16 04:03:54 UTC (rev 4419) +++ rhq/trunk/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertManagerRemote.java 2009-07-16 04:20:31 UTC (rev 4420) </span><span class="lines">@@ -27,6 +27,7 @@ </span><span class="cx"> import org.rhq.core.domain.alert.Alert; import org.rhq.core.domain.alert.AlertPriority; import org.rhq.core.domain.auth.Subject; </span><span class="add">+import org.rhq.core.domain.criteria.AlertCriteria; </span><span class="cx"> import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.enterprise.server.exception.FetchException; </span><span class="lines">@@ -70,6 +71,13 @@ </span><span class="cx"> @WebParam(name = "resourceIds") int[] resourceIds, // @WebParam(name = "beginTime") long beginTime, // @WebParam(name = "endTime") long endTime, // </span><span class="rem">- @WebParam(name = "pageControl") PageControl pc) // </span><span class="add">+ @WebParam(name = "pageControl") PageControl pageControl) // </span><span class="cx"> throws FetchException; </span><span class="add">+ + @WebMethod + PageList<Alert> findAlerts( // + @WebParam(name = "subject") Subject subject, // + @WebParam(name = "criteria") AlertCriteria criteria, // + @WebParam(name = "pageControl") PageControl pageControl) // + throws FetchException; </span><span class="cx"> } </span> </pre> </div> </div> </body> </html> |