com.ibm.maximo.oslc.SavedQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maximo-restclient Show documentation
Show all versions of maximo-restclient Show documentation
The Maximo REST client library provides a set of driver API's which can be consumed by an JAVA based web component that would like to interface with a Maximo instance
/*
* Licensed Materials - Property of IBM
*
* (C) COPYRIGHT IBM CORP. 2015 All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
*/
package com.ibm.maximo.oslc;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.xml.datatype.DatatypeConfigurationException;
public class SavedQuery {
private String name = null;
private Map map = new HashMap();
public SavedQuery() {
}
public SavedQuery(String name,Map map){
this.name=name;
this.map=map;
}
public SavedQuery name(String name){
this.name = name;
return this;
}
public SavedQuery params(Map params){
this.map=params;
return this;
}
public SavedQuery addParam(String key, Object value){
map.put(key, value);
return this;
}
public String savedQueryClause(){
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(this.name);
Set> set = this.map.entrySet();
for(Map.Entry entry : set)
{
try {
strBuilder.append("&").append("sqp:");
strBuilder.append(entry.getKey());
String encodeValue = Util.urlEncode(Util.stringValue(entry.getValue()));
strBuilder.append("=").append(encodeValue);
} catch (UnsupportedEncodingException e){
}catch(DatatypeConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return strBuilder.toString();
}
}