org.opennms.web.rest
Class OnmsRestService

java.lang.Object
  extended by org.opennms.web.rest.OnmsRestService
Direct Known Subclasses:
AlarmRestService, EventRestService, ForeignSourceRestService, NodeRestService, NotificationRestService, OnmsCategoryResource, OnmsIpInterfaceResource, OnmsMapElementResource, OnmsMapRestService, OnmsMonitoredServiceResource, OnmsSnmpInterfaceResource, OutageRestService, RequisitionRestService, SnmpConfigRestService

public class OnmsRestService
extends Object


Nested Class Summary
protected static class OnmsRestService.ComparisonOperation
           
 
Constructor Summary
OnmsRestService()
           
 
Method Summary
protected  void addFiltersToCriteria(javax.ws.rs.core.MultivaluedMap<String,String> params, OnmsCriteria criteria, Class<?> objectClass)
          Method to pull out all the named params in params and use them to add restriction filters to a criteria object.
protected  void addOrdering(javax.ws.rs.core.MultivaluedMap<String,String> params, OnmsCriteria criteria)
          Does ordering processing; pulled out to a separate method for visual clarity.
static String convertNameToPropertyName(String name)
          Convert a column name with underscores to the corresponding property name using "camel case".
protected  Category log()
           
protected  void setLimitOffset(javax.ws.rs.core.MultivaluedMap<String,String> params, OnmsCriteria criteria)
          Convenience for the other setLimitOffset method with the extra parameter, passing a default limit of 10
protected  void setLimitOffset(javax.ws.rs.core.MultivaluedMap<String,String> params, OnmsCriteria criteria, int defaultLimit)
          Uses parameters in params to setup criteria with standard limit and offset parameters.
protected  void setProperties(MultivaluedMapImpl params, Object req)
           
protected
<T> T
throwException(javax.ws.rs.core.Response.Status status, String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OnmsRestService

public OnmsRestService()
Method Detail

setLimitOffset

protected void setLimitOffset(javax.ws.rs.core.MultivaluedMap<String,String> params,
                              OnmsCriteria criteria)
Convenience for the other setLimitOffset method with the extra parameter, passing a default limit of 10

Parameters:
params - See other setLimitOffset
criteria - See other setLimitOffset

setLimitOffset

protected void setLimitOffset(javax.ws.rs.core.MultivaluedMap<String,String> params,
                              OnmsCriteria criteria,
                              int defaultLimit)
Uses parameters in params to setup criteria with standard limit and offset parameters. If "limit" is in params, is used, otherwise default limit is used. If limit is 0, then no limit is set If "offset" is in params, is set as the offset into the result set In both cases, the limit and offset parameters are removed if found.

Parameters:
params - Set of parameters to look in for limit and offset
criteria - The Criteria that will be modified with the limit and offset
defaultLimit - A limit to use if none is specified in the params

addFiltersToCriteria

protected void addFiltersToCriteria(javax.ws.rs.core.MultivaluedMap<String,String> params,
                                    OnmsCriteria criteria,
                                    Class<?> objectClass)
Method to pull out all the named params in params and use them to add restriction filters to a criteria object. Uses the objectClass to determine parameters and types; auto converts from strings to appropriate types, if at all possible. Additionally, the param "comparator", if set, will change the comparision from the default of equality. Acceptable comparators are: "equals", "ilike", "like", "gt", "lt", "ge", "le", "ne" (other values will default to equality). If there is an "orderBy" param, results will be ordered by the property name given. Default is ascending, unless "order" is set to "desc" If there is a "query" param, it will be added to the criteria as a raw hibernate SQL statement (in addition to any other parameters specified The "criteria" object will be populated with the filter and ordering details provided

Parameters:
params - set of string parameters from which various configuration properties are extracted
criteria - the object which will be populated with the filter/ordering
objectClass - the type of thing being filtered.

addOrdering

protected void addOrdering(javax.ws.rs.core.MultivaluedMap<String,String> params,
                           OnmsCriteria criteria)
Does ordering processing; pulled out to a separate method for visual clarity. Configures ordering as defined in addFiltersToCriteria

Parameters:
params - - set of values to look in for the "order" and "orderBy" values
criteria - - the criteria object which will be updated with ordering configuration

throwException

protected <T> T throwException(javax.ws.rs.core.Response.Status status,
                               String msg)

log

protected Category log()

convertNameToPropertyName

public static String convertNameToPropertyName(String name)
Convert a column name with underscores to the corresponding property name using "camel case". A name like "customer_number" would match a "customerNumber" property name.

Parameters:
name - the column name to be converted
Returns:
the name using "camel case"

setProperties

protected void setProperties(MultivaluedMapImpl params,
                             Object req)


Copyright © 2009. All Rights Reserved.