Skip to content

Commit

Permalink
#28 - initial commit for database related user management
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehertwig committed Apr 22, 2018
1 parent 1dd93cd commit 31d7d5c
Show file tree
Hide file tree
Showing 109 changed files with 11,155 additions and 3,042 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package de.chandre.admintool.core.ui;

import java.io.Serializable;

/**
* convenient transfer object for error messages
*
* @author André
* @since 1.1.7
*/
public class ATError implements Serializable {
private static final long serialVersionUID = -4972646697107352412L;

private String key;
private String message;

private String field;

public ATError() {
super();
}

public ATError(String key, String message) {
this(key, message, null);
}

public ATError(String key, String message, String field) {
super();
this.key = key;
this.message = message;
this.field = field;
}

public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}

public String getField() {
return field;
}

public void setField(String field) {
this.field = field;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((field == null) ? 0 : field.hashCode());
result = prime * result + ((key == null) ? 0 : key.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;
ATError other = (ATError) obj;
if (field == null) {
if (other.field != null)
return false;
} else if (!field.equals(other.field))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (message == null) {
if (other.message != null)
return false;
} else if (!message.equals(other.message))
return false;
return true;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ATError [key=").append(key).append(", message=").append(message).append(", field=")
.append(field).append("]");
return builder.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.chandre.admintool.core.ui.select2;

import java.util.ArrayList;
import java.util.List;

public class OptionGroupTO extends OptionTO {
private static final long serialVersionUID = 2324648170741736932L;

private String text;
private List<OptionTO> children = new ArrayList<>();;

public OptionGroupTO() {
super();
}
public OptionGroupTO(String text) {
super();
this.text = text;
}

public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public List<OptionTO> getChildren() {
return children;
}
public void setChildren(List<OptionTO> children) {
this.children = children;
}
public void addChild(OptionTO child) {
this.children.add(child);
}

public boolean hasChildren() {
return this.children != null && !this.children.isEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package de.chandre.admintool.core.ui.select2;

import java.io.Serializable;

public class OptionTO implements Serializable {
private static final long serialVersionUID = 6804008394662197234L;

private String id;
private String text;
private boolean selected;
private boolean disabled;

public OptionTO() {
super();
}

public OptionTO(String id, String text) {
this(id, text, false, false);
}
public OptionTO(String id, String text, boolean selected, boolean disabled) {
super();
this.id = id;
this.text = text;
this.selected = selected;
this.disabled = disabled;
}

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OptionTO [id=").append(id).append(", text=").append(text).append(", selected=").append(selected)
.append(", disabled=").append(disabled).append("]");
return builder.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.chandre.admintool.core.ui.select2;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Select2GroupedTO<E extends OptionTO> implements Serializable {
private static final long serialVersionUID = 922341647233302483L;

private List<E> result = new ArrayList<>();;

public List<E> getResult() {
return result;
}

public void setResult(List<E> result) {
this.result = result;
}

public boolean addResult(E option) {
if (option instanceof OptionGroupTO) {
if (OptionGroupTO.class.cast(option).hasChildren()) {
return this.result.add(option);
}
return false;
}
return this.result.add(option);
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Select2TO [result=").append(result).append("]");
return builder.toString();
}


}
Loading

0 comments on commit 31d7d5c

Please sign in to comment.