
se.kth.iss.ug2.Ug2AttributeInformation Maven / Gradle / Ivy
/*
* MIT License
*
* Copyright (c) 2017 Kungliga Tekniska högskolan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package se.kth.iss.ug2;
public class Ug2AttributeInformation {
public Ug2AttributeInformation(String ug2class, String name, String label_en, String label_sv, String description,
boolean uniq, boolean multival, boolean notnull,
String domain, String domainClass, String domainChars, Long domainMin, Long domainMax,
boolean autoCreate, boolean autoDelete, boolean special, boolean pseudo, boolean caseInsensitive) {
this.ug2class = ug2class;
this.name = name;
this.label_en = label_en;
this.label_sv = label_sv;
this.description = description;
this.uniq = uniq;
this.multival = multival;
this.notnull = notnull;
this.domain = domain;
this.domainClass = domainClass;
this.domainChars = domainChars;
this.domainMin = domainMin;
this.domainMax = domainMax;
this.autoCreate = autoCreate;
this.autoDelete = autoDelete;
this.special = special;
this.pseudo = pseudo;
this.caseInsensitive = caseInsensitive;
}
public Ug2AttributeInformation(String ug2class, String name, String label_en, String label_sv) {
this.ug2class = ug2class;
this.name = name;
this.label_en = label_en;
this.label_sv = label_sv;
this.description = null;
this.uniq = false;
this.multival = false;
this.notnull = false;
this.domain = null;
this.domainClass = null;
this.domainChars = null;
this.domainMin = null;
this.domainMax = null;
this.autoCreate = false;
this.autoDelete = false;
this.special = false;
this.pseudo = false;
this.caseInsensitive = false;
}
public String ug2class() {
return ug2class;
}
public String name() {
return name;
}
public String label_en() {
return label_en;
}
public String label_sv() {
return label_sv;
}
public String description() {
return description;
}
public boolean uniq() {
return uniq;
}
public boolean multival() {
return multival;
}
public boolean notnull() {
return notnull;
}
public boolean isMandatory() {
return notnull;
}
public String domain() {
return domain;
}
public String domainChars() {
return domainChars;
}
public String domainClass() {
return domainClass;
}
public Long domainMin() {
return domainMin;
}
public Long domainMax() {
return domainMax;
}
public boolean autoCreate() {
return autoCreate;
}
public boolean autoDelete() {
return autoDelete;
}
public boolean special() {
return special;
}
public boolean pseudo() {
return pseudo;
}
public boolean caseInsensitive() {
return caseInsensitive;
}
public Ug2AttributeInformation addDescription(String description) {
this.description = description;
return this;
}
public Ug2AttributeInformation makeUniq() {
this.uniq = true;
return this;
}
public Ug2AttributeInformation makeMultival() {
this.multival = true;
return this;
}
public Ug2AttributeInformation makeMandatory() {
this.notnull = true;
return this;
}
public Ug2AttributeInformation setDomain(String domain) {
this.domain = domain;
return this;
}
public Ug2AttributeInformation setDomainChars(String domainChars) {
this.domainChars = domainChars;
return this;
}
public Ug2AttributeInformation setDomainClass(String domainClass) {
if (this.domain == null)
this.domain = "class";
this.domainClass = domainClass;
return this;
}
public Ug2AttributeInformation setMin(Long domainMin) {
this.domainMin = domainMin;
return this;
}
public Ug2AttributeInformation setMax(Long domainMax) {
this.domainMax = domainMax;
return this;
}
public Ug2AttributeInformation makeAuto() {
this.autoCreate = true;
this.autoDelete = true;
return this;
}
public Ug2AttributeInformation makeSpecial() {
this.special = true;
return this;
}
public Ug2AttributeInformation makePseudo() {
this.pseudo = true;
return this;
}
public void makeCaseInsensitive() {
this.caseInsensitive = true;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(name + " (");
buf.append("uniq=").append(uniq);
buf.append(", multival=").append(multival);
buf.append(", notnull=").append(notnull);
if (domain != null) {
buf.append(", domain=").append(domain);
}
if (domainClass != null) {
buf.append(", domainClass=").append(domainClass);
}
if (domainChars != null) {
buf.append(", domainChars=").append(domainChars);
}
if (domainMin != null) {
buf.append(", domainMin=").append(domainMin);
}
if (domainMax != null) {
buf.append(", domainMax=").append(domainMax);
}
if (autoCreate) {
buf.append(", autoCreate");
}
if (autoDelete) {
buf.append(", autoDelete");
}
if (special) {
buf.append(", special");
}
if (pseudo) {
buf.append(", pseudo");
}
if (caseInsensitive) {
buf.append(", caseInsensitive");
}
buf.append(")");
if (description != null && description.length() > 0) {
buf.append(" \"").append(description).append("\"");
}
return buf.toString();
}
private final String ug2class;
private final String name;
private final String label_en;
private final String label_sv;
private String description;
private boolean uniq;
private boolean multival;
private boolean notnull;
private String domain;
private String domainClass;
private String domainChars;
private Long domainMin;
private Long domainMax;
private boolean autoCreate;
private boolean autoDelete;
private boolean special;
private boolean pseudo;
private boolean caseInsensitive;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy