From: Andreas Kohlbecker Date: Fri, 23 Jan 2015 11:40:19 +0000 (+0000) Subject: activating the swagger rest service documentation by reverting the revertion of the... X-Git-Tag: cdmlib-parent-3.5.0~150 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/commitdiff_plain/30936368abb578e9d78422d39e824eb356b3f69b activating the swagger rest service documentation by reverting the revertion of the premature committed experimental branch (swagger) svn: r21387, git: be528c1edf --- diff --git a/.gitattributes b/.gitattributes index 65ca60b6a5..3e306a44c8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -707,7 +707,9 @@ cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/NamespacesElement.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/PartialAdapter.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/TDWGNamespacePrefixMapper.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/UUIDAdapter.java -text +cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmAssignableTypeFilter.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmBaseType.java -text +cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmTypeScanner.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/ICdmCacher.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Address.java -text cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/AgentBase.java -text @@ -1129,6 +1131,7 @@ cdmlib-model/src/main/resources/update/update_term_r2.4.2.1-r2.4.2.2.mysql.sql - cdmlib-model/src/test/java/eu/etaxonomy/cdm/aspectj/PropertyChangeTest.java -text cdmlib-model/src/test/java/eu/etaxonomy/cdm/datagenerator/TaxonGenerator.java -text cdmlib-model/src/test/java/eu/etaxonomy/cdm/hibernate/BigDecimalUserTypeTest.java -text +cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/CdmTypeScannerTest.java -text cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/DatabaseInitialiser.java -text cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/agent/AgentValidationTest.java -text cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/agent/InstitutionalMembershipTest.java -text @@ -1781,8 +1784,8 @@ cdmlib-remote-webapp/ide/eclipse/cdmlib-remote[!!-~]-[!!-~]remote[!!-~]debug[!!- cdmlib-remote-webapp/ide/eclipse/cdmlib-remote-webapp[!!-~]-[!!-~]profile.launch -text cdmlib-remote-webapp/ide/eclipse/cdmlib-remote-webapp[!!-~]-[!!-~]run.launch -text cdmlib-remote-webapp/pom.xml -text +cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/CdmSpringMVCConfig.java -text cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/PreloadedBeans.java -text -cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/SpringMVCConfig.java -text cdmlib-remote-webapp/src/main/resources/log4j.properties -text cdmlib-remote-webapp/src/main/webapp/WEB-INF/applicationContext.views.xml -text cdmlib-remote-webapp/src/main/webapp/WEB-INF/applicationContext.xml -text @@ -1815,6 +1818,31 @@ cdmlib-remote-webapp/src/main/webapp/css/jquery-ui/images/ui-icons_888888_256x24 cdmlib-remote-webapp/src/main/webapp/css/jquery-ui/images/ui-icons_cd0a0a_256x240.png -text cdmlib-remote-webapp/src/main/webapp/css/jquery-ui/jquery-ui-1.8.23.custom.css -text cdmlib-remote-webapp/src/main/webapp/csv/csvExport.jsp -text +cdmlib-remote-webapp/src/main/webapp/doc/css/cdm.css -text +cdmlib-remote-webapp/src/main/webapp/doc/css/reset.css -text +cdmlib-remote-webapp/src/main/webapp/doc/css/screen.css -text +cdmlib-remote-webapp/src/main/webapp/doc/images/explorer_icons.png -text svneol=unset#unset +cdmlib-remote-webapp/src/main/webapp/doc/images/logo_small.png -text svneol=unset#unset +cdmlib-remote-webapp/src/main/webapp/doc/images/pet_store_api.png -text svneol=unset#unset +cdmlib-remote-webapp/src/main/webapp/doc/images/throbber.gif -text svneol=unset#unset +cdmlib-remote-webapp/src/main/webapp/doc/images/wordnik_api.png -text svneol=unset#unset +cdmlib-remote-webapp/src/main/webapp/doc/index.html -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/backbone-min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/handlebars-1.0.0.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/highlight.7.3.pack.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/jquery-1.8.0.min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/jquery.ba-bbq.min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/jquery.slideto.min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/jquery.wiggle.min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/shred.bundle.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/shred/content.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/swagger-oauth.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/swagger.js -text +cdmlib-remote-webapp/src/main/webapp/doc/lib/underscore-min.js -text +cdmlib-remote-webapp/src/main/webapp/doc/o2c.html -text +cdmlib-remote-webapp/src/main/webapp/doc/swagger-ui.js -text +cdmlib-remote-webapp/src/main/webapp/doc/swagger-ui.min.js -text +cdmlib-remote-webapp/src/main/webapp/images/logo_edit.png -text svneol=unset#unset cdmlib-remote-webapp/src/main/webapp/index.html -text cdmlib-remote-webapp/src/main/webapp/js/cdm_ws_progress.js -text cdmlib-remote-webapp/src/main/webapp/js/csv_export.js -text diff --git a/cdmlib-io/pom.xml b/cdmlib-io/pom.xml index b279dbf0e8..043318929a 100644 --- a/cdmlib-io/pom.xml +++ b/cdmlib-io/pom.xml @@ -1,137 +1,141 @@ - - - eu.etaxonomy - cdmlib-parent + + + eu.etaxonomy + cdmlib-parent 3.4.1-SNAPSHOT - ../pom.xml - + ../pom.xml + - 4.0.0 - cdmlib-io - CDM Import/Export - The import-export package for EDIT's cdmLibrary - - scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-io/ - scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-io/ - http://dev.e-taxonomy.eu/trac/browser/trunk/cdmlib/cdmlib-io/ - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.2 - - - - test-jar - - - - - - - - - eu.etaxonomy - cdmlib-persistence - test-jar - test - ${project.version} - - - eu.etaxonomy - cdmlib-ext - - - org.unitils - unitils-core - test - - - org.unitils - unitils-database - - - commons-dbcp - commons-dbcp - - - test - - - org.unitils - unitils-dbmaintainer - test - - - org.unitils - unitils-dbunit - test - - - org.unitils - unitils-easymock - test - - - org.unitils - unitils-mock - test - - - org.unitils - unitils-inject - test - - - org.unitils - unitils-orm - - - javax.persistence - persistence-api - - - test - - - org.unitils - unitils-spring - test - - - org.dbunit - dbunit - - - com.carrotsearch - junit-benchmarks - test - - - xmlunit - xmlunit - - - org.apache.poi - poi - - - org.springframework - org.springframework.oxm - - - identificationKeyAPI - identificationKeyAPI - + 4.0.0 + cdmlib-io + CDM Import/Export + The import-export package for EDIT's cdmLibrary + + scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-io/ + scm:svn:http://dev.e-taxonomy.eu/svn/trunk/cdmlib/cdmlib-io/ + http://dev.e-taxonomy.eu/trac/browser/trunk/cdmlib/cdmlib-io/ + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + + + test-jar + + + + + + + + + eu.etaxonomy + cdmlib-persistence + test-jar + test + ${project.version} + + + eu.etaxonomy + cdmlib-ext + + + com.google.guava + guava + + + org.unitils + unitils-core + test + + + org.unitils + unitils-database + + + commons-dbcp + commons-dbcp + + + test + + + org.unitils + unitils-dbmaintainer + test + + + org.unitils + unitils-dbunit + test + + + org.unitils + unitils-easymock + test + + + org.unitils + unitils-mock + test + + + org.unitils + unitils-inject + test + + + org.unitils + unitils-orm + + + javax.persistence + persistence-api + + + test + + + org.unitils + unitils-spring + test + + + org.dbunit + dbunit + + + com.carrotsearch + junit-benchmarks + test + + + xmlunit + xmlunit + + + org.apache.poi + poi + + + org.springframework + org.springframework.oxm + + + identificationKeyAPI + identificationKeyAPI + org.apache.jena jena-tdb - + diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmAssignableTypeFilter.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmAssignableTypeFilter.java new file mode 100644 index 0000000000..72e7c7fcb1 --- /dev/null +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmAssignableTypeFilter.java @@ -0,0 +1,71 @@ +// $Id$ +/** +* Copyright (C) 2014 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ +package eu.etaxonomy.cdm.model; + +import org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter; + +/** + * Special implementation for the cdm which allows to also match + * abstract base types and interfaces in eu.etaxonomy.cdm.model. + * + * + * @author a.kohlbecker + * @date Jul 31, 2014 + * + */ +public class CdmAssignableTypeFilter extends AbstractTypeHierarchyTraversingFilter { + + + private final Class targetType; + + /** + * @param targetType + */ + public CdmAssignableTypeFilter(Class targetType, boolean considerInherited, boolean considerInterfaces) { + super(considerInherited, considerInterfaces); + this.targetType = targetType; + } + + @Override + protected boolean matchClassName(String className) { + return this.targetType.getName().equals(className); + } + + @Override + protected Boolean matchSuperClass(String superClassName) { + return matchTargetType(superClassName); + } + + @Override + protected Boolean matchInterface(String interfaceName) { + return matchTargetType(interfaceName); + } + + + protected Boolean matchTargetType(String typeName) { + if (this.targetType.getName().equals(typeName)) { + return true; + } + else if (Object.class.getName().equals(typeName)) { + return Boolean.FALSE; + } + else if (typeName.startsWith("eu.etaxonomy.cdm.model.")) { + try { + Class clazz = getClass().getClassLoader().loadClass(typeName); + return Boolean.valueOf(this.targetType.isAssignableFrom(clazz)); + } + catch (ClassNotFoundException ex) { + // Class not found - can't determine a match that way. + } + } + return null; + } + +} diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmBaseType.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmBaseType.java index f79e1e9cc2..2b1b375e87 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmBaseType.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmBaseType.java @@ -10,17 +10,17 @@ package eu.etaxonomy.cdm.model; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; -import org.springframework.core.type.filter.AssignableTypeFilter; +import javax.persistence.Entity; + +import org.springframework.core.type.filter.AnnotationTypeFilter; import eu.etaxonomy.cdm.model.common.CdmBase; +import eu.etaxonomy.cdm.model.common.IdentifiableEntity; import eu.etaxonomy.cdm.model.description.DescriptionBase; import eu.etaxonomy.cdm.model.description.DescriptionElementBase; import eu.etaxonomy.cdm.model.name.TaxonNameBase; @@ -47,7 +47,7 @@ public enum CdmBaseType { private Class baseClass; - private Set> subClasses; + private Collection> subClasses; static Map, Class> subTypeToBaseTypeMap; @@ -70,26 +70,24 @@ public enum CdmBaseType { } } - public static Set> subclassesFor(Class clazz) throws ClassNotFoundException{ + private Collection> subclassesFor(Class clazz) throws ClassNotFoundException{ - Set> subClasses = new HashSet>(); - ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true); - provider.addIncludeFilter(new AssignableTypeFilter(clazz)); + boolean includeAbstract = true; + boolean includeInterfaces = false; - // scan only in eu.etaxonomy.cdm.model - Set components = provider.findCandidateComponents("eu/etaxonomy/cdm/model"); - for (BeanDefinition component : components) - { - subClasses.add((Class) Class.forName(component.getBeanClassName())); - } - return subClasses; + CdmTypeScanner scanner = new CdmTypeScanner(includeAbstract, includeInterfaces); + scanner.addIncludeFilter(new CdmAssignableTypeFilter(IdentifiableEntity.class, includeAbstract, includeInterfaces)); + scanner.addIncludeFilter(new AnnotationTypeFilter(Entity.class)); + Collection> classes = scanner.scanTypesIn("eu/etaxonomy/cdm/model"); + + return classes; } public static Class baseTypeFor(Class cdmType){ return subTypeToBaseTypeMap.get(cdmType); } - public Set> getSubClasses() { + public Collection> getSubClasses() { return subClasses; } diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmTypeScanner.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmTypeScanner.java new file mode 100644 index 0000000000..3148436c8b --- /dev/null +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/CdmTypeScanner.java @@ -0,0 +1,69 @@ +// $Id$ +/** +* Copyright (C) 2014 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ +package eu.etaxonomy.cdm.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.util.ClassUtils; + +/** + * @author a.kohlbecker + * @date Jul 31, 2014 + * + */ +public class CdmTypeScanner extends ClassPathScanningCandidateComponentProvider { + + static final String defaultBasePackage = "eu/etaxonomy/cdm/"; + + boolean includeAbstract; + boolean includeInterfaces; + + public CdmTypeScanner(boolean considerAbstract, boolean considerInterfaces) { + super(false); + this.includeAbstract = considerAbstract; + this.includeInterfaces = considerInterfaces; + } + + public final Collection> scanTypesIn(String basePackage) { + String _basePackage = basePackage == null ? defaultBasePackage : basePackage; + List> classes = new ArrayList>(); + for (BeanDefinition candidate : findCandidateComponents(_basePackage)) { + Class cls = ClassUtils.resolveClassName(candidate.getBeanClassName(), + ClassUtils.getDefaultClassLoader()); + classes.add(cls); + } + return classes; + } + + /** + * Determine whether the given bean definition qualifies as candidate. + *

The special implementation checks whether the class is concrete + * or abstract or an interface. The latter two conditions depend on + * the state of the two boolean fields includeAnstract, includeInterface. + * + * @param beanDefinition the bean definition to check + * @return whether the bean definition qualifies as a candidate component + */ + @Override + protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) { + return (beanDefinition.getMetadata().isIndependent() + && (beanDefinition.getMetadata().isConcrete() + || (includeAbstract && beanDefinition.getMetadata().isAbstract()) + || (includeInterfaces && beanDefinition.getMetadata().isInterface()) + ) + ); + } + + } \ No newline at end of file diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java index 4b46b648c7..9327bf4a2e 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java @@ -24,6 +24,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.codehaus.jackson.annotate.JsonIgnore; import org.hibernate.annotations.Type; import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Field; @@ -55,506 +56,512 @@ import eu.etaxonomy.cdm.strategy.cache.common.TimePeriodPartialFormatter; @XmlRootElement(name = "TimePeriod") @Embeddable public class TimePeriod implements Cloneable, Serializable { - private static final long serialVersionUID = 3405969418194981401L; - private static final Logger logger = Logger.getLogger(TimePeriod.class); - public static final DateTimeFieldType MONTH_TYPE = DateTimeFieldType.monthOfYear(); - public static final DateTimeFieldType YEAR_TYPE = DateTimeFieldType.year(); - public static final DateTimeFieldType DAY_TYPE = DateTimeFieldType.dayOfMonth(); - - @XmlElement(name = "Start") - @XmlJavaTypeAdapter(value = PartialAdapter.class) - @Type(type="partialUserType") - @Field(analyze = Analyze.NO) - @FieldBridge(impl = PartialBridge.class) - private Partial start; - - @XmlElement(name = "End") - @XmlJavaTypeAdapter(value = PartialAdapter.class) - @Type(type="partialUserType") - @Field(analyze = Analyze.NO) - @FieldBridge(impl = PartialBridge.class) - private Partial end; - - - @XmlElement(name = "FreeText") - private String freeText; + private static final long serialVersionUID = 3405969418194981401L; + private static final Logger logger = Logger.getLogger(TimePeriod.class); + public static final DateTimeFieldType MONTH_TYPE = DateTimeFieldType.monthOfYear(); + public static final DateTimeFieldType YEAR_TYPE = DateTimeFieldType.year(); + public static final DateTimeFieldType DAY_TYPE = DateTimeFieldType.dayOfMonth(); + + @XmlElement(name = "Start") + @XmlJavaTypeAdapter(value = PartialAdapter.class) + @Type(type="partialUserType") + @Field(analyze = Analyze.NO) + @FieldBridge(impl = PartialBridge.class) + @JsonIgnore // currently used for swagger model scanner + private Partial start; + + @XmlElement(name = "End") + @XmlJavaTypeAdapter(value = PartialAdapter.class) + @Type(type="partialUserType") + @Field(analyze = Analyze.NO) + @FieldBridge(impl = PartialBridge.class) + @JsonIgnore // currently used for swagger model scanner + private Partial end; + + + @XmlElement(name = "FreeText") + private String freeText; // ********************** FACTORY METHODS **************************/ - /** - * Factory method - * @return - */ - public static TimePeriod NewInstance(){ - return new TimePeriod(); - } - - - /** - * Factory method - * @return - */ - public static TimePeriod NewInstance(Partial startDate){ - return new TimePeriod(startDate); - } - - - /** - * Factory method - * @return - */ - public static TimePeriod NewInstance(Partial startDate, Partial endDate){ - return new TimePeriod(startDate, endDate); - } - - - /** - * Factory method - * @return - */ - public static TimePeriod NewInstance(Integer year){ - Integer endYear = null; - return NewInstance(year, endYear); - } - - /** - * Factory method - * @return - */ - public static TimePeriod NewInstance(Integer startYear, Integer endYear){ - Partial startDate = null; - Partial endDate = null; - if (startYear != null){ - startDate = new Partial().with(YEAR_TYPE, startYear); - } - if (endYear != null){ - endDate = new Partial().with(YEAR_TYPE, endYear); - } - return new TimePeriod(startDate, endDate); - } - - - - /** - * Factory method to create a TimePeriod from a Calendar. The Calendar is stored as the starting instant. - * @return - */ - public static TimePeriod NewInstance(Calendar startCalendar){ - return NewInstance(startCalendar, null); - } - - /** - * Factory method to create a TimePeriod from a ReadableInstant(e.g. DateTime). - * The ReadableInstant is stored as the starting instant. - * @return - */ - public static TimePeriod NewInstance(ReadableInstant readableInstant){ - return NewInstance(readableInstant, null); - } - - /** - * Factory method to create a TimePeriod from a starting and an ending Calendar - * @return - */ - public static TimePeriod NewInstance(Calendar startCalendar, Calendar endCalendar){ - Partial startDate = null; - Partial endDate = null; - if (startCalendar != null){ - startDate = calendarToPartial(startCalendar); - } - if (endCalendar != null){ - endDate = calendarToPartial(endCalendar); - } - return new TimePeriod(startDate, endDate); - } - - /** - * Factory method to create a TimePeriod from a starting and an ending Date - * @return TimePeriod - */ - public static TimePeriod NewInstance(Date startDate, Date endDate){ - //TODO conversion untested, implemented according to http://www.roseindia.net/java/java-conversion/datetocalender.shtml - Calendar calStart = null; - Calendar calEnd = null; - if (startDate != null){ - calStart = Calendar.getInstance(); - calStart.setTime(startDate); - } - if (endDate != null){ - calEnd = Calendar.getInstance(); - calEnd.setTime(endDate); - } - return NewInstance(calStart, calEnd); - } - - - /** - * Factory method to create a TimePeriod from a starting and an ending ReadableInstant(e.g. DateTime) - * @return - */ - public static TimePeriod NewInstance(ReadableInstant startInstant, ReadableInstant endInstant){ - Partial startDate = null; - Partial endDate = null; - if (startInstant != null){ - startDate = readableInstantToPartial(startInstant); - } - if (endInstant != null){ - endDate = readableInstantToPartial(endInstant); - } - return new TimePeriod(startDate, endDate); - } - -//****************** CONVERTERS ******************/ - - /** - * Transforms a {@link Calendar} into a Partial - * @param calendar - * @return - */ - public static Partial calendarToPartial(Calendar calendar){ - LocalDate ld = new LocalDate(calendar); - Partial partial = new Partial(ld); - return partial; - } - - /** - * Transforms a {@link ReadableInstant} into a Partial - * @param calendar - * @return - */ - public static Partial readableInstantToPartial(ReadableInstant readableInstant){ - DateTime dt = readableInstant.toInstant().toDateTime(); - LocalDate ld = dt.toLocalDate(); - Partial partial = new Partial(ld); - return partial; - } - - - public static Integer getPartialValue(Partial partial, DateTimeFieldType type){ - if (partial == null || ! partial.isSupported(type)){ - return null; - }else{ - return partial.get(type); - } - } - - - -//*********************** CONSTRUCTOR *********************************/ - - /** - * Constructor - */ - protected TimePeriod() { - super(); - } - public TimePeriod(Partial startDate) { - start=startDate; - } - public TimePeriod(Partial startDate, Partial endDate) { - start=startDate; - end=endDate; - } + /** + * Factory method + * @return + */ + public static TimePeriod NewInstance(){ + return new TimePeriod(); + } + + + /** + * Factory method + * @return + */ + public static TimePeriod NewInstance(Partial startDate){ + return new TimePeriod(startDate); + } + + + /** + * Factory method + * @return + */ + public static TimePeriod NewInstance(Partial startDate, Partial endDate){ + return new TimePeriod(startDate, endDate); + } + + + /** + * Factory method + * @return + */ + public static TimePeriod NewInstance(Integer year){ + Integer endYear = null; + return NewInstance(year, endYear); + } + + /** + * Factory method + * @return + */ + public static TimePeriod NewInstance(Integer startYear, Integer endYear){ + Partial startDate = null; + Partial endDate = null; + if (startYear != null){ + startDate = new Partial().with(YEAR_TYPE, startYear); + } + if (endYear != null){ + endDate = new Partial().with(YEAR_TYPE, endYear); + } + return new TimePeriod(startDate, endDate); + } + + + + /** + * Factory method to create a TimePeriod from a Calendar. The Calendar is stored as the starting instant. + * @return + */ + public static TimePeriod NewInstance(Calendar startCalendar){ + return NewInstance(startCalendar, null); + } + + /** + * Factory method to create a TimePeriod from a ReadableInstant(e.g. DateTime). + * The ReadableInstant is stored as the starting instant. + * @return + */ + public static TimePeriod NewInstance(ReadableInstant readableInstant){ + return NewInstance(readableInstant, null); + } + + /** + * Factory method to create a TimePeriod from a starting and an ending Calendar + * @return + */ + public static TimePeriod NewInstance(Calendar startCalendar, Calendar endCalendar){ + Partial startDate = null; + Partial endDate = null; + if (startCalendar != null){ + startDate = calendarToPartial(startCalendar); + } + if (endCalendar != null){ + endDate = calendarToPartial(endCalendar); + } + return new TimePeriod(startDate, endDate); + } + + /** + * Factory method to create a TimePeriod from a starting and an ending Date + * @return TimePeriod + */ + public static TimePeriod NewInstance(Date startDate, Date endDate){ + //TODO conversion untested, implemented according to http://www.roseindia.net/java/java-conversion/datetocalender.shtml + Calendar calStart = null; + Calendar calEnd = null; + if (startDate != null){ + calStart = Calendar.getInstance(); + calStart.setTime(startDate); + } + if (endDate != null){ + calEnd = Calendar.getInstance(); + calEnd.setTime(endDate); + } + return NewInstance(calStart, calEnd); + } + + + /** + * Factory method to create a TimePeriod from a starting and an ending ReadableInstant(e.g. DateTime) + * @return + */ + public static TimePeriod NewInstance(ReadableInstant startInstant, ReadableInstant endInstant){ + Partial startDate = null; + Partial endDate = null; + if (startInstant != null){ + startDate = readableInstantToPartial(startInstant); + } + if (endInstant != null){ + endDate = readableInstantToPartial(endInstant); + } + return new TimePeriod(startDate, endDate); + } + +//****************** CONVERTERS ******************/ + + /** + * Transforms a {@link Calendar} into a Partial + * @param calendar + * @return + */ + public static Partial calendarToPartial(Calendar calendar){ + LocalDate ld = new LocalDate(calendar); + Partial partial = new Partial(ld); + return partial; + } + + /** + * Transforms a {@link ReadableInstant} into a Partial + * @param calendar + * @return + */ + public static Partial readableInstantToPartial(ReadableInstant readableInstant){ + DateTime dt = readableInstant.toInstant().toDateTime(); + LocalDate ld = dt.toLocalDate(); + Partial partial = new Partial(ld); + return partial; + } + + + public static Integer getPartialValue(Partial partial, DateTimeFieldType type){ + if (partial == null || ! partial.isSupported(type)){ + return null; + }else{ + return partial.get(type); + } + } + + + +//*********************** CONSTRUCTOR *********************************/ + + /** + * Constructor + */ + protected TimePeriod() { + super(); + } + public TimePeriod(Partial startDate) { + start=startDate; + } + public TimePeriod(Partial startDate, Partial endDate) { + start=startDate; + end=endDate; + } //******************* GETTER / SETTER ************************************/ - public Partial getStart() { - return start; - } - - public void setStart(Partial start) { - this.start = start; - } - - public Partial getEnd() { - return end; - } - - public void setEnd(Partial end) { - this.end = end; - } - - /** - * For time periods that need to store more information than the one - * that can be stored in start and end. - * If free text is not null {@link #toString()} will always - * return the free text value. - *
Use {@link #toString()} for public use. - * @return the freeText - */ - public String getFreeText() { - return freeText; - } - - - /** - * Use {@link #parseSingleDate(String)} for public use. - * @param freeText the freeText to set - */ - public void setFreeText(String freeText) { - this.freeText = freeText; - } - - + + @JsonIgnore // currently used for swagger model scanner + public Partial getStart() { + return start; + } + + public void setStart(Partial start) { + this.start = start; + } + + + @JsonIgnore // currently used for swagger model scanner + public Partial getEnd() { + return end; + } + + public void setEnd(Partial end) { + this.end = end; + } + + /** + * For time periods that need to store more information than the one + * that can be stored in start and end. + * If free text is not null {@link #toString()} will always + * return the free text value. + *
Use {@link #toString()} for public use. + * @return the freeText + */ + public String getFreeText() { + return freeText; + } + + + /** + * Use {@link #parseSingleDate(String)} for public use. + * @param freeText the freeText to set + */ + public void setFreeText(String freeText) { + this.freeText = freeText; + } + + //******************* Transient METHODS ************************************/ - /** - * True, if this time period represents a period not a single point in time. - * This is by definition, that the time period has a start and an end value, - * and both have a year value that is not null - * @return - */ - @Transient - public boolean isPeriod(){ - if (getStartYear() != null && getEndYear() != null ){ - return true; - }else{ - return false; - } - } - - /** - * True, if there is no start date and no end date and no freetext representation exists. - * @return - */ - @Transient - public boolean isEmpty(){ - if (StringUtils.isBlank(this.getFreeText()) && start == null && end == null ){ - return true; - }else{ - return false; - } - } - - - - @Transient - public String getYear(){ - String result = ""; - if (getStartYear() != null){ - result += String.valueOf(getStartYear()); - if (getEndYear() != null){ - result += "-" + String.valueOf(getEndYear()); - } - }else{ - if (getEndYear() != null){ - result += String.valueOf(getEndYear()); - } - } - return result; - } - - @Transient - public Integer getStartYear(){ - return getPartialValue(start, YEAR_TYPE); - } - - @Transient - public Integer getStartMonth(){ - return getPartialValue(start, MONTH_TYPE); - } - - @Transient - public Integer getStartDay(){ - return getPartialValue(start, DAY_TYPE); - } - - @Transient - public Integer getEndYear(){ - return getPartialValue(end, YEAR_TYPE); - } - - @Transient - public Integer getEndMonth(){ - return getPartialValue(end, MONTH_TYPE); - } - - @Transient - public Integer getEndDay(){ - return getPartialValue(end, DAY_TYPE); - } - - public TimePeriod setStartYear(Integer year){ - return setStartField(year, YEAR_TYPE); - } - - public TimePeriod setStartMonth(Integer month) throws IndexOutOfBoundsException{ - return setStartField(month, MONTH_TYPE); - } - - public TimePeriod setStartDay(Integer day) throws IndexOutOfBoundsException{ - return setStartField(day, DAY_TYPE); - } - - public TimePeriod setEndYear(Integer year){ - return setEndField(year, YEAR_TYPE); - } - - public TimePeriod setEndMonth(Integer month) throws IndexOutOfBoundsException{ - return setEndField(month, MONTH_TYPE); - } - - public TimePeriod setEndDay(Integer day) throws IndexOutOfBoundsException{ - return setEndField(day, DAY_TYPE); - } - - public static Partial setPartialField(Partial partial, Integer value, DateTimeFieldType type) - throws IndexOutOfBoundsException{ - if (partial == null){ - partial = new Partial(); - } - if (value == null){ - return partial.without(type); - }else{ - checkFieldValues(value, type, partial); - return partial.with(type, value); - } - } - - @Transient - private TimePeriod setStartField(Integer value, DateTimeFieldType type) - throws IndexOutOfBoundsException{ - start = setPartialField(start, value, type); - return this; - } - - @Transient - private TimePeriod setEndField(Integer value, DateTimeFieldType type) - throws IndexOutOfBoundsException{ - end = setPartialField(end, value, type); - return this; - } - -// ******************************** internal methods *******************************/ - - /** - * Throws an IndexOutOfBoundsException if the value does not have a valid value - * (e.g. month > 12, month < 1, day > 31, etc.) - * @param value - * @param type - * @throws IndexOutOfBoundsException - */ - private static void checkFieldValues(Integer value, DateTimeFieldType type, Partial partial) - throws IndexOutOfBoundsException{ - int max = 9999999; - if (type.equals(MONTH_TYPE)){ - max = 12; - } - if (type.equals(DAY_TYPE)){ - max = 31; - Integer month = null; - if (partial.isSupported(MONTH_TYPE)){ - month = partial.get(MONTH_TYPE); - } - if (month != null){ - if (month == 2){ - max = 29; - }else if (month == 4 ||month == 6 ||month == 9 ||month == 11){ - max = 30; - } - } - } - if ( (value < 1 || value > max) ){ - throw new IndexOutOfBoundsException("Value must be between 1 and " + max); - } - } - - private void initStart(){ - if (start == null){ - start = new Partial(); - } - } - - private void initEnd(){ - if (end == null){ - end = new Partial(); - } - } + /** + * True, if this time period represents a period not a single point in time. + * This is by definition, that the time period has a start and an end value, + * and both have a year value that is not null + * @return + */ + @Transient + public boolean isPeriod(){ + if (getStartYear() != null && getEndYear() != null ){ + return true; + }else{ + return false; + } + } + + /** + * True, if there is no start date and no end date and no freetext representation exists. + * @return + */ + @Transient + public boolean isEmpty(){ + if (StringUtils.isBlank(this.getFreeText()) && start == null && end == null ){ + return true; + }else{ + return false; + } + } + + + + @Transient + public String getYear(){ + String result = ""; + if (getStartYear() != null){ + result += String.valueOf(getStartYear()); + if (getEndYear() != null){ + result += "-" + String.valueOf(getEndYear()); + } + }else{ + if (getEndYear() != null){ + result += String.valueOf(getEndYear()); + } + } + return result; + } + + @Transient + public Integer getStartYear(){ + return getPartialValue(start, YEAR_TYPE); + } + + @Transient + public Integer getStartMonth(){ + return getPartialValue(start, MONTH_TYPE); + } + + @Transient + public Integer getStartDay(){ + return getPartialValue(start, DAY_TYPE); + } + + @Transient + public Integer getEndYear(){ + return getPartialValue(end, YEAR_TYPE); + } + + @Transient + public Integer getEndMonth(){ + return getPartialValue(end, MONTH_TYPE); + } + + @Transient + public Integer getEndDay(){ + return getPartialValue(end, DAY_TYPE); + } + + public TimePeriod setStartYear(Integer year){ + return setStartField(year, YEAR_TYPE); + } + + public TimePeriod setStartMonth(Integer month) throws IndexOutOfBoundsException{ + return setStartField(month, MONTH_TYPE); + } + + public TimePeriod setStartDay(Integer day) throws IndexOutOfBoundsException{ + return setStartField(day, DAY_TYPE); + } + + public TimePeriod setEndYear(Integer year){ + return setEndField(year, YEAR_TYPE); + } + + public TimePeriod setEndMonth(Integer month) throws IndexOutOfBoundsException{ + return setEndField(month, MONTH_TYPE); + } + + public TimePeriod setEndDay(Integer day) throws IndexOutOfBoundsException{ + return setEndField(day, DAY_TYPE); + } + + public static Partial setPartialField(Partial partial, Integer value, DateTimeFieldType type) + throws IndexOutOfBoundsException{ + if (partial == null){ + partial = new Partial(); + } + if (value == null){ + return partial.without(type); + }else{ + checkFieldValues(value, type, partial); + return partial.with(type, value); + } + } + + @Transient + private TimePeriod setStartField(Integer value, DateTimeFieldType type) + throws IndexOutOfBoundsException{ + start = setPartialField(start, value, type); + return this; + } + + @Transient + private TimePeriod setEndField(Integer value, DateTimeFieldType type) + throws IndexOutOfBoundsException{ + end = setPartialField(end, value, type); + return this; + } + +// ******************************** internal methods *******************************/ + + /** + * Throws an IndexOutOfBoundsException if the value does not have a valid value + * (e.g. month > 12, month < 1, day > 31, etc.) + * @param value + * @param type + * @throws IndexOutOfBoundsException + */ + private static void checkFieldValues(Integer value, DateTimeFieldType type, Partial partial) + throws IndexOutOfBoundsException{ + int max = 9999999; + if (type.equals(MONTH_TYPE)){ + max = 12; + } + if (type.equals(DAY_TYPE)){ + max = 31; + Integer month = null; + if (partial.isSupported(MONTH_TYPE)){ + month = partial.get(MONTH_TYPE); + } + if (month != null){ + if (month == 2){ + max = 29; + }else if (month == 4 ||month == 6 ||month == 9 ||month == 11){ + max = 30; + } + } + } + if ( (value < 1 || value > max) ){ + throw new IndexOutOfBoundsException("Value must be between 1 and " + max); + } + } + + private void initStart(){ + if (start == null){ + start = new Partial(); + } + } + + private void initEnd(){ + if (end == null){ + end = new Partial(); + } + } //**************************** to String **************************************** - /** - * Returns the {@link #getFreeText()} value if free text is not null. - * Otherwise the concatenation of start and end is returned. - * - * @see java.lang.Object#toString() - */ - @Override + /** + * Returns the {@link #getFreeText()} value if free text is not null. + * Otherwise the concatenation of start and end is returned. + * + * @see java.lang.Object#toString() + */ + @Override public String toString(){ - String result = null; - DateTimeFormatter formatter = TimePeriodPartialFormatter.NewInstance(); - if ( StringUtils.isNotBlank(this.getFreeText())){ - result = this.getFreeText(); - }else{ - String strStart = start != null ? start.toString(formatter): null; - String strEnd = end != null ? end.toString(formatter): null; - result = CdmUtils.concat("-", strStart, strEnd); - } - return result; - } + String result = null; + DateTimeFormatter formatter = TimePeriodPartialFormatter.NewInstance(); + if ( StringUtils.isNotBlank(this.getFreeText())){ + result = this.getFreeText(); + }else{ + String strStart = start != null ? start.toString(formatter): null; + String strEnd = end != null ? end.toString(formatter): null; + result = CdmUtils.concat("-", strStart, strEnd); + } + return result; + } //*********** EQUALS **********************************/ - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (obj == null){ - return false; - } - if (! (obj instanceof TimePeriod)){ - return false; - } - TimePeriod that = (TimePeriod)obj; - - if (! CdmUtils.nullSafeEqual(this.start, that.start)){ - return false; - } - if (! CdmUtils.nullSafeEqual(this.end, that.end)){ - return false; - } - if (! CdmUtils.nullSafeEqual(this.freeText, that.freeText)){ - return false; - } - return true; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - int hashCode = 7; - hashCode = 29*hashCode + - (start== null? 33: start.hashCode()) + - (end== null? 39: end.hashCode()) + - (freeText== null? 41: freeText.hashCode()); - return super.hashCode(); - } + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (obj == null){ + return false; + } + if (! (obj instanceof TimePeriod)){ + return false; + } + TimePeriod that = (TimePeriod)obj; + + if (! CdmUtils.nullSafeEqual(this.start, that.start)){ + return false; + } + if (! CdmUtils.nullSafeEqual(this.end, that.end)){ + return false; + } + if (! CdmUtils.nullSafeEqual(this.freeText, that.freeText)){ + return false; + } + return true; + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + int hashCode = 7; + hashCode = 29*hashCode + + (start== null? 33: start.hashCode()) + + (end== null? 39: end.hashCode()) + + (freeText== null? 41: freeText.hashCode()); + return super.hashCode(); + } //*********** CLONE **********************************/ - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - @Override - public Object clone() { - try { - TimePeriod result = (TimePeriod)super.clone(); - result.setStart(this.start); //DateTime is immutable - result.setEnd(this.end); - result.setFreeText(this.freeText); - return result; - } catch (CloneNotSupportedException e) { - logger.warn("Clone not supported exception. Should never occurr !!"); - return null; - } - } + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + @Override + public Object clone() { + try { + TimePeriod result = (TimePeriod)super.clone(); + result.setStart(this.start); //DateTime is immutable + result.setEnd(this.end); + result.setFreeText(this.freeText); + return result; + } catch (CloneNotSupportedException e) { + logger.warn("Clone not supported exception. Should never occurr !!"); + return null; + } + } } \ No newline at end of file diff --git a/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/CdmTypeScannerTest.java b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/CdmTypeScannerTest.java new file mode 100644 index 0000000000..d58e95b02c --- /dev/null +++ b/cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/CdmTypeScannerTest.java @@ -0,0 +1,44 @@ +// $Id$ +/** +* Copyright (C) 2014 EDIT +* European Distributed Institute of Taxonomy +* http://www.e-taxonomy.eu +* +* The contents of this file are subject to the Mozilla Public License Version 1.1 +* See LICENSE.TXT at the top of this package for the full license terms. +*/ +package eu.etaxonomy.cdm.model; + +import static org.junit.Assert.assertTrue; + +import java.util.Collection; + +import org.junit.Test; + +import eu.etaxonomy.cdm.model.common.CdmBase; +import eu.etaxonomy.cdm.model.common.IdentifiableEntity; +import eu.etaxonomy.cdm.model.description.DescriptionBase; +import eu.etaxonomy.cdm.model.description.TaxonDescription; + +/** + * @author a.kohlbecker + * @date Jul 31, 2014 + * + */ +public class CdmTypeScannerTest { + + @Test + public void testCdmModelTypes() throws ClassNotFoundException { + + boolean includeAbstract = true; + boolean includeInterfaces = false; + + CdmTypeScanner scanner = new CdmTypeScanner(includeAbstract, includeInterfaces); + + scanner.addIncludeFilter(new CdmAssignableTypeFilter(IdentifiableEntity.class, includeAbstract, includeInterfaces)); + + Collection> classes = scanner.scanTypesIn("eu/etaxonomy/cdm/model"); + assertTrue(classes.contains(TaxonDescription.class)); + assertTrue("abstract base classes are missing", classes.contains(DescriptionBase.class)); + } +} diff --git a/cdmlib-remote-webapp/pom.xml b/cdmlib-remote-webapp/pom.xml index 8f1910e505..97b9ebef30 100644 --- a/cdmlib-remote-webapp/pom.xml +++ b/cdmlib-remote-webapp/pom.xml @@ -16,6 +16,7 @@ UTF-8 + 2.2.3 @@ -127,8 +128,30 @@ org.hibernate hibernate-c3p0 - + + + com.mangofactory + swagger-springmvc + 0.8.5 + + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + junit junit test @@ -138,7 +161,6 @@ yjp-controller-api-redist test - diff --git a/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/SpringMVCConfig.java b/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/CdmSpringMVCConfig.java similarity index 68% rename from cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/SpringMVCConfig.java rename to cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/CdmSpringMVCConfig.java index c5e1b516df..21eee4eede 100644 --- a/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/SpringMVCConfig.java +++ b/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/CdmSpringMVCConfig.java @@ -11,15 +11,21 @@ package eu.etaxonomy.cdm.remote.config; import java.util.ArrayList; +import java.util.Collection; import java.util.List; +import javax.persistence.Entity; import javax.servlet.ServletContext; +import org.apache.log4j.Logger; +import org.hibernate.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.Import; +import org.springframework.core.type.filter.AnnotationTypeFilter; import org.springframework.http.MediaType; import org.springframework.util.PathMatcher; import org.springframework.web.accept.ContentNegotiationManager; @@ -33,6 +39,16 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; import org.springframework.web.servlet.view.XmlViewResolver; +import com.mangofactory.swagger.configuration.SpringSwaggerConfig; +import com.mangofactory.swagger.plugin.EnableSwagger; +import com.mangofactory.swagger.plugin.SwaggerSpringMvcPlugin; +import com.wordnik.swagger.converter.ModelConverters; +import com.wordnik.swagger.converter.OverrideConverter; +import com.wordnik.swagger.model.ApiInfo; + +import eu.etaxonomy.cdm.model.CdmAssignableTypeFilter; +import eu.etaxonomy.cdm.model.CdmTypeScanner; +import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.remote.controller.interceptor.LocaleContextHandlerInterceptor; import eu.etaxonomy.cdm.remote.controller.util.CdmAntPathMatcher; import eu.etaxonomy.cdm.remote.view.PatternViewResolver; @@ -43,24 +59,25 @@ import eu.etaxonomy.cdm.remote.view.PatternViewResolver; * */ //@EnableWebMvc do not add this since we are overriding WebMvcConfigurationSupport directly, see requestMappingHandlerMapping() +@EnableSwagger @Configuration @Import(value={PreloadedBeans.class}) @ComponentScan(basePackages = { "eu.etaxonomy.cdm.remote.l10n", "eu.etaxonomy.cdm.remote.controller", "eu.etaxonomy.cdm.remote.service", - "eu.etaxonomy.cdm.remote.config" + "eu.etaxonomy.cdm.remote.config", } ) -//@EnableSwagger -public class SpringMVCConfig extends WebMvcConfigurationSupport { - +public class CdmSpringMVCConfig extends WebMvcConfigurationSupport { /** * turn caching off FOR DEBUGING ONLY !!!! */ private static final boolean XML_VIEW_CACHING = true; + public static final Logger logger = Logger.getLogger(CdmSpringMVCConfig.class); + @Autowired protected ServletContext servletContext; @@ -69,7 +86,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { private LocaleContextHandlerInterceptor localeContextHandlerInterceptor; -// private SpringSwaggerConfig springSwaggerConfig; + private SpringSwaggerConfig springSwaggerConfig; // ========================== JSP ================================= // public static final String[] WEB_JAR_RESOURCE_PATTERNS = {"css/", "images/", "lib/", "swagger-ui.js"}; @@ -96,6 +113,12 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { // } // ====================================================================== + public CdmSpringMVCConfig() { + super(); + logger.debug("contructor"); + + } + @Bean public PathMatcher pathMatcher(){ return new CdmAntPathMatcher(); @@ -103,6 +126,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { @Override @Bean + @DependsOn({"swaggerSpringMvcPlugin"}) public RequestMappingHandlerMapping requestMappingHandlerMapping() { /* NOTE: this override is the only reason why this class * needs to extends WebMvcConfigurationSupport. We may be able to @@ -112,10 +136,13 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { */ RequestMappingHandlerMapping handlerMapping = super.requestMappingHandlerMapping(); handlerMapping.setPathMatcher(pathMatcher()); + + logger.debug("requestMappingHandlerMapping"); return handlerMapping; } @Bean + @DependsOn({"swaggerSpringMvcPlugin"}) // swaggerSpringMvcPlugin and swaggerGlobalSettings must be loaded earlier public XmlViewResolver getOaiXmlViewResolver() { XmlViewResolver resolver = new XmlViewResolver(); resolver.setOrder(1); @@ -132,6 +159,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { protected void addInterceptors(InterceptorRegistry registry) { // TODO does it work? registry.addInterceptor(localeContextHandlerInterceptor); + logger.debug("addInterceptors"); } @@ -141,6 +169,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { // the Servlet container's "default" servlet, since the DispatcherServlet is mapped to "/" // so static content ad welcome files are handled by the default servlet configurer.enable(); + logger.debug("configureDefaultServletHandling"); } @Override @@ -154,6 +183,8 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { .mediaType("rdf", MediaType.APPLICATION_XML) .mediaType("rdfxml", MediaType.APPLICATION_XML) .mediaType("json", MediaType.APPLICATION_JSON); + + logger.debug("configureContentNegotiation"); } /** @@ -161,6 +192,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { * the ContentNegotiationManager created by the configurer (see previous method). */ @Bean + @DependsOn({"swaggerSpringMvcPlugin"}) public ViewResolver contentNegotiatingViewResolver(ContentNegotiationManager manager) { List resolvers = new ArrayList(); @@ -173,6 +205,7 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { resolver.setOrder(2); resolver.setContentNegotiationManager(manager); resolver.setViewResolvers(resolvers); + logger.debug("contentNegotiatingViewResolver"); return resolver; } @@ -184,42 +217,75 @@ public class SpringMVCConfig extends WebMvcConfigurationSupport { return resolver; } - // -------- Swagger configuration ------------ // /** * Required to autowire SpringSwaggerConfig - * / + */ @Autowired public void setSpringSwaggerConfig(SpringSwaggerConfig springSwaggerConfig) { this.springSwaggerConfig = springSwaggerConfig; + logger.debug("setSpringSwaggerConfig"); } /** * Every SwaggerSpringMvcPlugin bean is picked up by the swagger-mvc framework - allowing for multiple * swagger groups i.e. same code base multiple swagger resource listings. - * / - @Bean - public SwaggerSpringMvcPlugin customImplementation(){ - // includePatterns: If not supplied a single pattern ".*?" is used by SwaggerSpringMvcPlugin - // which matches anything and hence all RequestMappings. Here we define it explicitly - return new SwaggerSpringMvcPlugin(this.springSwaggerConfig) - .apiInfo(apiInfo()). - includePatterns(".*?"); + */ + @Bean(name="swaggerSpringMvcPlugin") + public SwaggerSpringMvcPlugin swaggerSpringMvcPlugin(){ + // fully skip the creation of cdm model documentation + // since it will be too excessive to scan the huge cdm model + // which in fact has cycles. + + String emptyJSON = "{}"; + OverrideConverter sessionConverter = new OverrideConverter(); + + //TODO failes to convert json to model + // "org.json4s.package$MappingException: Did not find value + // which can be converted into java.lang.String" + sessionConverter.add(Session.class.getName(), emptyJSON); + + ModelConverters.addConverter(sessionConverter, true); + + logger.debug("swaggerSpringMvcPlugin"); + Collection> allCdmTypes = allCdmTypes(); + allCdmTypes.add(eu.etaxonomy.cdm.api.service.pager.Pager.class); + allCdmTypes.add(eu.etaxonomy.cdm.api.facade.DerivedUnitFacade.class); + + return new SwaggerSpringMvcPlugin(this.springSwaggerConfig) + .apiInfo(apiInfo()) + .includePatterns(".*?") // matches all RequestMappings + .ignoredParameterTypes(allCdmTypes.toArray(new Class[allCdmTypes.size()])); // is internally merged with the defaultIgnorableParameterTypes of the } +/** + * @return + */ +private Collection> allCdmTypes() { + boolean includeAbstract = true; + boolean includeInterfaces = false; + Collection> classes = null; + + CdmTypeScanner scanner = new CdmTypeScanner(includeAbstract, includeInterfaces); + scanner.addIncludeFilter(new AnnotationTypeFilter(Entity.class)); + scanner.addIncludeFilter(new CdmAssignableTypeFilter(CdmBase.class, includeAbstract, includeInterfaces)); + classes = scanner.scanTypesIn("eu/etaxonomy/cdm/model"); + + return classes; +} + private ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo( - "EU-BON Utis", - "The Unified Taxonomic Information Service (UTIS) is the taxonomic backbone for the EU-BON project", - "UTIS API terms of service", + "CDM Remote REST services", + "", + null, // terms of service "EditSupport@bgbm.org", "Mozilla Public License 2.0", "http://www.mozilla.org/MPL/2.0/" ); return apiInfo; } - */ } diff --git a/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/PreloadedBeans.java b/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/PreloadedBeans.java index 55ff5c1e3d..64d12d5d2c 100644 --- a/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/PreloadedBeans.java +++ b/cdmlib-remote-webapp/src/main/java/eu/etaxonomy/cdm/remote/config/PreloadedBeans.java @@ -25,5 +25,4 @@ public class PreloadedBeans { return new LocaleContextHandlerInterceptor(); } - } diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/css/cdm.css b/cdmlib-remote-webapp/src/main/webapp/doc/css/cdm.css new file mode 100644 index 0000000000..c3acb2acc7 --- /dev/null +++ b/cdmlib-remote-webapp/src/main/webapp/doc/css/cdm.css @@ -0,0 +1,27 @@ +body.swagger-section #header { + padding:0 50px; + background-color:#F4F7E7; +} + +#header #banner{ + margin-left:auto; + margin-right:auto; + max-width: 960px; + font-size: 200%; + font-family: "Droid Sans",Verdana,Arial,Helvetica,sans-serif; +} + +#description { + padding-top:10px; + padding-bottom:10px; + background-color:#F4F7E7; +} + +#footer { + position: relative; + bottom: 0px; + max-width: 960px; + margin-top: 4em; + margin-left:auto; + margin-right:auto; +} \ No newline at end of file diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/css/reset.css b/cdmlib-remote-webapp/src/main/webapp/doc/css/reset.css new file mode 100644 index 0000000000..b2b078943c --- /dev/null +++ b/cdmlib-remote-webapp/src/main/webapp/doc/css/reset.css @@ -0,0 +1,125 @@ +/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display: block; +} +body { + line-height: 1; +} +ol, +ul { + list-style: none; +} +blockquote, +q { + quotes: none; +} +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/css/screen.css b/cdmlib-remote-webapp/src/main/webapp/doc/css/screen.css new file mode 100644 index 0000000000..f2148836bd --- /dev/null +++ b/cdmlib-remote-webapp/src/main/webapp/doc/css/screen.css @@ -0,0 +1,1221 @@ +/* Original style from softwaremaniacs.org (c) Ivan Sagalaev */ +.swagger-section pre code { + display: block; + padding: 0.5em; + background: #F0F0F0; +} +.swagger-section pre code, +.swagger-section pre .subst, +.swagger-section pre .tag .title, +.swagger-section pre .lisp .title, +.swagger-section pre .clojure .built_in, +.swagger-section pre .nginx .title { + color: black; +} +.swagger-section pre .string, +.swagger-section pre .title, +.swagger-section pre .constant, +.swagger-section pre .parent, +.swagger-section pre .tag .value, +.swagger-section pre .rules .value, +.swagger-section pre .rules .value .number, +.swagger-section pre .preprocessor, +.swagger-section pre .ruby .symbol, +.swagger-section pre .ruby .symbol .string, +.swagger-section pre .aggregate, +.swagger-section pre .template_tag, +.swagger-section pre .django .variable, +.swagger-section pre .smalltalk .class, +.swagger-section pre .addition, +.swagger-section pre .flow, +.swagger-section pre .stream, +.swagger-section pre .bash .variable, +.swagger-section pre .apache .tag, +.swagger-section pre .apache .cbracket, +.swagger-section pre .tex .command, +.swagger-section pre .tex .special, +.swagger-section pre .erlang_repl .function_or_atom, +.swagger-section pre .markdown .header { + color: #800; +} +.swagger-section pre .comment, +.swagger-section pre .annotation, +.swagger-section pre .template_comment, +.swagger-section pre .diff .header, +.swagger-section pre .chunk, +.swagger-section pre .markdown .blockquote { + color: #888; +} +.swagger-section pre .number, +.swagger-section pre .date, +.swagger-section pre .regexp, +.swagger-section pre .literal, +.swagger-section pre .smalltalk .symbol, +.swagger-section pre .smalltalk .char, +.swagger-section pre .go .constant, +.swagger-section pre .change, +.swagger-section pre .markdown .bullet, +.swagger-section pre .markdown .link_url { + color: #080; +} +.swagger-section pre .label, +.swagger-section pre .javadoc, +.swagger-section pre .ruby .string, +.swagger-section pre .decorator, +.swagger-section pre .filter .argument, +.swagger-section pre .localvars, +.swagger-section pre .array, +.swagger-section pre .attr_selector, +.swagger-section pre .important, +.swagger-section pre .pseudo, +.swagger-section pre .pi, +.swagger-section pre .doctype, +.swagger-section pre .deletion, +.swagger-section pre .envvar, +.swagger-section pre .shebang, +.swagger-section pre .apache .sqbracket, +.swagger-section pre .nginx .built_in, +.swagger-section pre .tex .formula, +.swagger-section pre .erlang_repl .reserved, +.swagger-section pre .prompt, +.swagger-section pre .markdown .link_label, +.swagger-section pre .vhdl .attribute, +.swagger-section pre .clojure .attribute, +.swagger-section pre .coffeescript .property { + color: #8888ff; +} +.swagger-section pre .keyword, +.swagger-section pre .id, +.swagger-section pre .phpdoc, +.swagger-section pre .title, +.swagger-section pre .built_in, +.swagger-section pre .aggregate, +.swagger-section pre .css .tag, +.swagger-section pre .javadoctag, +.swagger-section pre .phpdoc, +.swagger-section pre .yardoctag, +.swagger-section pre .smalltalk .class, +.swagger-section pre .winutils, +.swagger-section pre .bash .variable, +.swagger-section pre .apache .tag, +.swagger-section pre .go .typename, +.swagger-section pre .tex .command, +.swagger-section pre .markdown .strong, +.swagger-section pre .request, +.swagger-section pre .status { + font-weight: bold; +} +.swagger-section pre .markdown .emphasis { + font-style: italic; +} +.swagger-section pre .nginx .built_in { + font-weight: normal; +} +.swagger-section pre .coffeescript .javascript, +.swagger-section pre .javascript .xml, +.swagger-section pre .tex .formula, +.swagger-section pre .xml .javascript, +.swagger-section pre .xml .vbscript, +.swagger-section pre .xml .css, +.swagger-section pre .xml .cdata { + opacity: 0.5; +} +.swagger-section .swagger-ui-wrap { + line-height: 1; + font-family: "Droid Sans", sans-serif; + max-width: 960px; + margin-left: auto; + margin-right: auto; +} +.swagger-section .swagger-ui-wrap b, +.swagger-section .swagger-ui-wrap strong { + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap q, +.swagger-section .swagger-ui-wrap blockquote { + quotes: none; +} +.swagger-section .swagger-ui-wrap p { + line-height: 1.4em; + padding: 0 0 10px; + color: #333333; +} +.swagger-section .swagger-ui-wrap q:before, +.swagger-section .swagger-ui-wrap q:after, +.swagger-section .swagger-ui-wrap blockquote:before, +.swagger-section .swagger-ui-wrap blockquote:after { + content: none; +} +.swagger-section .swagger-ui-wrap .heading_with_menu h1, +.swagger-section .swagger-ui-wrap .heading_with_menu h2, +.swagger-section .swagger-ui-wrap .heading_with_menu h3, +.swagger-section .swagger-ui-wrap .heading_with_menu h4, +.swagger-section .swagger-ui-wrap .heading_with_menu h5, +.swagger-section .swagger-ui-wrap .heading_with_menu h6 { + display: block; + clear: none; + float: left; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + width: 60%; +} +.swagger-section .swagger-ui-wrap table { + border-collapse: collapse; + border-spacing: 0; +} +.swagger-section .swagger-ui-wrap table thead tr th { + padding: 5px; + font-size: 0.9em; + color: #666666; + border-bottom: 1px solid #999999; +} +.swagger-section .swagger-ui-wrap table tbody tr:last-child td { + border-bottom: none; +} +.swagger-section .swagger-ui-wrap table tbody tr.offset { + background-color: #f0f0f0; +} +.swagger-section .swagger-ui-wrap table tbody tr td { + padding: 6px; + font-size: 0.9em; + border-bottom: 1px solid #cccccc; + vertical-align: top; + line-height: 1.3em; +} +.swagger-section .swagger-ui-wrap ol { + margin: 0px 0 10px; + padding: 0 0 0 18px; + list-style-type: decimal; +} +.swagger-section .swagger-ui-wrap ol li { + padding: 5px 0px; + font-size: 0.9em; + color: #333333; +} +.swagger-section .swagger-ui-wrap ol, +.swagger-section .swagger-ui-wrap ul { + list-style: none; +} +.swagger-section .swagger-ui-wrap h1 a, +.swagger-section .swagger-ui-wrap h2 a, +.swagger-section .swagger-ui-wrap h3 a, +.swagger-section .swagger-ui-wrap h4 a, +.swagger-section .swagger-ui-wrap h5 a, +.swagger-section .swagger-ui-wrap h6 a { + text-decoration: none; +} +.swagger-section .swagger-ui-wrap h1 a:hover, +.swagger-section .swagger-ui-wrap h2 a:hover, +.swagger-section .swagger-ui-wrap h3 a:hover, +.swagger-section .swagger-ui-wrap h4 a:hover, +.swagger-section .swagger-ui-wrap h5 a:hover, +.swagger-section .swagger-ui-wrap h6 a:hover { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap h1 span.divider, +.swagger-section .swagger-ui-wrap h2 span.divider, +.swagger-section .swagger-ui-wrap h3 span.divider, +.swagger-section .swagger-ui-wrap h4 span.divider, +.swagger-section .swagger-ui-wrap h5 span.divider, +.swagger-section .swagger-ui-wrap h6 span.divider { + color: #aaaaaa; +} +.swagger-section .swagger-ui-wrap a { + color: #547f00; +} +.swagger-section .swagger-ui-wrap a img { + border: none; +} +.swagger-section .swagger-ui-wrap article, +.swagger-section .swagger-ui-wrap aside, +.swagger-section .swagger-ui-wrap details, +.swagger-section .swagger-ui-wrap figcaption, +.swagger-section .swagger-ui-wrap figure, +.swagger-section .swagger-ui-wrap footer, +.swagger-section .swagger-ui-wrap header, +.swagger-section .swagger-ui-wrap hgroup, +.swagger-section .swagger-ui-wrap menu, +.swagger-section .swagger-ui-wrap nav, +.swagger-section .swagger-ui-wrap section, +.swagger-section .swagger-ui-wrap summary { + display: block; +} +.swagger-section .swagger-ui-wrap pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #fcf6db; + border: 1px solid #e5e0c6; + padding: 10px; +} +.swagger-section .swagger-ui-wrap pre code { + line-height: 1.6em; + background: none; +} +.swagger-section .swagger-ui-wrap .content > .content-type > div > label { + clear: both; + display: block; + color: #0F6AB4; + font-size: 1.1em; + margin: 0; + padding: 15px 0 5px; +} +.swagger-section .swagger-ui-wrap .content pre { + font-size: 12px; + margin-top: 5px; + padding: 5px; +} +.swagger-section .swagger-ui-wrap .icon-btn { + cursor: pointer; +} +.swagger-section .swagger-ui-wrap .info_title { + padding-bottom: 10px; + font-weight: bold; + font-size: 25px; +} +.swagger-section .swagger-ui-wrap p.big, +.swagger-section .swagger-ui-wrap div.big p { + font-size: 1em; + margin-bottom: 10px; +} +.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input { + width: 500px !important; +} +.swagger-section .swagger-ui-wrap .info_license { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_tos { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .message-fail { + color: #cc0000; +} +.swagger-section .swagger-ui-wrap .info_contact { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_description { + padding-bottom: 10px; + font-size: 15px; +} +.swagger-section .swagger-ui-wrap .markdown ol li, +.swagger-section .swagger-ui-wrap .markdown ul li { + padding: 3px 0px; + line-height: 1.4em; + color: #333333; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input { + display: block; + padding: 4px; + width: auto; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title { + font-size: 1.3em; +} +.swagger-section .swagger-ui-wrap table.fullwidth { + width: 100%; +} +.swagger-section .swagger-ui-wrap .model-signature { + font-family: "Droid Sans", sans-serif; + font-size: 1em; + line-height: 1.5em; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav a { + text-decoration: none; + color: #AAA; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover { + text-decoration: underline; + color: black; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected { + color: black; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap .model-signature .propType { + color: #5555aa; +} +.swagger-section .swagger-ui-wrap .model-signature pre:hover { + background-color: #ffffdd; +} +.swagger-section .swagger-ui-wrap .model-signature pre { + font-size: .85em; + line-height: 1.2em; + overflow: auto; + max-height: 200px; + cursor: pointer; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav { + display: block; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li { + float: left; + margin: 0 5px 5px 0; + padding: 2px 5px 2px 0; + border-right: 1px solid #ddd; +} +.swagger-section .swagger-ui-wrap .model-signature .propOpt { + color: #555; +} +.swagger-section .swagger-ui-wrap .model-signature .snippet small { + font-size: 0.75em; +} +.swagger-section .swagger-ui-wrap .model-signature .propOptKey { + font-style: italic; +} +.swagger-section .swagger-ui-wrap .model-signature .description .strong { + font-weight: bold; + color: #000; + font-size: .9em; +} +.swagger-section .swagger-ui-wrap .model-signature .description div { + font-size: 0.9em; + line-height: 1.5em; + margin-left: 1em; +} +.swagger-section .swagger-ui-wrap .model-signature .description .stronger { + font-weight: bold; + color: #000; +} +.swagger-section .swagger-ui-wrap .model-signature .propName { + font-weight: bold; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-container { + clear: both; +} +.swagger-section .swagger-ui-wrap .body-textarea { + width: 300px; + height: 100px; + border: 1px solid #aaa; +} +.swagger-section .swagger-ui-wrap .markdown p code, +.swagger-section .swagger-ui-wrap .markdown li code { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #f0f0f0; + color: black; + padding: 1px 3px; +} +.swagger-section .swagger-ui-wrap .required { + font-weight: bold; +} +.swagger-section .swagger-ui-wrap input.parameter { + width: 300px; + border: 1px solid #aaa; +} +.swagger-section .swagger-ui-wrap h1 { + color: black; + font-size: 1.5em; + line-height: 1.3em; + padding: 10px 0 10px 0; + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap .heading_with_menu { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap .heading_with_menu ul { + display: block; + clear: none; + float: right; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + margin-top: 10px; +} +.swagger-section .swagger-ui-wrap h2 { + color: black; + font-size: 1.3em; + padding: 10px 0 10px 0; +} +.swagger-section .swagger-ui-wrap h2 a { + color: black; +} +.swagger-section .swagger-ui-wrap h2 span.sub { + font-size: 0.7em; + color: #999999; + font-style: italic; +} +.swagger-section .swagger-ui-wrap h2 span.sub a { + color: #777777; +} +.swagger-section .swagger-ui-wrap span.weak { + color: #666666; +} +.swagger-section .swagger-ui-wrap .message-success { + color: #89BF04; +} +.swagger-section .swagger-ui-wrap caption, +.swagger-section .swagger-ui-wrap th, +.swagger-section .swagger-ui-wrap td { + text-align: left; + font-weight: normal; + vertical-align: middle; +} +.swagger-section .swagger-ui-wrap .code { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea { + font-family: "Droid Sans", sans-serif; + height: 250px; + padding: 4px; + display: block; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select { + display: block; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label { + display: block; + float: left; + clear: none; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input { + display: block; + float: left; + clear: none; + margin: 0 5px 0 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label { + color: black; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label { + display: block; + clear: both; + width: auto; + padding: 0 0 3px; + color: #666666; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr { + padding-left: 3px; + color: #888888; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints { + margin-left: 0; + font-style: italic; + font-size: 0.9em; + margin: 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons { + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap span.blank, +.swagger-section .swagger-ui-wrap span.empty { + color: #888888; + font-style: italic; +} +.swagger-section .swagger-ui-wrap .markdown h3 { + color: #547f00; +} +.swagger-section .swagger-ui-wrap .markdown h4 { + color: #666666; +} +.swagger-section .swagger-ui-wrap .markdown pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #fcf6db; + border: 1px solid #e5e0c6; + padding: 10px; + margin: 0 0 10px 0; +} +.swagger-section .swagger-ui-wrap .markdown pre code { + line-height: 1.6em; +} +.swagger-section .swagger-ui-wrap div.gist { + margin: 20px 0 25px 0 !important; +} +.swagger-section .swagger-ui-wrap ul#resources { + font-family: "Droid Sans", sans-serif; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource { + border-bottom: 1px solid #dddddd; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a, +.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a, +.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a { + color: #555555; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child { + border-bottom: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading { + border: 1px solid transparent; + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options { + overflow: hidden; + padding: 0; + display: block; + clear: none; + float: right; + margin: 14px 10px 0 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li { + float: left; + clear: none; + margin: 0; + padding: 2px 10px; + border-right: 1px solid #dddddd; + color: #666666; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a { + color: #aaaaaa; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover { + text-decoration: underline; + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 { + color: #999999; + padding-left: 0; + display: block; + clear: none; + float: left; + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a { + color: #999999; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation { + float: none; + clear: both; + overflow: hidden; + display: block; + margin: 0 0 10px; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading { + float: none; + clear: both; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 { + display: block; + clear: none; + float: left; + width: auto; + margin: 0; + padding: 0; + line-height: 1.1em; + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path { + padding-left: 10px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a { + color: black; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a { + text-transform: uppercase; + text-decoration: none; + color: white; + display: inline-block; + width: 50px; + font-size: 0.7em; + text-align: center; + padding: 7px 0 4px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + -o-border-radius: 2px; + -ms-border-radius: 2px; + -khtml-border-radius: 2px; + border-radius: 2px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span { + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options { + overflow: hidden; + padding: 0; + display: block; + clear: none; + float: right; + margin: 6px 10px 0 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li { + float: left; + clear: none; + margin: 0; + padding: 2px 10px; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a { + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content { + border-top: none; + padding: 10px; + -moz-border-radius-bottomleft: 6px; + -webkit-border-bottom-left-radius: 6px; + -o-border-bottom-left-radius: 6px; + -ms-border-bottom-left-radius: 6px; + -khtml-border-bottom-left-radius: 6px; + border-bottom-left-radius: 6px; + -moz-border-radius-bottomright: 6px; + -webkit-border-bottom-right-radius: 6px; + -o-border-bottom-right-radius: 6px; + -ms-border-bottom-right-radius: 6px; + -khtml-border-bottom-right-radius: 6px; + border-bottom-right-radius: 6px; + margin: 0 0 20px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4 { + font-size: 1.1em; + margin: 0; + padding: 15px 0 5px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a { + padding: 4px 0 0 10px; + display: inline-block; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header img { + display: block; + clear: none; + float: right; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit { + display: block; + clear: none; + float: left; + padding: 6px 8px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error { + outline: 2px solid black; + outline-color: #cc0000; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + padding: 10px; + font-size: 0.9em; + max-height: 400px; + overflow-y: auto; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading { + background-color: #f9f2e9; + border: 1px solid #f0e0ca; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a { + background-color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #f0e0ca; + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a { + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content { + background-color: #faf5ee; + border: 1px solid #f0e0ca; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4 { + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a { + color: #dcb67f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading { + background-color: #fcffcd; + border: 1px solid black; + border-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a { + text-transform: uppercase; + background-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #ffd20f; + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a { + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content { + background-color: #fcffcd; + border: 1px solid black; + border-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4 { + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a { + color: #6fc992; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading { + background-color: #f5e8e8; + border: 1px solid #e8c6c7; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a { + text-transform: uppercase; + background-color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #e8c6c7; + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a { + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { + background-color: #f7eded; + border: 1px solid #e8c6c7; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4 { + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a { + color: #c8787a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading { + background-color: #e7f6ec; + border: 1px solid #c3e8d1; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a { + background-color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3e8d1; + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a { + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content { + background-color: #ebf7f0; + border: 1px solid #c3e8d1; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4 { + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a { + color: #6fc992; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading { + background-color: #FCE9E3; + border: 1px solid #F5D5C3; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a { + background-color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #f0cecb; + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a { + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content { + background-color: #faf0ef; + border: 1px solid #f0cecb; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4 { + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a { + color: #dcb67f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading { + background-color: #e7f0f7; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a { + background-color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3d9ec; + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4 { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a { + color: #6fa5d2; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading { + background-color: #e7f0f7; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a { + background-color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3d9ec; + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4 { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a { + color: #6fa5d2; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { + border-top: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap p#colophon { + margin: 0 15px 40px 15px; + padding: 10px 0; + font-size: 0.8em; + border-top: 1px solid #dddddd; + font-family: "Droid Sans", sans-serif; + color: #999999; + font-style: italic; +} +.swagger-section .swagger-ui-wrap p#colophon a { + text-decoration: none; + color: #547f00; +} +.swagger-section .swagger-ui-wrap h3 { + color: black; + font-size: 1.1em; + padding: 10px 0 10px 0; +} +.swagger-section .swagger-ui-wrap .markdown ol, +.swagger-section .swagger-ui-wrap .markdown ul { + font-family: "Droid Sans", sans-serif; + margin: 5px 0 10px; + padding: 0 0 0 18px; + list-style-type: disc; +} +.swagger-section .swagger-ui-wrap form.form_box { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; + padding: 10px; +} +.swagger-section .swagger-ui-wrap form.form_box label { + color: #0f6ab4 !important; +} +.swagger-section .swagger-ui-wrap form.form_box input[type=submit] { + display: block; + padding: 10px; +} +.swagger-section .swagger-ui-wrap form.form_box p.weak { + font-size: 0.8em; +} +.swagger-section .swagger-ui-wrap form.form_box p { + font-size: 0.9em; + padding: 0 0 15px; + color: #7e7b6d; +} +.swagger-section .swagger-ui-wrap form.form_box p a { + color: #646257; +} +.swagger-section .swagger-ui-wrap form.form_box p strong { + color: black; +} +.swagger-section .title { + font-style: bold; +} +.swagger-section .secondary_form { + display: none; +} +.swagger-section .main_image { + display: block; + margin-left: auto; + margin-right: auto; +} +.swagger-section .oauth_body { + margin-left: 100px; + margin-right: 100px; +} +.swagger-section .oauth_submit { + text-align: center; +} +.swagger-section .api-popup-dialog { + z-index: 10000; + position: absolute; + width: 500px; + background: #FFF; + padding: 20px; + border: 1px solid #ccc; + border-radius: 5px; + display: none; + font-size: 13px; + color: #777; +} +.swagger-section .api-popup-dialog .api-popup-title { + font-size: 24px; + padding: 10px 0; +} +.swagger-section .api-popup-dialog .api-popup-title { + font-size: 24px; + padding: 10px 0; +} +.swagger-section .api-popup-dialog p.error-msg { + padding-left: 5px; + padding-bottom: 5px; +} +.swagger-section .api-popup-dialog button.api-popup-authbtn { + height: 30px; +} +.swagger-section .api-popup-dialog button.api-popup-cancel { + height: 30px; +} +.swagger-section .api-popup-scopes { + padding: 10px 20px; +} +.swagger-section .api-popup-scopes li { + padding: 5px 0; + line-height: 20px; +} +.swagger-section .api-popup-scopes .api-scope-desc { + padding-left: 20px; + font-style: italic; +} +.swagger-section .api-popup-scopes li input { + position: relative; + top: 2px; +} +.swagger-section .api-popup-actions { + padding-top: 10px; +} +.swagger-section .access { + float: right; +} +.swagger-section .auth { + float: right; +} +.swagger-section #api_information_panel { + position: absolute; + background: #FFF; + border: 1px solid #ccc; + border-radius: 5px; + display: none; + font-size: 13px; + max-width: 300px; + line-height: 30px; + color: black; + padding: 5px; +} +.swagger-section #api_information_panel p .api-msg-enabled { + color: green; +} +.swagger-section #api_information_panel p .api-msg-disabled { + color: red; +} +.swagger-section .api-ic { + height: 18px; + vertical-align: middle; + display: inline-block; + background: url(../images/explorer_icons.png) no-repeat; +} +.swagger-section .ic-info { + background-position: 0 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-warning { + background-position: -60px 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-error { + background-position: -30px 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-off { + background-position: -90px 0; + width: 58px; + margin-top: -4px; + cursor: pointer; +} +.swagger-section .ic-on { + background-position: -160px 0; + width: 58px; + margin-top: -4px; + cursor: pointer; +} +.swagger-section #header { + background-color: #89bf04; + padding: 14px; +} +.swagger-section #header a#logo { + font-size: 1.5em; + font-weight: bold; + text-decoration: none; + background: transparent url(../images/logo_small.png) no-repeat left center; + padding: 20px 0 20px 40px; + color: white; +} +.swagger-section #header form#api_selector { + display: block; + clear: none; + float: right; +} +.swagger-section #header form#api_selector .input { + display: block; + clear: none; + float: left; + margin: 0 10px 0 0; +} +.swagger-section #header form#api_selector .input input#input_apiKey { + width: 200px; +} +.swagger-section #header form#api_selector .input input#input_baseUrl { + width: 400px; +} +.swagger-section #header form#api_selector .input a#explore { + display: block; + text-decoration: none; + font-weight: bold; + padding: 6px 8px; + font-size: 0.9em; + color: white; + background-color: #547f00; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + -o-border-radius: 4px; + -ms-border-radius: 4px; + -khtml-border-radius: 4px; + border-radius: 4px; +} +.swagger-section #header form#api_selector .input a#explore:hover { + background-color: #547f00; +} +.swagger-section #header form#api_selector .input input { + font-size: 0.9em; + padding: 3px; + margin: 0; +} +.swagger-section #content_message { + margin: 10px 15px; + font-style: italic; + color: #999999; +} +.swagger-section #message-bar { + min-height: 30px; + text-align: center; + padding-top: 10px; +} diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/images/explorer_icons.png b/cdmlib-remote-webapp/src/main/webapp/doc/images/explorer_icons.png new file mode 100644 index 0000000000..ed9d2fffb6 Binary files /dev/null and b/cdmlib-remote-webapp/src/main/webapp/doc/images/explorer_icons.png differ diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/images/logo_small.png b/cdmlib-remote-webapp/src/main/webapp/doc/images/logo_small.png new file mode 100644 index 0000000000..5496a65579 Binary files /dev/null and b/cdmlib-remote-webapp/src/main/webapp/doc/images/logo_small.png differ diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/images/pet_store_api.png b/cdmlib-remote-webapp/src/main/webapp/doc/images/pet_store_api.png new file mode 100644 index 0000000000..f9f9cd4aeb Binary files /dev/null and b/cdmlib-remote-webapp/src/main/webapp/doc/images/pet_store_api.png differ diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/images/throbber.gif b/cdmlib-remote-webapp/src/main/webapp/doc/images/throbber.gif new file mode 100644 index 0000000000..0639388924 Binary files /dev/null and b/cdmlib-remote-webapp/src/main/webapp/doc/images/throbber.gif differ diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/images/wordnik_api.png b/cdmlib-remote-webapp/src/main/webapp/doc/images/wordnik_api.png new file mode 100644 index 0000000000..dca4f1455a Binary files /dev/null and b/cdmlib-remote-webapp/src/main/webapp/doc/images/wordnik_api.png differ diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/index.html b/cdmlib-remote-webapp/src/main/webapp/doc/index.html new file mode 100644 index 0000000000..34a27e8c1f --- /dev/null +++ b/cdmlib-remote-webapp/src/main/webapp/doc/index.html @@ -0,0 +1,88 @@ + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
 
+
+
+ + + diff --git a/cdmlib-remote-webapp/src/main/webapp/doc/lib/backbone-min.js b/cdmlib-remote-webapp/src/main/webapp/doc/lib/backbone-min.js new file mode 100644 index 0000000000..c1c0d4fff2 --- /dev/null +++ b/cdmlib-remote-webapp/src/main/webapp/doc/lib/backbone-min.js @@ -0,0 +1,38 @@ +// Backbone.js 0.9.2 + +// (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. +// Backbone may be freely distributed under the MIT license. +// For all details and documentation: +// http://backbonejs.org +(function(){var l=this,y=l.Backbone,z=Array.prototype.slice,A=Array.prototype.splice,g;g="undefined"!==typeof exports?exports:l.Backbone={};g.VERSION="0.9.2";var f=l._;!f&&"undefined"!==typeof require&&(f=require("underscore"));var i=l.jQuery||l.Zepto||l.ender;g.setDomLibrary=function(a){i=a};g.noConflict=function(){l.Backbone=y;return this};g.emulateHTTP=!1;g.emulateJSON=!1;var p=/\s+/,k=g.Events={on:function(a,b,c){var d,e,f,g,j;if(!b)return this;a=a.split(p);for(d=this._callbacks||(this._callbacks= +{});e=a.shift();)f=(j=d[e])?j.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:j?j.next:f};return this},off:function(a,b,c){var d,e,h,g,j,q;if(e=this._callbacks){if(!a&&!b&&!c)return delete this._callbacks,this;for(a=a?a.split(p):f.keys(e);d=a.shift();)if(h=e[d],delete e[d],h&&(b||c))for(g=h.tail;(h=h.next)!==g;)if(j=h.callback,q=h.context,b&&j!==b||c&&q!==c)this.on(d,j,q);return this}},trigger:function(a){var b,c,d,e,f,g;if(!(d=this._callbacks))return this;f=d.all;a=a.split(p);for(g= +z.call(arguments,1);b=a.shift();){if(c=d[b])for(e=c.tail;(c=c.next)!==e;)c.callback.apply(c.context||this,g);if(c=f){e=c.tail;for(b=[b].concat(g);(c=c.next)!==e;)c.callback.apply(c.context||this,b)}}return this}};k.bind=k.on;k.unbind=k.off;var o=g.Model=function(a,b){var c;a||(a={});b&&b.parse&&(a=this.parse(a));if(c=n(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection);this.attributes={};this._escapedAttributes={};this.cid=f.uniqueId("c");this.changed={};this._silent= +{};this._pending={};this.set(a,{silent:!0});this.changed={};this._silent={};this._pending={};this._previousAttributes=f.clone(this.attributes);this.initialize.apply(this,arguments)};f.extend(o.prototype,k,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return f.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;b=this.get(a);return this._escapedAttributes[a]=f.escape(null== +b?"":""+b)},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c||(c={});if(!d)return this;d instanceof o&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var b=c.changes={},h=this.attributes,g=this._escapedAttributes,j=this._previousAttributes||{};for(e in d){a=d[e];if(!f.isEqual(h[e],a)||c.unset&&f.has(h,e))delete g[e],(c.silent?this._silent: +b)[e]=!0;c.unset?delete h[e]:h[e]=a;!f.isEqual(j[e],a)||f.has(h,e)!=f.has(j,e)?(this.changed[e]=a,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}c.silent||this.change(c);return this},unset:function(a,b){(b||(b={})).unset=!0;return this.set(a,null,b)},clear:function(a){(a||(a={})).unset=!0;return this.set(f.clone(this.attributes),a)},fetch:function(a){var a=a?f.clone(a):{},b=this,c=a.success;a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)}; +a.error=g.wrapError(a.error,b,a);return(this.sync||g.sync).call(this,"read",this,a)},save:function(a,b,c){var d,e;f.isObject(a)||null==a?(d=a,c=b):(d={},d[a]=b);c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;e=f.clone(this.attributes)}a=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c))return!1;var h=this,i=c.success;c.success=function(a,b,e){b=h.parse(a,e);if(c.wait){delete c.wait;b=f.extend(d||{},b)}if(!h.set(b,c))return false;i?i(h,a):h.trigger("sync",h,a,c)};c.error=g.wrapError(c.error, +h,c);b=this.isNew()?"create":"update";b=(this.sync||g.sync).call(this,b,this,c);c.wait&&this.set(e,a);return b},destroy:function(a){var a=a?f.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d();c?c(b,e):b.trigger("sync",b,e,a)};a.error=g.wrapError(a.error,b,a);var e=(this.sync||g.sync).call(this,"delete",this,a);a.wait||d();return e},url:function(){var a=n(this,"urlRoot")||n(this.collection,"url")||t(); +return this.isNew()?a:a+("/"==a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;for(;!f.isEmpty(this._pending);){this._pending= +{};this.trigger("change",this,a);for(c in this.changed)!this._pending[c]&&!this._silent[c]&&delete this.changed[c];this._previousAttributes=f.clone(this.attributes)}this._changing=!1;return this},hasChanged:function(a){return!arguments.length?!f.isEmpty(this.changed):f.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)if(!f.isEqual(d[e],b=a[e]))(c||(c={}))[e]=b;return c},previous:function(a){return!arguments.length|| +!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;var a=f.extend({},this.attributes,a),c=this.validate(a,b);if(!c)return!0;b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b);return!1}});var r=g.Collection=function(a,b){b||(b={});b.model&&(this.model=b.model);b.comparator&&(this.comparator=b.comparator); +this._reset();this.initialize.apply(this,arguments);a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(r.prototype,k,{model:o,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,d,e,g,i,j={},k={},l=[];b||(b={});a=f.isArray(a)?a.slice():[a];c=0;for(d=a.length;c=b))this.iframe=i('