Skip to content

Commit

Permalink
Merge pull request #960 from Jeffrey-Simpson/957
Browse files Browse the repository at this point in the history
957
  • Loading branch information
poorva1209 authored Jul 10, 2019
2 parents f365aaa + 044c148 commit be212bf
Show file tree
Hide file tree
Showing 10 changed files with 418 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package gov.pnnl.goss.gridappsd;
package gov.pnnl.goss.gridappsd.dto;

import java.io.Serializable;

import com.google.gson.Gson;

public class Difference implements Serializable{

/**
*
*/
private static final long serialVersionUID = 7965569387061225456L;

public String object;

public String attribute;
public String attribute;

public String value;
public Object value;

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import gov.pnnl.goss.gridappsd.dto.events.CommOutage;
import gov.pnnl.goss.gridappsd.dto.events.Event;
import gov.pnnl.goss.gridappsd.dto.events.Fault;
import gov.pnnl.goss.gridappsd.dto.events.ScheduledCommandEvent;

import java.io.Serializable;

Expand Down Expand Up @@ -139,7 +140,7 @@ public String toString() {
public static RequestSimulation parse(String jsonString){
GsonBuilder gsonBuilder = new GsonBuilder();
RuntimeTypeAdapterFactory<Event> commandAdapterFactory = RuntimeTypeAdapterFactory.of(Event.class, "event_type")
.registerSubtype(CommOutage.class,"CommOutage").registerSubtype(Fault.class, "Fault");
.registerSubtype(CommOutage.class,"CommOutage").registerSubtype(Fault.class, "Fault").registerSubtype(ScheduledCommandEvent.class,"ScheduledCommandEvent");
gsonBuilder.registerTypeAdapterFactory(commandAdapterFactory);
gsonBuilder.setPrettyPrinting();
Gson gson = gsonBuilder.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
******************************************************************************/
package gov.pnnl.goss.gridappsd.dto.events;

import java.util.List;
import java.util.Map;

import com.google.gson.Gson;
Expand Down Expand Up @@ -75,7 +76,7 @@ public int getValue(){

public PhaseConnectedFaultKind PhaseConnectedFaultKind;

public String ObjectMRID;
public List<String> ObjectMRID;

public PhaseCode phases;

Expand All @@ -96,11 +97,11 @@ public void setPhaseConnectFaultKind(
PhaseConnectedFaultKind = phaseConnectFaultKind;
}

public String getObjectMRID() {
public List<String> getObjectMRID() {
return ObjectMRID;
}

public void setObjectMRID(String ObjectMRID) {
public void setObjectMRID(List<String> ObjectMRID) {
this.ObjectMRID = ObjectMRID;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ public class ObjectMridAttributeMap implements Serializable {

private static final long serialVersionUID = 1L;

String objectMrid;
String objectMRID;
String attribute;


public ObjectMridAttributeMap(){
super();
}

public ObjectMridAttributeMap(String objectMrid, String attribute) {
public ObjectMridAttributeMap(String objectMRID, String attribute) {
super();
this.objectMrid = objectMrid;
this.objectMRID = objectMRID;
this.attribute = attribute;
}

public String getObjectMrid() {
return objectMrid;
public String getObjectMRID() {
return objectMRID;
}
public void setObjectMrid(String objectMrid) {
this.objectMrid = objectMrid;
public void setObjectMRID(String objectMRID) {
this.objectMRID = objectMRID;
}
public String getAttribute() {
return attribute;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright (c) 2017, Battelle Memorial Institute All rights reserved.
* Battelle Memorial Institute (hereinafter Battelle) hereby grants permission to any person or entity
* lawfully obtaining a copy of this software and associated documentation files (hereinafter the
* Software) to redistribute and use the Software in source and binary forms, with or without modification.
* Such person or entity may use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and may permit others to do so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* Other than as used herein, neither the name Battelle Memorial Institute or Battelle may be used in any
* form whatsoever without the express written consent of Battelle.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* General disclaimer for use with OSS licenses
*
* This material was prepared as an account of work sponsored by an agency of the United States Government.
* Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any
* of their employees, nor any jurisdiction or organization that has cooperated in the development of these
* materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for
* the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process
* disclosed, or represents that its use would not infringe privately owned rights.
*
* Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer,
* or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United
* States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed
* herein do not necessarily state or reflect those of the United States Government or any agency thereof.
*
* PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the
* UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830
******************************************************************************/
package gov.pnnl.goss.gridappsd.dto.events;

import com.google.gson.Gson;

import gov.pnnl.goss.gridappsd.dto.DifferenceMessage;

public class ScheduledCommandEvent extends Event{

private static final long serialVersionUID = 2435694477772334059L;

DifferenceMessage message;

public void setMessage(DifferenceMessage dm) {
message=dm;
}

public DifferenceMessage getMessage() {
return message;
}

public static ScheduledCommandEvent parse(String jsonString){
Gson gson = new Gson();
ScheduledCommandEvent obj = gson.fromJson(jsonString, ScheduledCommandEvent.class);
if(obj.occuredDateTime==0 || obj.stopDateTime==0)
throw new RuntimeException("Expected attribute timeInitiated or timeCleared is not found");
return obj;
}


}
Loading

0 comments on commit be212bf

Please sign in to comment.