diff --git a/src/main/java/org/openepics/names/rest/beans/simplified/NameElement.java b/src/main/java/org/openepics/names/rest/beans/simplified/NameElement.java new file mode 100644 index 0000000000000000000000000000000000000000..5817faa1c491d19e50701bc69c85ddb0e0381d07 --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/simplified/NameElement.java @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.rest.beans.simplified; + +import java.io.Serializable; +import java.util.Date; +import java.util.UUID; + +import org.openepics.names.rest.beans.Status; + +/** + * Bean (data transfer object) for communication and (json, xml) serialization. + * Intended for operations that read names. + * + * @author Lars Johansson + */ +public class NameElement extends NameElementCommand implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2716415801117244814L; + + private String systemstructure; + private String devicestructure; + private String name; + private Status status; + private Boolean latest; + private Boolean deleted; + private Date when; + private String who; + + /** + * Public constructor. + */ + public NameElement() { + super(); + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param parentsystemstructure parent system structure uuid + * @param parentdevicestructure parent device structure uuid + * @param index index + * @param description description + * @param comment comment + */ + public NameElement( + UUID uuid, UUID parentsystemstructure, UUID parentdevicestructure, String index, + String description, String comment) { + super(uuid, parentsystemstructure, parentdevicestructure, index, description, comment); + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param parentsystemstructure parent system structure uuid + * @param parentdevicestructure parent device structure uuid + * @param index index + * @param description description + * @param comment comment + * @param systemstructure system structure mnemonic path + * @param devicestructure device structure mnemonic path + * @param name name + * @param status status + * @param latest latest + * @param deleted deleted + * @param when when + * @param who who + */ + public NameElement( + UUID uuid, UUID parentsystemstructure, UUID parentdevicestructure, String index, + String description, String comment, + String systemstructure, String devicestructure, String name, + Status status, Boolean latest, Boolean deleted, + Date when, String who) { + super(); + this.systemstructure = systemstructure; + this.devicestructure = devicestructure; + this.name = name; + this.status = status; + this.latest = latest; + this.deleted = deleted; + this.when = when; + this.who = who; + } + + public String getSystemstructure() { + return systemstructure; + } + public void setSystemstructure(String systemstructure) { + this.systemstructure = systemstructure; + } + public String getDevicestructure() { + return devicestructure; + } + public void setDevicestructure(String devicestructure) { + this.devicestructure = devicestructure; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Status getStatus() { + return status; + } + public void setStatus(Status status) { + this.status = status; + } + public Boolean isLatest() { + return latest; + } + public void setLatest(Boolean latest) { + this.latest = latest; + } + public Boolean isDeleted() { + return deleted; + } + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + public Date getWhen() { + return when; + } + public void setWhen(Date when) { + this.when = when; + } + public String getWho() { + return who; + } + public void setWho(String who) { + this.who = who; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((NameElement) obj); + } + + public boolean equals(NameElement other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getSystemstructure() == null) { + if (other.getSystemstructure() != null) + return false; + } else if (!getSystemstructure().equals(other.getSystemstructure())) + return false; + if (getDevicestructure() == null) { + if (other.getDevicestructure() != null) + return false; + } else if (!getDevicestructure().equals(other.getDevicestructure())) + return false; + if (getName() == null) { + if (other.getName() != null) + return false; + } else if (!getName().equals(other.getName())) + return false; + if (getStatus() == null) { + if (other.getStatus() != null) + return false; + } else if (!getStatus().equals(other.getStatus())) + return false; + if (isLatest() == null) { + if (other.isLatest() != null) + return false; + } else if (!isLatest().equals(other.isLatest())) + return false; + if (isDeleted() == null) { + if (other.isDeleted() != null) + return false; + } else if (!isDeleted().equals(other.isDeleted())) + return false; + if (getWhen() == null) { + if (other.getWhen() != null) + return false; + } else if (!getWhen().equals(other.getWhen())) + return false; + if (getWho() == null) { + if (other.getWho() != null) + return false; + } else if (!getWho().equals(other.getWho())) + return false; + + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"parentsystemstructure\": " + getParentsystemstructure()); + sb.append(", \"parentdevicestructure\": " + getParentdevicestructure()); + sb.append(", \"systemstructure\": " + getSystemstructure()); + sb.append(", \"devicestructure\": " + getDevicestructure()); + sb.append(", \"index\": " + getIndex()); + sb.append(", \"name\": " + getName()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"status\": " + getStatus()); + sb.append(", \"latest\": " + isLatest()); + sb.append(", \"deleted\": " + isDeleted()); + sb.append(", \"when\": " + getWhen()); + sb.append(", \"who\": " + getWho()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + + public String toStringSimple() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"name\": " + getName()); + sb.append(", \"status\": " + getStatus()); + sb.append(", \"latest\": " + isLatest()); + sb.append(", \"deleted\": " + isDeleted()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/rest/beans/simplified/NameElementCommand.java b/src/main/java/org/openepics/names/rest/beans/simplified/NameElementCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..04666a294c72574524e9794f8597f9237a2d3869 --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/simplified/NameElementCommand.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.rest.beans.simplified; + +import java.io.Serializable; +import java.util.UUID; + +/** + * Bean (data transfer object) for communication and (json, xml) serialization. + * Intended for operations that modify names. + * + * @author Lars Johansson + */ +public class NameElementCommand implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3166840982436164399L; + + private UUID uuid; + private UUID parentsystemstructure; + private UUID parentdevicestructure; + private String index; + private String description; + private String comment; + + /** + * Public constructor. + */ + public NameElementCommand() { + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param parentsystemstructure parent system structure uuid + * @param parentdevicestructure parent device structure uuid + * @param index index + * @param description description + * @param comment comment + */ + public NameElementCommand(UUID uuid, UUID parentsystemstructure, UUID parentdevicestructure, String index, + String description, String comment) { + super(); + this.uuid = uuid; + this.parentsystemstructure = parentsystemstructure; + this.parentdevicestructure = parentdevicestructure; + this.index = index; + this.description = description; + this.comment = comment; + } + + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + public UUID getParentsystemstructure() { + return parentsystemstructure; + } + public void setParentsystemstructure(UUID parentsystemstructure) { + this.parentsystemstructure = parentsystemstructure; + } + public UUID getParentdevicestructure() { + return parentdevicestructure; + } + public void setParentdevicestructure(UUID parentdevicestructure) { + this.parentdevicestructure = parentdevicestructure; + } + public String getIndex() { + return index; + } + public void setIndex(String index) { + this.index = index; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((NameElementCommand) obj); + } + + public boolean equals(NameElementCommand other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getUuid() == null) { + if (other.getUuid() != null) + return false; + } else if (!getUuid().equals(other.getUuid())) + return false; + if (getParentsystemstructure() == null) { + if (other.getParentsystemstructure() != null) + return false; + } else if (!getParentsystemstructure().equals(other.getParentsystemstructure())) + return false; + if (getParentdevicestructure() == null) { + if (other.getParentdevicestructure() != null) + return false; + } else if (!getParentdevicestructure().equals(other.getParentdevicestructure())) + return false; + if (getIndex() == null) { + if (other.getIndex() != null) + return false; + } else if (!getIndex().equals(other.getIndex())) + return false; + if (getDescription() == null) { + if (other.getDescription() != null) + return false; + } else if (!getDescription().equals(other.getDescription())) + return false; + if (getComment() == null) { + if (other.getComment() != null) + return false; + } else if (!getComment().equals(other.getComment())) + return false; + + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"parentsystemstructure\": " + getParentsystemstructure()); + sb.append(", \"parentdevicestructure\": " + getParentdevicestructure()); + sb.append(", \"index\": " + getIndex()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/rest/beans/simplified/StructureElement.java b/src/main/java/org/openepics/names/rest/beans/simplified/StructureElement.java new file mode 100644 index 0000000000000000000000000000000000000000..b9c9c06cd710875ad951f2aa05141032854108ad --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/simplified/StructureElement.java @@ -0,0 +1,244 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.rest.beans.simplified; + +import java.io.Serializable; +import java.util.Date; +import java.util.UUID; + +import org.openepics.names.rest.beans.Status; +import org.openepics.names.rest.beans.Type; + +/** + * Bean (data transfer object) for communication and (json, xml) serialization. + * Intended for operations that read structures. + * + * @author Lars Johansson + */ +public class StructureElement extends StructureElementCommand implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 356654987707139728L; + + private String mnemonicpath; + private Integer level; + private Status status; + private Boolean latest; + private Boolean deleted; + private Date when; + private String who; + + /** + * Public constructor. + */ + public StructureElement() { + super(); + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param type type + * @param parent parent + * @param name name + * @param mnemonic mnemonic + * @param description description + * @param comment comment + */ + public StructureElement( + UUID uuid, Type type, UUID parent, String name, String mnemonic, + String description, String comment) { + super(uuid, type, parent, name, mnemonic, description, comment); + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param type type + * @param parent parent + * @param name name + * @param mnemonic mnemonic + * @param description description + * @param comment comment + * @param mnemonicpath mnemonic path + * @param level level + * @param status status + * @param latest latest + * @param deleted deleted + * @param when when + * @param who who + */ + public StructureElement( + UUID uuid, Type type, UUID parent, String name, String mnemonic, + String description, String comment, + String mnemonicpath, Integer level, + Status status, Boolean latest, Boolean deleted, + Date when, String who) { + super(uuid, type, parent, name, mnemonic, description, comment); + this.mnemonicpath = mnemonicpath; + this.level = level; + this.status = status; + this.latest = latest; + this.deleted = deleted; + this.when = when; + this.who = who; + } + + public String getMnemonicpath() { + return mnemonicpath; + } + public void setMnemonicpath(String mnemonicpath) { + this.mnemonicpath = mnemonicpath; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public Status getStatus() { + return status; + } + public void setStatus(Status status) { + this.status = status; + } + public Boolean isLatest() { + return latest; + } + public void setLatest(Boolean latest) { + this.latest = latest; + } + public Boolean isDeleted() { + return deleted; + } + public void setDeleted(Boolean deleted) { + this.deleted = deleted; + } + public Date getWhen() { + return when; + } + public void setWhen(Date when) { + this.when = when; + } + public String getWho() { + return who; + } + public void setWho(String who) { + this.who = who; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((StructureElement) obj); + } + + public boolean equals(StructureElement other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getMnemonicpath() == null) { + if (other.getMnemonicpath() != null) + return false; + } else if (!getMnemonicpath().equals(other.getMnemonicpath())) + return false; + if (getLevel() == null) { + if (other.getLevel() != null) + return false; + } else if (!getLevel().equals(other.getLevel())) + return false; + if (getStatus() == null) { + if (other.getStatus() != null) + return false; + } else if (!getStatus().equals(other.getStatus())) + return false; + if (isLatest() == null) { + if (other.isLatest() != null) + return false; + } else if (!isLatest().equals(other.isLatest())) + return false; + if (isDeleted() == null) { + if (other.isDeleted() != null) + return false; + } else if (!isDeleted().equals(other.isDeleted())) + return false; + if (getWhen() == null) { + if (other.getWhen() != null) + return false; + } else if (!getWhen().equals(other.getWhen())) + return false; + if (getWho() == null) { + if (other.getWho() != null) + return false; + } else if (!getWho().equals(other.getWho())) + return false; + + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"type\": " + getType()); + sb.append(", \"parent_uuid\": " + getParent()); + sb.append(", \"name\": " + getName()); + sb.append(", \"mnemonic\": " + getMnemonic()); + sb.append(", \"mnemonicpath\": " + getMnemonicpath()); + sb.append(", \"level\": " + getLevel()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"status\": " + getStatus()); + sb.append(", \"latest\": " + isLatest()); + sb.append(", \"deleted\": " + isDeleted()); + sb.append(", \"when\": " + getWhen()); + sb.append(", \"who\": " + getWho()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + + public String toStringSimple() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"type\": " + getType()); + sb.append(", \"mnemonic\": " + getMnemonic()); + sb.append(", \"status\": " + getStatus()); + sb.append(", \"latest\": " + isLatest()); + sb.append(", \"deleted\": " + isDeleted()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/rest/beans/simplified/StructureElementCommand.java b/src/main/java/org/openepics/names/rest/beans/simplified/StructureElementCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..9b53a9509f1d19b61e33844c8111c446f7d08d66 --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/simplified/StructureElementCommand.java @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.rest.beans.simplified; + +import java.io.Serializable; +import java.util.UUID; + +import org.openepics.names.rest.beans.Type; + +/** + * Bean (data transfer object) for communication and (json, xml) serialization. + * Intended for operations that modify structures. + * + * @author Lars Johansson + */ +public class StructureElementCommand implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 788979309267676232L; + + private UUID uuid; + private Type type; + private UUID parent; + private String name; + private String mnemonic; + private String description; + private String comment; + + /** + * Public constructor. + */ + public StructureElementCommand() { + }; + + /** + * Public constructor. + * + * @param uuid uuid + * @param type type + * @param parent parent + * @param name name + * @param mnemonic mnemonic + * @param description description + * @param comment comment + */ + public StructureElementCommand( + UUID uuid, Type type, UUID parent, String name, String mnemonic, + String description, String comment) { + super(); + this.uuid = uuid; + this.type = type; + this.parent = parent; + this.name = name; + this.mnemonic = mnemonic; + this.description = description; + this.comment = comment; + } + + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + public Type getType() { + return type; + } + public void setType(Type type) { + this.type = type; + } + public UUID getParent() { + return parent; + } + public void setParent(UUID parent) { + this.parent = parent; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getMnemonic() { + return mnemonic; + } + public void setMnemonic(String mnemonic) { + this.mnemonic = mnemonic; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals((StructureElementCommand) obj); + } + + public boolean equals(StructureElementCommand other) { + if (other == null) + return false; + + if (getUuid() == null) { + if (other.getUuid() != null) + return false; + } else if (!getUuid().equals(other.getUuid())) + return false; + if (getType() == null) { + if (other.getType() != null) + return false; + } else if (!getType().equals(other.getType())) + return false; + if (getParent() == null) { + if (other.getParent() != null) + return false; + } else if (!getParent().equals(other.getParent())) + return false; + if (getName() == null) { + if (other.getName() != null) + return false; + } else if (!getName().equals(other.getName())) + return false; + if (getMnemonic() == null) { + if (other.getMnemonic() != null) + return false; + } else if (!getMnemonic().equals(other.getMnemonic())) + return false; + if (getDescription() == null) { + if (other.getDescription() != null) + return false; + } else if (!getDescription().equals(other.getDescription())) + return false; + if (getComment() == null) { + if (other.getComment() != null) + return false; + } else if (!getComment().equals(other.getComment())) + return false; + + return true; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"type\": " + getType()); + sb.append(", \"parent_uuid\": " + getParent()); + sb.append(", \"name\": " + getName()); + sb.append(", \"mnemonic\": " + getMnemonic()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + +}