summaryrefslogtreecommitdiffstats
path: root/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes
diff options
context:
space:
mode:
Diffstat (limited to 'winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes')
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/FileMeta.java110
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/TypeWithShortName.java60
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/IdNames.java30
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/AdminId.java55
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/ConstraintTypesId.java26
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/NamespacesId.java26
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanLanguagesId.java26
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanTypesId.java26
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/TypesId.java22
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/ArtifactTemplateDirectoryId.java28
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/SelfServiceMetaDataId.java24
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/VisualAppearanceId.java28
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataItem.java56
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataWithOptGroups.java52
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2OptGroup.java65
-rw-r--r--winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/package-info.java17
16 files changed, 651 insertions, 0 deletions
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/FileMeta.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/FileMeta.java
new file mode 100644
index 0000000..bf25ae7
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/FileMeta.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes;
+
+import java.io.IOException;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.io.FilenameUtils;
+import org.eclipse.winery.common.RepositoryFileReference;
+import org.eclipse.winery.repository.Constants;
+import org.eclipse.winery.repository.Prefs;
+import org.eclipse.winery.repository.Utils;
+import org.eclipse.winery.repository.backend.Repository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * based on
+ * https://github.com/blueimp/jQuery-File-Upload/wiki/Google-App-Engine-Java
+ *
+ * The getters are named according to the requirements of the template in
+ * jquery-file-upload-full.jsp
+ */
+@XmlRootElement
+public class FileMeta {
+
+ private static final Logger logger = LoggerFactory.getLogger(FileMeta.class);
+
+ String name;
+ long size;
+ String url;
+ String deleteUrl;
+ String deleteType = "DELETE";
+ String thumbnailUrl;
+
+
+ public String getName() {
+ return this.name;
+ }
+
+ public long getSize() {
+ return this.size;
+ }
+
+ public String getUrl() {
+ return this.url;
+ }
+
+ public String getDeleteUrl() {
+ return this.deleteUrl;
+ }
+
+ public String getDeleteType() {
+ return this.deleteType;
+ }
+
+ public String getThumbnailUrl() {
+ return this.thumbnailUrl;
+ }
+
+ public FileMeta(String filename, long size, String url, String thumbnailUrl) {
+ this.name = filename;
+ this.size = size;
+ this.url = url;
+ this.thumbnailUrl = thumbnailUrl;
+ this.deleteUrl = url;
+ }
+
+ public FileMeta(RepositoryFileReference ref) {
+ this.name = ref.getFileName();
+ try {
+ this.size = Repository.INSTANCE.getSize(ref);
+ } catch (IOException e) {
+ FileMeta.logger.error(e.getMessage(), e);
+ this.size = 0;
+ }
+ this.url = Utils.getAbsoluteURL(ref);
+ this.deleteUrl = this.url;
+ this.thumbnailUrl = Prefs.INSTANCE.getResourcePath() + Constants.PATH_MIMETYPEIMAGES + FilenameUtils.getExtension(this.name) + Constants.SUFFIX_MIMETYPEIMAGES;
+ }
+
+ /**
+ * @param ref the reference to get information from
+ * @param URLprefix the string which should be prepended the actual URL.
+ * Including the "/"
+ */
+ public FileMeta(RepositoryFileReference ref, String URLprefix) {
+ this(ref);
+ this.url = URLprefix + this.url;
+ }
+
+ /**
+ * The constructor is used for JAX-B only. Therefore, the warning "unused"
+ * is suppressed
+ */
+ @SuppressWarnings("unused")
+ private FileMeta() {
+ }
+
+} \ No newline at end of file
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/TypeWithShortName.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/TypeWithShortName.java
new file mode 100644
index 0000000..eae201d
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/TypeWithShortName.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes;
+
+public class TypeWithShortName implements Comparable<TypeWithShortName> {
+
+ private final String type;
+ // we could have used "URI" as type here but this seems to be unnecessary
+ // overhead
+
+ // this is a kind of ID
+ private final String shortName;
+
+
+ public TypeWithShortName(String type, String shortName) {
+ this.type = type;
+ this.shortName = shortName;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public String getShortName() {
+ return this.shortName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof TypeWithShortName) {
+ return ((TypeWithShortName) o).getType().equals(this.getType());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return this.getType().hashCode();
+ }
+
+ @Override
+ public int compareTo(TypeWithShortName o) {
+ int c = this.getShortName().compareTo(o.getShortName());
+ if (c == 0) {
+ // not sure if this will ever happen
+ c = this.getType().compareTo(o.getType());
+ }
+ return c;
+ }
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/IdNames.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/IdNames.java
new file mode 100644
index 0000000..f06c917
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/IdNames.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids;
+
+/**
+ * This class is the brother of {@link org.eclipse.winery.common.id.IdNames}
+ *
+ * It includes all id names used additionally in the local ids
+ */
+public class IdNames {
+
+ // the files belonging to one artifact template are nested in the sub
+ // directory "files"
+ public static final String ARTIFACTTEMPLATEDIRECTORY = "files";
+
+ public static final String CONSTRAINTTYPES = "constrainttypes";
+ public static final String NAMESPACES = "namespaces";
+ public static final String PLANLANGUAGES = "planlanguages";
+ public static final String PLANTYPES = "plantypes";
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/AdminId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/AdminId.java
new file mode 100644
index 0000000..3a31b05
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/AdminId.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.GenericId;
+import org.eclipse.winery.common.ids.XMLId;
+
+/**
+ * The Id for the single admin resource holding administrative things such as
+ * the prefixes of namespaces
+ */
+public abstract class AdminId extends GenericId {
+
+ protected AdminId(XMLId xmlId) {
+ super(xmlId);
+ }
+
+ @Override
+ public int compareTo(GenericId o) {
+ if (o instanceof AdminId) {
+ return this.getXmlId().compareTo(o.getXmlId());
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ @Override
+ public GenericId getParent() {
+ return null;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof AdminId) {
+ return this.getXmlId().equals(((AdminId) obj).getXmlId());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return this.getXmlId().hashCode();
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/ConstraintTypesId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/ConstraintTypesId.java
new file mode 100644
index 0000000..210a2c7
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/ConstraintTypesId.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.repository.datatypes.ids.IdNames;
+
+public class ConstraintTypesId extends TypesId {
+
+ private final static XMLId xmlId = new XMLId(IdNames.CONSTRAINTTYPES, false);
+
+
+ public ConstraintTypesId() {
+ super(ConstraintTypesId.xmlId);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/NamespacesId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/NamespacesId.java
new file mode 100644
index 0000000..4bdb233
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/NamespacesId.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.repository.datatypes.ids.IdNames;
+
+public class NamespacesId extends AdminId {
+
+ private final static XMLId xmlId = new XMLId(IdNames.NAMESPACES, false);
+
+
+ public NamespacesId() {
+ super(NamespacesId.xmlId);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanLanguagesId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanLanguagesId.java
new file mode 100644
index 0000000..7ebfb7d
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanLanguagesId.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.repository.datatypes.ids.IdNames;
+
+public class PlanLanguagesId extends TypesId {
+
+ private final static XMLId xmlId = new XMLId(IdNames.PLANLANGUAGES, false);
+
+
+ public PlanLanguagesId() {
+ super(PlanLanguagesId.xmlId);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanTypesId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanTypesId.java
new file mode 100644
index 0000000..e44cd2b
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/PlanTypesId.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.repository.datatypes.ids.IdNames;
+
+public class PlanTypesId extends TypesId {
+
+ private final static XMLId xmlId = new XMLId(IdNames.PLANTYPES, false);
+
+
+ public PlanTypesId() {
+ super(PlanTypesId.xmlId);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/TypesId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/TypesId.java
new file mode 100644
index 0000000..db40780
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/admin/TypesId.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.admin;
+
+import org.eclipse.winery.common.ids.XMLId;
+
+public abstract class TypesId extends AdminId {
+
+ protected TypesId(XMLId xmlId) {
+ super(xmlId);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/ArtifactTemplateDirectoryId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/ArtifactTemplateDirectoryId.java
new file mode 100644
index 0000000..cce2d53
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/ArtifactTemplateDirectoryId.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.elements;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.common.ids.definitions.ArtifactTemplateId;
+import org.eclipse.winery.common.ids.elements.TOSCAElementId;
+import org.eclipse.winery.repository.datatypes.ids.IdNames;
+
+public class ArtifactTemplateDirectoryId extends TOSCAElementId {
+
+ private final static XMLId xmlID = new XMLId(IdNames.ARTIFACTTEMPLATEDIRECTORY, false);
+
+
+ public ArtifactTemplateDirectoryId(ArtifactTemplateId parent) {
+ super(parent, ArtifactTemplateDirectoryId.xmlID);
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/SelfServiceMetaDataId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/SelfServiceMetaDataId.java
new file mode 100644
index 0000000..6bd5db8
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/SelfServiceMetaDataId.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.elements;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.common.ids.definitions.ServiceTemplateId;
+import org.eclipse.winery.common.ids.elements.TOSCAElementId;
+
+public class SelfServiceMetaDataId extends TOSCAElementId {
+
+ public SelfServiceMetaDataId(ServiceTemplateId parent) {
+ super(parent, new XMLId("SELFSERVICE-Metadata", true));
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/VisualAppearanceId.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/VisualAppearanceId.java
new file mode 100644
index 0000000..9b7784f
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/ids/elements/VisualAppearanceId.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2013 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.ids.elements;
+
+import org.eclipse.winery.common.ids.XMLId;
+import org.eclipse.winery.common.ids.definitions.TopologyGraphElementEntityTypeId;
+import org.eclipse.winery.common.ids.elements.TOSCAElementId;
+
+/**
+ * ID for a pseudo-TOSCA-Element holding the data for the visual appearance
+ * (e.g., icons for node types)
+ */
+public class VisualAppearanceId extends TOSCAElementId {
+
+ public VisualAppearanceId(TopologyGraphElementEntityTypeId parent) {
+ super(parent, new XMLId("appearance", true));
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataItem.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataItem.java
new file mode 100644
index 0000000..1b8fb9a
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataItem.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.select2;
+
+/**
+ * Models a data item for select2. In case optgroups have to be returned, use
+ * this element in a TreeMap
+ */
+public class Select2DataItem implements Comparable<Select2DataItem> {
+
+ private final String id;
+ private final String text;
+
+
+ public Select2DataItem(String id, String text) {
+ this.id = id;
+ this.text = text;
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getText() {
+ return this.text;
+ }
+
+ /**
+ * Sort order is based on text
+ */
+ @Override
+ public int compareTo(Select2DataItem o) {
+ return this.getText().compareTo(o.getText());
+ }
+
+ /**
+ * Equality is checked at id level
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Select2DataItem)) {
+ return false;
+ }
+ return this.getId().equals(((Select2DataItem) o).getId());
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataWithOptGroups.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataWithOptGroups.java
new file mode 100644
index 0000000..50e5ecd
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2DataWithOptGroups.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2015 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.select2;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class Select2DataWithOptGroups {
+
+ Map<String, Select2OptGroup> idx = new HashMap<>();
+
+
+ /**
+ * Add an item to a group
+ *
+ * @param group the group
+ * @param id the id of the item
+ * @param text the text of the item {@inheritDoc}
+ */
+ public void add(String group, String id, String text) {
+ Select2OptGroup optGroup = this.idx.get(group);
+ if (optGroup == null) {
+ optGroup = new Select2OptGroup(group);
+ this.idx.put(group, optGroup);
+ }
+
+ Select2DataItem item = new Select2DataItem(id, text);
+ optGroup.addItem(item);
+ }
+
+ public SortedSet<Select2OptGroup> asSortedSet() {
+ // convert the index to the real result
+ SortedSet<Select2OptGroup> res = new TreeSet<>();
+ for (Select2OptGroup optGroup : this.idx.values()) {
+ res.add(optGroup);
+ }
+
+ return res;
+
+ }
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2OptGroup.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2OptGroup.java
new file mode 100644
index 0000000..7a7a88b
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/Select2OptGroup.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.winery.repository.datatypes.select2;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public class Select2OptGroup implements Comparable<Select2OptGroup> {
+
+ private final String text;
+ private final SortedSet<Select2DataItem> children;
+
+
+ public Select2OptGroup(String text) {
+ this.text = text;
+ this.children = new TreeSet<Select2DataItem>();
+ }
+
+ public String getText() {
+ return this.text;
+ }
+
+ /**
+ * Returns the internal SortedSet for data items.
+ */
+ public SortedSet<Select2DataItem> getChildren() {
+ return this.children;
+ }
+
+ public void addItem(Select2DataItem item) {
+ this.children.add(item);
+ }
+
+ /**
+ * Quick hack to test Select2OptGroups for equality. Only the text is
+ * tested, not the contained children. This might cause issues later, but
+ * currently not.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Select2OptGroup)) {
+ return false;
+ }
+ return this.text.equals(((Select2OptGroup) o).text);
+ }
+
+ /**
+ * Quick hack to compare Select2OptGroups. Only the text is compared, not
+ * the contained children. This might cause issues later, but currently not.
+ */
+ @Override
+ public int compareTo(Select2OptGroup o) {
+ return this.getText().compareTo(o.getText());
+ }
+
+}
diff --git a/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/package-info.java b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/package-info.java
new file mode 100644
index 0000000..ee1fbaf
--- /dev/null
+++ b/winery/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/datatypes/select2/package-info.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2014 University of Stuttgart.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and the Apache License 2.0 which both accompany this distribution,
+ * and are available at http://www.eclipse.org/legal/epl-v10.html
+ * and http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Contributors:
+ * Oliver Kopp - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * This package collects all datatypes required to generate valid select2 data objects
+ * {@see http://ivaynberg.github.io/select2/}: Example Hierarchical Data
+ */
+package org.eclipse.winery.repository.datatypes.select2; \ No newline at end of file