Skip to content

Commit 9facbe4

Browse files
committed
Added XML annotations to all models.
1 parent 1a2b518 commit 9facbe4

39 files changed

+231
-0
lines changed

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/AuthorizeConfirmation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ of this software and associated documentation files (the "Software"), to deal
2929

3030
import eu.chargetime.ocpp.model.Confirmation;
3131

32+
import javax.xml.bind.annotation.XmlElement;
33+
import javax.xml.bind.annotation.XmlRootElement;
34+
3235
/**
3336
* Sent by the Centarl System to the Charge Point in response to a {@link AuthorizeRequest}.
3437
*/
38+
@XmlRootElement
3539
public class AuthorizeConfirmation implements Confirmation
3640
{
3741
private IdTagInfo idTagInfo;
@@ -51,6 +55,7 @@ public IdTagInfo getIdTagInfo()
5155
*
5256
* @param idTagInfo an instance of {@link IdTagInfo}.
5357
*/
58+
@XmlElement
5459
public void setIdTagInfo(IdTagInfo idTagInfo) {
5560
this.idTagInfo = idTagInfo;
5661
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/AuthorizeRequest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import eu.chargetime.ocpp.model.Request;
55
import eu.chargetime.ocpp.utilities.ModelUtil;
66

7+
import javax.xml.bind.annotation.XmlElement;
8+
import javax.xml.bind.annotation.XmlRootElement;
9+
710
/*
811
ChargeTime.eu - Java-OCA-OCPP
912
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
@@ -34,6 +37,7 @@ of this software and associated documentation files (the "Software"), to deal
3437
/**
3538
* Sent by the Charge Point to the Central System.
3639
*/
40+
@XmlRootElement
3741
public class AuthorizeRequest implements Request
3842
{
3943
private String idTag;
@@ -67,6 +71,7 @@ public String getIdTag()
6771
* @param idTag String, max 20 characters. Case insensitive.
6872
* @throws PropertyConstraintException field isn't filled out correct.
6973
*/
74+
@XmlElement
7075
public void setIdTag(String idTag) throws PropertyConstraintException {
7176
if (!ModelUtil.validate(idTag, 20))
7277
throw new PropertyConstraintException("idTag", idTag, "Exceeded limit");

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/BootNotificationConfirmation.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import eu.chargetime.ocpp.PropertyConstraintException;
44
import eu.chargetime.ocpp.model.Confirmation;
55

6+
import javax.xml.bind.annotation.XmlElement;
7+
import javax.xml.bind.annotation.XmlRootElement;
68
import java.text.SimpleDateFormat;
79
import java.util.Calendar;
810
import java.util.TimeZone;
@@ -39,6 +41,7 @@ of this software and associated documentation files (the "Software"), to deal
3941
*
4042
* @see BootNotificationRequest
4143
*/
44+
@XmlRootElement
4245
public class BootNotificationConfirmation implements Confirmation
4346
{
4447
private Calendar currentTime;
@@ -72,6 +75,7 @@ public Calendar objCurrentTime() {
7275
*
7376
* @param currentTime Central System’s current time.
7477
*/
78+
@XmlElement
7579
public void setCurrentTime(Calendar currentTime)
7680
{
7781
this.currentTime = currentTime;
@@ -97,6 +101,7 @@ public int getInterval()
97101
* @param interval heartbeat/delay interval in seconds. Min value 0.
98102
* @throws PropertyConstraintException field isn't filled out correct.
99103
*/
104+
@XmlElement
100105
public void setInterval(int interval) throws PropertyConstraintException {
101106
if (interval <= 0)
102107
throw new PropertyConstraintException("interval", interval, "Must be a positive value");
@@ -129,6 +134,7 @@ public String getStatus()
129134
*
130135
* @param status Charge Points registration status.
131136
*/
137+
@XmlElement
132138
public void setStatus(RegistrationStatus status) {
133139
this.status = status;
134140
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChangeAvailabilityConfirmation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ of this software and associated documentation files (the "Software"), to deal
2929

3030
import eu.chargetime.ocpp.model.Confirmation;
3131

32+
import javax.xml.bind.annotation.XmlElement;
33+
import javax.xml.bind.annotation.XmlRootElement;
34+
3235
/**
3336
* return by Charge Point to Central System.
3437
*/
38+
@XmlRootElement
3539
public class ChangeAvailabilityConfirmation implements Confirmation {
3640

3741
private AvailabilityStatus status;
@@ -59,6 +63,7 @@ public AvailabilityStatus objStatus() {
5963
*
6064
* @param status the {@link AvailabilityStatus} of connector.
6165
*/
66+
@XmlElement
6267
public void setStatus(AvailabilityStatus status) {
6368
this.status = status;
6469
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChangeAvailabilityRequest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import eu.chargetime.ocpp.PropertyConstraintException;
44
import eu.chargetime.ocpp.model.Request;
55

6+
import javax.xml.bind.annotation.XmlElement;
7+
import javax.xml.bind.annotation.XmlRootElement;
8+
69
/*
710
ChargeTime.eu - Java-OCA-OCPP
811
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
@@ -33,6 +36,7 @@ of this software and associated documentation files (the "Software"), to deal
3336
/**
3437
* Sent by the Central System to the Charge Point.
3538
*/
39+
@XmlRootElement
3640
public class ChangeAvailabilityRequest implements Request
3741
{
3842
private int connectorId = -1;
@@ -55,6 +59,7 @@ public int getConnectorId() {
5559
* @param connectorId integer, must be a positive number.
5660
* @throws PropertyConstraintException Value was a negative number.
5761
*/
62+
@XmlElement
5863
public void setConnectorId(int connectorId) throws PropertyConstraintException {
5964
if (connectorId < 0)
6065
throw new PropertyConstraintException("connectorId", connectorId, "Must be >= 0");
@@ -85,6 +90,7 @@ public AvailabilityType objType() {
8590
*
8691
* @param type {@link AvailabilityType} of the connector
8792
*/
93+
@XmlElement
8894
public void setType(AvailabilityType type) {
8995
this.type = type;
9096
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChangeConfigurationConfirmation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import eu.chargetime.ocpp.model.Confirmation;
44

5+
import javax.xml.bind.annotation.XmlElement;
6+
import javax.xml.bind.annotation.XmlRootElement;
7+
58
/*
69
ChargeTime.eu - Java-OCA-OCPP
710
Copyright (C) 2015-2016 Thomas Volden <[email protected]>
@@ -32,6 +35,7 @@ of this software and associated documentation files (the "Software"), to deal
3235
/**
3336
* Returned from Charge Point to Central System
3437
*/
38+
@XmlRootElement
3539
public class ChangeConfigurationConfirmation implements Confirmation {
3640
private ConfigurationStatus status;
3741

@@ -58,6 +62,7 @@ public ConfigurationStatus objStatus() {
5862
*
5963
* @param status the {@link ConfigurationStatus}.
6064
*/
65+
@XmlElement
6166
public void setStatus(ConfigurationStatus status) {
6267
this.status = status;
6368
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChangeConfigurationRequest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import eu.chargetime.ocpp.model.Request;
55
import eu.chargetime.ocpp.utilities.ModelUtil;
66

7+
import javax.xml.bind.annotation.XmlElement;
8+
import javax.xml.bind.annotation.XmlRootElement;
9+
710
/*
811
ChargeTime.eu - Java-OCA-OCPP
912
@@ -36,6 +39,7 @@ of this software and associated documentation files (the "Software"), to deal
3639
* It is RECOMMENDED that the content and meaning of the 'key' and 'value'
3740
* fields is agreed upon between Charge Point and Central System.
3841
*/
42+
@XmlRootElement
3943
public class ChangeConfigurationRequest implements Request {
4044
private String key;
4145
private String value;
@@ -55,6 +59,7 @@ public String getKey() {
5559
* @param key String, max 50 characters, case insensitive.
5660
* @throws PropertyConstraintException Value exceeds 50 characters.
5761
*/
62+
@XmlElement
5863
public void setKey(String key) throws PropertyConstraintException {
5964
if (!isValidKey(key))
6065
throw new PropertyConstraintException("key", key);
@@ -81,6 +86,7 @@ public String getValue() {
8186
* @param value String, max 500 characters, case insensitive.
8287
* @throws PropertyConstraintException Value exceeds 500 characters.
8388
*/
89+
@XmlElement
8490
public void setValue(String value) throws PropertyConstraintException {
8591
if (!isValidValue(value))
8692
throw new PropertyConstraintException("value", value);

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChargingProfile.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import eu.chargetime.ocpp.PropertyConstraintException;
44
import eu.chargetime.ocpp.model.Validatable;
55

6+
import javax.xml.bind.annotation.XmlElement;
7+
import javax.xml.bind.annotation.XmlRootElement;
68
import java.text.SimpleDateFormat;
79
import java.util.Calendar;
810
import java.util.TimeZone;
@@ -32,6 +34,7 @@
3234
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3335
* SOFTWARE.
3436
*/
37+
@XmlRootElement
3538
public class ChargingProfile implements Validatable {
3639
private Integer chargingProfileId;
3740
private Integer transactionId;
@@ -55,6 +58,7 @@ public boolean validate() {
5558
return valid;
5659
}
5760

61+
@XmlElement
5862
public void setChargingProfileId(Integer chargingProfileId) throws PropertyConstraintException {
5963
if (chargingProfileId == null)
6064
throw new PropertyConstraintException("chargingProfileId", chargingProfileId);
@@ -66,6 +70,7 @@ public Integer getChargingProfileId() {
6670
return chargingProfileId;
6771
}
6872

73+
@XmlElement
6974
public void setTransactionId(Integer transactionId) {
7075
this.transactionId = transactionId;
7176
}
@@ -74,6 +79,7 @@ public Integer getTransactionId() {
7479
return transactionId;
7580
}
7681

82+
@XmlElement
7783
public void setStackLevel(Integer stackLevel) throws PropertyConstraintException {
7884
if (stackLevel < 0)
7985
throw new PropertyConstraintException("stackLevel", stackLevel);
@@ -85,6 +91,7 @@ public Integer getStackLevel() {
8591
return stackLevel;
8692
}
8793

94+
@XmlElement
8895
public void setChargingProfilePurpose(ChargingProfilePurposeType chargingProfilePurpose) throws PropertyConstraintException {
8996
this.chargingProfilePurpose = chargingProfilePurpose;
9097
}
@@ -97,6 +104,7 @@ public ChargingProfilePurposeType objChargingProfilePurpose() {
97104
return chargingProfilePurpose;
98105
}
99106

107+
@XmlElement
100108
public void setChargingProfileKind(ChargingProfileKindType chargingProfileKind) throws PropertyConstraintException {
101109
this.chargingProfileKind = chargingProfileKind;
102110
}
@@ -109,6 +117,7 @@ public ChargingProfileKindType objChargingProfileKind() {
109117
return chargingProfileKind;
110118
}
111119

120+
@XmlElement
112121
public void setRecurrencyKind(RecurrencyKindType recurrencyKind) throws PropertyConstraintException {
113122
this.recurrencyKind = recurrencyKind;
114123
}
@@ -121,6 +130,7 @@ public RecurrencyKindType objRecurrencyKind() {
121130
return recurrencyKind;
122131
}
123132

133+
@XmlElement
124134
public void setValidFrom(Calendar validFrom) {
125135
this.validFrom = validFrom;
126136
}
@@ -135,6 +145,7 @@ public Calendar objValidFrom() {
135145
return this.validFrom;
136146
}
137147

148+
@XmlElement
138149
public void setValidTo(Calendar validTo) {
139150
this.validTo = validTo;
140151
}
@@ -149,6 +160,7 @@ public Calendar objValidTo() {
149160
return validTo;
150161
}
151162

163+
@XmlElement
152164
public void setChargingSchedule(ChargingSchedule chargingSchedule) {
153165
this.chargingSchedule = chargingSchedule;
154166
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChargingSchedule.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import eu.chargetime.ocpp.model.Validatable;
44

5+
import javax.xml.bind.annotation.XmlElement;
6+
import javax.xml.bind.annotation.XmlRootElement;
57
import java.text.SimpleDateFormat;
68
import java.util.Calendar;
79
import java.util.TimeZone;
@@ -35,6 +37,7 @@
3537
/**
3638
* Class type used with {@link ChargingProfile}
3739
*/
40+
@XmlRootElement
3841
public class ChargingSchedule implements Validatable {
3942
private Integer duration;
4043
private Calendar startSchedule;
@@ -69,6 +72,7 @@ public Integer getDuration() {
6972
*
7073
* @param duration integer, duration in seconds.
7174
*/
75+
@XmlElement
7276
public void setDuration(Integer duration) {
7377
this.duration = duration;
7478
}
@@ -99,6 +103,7 @@ public Calendar objStartSchedule() {
99103
*
100104
* @param startSchedule Calendar, start time.
101105
*/
106+
@XmlElement
102107
public void setStartSchedule(Calendar startSchedule) {
103108
this.startSchedule = startSchedule;
104109
}
@@ -126,6 +131,7 @@ public ChargingRateUnitType objChargingRateUnit() {
126131
*
127132
* @param chargingRateUnit the {@link ChargingRateUnitType}.
128133
*/
134+
@XmlElement
129135
public void setChargingRateUnit(ChargingRateUnitType chargingRateUnit) {
130136
this.chargingRateUnit = chargingRateUnit;
131137
}
@@ -144,6 +150,7 @@ public ChargingSchedulePeriod[] getChargingSchedulePeriod() {
144150
*
145151
* @param chargingSchedulePeriod array of {@link ChargingSchedulePeriod}.
146152
*/
153+
@XmlElement
147154
public void setChargingSchedulePeriod(ChargingSchedulePeriod[] chargingSchedulePeriod) {
148155
this.chargingSchedulePeriod = chargingSchedulePeriod;
149156
}
@@ -167,6 +174,7 @@ public Double getMinChargingRate() {
167174
*
168175
* @param minChargingRate decimal, min charge rate.
169176
*/
177+
@XmlElement
170178
public void setMinChargingRate(Double minChargingRate) {
171179
this.minChargingRate = minChargingRate;
172180
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChargingSchedulePeriod.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@
2828

2929
import eu.chargetime.ocpp.model.Validatable;
3030

31+
import javax.xml.bind.annotation.XmlElement;
32+
import javax.xml.bind.annotation.XmlRootElement;
33+
3134
/**
3235
* Class Type used with {@link ChargingSchedule}.
3336
*/
37+
@XmlRootElement
3438
public class ChargingSchedulePeriod implements Validatable {
3539
private Integer startPeriod;
3640
private Double limit;
@@ -50,6 +54,7 @@ public boolean validate() {
5054
*
5155
* @param startPeriod integer, seconds from start of schedule.
5256
*/
57+
@XmlElement
5358
public void setStartPeriod(Integer startPeriod) {
5459
this.startPeriod = startPeriod;
5560
}
@@ -70,6 +75,7 @@ public Integer getStartPeriod() {
7075
*
7176
* @param limit decimal, power limit.
7277
*/
78+
@XmlElement
7379
public void setLimit(Double limit) {
7480
this.limit = limit;
7581
}
@@ -90,6 +96,7 @@ public Double getLimit() {
9096
*
9197
* @param numberPhases integer, default is 3.
9298
*/
99+
@XmlElement
93100
public void setNumberPhases(Integer numberPhases) {
94101
this.numberPhases = numberPhases;
95102
}

0 commit comments

Comments
 (0)