<% /******************************************************************************* * Copyright (c) 2013 Pascal Hirmer. * 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: * Pascal Hirmer - initial API and implementation *******************************************************************************/ %> <%@tag language="java" pageEncoding="UTF-8" description="This tag is used to render Node and Relationship Templates for selection in a dialog."%> <%-- attributes for the NodeTemplate selection --%> <%@attribute name="templateURL" type="java.lang.String"%> <%@attribute name="topologyName" type="java.lang.String"%> <%@attribute name="topologyNamespace" type="java.lang.String"%> <%@attribute name="repositoryURL" type="java.lang.String" %> <%@attribute name="stName" type="java.lang.String" %> <%@attribute name="choices" type="java.util.Map>>"%> <%@tag import="java.util.ArrayList"%> <%@tag import="java.util.HashMap"%> <%@tag import="java.util.List"%> <%@tag import="java.util.Map"%> <%@tag import="java.util.UUID"%> <%@tag import="javax.xml.namespace.QName"%> <%@tag import="org.eclipse.winery.model.tosca.TEntityTemplate"%> <%@tag import="org.eclipse.winery.model.tosca.TNodeTemplate"%> <%@tag import="org.eclipse.winery.model.tosca.TRelationshipTemplate"%> <%@tag import="org.eclipse.winery.model.tosca.TRelationshipType"%> <%@tag import="org.eclipse.winery.repository.client.WineryRepositoryClientFactory"%> <%@tag import="org.eclipse.winery.repository.client.IWineryRepositoryClient"%> <%@tag import="org.eclipse.winery.common.Util"%> <%@taglib prefix="ntrq" tagdir="/WEB-INF/tags/common/templates/nodetemplates/reqscaps" %> <%@taglib prefix="nt" tagdir="/WEB-INF/tags/common/templates/nodetemplates" %>

There are several possible Node Templates to be inserted.
Please select your desired NodeTemplate:

<% // the pixel distance between the displayed NodeTemplates final int NODE_TEMPLATE_DISTANCE = 150; IWineryRepositoryClient client = WineryRepositoryClientFactory.getWineryRepositoryClient(); client.addRepository(repositoryURL); // instantiate variables Map idMap = new HashMap(); List possibleConnections = new ArrayList(); String sourceId = ""; String randomId = ""; String id = ""; // a counter used for an ID int counter = 0; // used for the position of the NodeTemplate in the EditorArea int topCounter = 0; %> <% // render a topology for every choice to be displayed in the dialog for (TNodeTemplate nt: choices.keySet()) { Map> entityTemplates = choices.get(nt); for (TNodeTemplate choice: entityTemplates.keySet()) { id = "choice" + Integer.toString(counter); %>
<% topCounter = 0; %> <% topCounter = topCounter + NODE_TEMPLATE_DISTANCE; %>
<% if (entityTemplates.get(choice).size() > 1) { %>

There are several possible Relationship Templates to connect the Node Templates <%=nt.getName()%> and <%=choice.getName()%>. Please choose at least one connection:

<%} for (TEntityTemplate rtChoice: entityTemplates.get(choice)) { TRelationshipTemplate connector = (TRelationshipTemplate) rtChoice; if (entityTemplates.get(choice).size() > 1) { %> <%=connector.getName()%>
<% } sourceId = ((TNodeTemplate) connector.getSourceElement().getRef()).getId(); String targetId = ((TNodeTemplate) connector.getTargetElement().getRef()).getId(); QName type = connector.getType(); String visualSourceId = idMap.get(sourceId); String visualTargetId = idMap.get(targetId); %> <%} %>
<% counter++; } }%>


Press this button if you want to continue the completion manually.