-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1642 from GRIDAPPSD/releases/2022.04.0
Release of version 2022.04.0
- Loading branch information
Showing
12 changed files
with
226 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
gov.pnnl.goss.gridappsd/src/gov/pnnl/goss/gridappsd/dto/RequestTimeseriesDataAdvanced.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package gov.pnnl.goss.gridappsd.dto; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.apache.commons.lang3.exception.ExceptionUtils; | ||
|
||
import com.fasterxml.jackson.core.JsonParseException; | ||
import com.fasterxml.jackson.databind.JsonMappingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.google.gson.Gson; | ||
import com.google.gson.JsonSyntaxException; | ||
|
||
public class RequestTimeseriesDataAdvanced extends RequestTimeseriesData { | ||
|
||
private static final long serialVersionUID = -820277813503252512L; | ||
|
||
List<Object> queryFilter = new ArrayList<Object>(); | ||
|
||
List<String> selectCriteria = new ArrayList<String>(); | ||
Integer last; | ||
Integer first; | ||
|
||
public List<Object> getQueryFilter() { | ||
return queryFilter; | ||
} | ||
|
||
public void setQueryFilter(List<Object> advancedQueryFilter) { | ||
this.queryFilter = advancedQueryFilter; | ||
} | ||
|
||
|
||
|
||
public List<String> getSelectCriteria() { | ||
return selectCriteria; | ||
} | ||
public void setSelectCriteria(List<String> selectCriteria) { | ||
this.selectCriteria = selectCriteria; | ||
} | ||
|
||
|
||
public Integer getLast() { | ||
return last; | ||
} | ||
|
||
public void setLast(Integer last) { | ||
this.last = last; | ||
} | ||
|
||
public Integer getFirst() { | ||
return first; | ||
} | ||
|
||
public void setFirst(Integer first) { | ||
this.first = first; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
Gson gson = new Gson(); | ||
return gson.toJson(this); | ||
} | ||
|
||
public static RequestTimeseriesDataAdvanced parse(String jsonString){ | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
RequestTimeseriesDataAdvanced obj = null; | ||
String error = ""; | ||
try { | ||
obj = objectMapper.readValue(jsonString, RequestTimeseriesDataAdvanced.class); | ||
} catch (JsonParseException e) { | ||
error = ExceptionUtils.getStackTrace(e); | ||
} catch (JsonMappingException e) { | ||
error = ExceptionUtils.getStackTrace(e); | ||
} catch (IOException e) { | ||
error = ExceptionUtils.getStackTrace(e); | ||
} | ||
if(obj==null){ | ||
throw new JsonSyntaxException("Request time series data request could not be parsed: "+error); | ||
} | ||
|
||
// if(obj!=null && obj.queryMeasurement.equals("simulation")){ | ||
//if(obj.queryFilter==null || !obj.queryFilter.containsKey("simulation_id")) | ||
// throw new JsonSyntaxException("Expected filter simulation_id not found."); | ||
//TODO iterate through and look for key = simulation_id | ||
return obj; | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.