blob: 5fb0d8f660a75659c3e1221ffb0944bab37f766e [file] [log] [blame]
[comment encoding = UTF-8 /]
[comment
<%--
Copyright (c) 2011, 2012 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v. 1.0 which accompanies this distribution.
The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Sam Padgett - initial API and implementation
Michael Fiedler - adapted for OSLC4J
Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
--%>
/]
[module generateResourceCreatorJsp('http://org.eclipse.lyo/oslc4j/adaptorInterface')]
[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
[template public generateResourceCreatorJsp(aCreationDialog: Dialog)]
[file (resourceCreatorJspFullFileName(aCreationDialog), false, 'UTF-8')]
[let anAdaptorInterface: AdaptorInterface = containingAdaptorInterface(aCreationDialog)]
<!DOCTYPE html>
<%--
Copyright (c) 2011, 2012 IBM Corporation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
and Eclipse Distribution License v. 1.0 which accompanies this distribution.
The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
and the Eclipse Distribution License is available at
http://www.eclipse.org/org/documents/edl-v10.php.
Contributors:
Sam Padgett - initial API and implementation
Michael Fiedler - adapted for OSLC4J
Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
This file is generated by org.eclipse.lyo.oslc4j.codegenerator
--%>
<%--[protected ('"body"')]
TODO: Replace/adjust this default content as necessary.
All manual changes in this "protected" user code area will NOT be overwritten upon subsequent code generations.
To revert to the default generated content, delete all content in this file, and then re-generate.
--%>
<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
<%@page import="java.util.List" %>
[for (aResource: Resource | aCreationDialog.resourceTypes)]
<%@page import="[javaClassFullName(aResource, anAdaptorInterface, null) /]"%>
[/for]
<%@page import="org.eclipse.lyo.oslc4j.core.OSLC4JUtils"%>
<%@page import="javax.ws.rs.core.UriBuilder"%>
<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
<%
String creatorUri = (String) request.getAttribute("creatorUri");
[for (aPathParameter: String | JAXRSPathParameters(aCreationDialog.URI(false)))]
String [aPathParameter/] = (String) request.getAttribute("[aPathParameter/]");
[/for]
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>[aCreationDialog.title/]</title>
<script type="text/javascript" src="<%=UriBuilder.fromUri(OSLC4JUtils.getPublicURI()).path("[delegatedUIJavaScriptsRelativeFileName(anAdaptorInterface)/]").build().toString()%>"></script>
</head>
<body style="padding: 10px;">
<div id="bugzilla-body">
<form id="Create" method="POST" class="enter_bug_form">
<table style="clear: both;">
[if not (aCreationDialog.resourceTypes->size() = 1)]
// TODO Implement code to create the creation form. This method seems to be expected to handle more than a single type of resources.
[else]
[let aResource : Resource = aCreationDialog.resourceTypes->first()]
[comment TODO: This whole way of producing the form should be rethought. Which approach gives the programmer
best possibility to modify the generated stuff. (hiding fields, changing the format, removing fields, etc.)/]
[for (aProperty: ResourceProperty | (aResource.resourceProperties->asSequence())->union(interfaceProperties(aResource)))]
<tr>
<td><%= [javaClassName(aResource)/].[propertyToHtmlForCreationMethodName(aProperty, aResource, aCreationDialog)/](request[commaSeparate(dialogMethodParameterList(aCreationDialog, false), true, false)/])%></td>
</tr>
[/for]
[for (aProperty: ResourceProperty | inheritedProperties(aResource))]
<tr>
<td><%= [javaClassName(aResource)/].[propertyToHtmlForCreationMethodName(aProperty, aResource, null)/](request)%></td>
</tr>
[/for]
[/let]
[/if]
<tr>
<td></td>
<td>
<input type="button"
value="Submit"
onclick="javascript: create( '<%= creatorUri %>' )">
<input type="reset">
</td>
</tr>
</table>
<div style="width: 500px;">
</div>
</form>
<div style="clear: both;"></div>
</div>
</body>
</html>
<%--[/protected]--%>
[/let]
[/file]
[/template]