Skip to content

Commit

Permalink
Update to fix verifyGoogleJavaFormat exception issue ChargeTimeEU Cha…
Browse files Browse the repository at this point in the history
  • Loading branch information
DB authored and DB committed Feb 29, 2020
1 parent acfeefc commit a68f54b
Show file tree
Hide file tree
Showing 32 changed files with 4,039 additions and 4,090 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,80 +31,73 @@ of this software and associated documentation files (the "Software"), to deal

import eu.chargetime.ocpp.model.Confirmation;
import eu.chargetime.ocpp.utilities.MoreObjects;

import java.util.Objects;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/**
* Sent by the Central System to the Charge Point in response to a {@link AuthorizeRequest}.
*/
/** Sent by the Central System to the Charge Point in response to a {@link AuthorizeRequest}. */
@XmlRootElement(name = "authorizeResponse")
public class AuthorizeConfirmation implements Confirmation {

private IdTagInfo idTagInfo;

/**
* @deprecated use {@link #AuthorizeConfirmation(IdTagInfo)} to be sure to set required fields
*/
@Deprecated
public AuthorizeConfirmation() {

}

/**
* Handle required fields.
*
* @param idTagInfo the {@link IdTagInfo}, see {@link #setIdTagInfo(IdTagInfo)}
*/
public AuthorizeConfirmation(IdTagInfo idTagInfo) {
setIdTagInfo(idTagInfo);
}

/**
* This contains information about authorization status, expiry and parent id.
*
* @return an instance of {@link IdTagInfo}.
*/
public IdTagInfo getIdTagInfo() {
return idTagInfo;
}

/**
* Required. This contains information about authorization status, expiry and parent id.
*
* @param idTagInfo an instance of {@link IdTagInfo}.
*/
@XmlElement
public void setIdTagInfo(IdTagInfo idTagInfo) {
this.idTagInfo = idTagInfo;
}

@Override
public boolean validate() {
boolean valid = true;
if (valid &= idTagInfo != null) valid &= idTagInfo.validate();
return valid;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorizeConfirmation response = (AuthorizeConfirmation) o;
return Objects.equals(idTagInfo, response.idTagInfo);
}

@Override
public int hashCode() {
return Objects.hash(idTagInfo);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("idTagInfo", idTagInfo)
.add("isValid", validate())
.toString();
}
private IdTagInfo idTagInfo;

/** @deprecated use {@link #AuthorizeConfirmation(IdTagInfo)} to be sure to set required fields */
@Deprecated
public AuthorizeConfirmation() {}

/**
* Handle required fields.
*
* @param idTagInfo the {@link IdTagInfo}, see {@link #setIdTagInfo(IdTagInfo)}
*/
public AuthorizeConfirmation(IdTagInfo idTagInfo) {
setIdTagInfo(idTagInfo);
}

/**
* This contains information about authorization status, expiry and parent id.
*
* @return an instance of {@link IdTagInfo}.
*/
public IdTagInfo getIdTagInfo() {
return idTagInfo;
}

/**
* Required. This contains information about authorization status, expiry and parent id.
*
* @param idTagInfo an instance of {@link IdTagInfo}.
*/
@XmlElement
public void setIdTagInfo(IdTagInfo idTagInfo) {
this.idTagInfo = idTagInfo;
}

@Override
public boolean validate() {
boolean valid = true;
if (valid &= idTagInfo != null) valid &= idTagInfo.validate();
return valid;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorizeConfirmation response = (AuthorizeConfirmation) o;
return Objects.equals(idTagInfo, response.idTagInfo);
}

@Override
public int hashCode() {
return Objects.hash(idTagInfo);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("idTagInfo", idTagInfo)
.add("isValid", validate())
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import eu.chargetime.ocpp.model.Request;
import eu.chargetime.ocpp.utilities.ModelUtil;
import eu.chargetime.ocpp.utilities.MoreObjects;

import java.util.Objects;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/*
ChargeTime.eu - Java-OCA-OCPP
Expand Down Expand Up @@ -38,84 +37,79 @@ of this software and associated documentation files (the "Software"), to deal
SOFTWARE.
*/

/**
* Sent by the Charge Point to the Central System.
*/
/** Sent by the Charge Point to the Central System. */
@XmlRootElement
public class AuthorizeRequest implements Request {

private static final int IDTAG_MAX_LENGTH = 20;
private static final String ERROR_MESSAGE = "Exceeded limit of " + IDTAG_MAX_LENGTH + " chars";

private String idTag;

/**
* @deprecated use {@link #AuthorizeRequest(String)} to be sure to set required fields
*/
@Deprecated
public AuthorizeRequest() {
}

/**
* Handle required fields.
*
* @param idTag authorize id, see {@link #setIdTag(String)}
*/
public AuthorizeRequest(String idTag) {
setIdTag(idTag);
}

/**
* This contains the identifier that needs to be authorized.
*
* @return String, max 20 characters. Case insensitive.
*/
public String getIdTag() {
return idTag;
}

/**
* Required. This contains the identifier that needs to be authorized.
*
* @param idTag String, max 20 characters. Case insensitive.
*/
@XmlElement
public void setIdTag(String idTag) {
if (!ModelUtil.validate(idTag, IDTAG_MAX_LENGTH)) {
throw new PropertyConstraintException(idTag.length(), ERROR_MESSAGE);
}

this.idTag = idTag;
}

@Override
public boolean validate() {
return ModelUtil.validate(idTag, IDTAG_MAX_LENGTH);
}

@Override
public boolean transactionRelated() {
return false;
private static final int IDTAG_MAX_LENGTH = 20;
private static final String ERROR_MESSAGE = "Exceeded limit of " + IDTAG_MAX_LENGTH + " chars";

private String idTag;

/** @deprecated use {@link #AuthorizeRequest(String)} to be sure to set required fields */
@Deprecated
public AuthorizeRequest() {}

/**
* Handle required fields.
*
* @param idTag authorize id, see {@link #setIdTag(String)}
*/
public AuthorizeRequest(String idTag) {
setIdTag(idTag);
}

/**
* This contains the identifier that needs to be authorized.
*
* @return String, max 20 characters. Case insensitive.
*/
public String getIdTag() {
return idTag;
}

/**
* Required. This contains the identifier that needs to be authorized.
*
* @param idTag String, max 20 characters. Case insensitive.
*/
@XmlElement
public void setIdTag(String idTag) {
if (!ModelUtil.validate(idTag, IDTAG_MAX_LENGTH)) {
throw new PropertyConstraintException(idTag.length(), ERROR_MESSAGE);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorizeRequest request = (AuthorizeRequest) o;
return Objects.equals(idTag, request.idTag);
}

@Override
public int hashCode() {
return Objects.hash(idTag);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("idTag", idTag)
.add("isValid", validate())
.toString();
}
this.idTag = idTag;
}

@Override
public boolean validate() {
return ModelUtil.validate(idTag, IDTAG_MAX_LENGTH);
}

@Override
public boolean transactionRelated() {
return false;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorizeRequest request = (AuthorizeRequest) o;
return Objects.equals(idTag, request.idTag);
}

@Override
public int hashCode() {
return Objects.hash(idTag);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("idTag", idTag)
.add("isValid", validate())
.toString();
}
}
Loading

0 comments on commit a68f54b

Please sign in to comment.