com.reprezen.genflow.openapi3.doc.TopMatter Maven / Gradle / Ivy
/**
* Copyright © 2013, 2016 Modelsolv, Inc.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property
* of ModelSolv, Inc. See the file license.html in the root directory of
* this project for further information.
*/
package com.reprezen.genflow.openapi3.doc;
import com.reprezen.genflow.openapi3.doc.DocHelper;
import com.reprezen.genflow.openapi3.doc.HelperHelper;
import com.reprezen.kaizen.oasparser.model3.Contact;
import com.reprezen.kaizen.oasparser.model3.Info;
import com.reprezen.kaizen.oasparser.model3.License;
import com.reprezen.kaizen.oasparser.model3.OpenApi3;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
@SuppressWarnings("all")
public class TopMatter {
@Extension
private DocHelper _docHelper = HelperHelper.getDocHelper();
public CharSequence get(final OpenApi3 model) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("");
_builder.newLine();
_builder.append(" ");
_builder.append("");
_builder.newLine();
_builder.append(" ");
_builder.append("");
Info _info = model.getInfo();
String _title = null;
if (_info!=null) {
_title=_info.getTitle();
}
_builder.append(_title, " ");
_builder.append(" ");
Object _baseUri = this.getBaseUri(model);
_builder.append(_baseUri, " ");
_builder.append("
");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("");
_builder.newLine();
_builder.append(" ");
_builder.append("");
_builder.newLine();
_builder.append(" ");
Info _info_1 = model.getInfo();
String _description = null;
if (_info_1!=null) {
_description=_info_1.getDescription();
}
String _docHtml = null;
if (_description!=null) {
_docHtml=this._docHelper.getDocHtml(_description);
}
_builder.append(_docHtml, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("");
_builder.newLine();
_builder.append(" ");
_builder.append("Version ");
Info _info_2 = model.getInfo();
String _version = null;
if (_info_2!=null) {
_version=_info_2.getVersion();
}
_builder.append(_version, " ");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("Contact ");
CharSequence _contactInfoHtml = this.getContactInfoHtml(model);
_builder.append(_contactInfoHtml, " ");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("Terms of Service ");
Info _info_3 = model.getInfo();
String _termsOfService = null;
if (_info_3!=null) {
_termsOfService=_info_3.getTermsOfService();
}
String _docHtml_1 = this._docHelper.getDocHtml(_termsOfService);
_builder.append(_docHtml_1, " ");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("License ");
CharSequence _licenseInfoHtml = this.getLicenseInfoHtml(model);
_builder.append(_licenseInfoHtml, " ");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("
");
_builder.newLine();
_builder.append(" ");
_builder.append("");
_builder.newLine();
_builder.append("");
_builder.newLine();
return _builder;
}
private Object getBaseUri(final OpenApi3 model) {
return null;
}
private CharSequence getContactInfoHtml(final OpenApi3 model) {
CharSequence _xblockexpression = null;
{
Info _info = model.getInfo();
Contact _contact = null;
if (_info!=null) {
_contact=_info.getContact();
}
final Contact contact = _contact;
CharSequence _xifexpression = null;
if ((contact != null)) {
CharSequence _xblockexpression_1 = null;
{
String _elvis = null;
String _name = contact.getName();
if (_name != null) {
_elvis = _name;
} else {
String _url = contact.getUrl();
_elvis = _url;
}
final String primaryText = _elvis;
String _xifexpression_1 = null;
String _url_1 = contact.getUrl();
boolean _tripleNotEquals = (_url_1 != null);
if (_tripleNotEquals) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("");
_builder.append(primaryText);
_builder.append("");
_xifexpression_1 = _builder.toString();
} else {
_xifexpression_1 = primaryText;
}
final String primary = _xifexpression_1;
String _xifexpression_2 = null;
String _email = contact.getEmail();
boolean _tripleNotEquals_1 = (_email != null);
if (_tripleNotEquals_1) {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("");
String _email_2 = contact.getEmail();
_builder_1.append(_email_2);
_builder_1.append("");
_xifexpression_2 = _builder_1.toString();
}
final String email = _xifexpression_2;
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append(primary);
_builder_2.append(" ");
_builder_2.append(email);
_xblockexpression_1 = _builder_2;
}
_xifexpression = _xblockexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
private CharSequence getLicenseInfoHtml(final OpenApi3 model) {
CharSequence _xblockexpression = null;
{
Info _info = model.getInfo();
License _license = null;
if (_info!=null) {
_license=_info.getLicense();
}
final License license = _license;
CharSequence _xifexpression = null;
if ((license != null)) {
CharSequence _xblockexpression_1 = null;
{
String _elvis = null;
String _name = license.getName();
if (_name != null) {
_elvis = _name;
} else {
String _url = license.getUrl();
_elvis = _url;
}
final String text = _elvis;
CharSequence _xifexpression_1 = null;
String _url_1 = license.getUrl();
boolean _tripleNotEquals = (_url_1 != null);
if (_tripleNotEquals) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("");
_builder.append(text);
_builder.append("");
_xifexpression_1 = _builder;
} else {
_xifexpression_1 = text;
}
_xblockexpression_1 = _xifexpression_1;
}
_xifexpression = _xblockexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy