Navigation Menu

Skip to content

Commit

Permalink
KAA-876: Add missing Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Khablenko committed Mar 23, 2016
1 parent 06afa5e commit 71a0b81
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 153 deletions.
Expand Up @@ -13,61 +13,47 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */

package org.kaaproject.kaa.common.dto.credentials; package org.kaaproject.kaa.common.dto.credentials;


import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;


import org.kaaproject.kaa.common.dto.HasId; import org.kaaproject.kaa.common.dto.HasId;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

/** /**
* @author Bohdan Khablenko * @author Bohdan Khablenko
* @author Andrew Shvayka * @author Andrew Shvayka
* *
* @since v0.9.0 * @since v0.9.0
*/ */
@JsonInclude(Include.NON_NULL)
public final class CredentialsDto implements HasId, Serializable { public final class CredentialsDto implements HasId, Serializable {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1000L;


@JsonProperty("credentialsId")
private String id; private String id;

private byte[] credentialsBody;
@JsonProperty("credentials")
private byte[] credentials;

@JsonProperty("status")
private CredentialsStatus status; private CredentialsStatus status;

public CredentialsDto() {
super();
}


@Override @Override
public String getId() { public String getId() {
return id; return this.id;
} }


@Override
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }


public byte[] getCredentials() { public byte[] getCredentialsBody() {
return credentials; return this.credentialsBody;
} }


public void setCredentials(byte[] credentials) { public void setCredentialsBody(byte[] credentialsBody) {
this.credentials = credentials; this.credentialsBody = credentialsBody;
} }


public CredentialsStatus getStatus() { public CredentialsStatus getStatus() {
return status; return this.status;
} }


public void setStatus(CredentialsStatus status) { public void setStatus(CredentialsStatus status) {
Expand All @@ -78,36 +64,50 @@ public void setStatus(CredentialsStatus status) {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + Arrays.hashCode(credentials); result = prime * result + Arrays.hashCode(this.credentialsBody);
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((this.status == null) ? 0 : this.status.hashCode());
return result; return result;
} }


@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj) {
return true; return true;
if (obj == null) }
if (obj == null) {
return false; return false;
if (getClass() != obj.getClass()) }
if (getClass() != obj.getClass()) {
return false; return false;
}
CredentialsDto other = (CredentialsDto) obj; CredentialsDto other = (CredentialsDto) obj;
if (!Arrays.equals(credentials, other.credentials)) if (!Arrays.equals(this.credentialsBody, other.credentialsBody)) {
return false; return false;
if (id == null) { }
if (other.id != null) if (this.id == null) {
if (other.id != null) {
return false; return false;
} else if (!id.equals(other.id)) }
} else if (!this.id.equals(other.id)) {
return false; return false;
if (status != other.status) }
if (this.status != other.status) {
return false; return false;
}
return true; return true;
} }


@Override @Override
public String toString() { public String toString() {
return "CredentialsDto [id=" + id + ", credentials=" + Arrays.toString(credentials) + ", status=" + status + "]"; StringBuilder builder = new StringBuilder();
builder.append("CredentialsDto [id=");
builder.append(this.id);
builder.append(", credentialsBody=");
builder.append(Arrays.toString(this.credentialsBody));
builder.append(", status=");
builder.append(this.status);
builder.append("]");
return builder.toString();
} }

} }
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */

package org.kaaproject.kaa.common.dto.credentials; package org.kaaproject.kaa.common.dto.credentials;


/** /**
* @author Bohdan Khablenko
* @author Andrew Shvayka * @author Andrew Shvayka
* *
* @since v0.9.0 * @since v0.9.0
*/ */
public enum CredentialsStatus { public enum CredentialsStatus {
AVAILABLE, IN_USE, REVOKED; AVAILABLE, IN_USE, REVOKED;
} }
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */

package org.kaaproject.kaa.common.dto.credentials; package org.kaaproject.kaa.common.dto.credentials;


import java.io.Serializable; import java.io.Serializable;
Expand All @@ -21,75 +22,157 @@
import org.kaaproject.kaa.common.dto.HasId; import org.kaaproject.kaa.common.dto.HasId;


/** /**
* @author Bohdan Khablenko
* @author Andrew Shvayka * @author Andrew Shvayka
* @author Bohdan Khablenko
* *
* @since v0.9.0 * @since v0.9.0
*/ */
public class EndpointRegistrationInfoDto implements HasId, Serializable { public final class EndpointRegistrationInfoDto implements HasId, Serializable {

private static final long serialVersionUID = 1000L;


private static final long serialVersionUID = 1L;

private String id; private String id;

private String applicationId; private String applicationId;

/**
* This is optional
*/
private String credentialsId;

private String endpointId; private String endpointId;

private String credentialsId;
private Integer serverProfileVersion; private Integer serverProfileVersion;

private String serverProfileBody; private String serverProfileBody;


@Override
public String getId() { public String getId() {
return id; return this.id;
} }


public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }


public String getApplicationId() { public String getApplicationId() {
return applicationId; return this.applicationId;
} }


public void setApplicationId(String applicationId) { public void setApplicationId(String applicationId) {
this.applicationId = applicationId; this.applicationId = applicationId;
} }


public String getCredentialsId() { public String getEndpointId() {
return credentialsId; return this.endpointId;
} }


public void setCredentialsId(String credentialsId) { public void setEndpointId(String endpointId) {
this.credentialsId = credentialsId; this.endpointId = endpointId;
} }


public String getEndpointId() { public Optional<String> getCredentialsId() {
return endpointId; return Optional.ofNullable(this.credentialsId);
} }


public void setEndpointId(String endpointId) { public void setCredentialsId(String credentialsId) {
this.endpointId = endpointId; this.credentialsId = credentialsId;
} }


public Optional<Integer> getServerProfileVersion() { public Optional<Integer> getServerProfileVersion() {
return Optional.ofNullable(serverProfileVersion); return Optional.ofNullable(this.serverProfileVersion);
} }


public void setServerProfileVersion(Integer serverProfileVersion) { public void setServerProfileVersion(Integer serverProfileVersion) {
this.serverProfileVersion = serverProfileVersion; this.serverProfileVersion = serverProfileVersion;
} }


public Optional<String> getServerProfileBody() { public Optional<String> getServerProfileBody() {
return Optional.ofNullable(serverProfileBody); return Optional.ofNullable(this.serverProfileBody);
} }


public void setServerProfileBody(String serverProfileBody) { public void setServerProfileBody(String serverProfileBody) {
this.serverProfileBody = serverProfileBody; this.serverProfileBody = serverProfileBody;
} }

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.applicationId == null) ? 0 : this.applicationId.hashCode());
result = prime * result + ((this.credentialsId == null) ? 0 : this.credentialsId.hashCode());
result = prime * result + ((this.endpointId == null) ? 0 : this.endpointId.hashCode());
result = prime * result + ((this.id == null) ? 0 : this.id.hashCode());
result = prime * result + ((this.serverProfileBody == null) ? 0 : this.serverProfileBody.hashCode());
result = prime * result + ((this.serverProfileVersion == null) ? 0 : this.serverProfileVersion.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
EndpointRegistrationInfoDto other = (EndpointRegistrationInfoDto) obj;
if (this.applicationId == null) {
if (other.applicationId != null) {
return false;
}
} else if (!this.applicationId.equals(other.applicationId)) {
return false;
}
if (this.credentialsId == null) {
if (other.credentialsId != null) {
return false;
}
} else if (!this.credentialsId.equals(other.credentialsId)) {
return false;
}
if (this.endpointId == null) {
if (other.endpointId != null) {
return false;
}
} else if (!this.endpointId.equals(other.endpointId)) {
return false;
}
if (this.id == null) {
if (other.id != null) {
return false;
}
} else if (!this.id.equals(other.id)) {
return false;
}
if (this.serverProfileBody == null) {
if (other.serverProfileBody != null) {
return false;
}
} else if (!this.serverProfileBody.equals(other.serverProfileBody)) {
return false;
}
if (this.serverProfileVersion == null) {
if (other.serverProfileVersion != null) {
return false;
}
} else if (!this.serverProfileVersion.equals(other.serverProfileVersion)) {
return false;
}
return true;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("EndpointRegistrationInfoDto [id=");
builder.append(this.id);
builder.append(", applicationId=");
builder.append(this.applicationId);
builder.append(", endpointId=");
builder.append(this.endpointId);
builder.append(", credentialsId=");
builder.append(this.credentialsId);
builder.append(", serverProfileVersion=");
builder.append(this.serverProfileVersion);
builder.append(", serverProfileBody=");
builder.append(this.serverProfileBody);
builder.append("]");
return builder.toString();
}
} }

0 comments on commit 71a0b81

Please sign in to comment.