diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml new file mode 100644 index 0000000000..f0f9ebe8c5 --- /dev/null +++ b/scm-webapp/pom.xml @@ -0,0 +1,115 @@ + + + + 4.0.0 + + sonia.scm + scm-webapp + war + 1.0-SNAPSHOT + scm-webapp Java EE 6 Webapp + + + + java.net2 + Repository hosting the jee6 artifacts + http://download.java.net/maven/2 + + + + + + + javax + javaee-web-api + 6.0 + provided + + + + junit + junit + 4.8.1 + test + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.1 + + 1.6 + 1.6 + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-war-plugin + 2.1-beta-1 + + false + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.3 + + ${project.build.sourceEncoding} + + + + + scm-webapp + + + + + + + endorsed + + + sun.boot.class.path + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.1 + + + ${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path} + + + + + javax + javaee-endorsed-api + 6.0 + + + + + + + + + + + UTF-8 + + + + diff --git a/scm-webapp/src/main/java/sonia/scm/Group.java b/scm-webapp/src/main/java/sonia/scm/Group.java new file mode 100644 index 0000000000..8582d32cb0 --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/Group.java @@ -0,0 +1,158 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + + +package sonia.scm; + +//~--- non-JDK imports -------------------------------------------------------- + +import sonia.scm.util.Util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** + * + * @author Sebastian Sdorra + */ +public class Group implements Serializable +{ + + /** Field description */ + private static final long serialVersionUID = 1752369869345245872L; + + //~--- constructors --------------------------------------------------------- + + /** + * Constructs ... + * + * + * @param name + */ + public Group(String name) + { + this.name = name; + this.members = new ArrayList(); + } + + /** + * Constructs ... + * + * + * @param name + * @param members + */ + public Group(String name, List members) + { + this.name = name; + this.members = members; + } + + //~--- methods -------------------------------------------------------------- + + /** + * Method description + * + * + * @param member + * + * @return + */ + public boolean add(String member) + { + return members.add(member); + } + + /** + * Method description + * + */ + public void clear() + { + members.clear(); + } + + /** + * Method description + * + * + * @param member + * + * @return + */ + public boolean remove(String member) + { + return members.remove(member); + } + + /** + * Method description + * + * + * @return + */ + @Override + public String toString() + { + StringBuilder msg = new StringBuilder(); + + msg.append(name).append(" ["); + + if (Util.isNotEmpty(members)) + { + Iterator it = members.iterator(); + + while (it.hasNext()) + { + msg.append(it.next()); + + if (it.hasNext()) + { + msg.append(","); + } + } + } + + return msg.append("]").toString(); + } + + //~--- get methods ---------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public List getMembers() + { + return members; + } + + /** + * Method description + * + * + * @return + */ + public String getName() + { + return name; + } + + //~--- fields --------------------------------------------------------------- + + /** Field description */ + private List members; + + /** Field description */ + private String name; +} diff --git a/scm-webapp/src/main/java/sonia/scm/util/Util.java b/scm-webapp/src/main/java/sonia/scm/util/Util.java new file mode 100644 index 0000000000..0074c85374 --- /dev/null +++ b/scm-webapp/src/main/java/sonia/scm/util/Util.java @@ -0,0 +1,98 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + + + +package sonia.scm.util; + +//~--- JDK imports ------------------------------------------------------------ + +import java.util.Collection; + +/** + * + * @author Sebastian Sdorra + */ +public class Util +{ + + /** + * Method description + * + * + * @param value + * + * @return + */ + public static boolean isEmpty(String value) + { + return (value == null) || (value.trim().length() == 0); + } + + /** + * Method description + * + * + * @param collection + * + * @return + */ + public static boolean isEmpty(Collection collection) + { + return (collection == null) || collection.isEmpty(); + } + + /** + * Method description + * + * + * @param array + * + * @return + */ + public static boolean isEmpty(Object[] array) + { + return (array == null) || (array.length == 0); + } + + /** + * Method description + * + * + * @param value + * + * @return + */ + public static boolean isNotEmpty(String value) + { + return (value != null) && (value.trim().length() > 0); + } + + /** + * Method description + * + * + * @param collection + * + * @return + */ + public static boolean isNotEmpty(Collection collection) + { + return (collection != null) &&!collection.isEmpty(); + } + + /** + * Method description + * + * + * @param array + * + * @return + */ + public static boolean isNotEmpty(Object[] array) + { + return (array != null) && (array.length > 0); + } +} diff --git a/scm-webapp/src/main/webapp/WEB-INF/web.xml b/scm-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..6ea7250574 --- /dev/null +++ b/scm-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,13 @@ + + + + + + 30 + + + + diff --git a/scm-webapp/src/main/webapp/index.jsp b/scm-webapp/src/main/webapp/index.jsp new file mode 100644 index 0000000000..ab292c3479 --- /dev/null +++ b/scm-webapp/src/main/webapp/index.jsp @@ -0,0 +1,13 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + JSP Page + + +

Hello World!

+ +