Easter cleaning
This commit is contained in:
commit
9e36078b2e
1862 changed files with 270281 additions and 0 deletions
|
|
@ -0,0 +1,725 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.x4o.maisdoc.flake.MaisDocNodeDataConfiguratorBean;
|
||||
import org.x4o.maisdoc.flake.MaisDocNodeWriterBean;
|
||||
|
||||
/**
|
||||
* ApiDoc holds all config and data to write a full api doc structure.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDoc {
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private MaisDocNode rootNode = null;
|
||||
private MaisDocNode rootNodeTreePage = null;
|
||||
private List<MaisDocNodeWriter> nodeBodyWriters = null;
|
||||
private List<MaisDocConcept> concepts = null;
|
||||
private String docCopyright = null;
|
||||
private String docAbout = null;
|
||||
private List<String> metaKeywords = null;
|
||||
private File metaStyleSheet = null;
|
||||
private String metaStyleSheetThema = null;
|
||||
private List<MaisDocPage> docPages = null;
|
||||
private Class<?> frameNavConceptClass = null;
|
||||
private Boolean frameNavOverviewPrintParent = null;
|
||||
private Boolean frameNavPrintParentId = null;
|
||||
private Boolean frameNavPrintParent = null;
|
||||
private Boolean frameNavPrintParentParent = null;
|
||||
private List<Class<?>> treeNodeClassExcludes = null;
|
||||
private List<Class<?>> treeNodePageModeClass = null;
|
||||
private List<MaisDocNodeDataConfigurator> dataConfigurators = null;
|
||||
private List<Class<?>> annotatedClasses = null;
|
||||
private MaisDocNodeData nodeData = null;
|
||||
private String docStatsJS = null;
|
||||
private String noFrameAllName = null;
|
||||
private String noFrameAllLink = null;
|
||||
private String noFrameAllTopJS = null;
|
||||
private String noFrameAllBottomJS = null;
|
||||
private boolean fillOnce = false;
|
||||
private List<MaisDocRemoteClass> remoteClasses = null;
|
||||
private boolean skipRootTreePathNode = true;
|
||||
private boolean printConceptTitle = true;
|
||||
private boolean printConceptPrevNext = true;
|
||||
private Map<String,String> groupTypeNames = null;
|
||||
private Map<String,Integer> groupTypeOrder = null;
|
||||
private String docPageSubTitle = null;
|
||||
|
||||
public MaisDoc() {
|
||||
nodeBodyWriters = new ArrayList<MaisDocNodeWriter>(20);
|
||||
concepts = new ArrayList<MaisDocConcept>(10);
|
||||
metaKeywords = new ArrayList<String>(5);
|
||||
docPages = new ArrayList<MaisDocPage>(5);
|
||||
treeNodeClassExcludes = new ArrayList<Class<?>>(5);
|
||||
treeNodePageModeClass = new ArrayList<Class<?>>(5);
|
||||
dataConfigurators = new ArrayList<MaisDocNodeDataConfigurator>(5);
|
||||
annotatedClasses = new ArrayList<Class<?>>(5);
|
||||
remoteClasses = new ArrayList<MaisDocRemoteClass>(5);
|
||||
groupTypeNames = new HashMap<String,String>(3);
|
||||
groupTypeOrder = new HashMap<String,Integer>(3);
|
||||
}
|
||||
|
||||
public void checkModel() throws NullPointerException,IllegalArgumentException {
|
||||
checkNull(name,"name");
|
||||
checkNull(description,"description");
|
||||
checkNull(docAbout,"docAbout");
|
||||
checkNull(docCopyright,"docCopyright");
|
||||
checkNull(rootNode,"rootNode");
|
||||
checkNull(frameNavConceptClass,"frameNavConceptClass");
|
||||
checkNull(noFrameAllName,"noFrameAllName");
|
||||
|
||||
if (concepts.isEmpty()) {
|
||||
throw new IllegalStateException("Can't work with empty concepts");
|
||||
}
|
||||
if (frameNavOverviewPrintParent==null) {
|
||||
setFrameNavOverviewPrintParent(false);
|
||||
}
|
||||
if (frameNavPrintParent==null) {
|
||||
setFrameNavPrintParent(false);
|
||||
}
|
||||
if (frameNavPrintParentParent==null) {
|
||||
setFrameNavPrintParentParent(false);
|
||||
}
|
||||
if (frameNavPrintParentId==null) {
|
||||
setFrameNavPrintParentId(false);
|
||||
}
|
||||
|
||||
if (metaStyleSheetThema==null) {
|
||||
setMetaStyleSheetThema("jdk7");
|
||||
}
|
||||
if (noFrameAllTopJS==null) {
|
||||
noFrameAllTopJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_top\");\n"+
|
||||
"if(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
|
||||
}
|
||||
if (noFrameAllBottomJS==null) {
|
||||
noFrameAllBottomJS = "\nallClassesLink = document.getElementById(\"allclasses_navbar_bottom\");\n"+
|
||||
"if(window==top) {\n\tallClassesLink.style.display = \"block\";\n} else {\n\tallClassesLink.style.display = \"none\";\n}\n";
|
||||
}
|
||||
if (noFrameAllLink==null) {
|
||||
MaisDocConcept navConcept = findConceptByClass(getFrameNavConceptClass());
|
||||
setNoFrameAllLink("all"+navConcept.getId()+"-noframe.html");
|
||||
}
|
||||
|
||||
fillRuntimeData();
|
||||
|
||||
if (nodeBodyWriters.isEmpty()) {
|
||||
fillOnce = false;
|
||||
dataConfigurators.clear();
|
||||
throw new IllegalStateException("Can't work with empty nodeBodyWriters");
|
||||
}
|
||||
}
|
||||
|
||||
private void fillRuntimeData() {
|
||||
if (fillOnce) {
|
||||
return;
|
||||
}
|
||||
setNodeData(new MaisDocNodeData());
|
||||
try {
|
||||
for (Class<?> annoClass:getAnnotatedClasses()) {
|
||||
Object bean = annoClass.newInstance();
|
||||
MaisDocNodeWriterBean.addAnnotatedNodeContentWriters(this,bean);
|
||||
MaisDocNodeDataConfiguratorBean.addAnnotatedNodeDataConfigurators(this, bean);
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
String navLink = "overview-"+concept.getId()+".html";
|
||||
boolean resetHref = true;
|
||||
if (concept.getParent()==null) {
|
||||
resetHref = false; // don't reset root node
|
||||
} else {
|
||||
navLink = null; // rest start with null href's
|
||||
}
|
||||
MaisDocNavLink link = new MaisDocNavLink(concept.getId(), navLink, concept.getName(),concept.getName(),resetHref);
|
||||
getNodeData().addNavLink(link);
|
||||
}
|
||||
for (MaisDocPage page:getDocPages()) {
|
||||
String navLink = page.getId()+".html";
|
||||
MaisDocNavLink link = new MaisDocNavLink(page.getId(), navLink, page.getName(),page.getName(),false);
|
||||
getNodeData().addNavLink(link);
|
||||
}
|
||||
for (MaisDocRemoteClass rc:getRemoteClasses()) {
|
||||
try {
|
||||
rc.parseRemotePackageList();
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("While parsing: "+rc.getDocUrl()+" got: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
fillOnce = true;
|
||||
}
|
||||
|
||||
private void checkNull(Object obj,String objName) {
|
||||
if (obj==null) {
|
||||
throw new NullPointerException("Can't work with null "+objName);
|
||||
}
|
||||
}
|
||||
|
||||
public MaisDocConcept findConceptByClass(Class<?> objClass) {
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
if (concept.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return concept;
|
||||
}
|
||||
for (MaisDocConcept c:concept.getChildConcepts()) {
|
||||
if (c.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return concept;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public MaisDocConcept findConceptChildByNode(MaisDocNode node) {
|
||||
Class<?> objClass = node.getUserData().getClass();
|
||||
Class<?> parentClass = null;
|
||||
if (node.getParent()!=null) {
|
||||
parentClass = node.getParent().getUserData().getClass();
|
||||
}
|
||||
for (MaisDocConcept concept:getConcepts()) {
|
||||
if (parentClass!=null && concept.getConceptClass().isAssignableFrom(parentClass)==false) {
|
||||
continue;
|
||||
}
|
||||
for (MaisDocConcept c:concept.getChildConcepts()) {
|
||||
if (c.getConceptClass().isAssignableFrom(objClass)) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<MaisDocRemoteClass> getRemoteClasses() {
|
||||
return remoteClasses;
|
||||
}
|
||||
|
||||
public void addRemoteClass(MaisDocRemoteClass remoteClass) {
|
||||
remoteClasses.add(remoteClass);
|
||||
}
|
||||
|
||||
public void removeRemoteClass(MaisDocRemoteClass remoteClass) {
|
||||
remoteClasses.add(remoteClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getAnnotatedClasses() {
|
||||
return annotatedClasses;
|
||||
}
|
||||
|
||||
public void removeAnnotatedClasses(Class<?> annotatedClass) {
|
||||
annotatedClasses.remove(annotatedClass);
|
||||
}
|
||||
|
||||
public void addAnnotatedClasses(Class<?> annotatedClass) {
|
||||
annotatedClasses.add(annotatedClass);
|
||||
}
|
||||
|
||||
public List<MaisDocNodeDataConfigurator> getDataConfigurators() {
|
||||
return dataConfigurators;
|
||||
}
|
||||
|
||||
public void removeDataConfigurator(MaisDocNodeDataConfigurator conf) {
|
||||
dataConfigurators.remove(conf);
|
||||
}
|
||||
|
||||
public void addDataConfigurator(MaisDocNodeDataConfigurator conf) {
|
||||
dataConfigurators.add(conf);
|
||||
}
|
||||
|
||||
public MaisDocNodeWriter addNodeBodyWriter(MaisDocNodeWriter writer) {
|
||||
nodeBodyWriters.add(writer);
|
||||
return writer;
|
||||
}
|
||||
|
||||
public boolean removeNodeBodyWriter(MaisDocNodeWriter writer) {
|
||||
return nodeBodyWriters.remove(writer);
|
||||
}
|
||||
|
||||
public List<MaisDocNodeWriter> getNodeBodyWriters() {
|
||||
return nodeBodyWriters;
|
||||
}
|
||||
|
||||
public MaisDocConcept addConcept(MaisDocConcept concept) {
|
||||
concepts.add(concept);
|
||||
return concept;
|
||||
}
|
||||
|
||||
public boolean removeConcept(MaisDocConcept concept) {
|
||||
return concepts.remove(concept);
|
||||
}
|
||||
|
||||
public List<MaisDocConcept> getConcepts() {
|
||||
return concepts;
|
||||
}
|
||||
|
||||
public void addMetaKeyword(String keyword) {
|
||||
metaKeywords.add(keyword);
|
||||
}
|
||||
|
||||
public void addMetaKeywordAll(Collection<String> keywords) {
|
||||
metaKeywords.addAll(keywords);
|
||||
}
|
||||
|
||||
public boolean removeMetaKeyword(String keyword) {
|
||||
return metaKeywords.remove(keyword);
|
||||
}
|
||||
|
||||
public List<String> getDocKeywords() {
|
||||
return metaKeywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metaStyleSheet
|
||||
*/
|
||||
public File getMetaStyleSheet() {
|
||||
return metaStyleSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param metaStyleSheet the metaStyleSheet to set
|
||||
*/
|
||||
public void setMetaStyleSheet(File metaStyleSheet) {
|
||||
this.metaStyleSheet = metaStyleSheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metaStyleSheetThema
|
||||
*/
|
||||
public String getMetaStyleSheetThema() {
|
||||
return metaStyleSheetThema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param metaStyleSheetThema the metaStyleSheetThema to set
|
||||
*/
|
||||
public void setMetaStyleSheetThema(String metaStyleSheetThema) {
|
||||
this.metaStyleSheetThema = metaStyleSheetThema;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docCopyright
|
||||
*/
|
||||
public String getDocCopyright() {
|
||||
return docCopyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docCopyright the docCopyright to set
|
||||
*/
|
||||
public void setDocCopyright(String docCopyright) {
|
||||
this.docCopyright = docCopyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates default copyright message for owner.
|
||||
* @param owner The owner of the copyright.
|
||||
*/
|
||||
public void createDocCopyright(String owner) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
String year = Integer.toString(calendar.get(Calendar.YEAR));
|
||||
createDocCopyright(owner, year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates default copyright message for owner and year.
|
||||
* @param owner The owner of the copyright.
|
||||
* @param year The year of the copyright.
|
||||
*/
|
||||
public void createDocCopyright(String owner, String year) {
|
||||
StringBuilder buf = new StringBuilder(100);
|
||||
buf.append("Copyright © ");
|
||||
buf.append(year);
|
||||
buf.append(" ");
|
||||
buf.append(owner.toUpperCase());
|
||||
buf.append(" ");
|
||||
buf.append("All Rights Reserved.");
|
||||
setDocCopyright(buf.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docAbout
|
||||
*/
|
||||
public String getDocAbout() {
|
||||
return docAbout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docAbout the docAbout to set
|
||||
*/
|
||||
public void setDocAbout(String docAbout) {
|
||||
this.docAbout = docAbout;
|
||||
}
|
||||
|
||||
public MaisDocPage addDocPage(MaisDocPage page) {
|
||||
docPages.add(page);
|
||||
return page;
|
||||
}
|
||||
|
||||
public boolean removeDocPage(MaisDocPage page) {
|
||||
return docPages.remove(page);
|
||||
}
|
||||
|
||||
public List<MaisDocPage> getDocPages() {
|
||||
return docPages;
|
||||
}
|
||||
|
||||
public MaisDocPage findDocPageById(String docPageId) {
|
||||
if (docPageId==null) {
|
||||
throw new NullPointerException("Can't search for null id.");
|
||||
}
|
||||
for (MaisDocPage page:docPages) {
|
||||
if (page.getId().equals(docPageId)) {
|
||||
return page;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Class<?> addTreeNodeClassExclude(Class<?> excludeClass) {
|
||||
treeNodeClassExcludes.add(excludeClass);
|
||||
return excludeClass;
|
||||
}
|
||||
|
||||
public boolean removeTreeNodeClassExclude(Class<?> excludeClass) {
|
||||
return treeNodeClassExcludes.remove(excludeClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTreeNodeClassExcludes() {
|
||||
return treeNodeClassExcludes;
|
||||
}
|
||||
|
||||
public Class<?> addTreeNodePageModeClass(Class<?> pageModeClass) {
|
||||
treeNodePageModeClass.add(pageModeClass);
|
||||
return pageModeClass;
|
||||
}
|
||||
|
||||
public boolean removeTreeNodePageModeClass(Class<?> pageModeClass) {
|
||||
return treeNodePageModeClass.remove(pageModeClass);
|
||||
}
|
||||
|
||||
public List<Class<?>> getTreeNodePageModeClasses() {
|
||||
return treeNodePageModeClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rootNodeTreePage
|
||||
*/
|
||||
public MaisDocNode getRootNodeTreePage() {
|
||||
return rootNodeTreePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootNodeTreePage the rootNodeTreePage to set
|
||||
*/
|
||||
public void setRootNodeTreePage(MaisDocNode rootNodeTreePage) {
|
||||
this.rootNodeTreePage = rootNodeTreePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rootNode
|
||||
*/
|
||||
public MaisDocNode getRootNode() {
|
||||
return rootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rootNode the rootNode to set
|
||||
*/
|
||||
public void setRootNode(MaisDocNode rootNode) {
|
||||
this.rootNode = rootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavConceptClass
|
||||
*/
|
||||
public Class<?> getFrameNavConceptClass() {
|
||||
return frameNavConceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavConceptClass the frameNavConceptClass to set
|
||||
*/
|
||||
public void setFrameNavConceptClass(Class<?> frameNavConceptClass) {
|
||||
this.frameNavConceptClass = frameNavConceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParent
|
||||
*/
|
||||
public Boolean getFrameNavPrintParent() {
|
||||
return frameNavPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParent the frameNavPrintParent to set
|
||||
*/
|
||||
public void setFrameNavPrintParent(Boolean frameNavPrintParent) {
|
||||
this.frameNavPrintParent = frameNavPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParentParent
|
||||
*/
|
||||
public Boolean getFrameNavPrintParentParent() {
|
||||
return frameNavPrintParentParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParentParent the frameNavPrintParentParent to set
|
||||
*/
|
||||
public void setFrameNavPrintParentParent(Boolean frameNavPrintParentParent) {
|
||||
this.frameNavPrintParentParent = frameNavPrintParentParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavOverviewPrintParent
|
||||
*/
|
||||
public Boolean getFrameNavOverviewPrintParent() {
|
||||
return frameNavOverviewPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavOverviewPrintParent the frameNavOverviewPrintParent to set
|
||||
*/
|
||||
public void setFrameNavOverviewPrintParent(Boolean frameNavOverviewPrintParent) {
|
||||
this.frameNavOverviewPrintParent = frameNavOverviewPrintParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the frameNavPrintParentId
|
||||
*/
|
||||
public Boolean getFrameNavPrintParentId() {
|
||||
return frameNavPrintParentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param frameNavPrintParentId the frameNavPrintParentId to set
|
||||
*/
|
||||
public void setFrameNavPrintParentId(Boolean frameNavPrintParentId) {
|
||||
this.frameNavPrintParentId = frameNavPrintParentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nodeData
|
||||
*/
|
||||
public MaisDocNodeData getNodeData() {
|
||||
return nodeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeData the nodeData to set
|
||||
*/
|
||||
public void setNodeData(MaisDocNodeData nodeData) {
|
||||
this.nodeData = nodeData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docStatsJS
|
||||
*/
|
||||
public String getDocStatsJS() {
|
||||
return docStatsJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docStatsJS the docStatsJS to set
|
||||
*/
|
||||
public void setDocStatsJS(String docStatsJS) {
|
||||
this.docStatsJS = docStatsJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllName
|
||||
*/
|
||||
public String getNoFrameAllName() {
|
||||
return noFrameAllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllName the noFrameAllName to set
|
||||
*/
|
||||
public void setNoFrameAllName(String noFrameAllName) {
|
||||
this.noFrameAllName = noFrameAllName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllLink
|
||||
*/
|
||||
public String getNoFrameAllLink() {
|
||||
return noFrameAllLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllLink the noFrameAllLink to set
|
||||
*/
|
||||
public void setNoFrameAllLink(String noFrameAllLink) {
|
||||
this.noFrameAllLink = noFrameAllLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllTopJS
|
||||
*/
|
||||
public String getNoFrameAllTopJS() {
|
||||
return noFrameAllTopJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllTopJS the noFrameAllTopJS to set
|
||||
*/
|
||||
public void setNoFrameAllTopJS(String noFrameAllTopJS) {
|
||||
this.noFrameAllTopJS = noFrameAllTopJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noFrameAllBottomJS
|
||||
*/
|
||||
public String getNoFrameAllBottomJS() {
|
||||
return noFrameAllBottomJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noFrameAllBottomJS the noFrameAllBottomJS to set
|
||||
*/
|
||||
public void setNoFrameAllBottomJS(String noFrameAllBottomJS) {
|
||||
this.noFrameAllBottomJS = noFrameAllBottomJS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skipRootTreePathNode
|
||||
*/
|
||||
public boolean isSkipRootTreePathNode() {
|
||||
return skipRootTreePathNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skipRootTreePathNode the skipRootTreePathNode to set
|
||||
*/
|
||||
public void setSkipRootTreePathNode(boolean skipRootTreePathNode) {
|
||||
this.skipRootTreePathNode = skipRootTreePathNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the printConceptTitle
|
||||
*/
|
||||
public boolean isPrintConceptTitle() {
|
||||
return printConceptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param printConceptTitle the printConceptTitle to set
|
||||
*/
|
||||
public void setPrintConceptTitle(boolean printConceptTitle) {
|
||||
this.printConceptTitle = printConceptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the printConceptPrevNext
|
||||
*/
|
||||
public boolean isPrintConceptPrevNext() {
|
||||
return printConceptPrevNext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param printConceptPrevNext the printConceptPrevNext to set
|
||||
*/
|
||||
public void setPrintConceptPrevNext(boolean printConceptPrevNext) {
|
||||
this.printConceptPrevNext = printConceptPrevNext;
|
||||
}
|
||||
|
||||
public List<String> getGroupTypesOrdered() {
|
||||
Map<Integer,String> orderedMap = new TreeMap<Integer,String>();
|
||||
for (String key:groupTypeOrder.keySet()) {
|
||||
Integer order = groupTypeOrder.get(key);
|
||||
orderedMap.put(order, key);
|
||||
}
|
||||
return new ArrayList<String>(orderedMap.values());
|
||||
}
|
||||
|
||||
public String getGroupTypeName(String groupTypeKey) {
|
||||
String result = groupTypeNames.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = groupTypeKey;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setGroupTypeName(String groupTypeKey,String name,int order) {
|
||||
groupTypeNames.put(groupTypeKey,name);
|
||||
groupTypeOrder.put(groupTypeKey, order);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docPageSubTitle
|
||||
*/
|
||||
public String getDocPageSubTitle() {
|
||||
return docPageSubTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docPageSubTitle the docPageSubTitle to set
|
||||
*/
|
||||
public void setDocPageSubTitle(String docPageSubTitle) {
|
||||
this.docPageSubTitle = docPageSubTitle;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocConcept defines the prime concepts which for which we write documents.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocConcept {
|
||||
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String descriptionName = null;
|
||||
private String descriptionHelp = null;
|
||||
private MaisDocConcept parent = null;
|
||||
private Class<?> conceptClass = null;
|
||||
private List<MaisDocConcept> childConcepts = null;
|
||||
|
||||
public MaisDocConcept() {
|
||||
childConcepts = new ArrayList<MaisDocConcept>(5);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String id,Class<?> conceptClass) {
|
||||
this();
|
||||
setId(id);
|
||||
setConceptClass(conceptClass);
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String[] text,Class<?> conceptClass) {
|
||||
this(parent,text[0],text[1],text[2],text[3],conceptClass);
|
||||
}
|
||||
|
||||
public MaisDocConcept(MaisDocConcept parent,String id,String name,String descriptionName,String descriptionHelp,Class<?> conceptClass) {
|
||||
this(parent,id,conceptClass);
|
||||
setName(name);
|
||||
setDescriptionName(descriptionName);
|
||||
setDescriptionHelp(descriptionHelp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the descriptionName
|
||||
*/
|
||||
public String getDescriptionName() {
|
||||
return descriptionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param descriptionName the descriptionName to set
|
||||
*/
|
||||
public void setDescriptionName(String descriptionName) {
|
||||
this.descriptionName = descriptionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the descriptionHelp
|
||||
*/
|
||||
public String getDescriptionHelp() {
|
||||
return descriptionHelp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param descriptionHelp the descriptionHelp to set
|
||||
*/
|
||||
public void setDescriptionHelp(String descriptionHelp) {
|
||||
this.descriptionHelp = descriptionHelp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the conceptClass
|
||||
*/
|
||||
public Class<?> getConceptClass() {
|
||||
return conceptClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conceptClass the conceptClass to set
|
||||
*/
|
||||
public void setConceptClass(Class<?> conceptClass) {
|
||||
this.conceptClass = conceptClass;
|
||||
}
|
||||
|
||||
public void addChildConcepts(MaisDocConcept childConcept) {
|
||||
childConcepts.add(childConcept);
|
||||
}
|
||||
|
||||
public void removeChildConcept(MaisDocConcept childConcept) {
|
||||
childConcepts.remove(childConcept);
|
||||
}
|
||||
|
||||
public List<MaisDocConcept> getChildConcepts() {
|
||||
return childConcepts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public MaisDocConcept getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent the parent to set
|
||||
*/
|
||||
public void setParent(MaisDocConcept parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocIndexItem holds data to print the index all page.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Nov 09, 2013
|
||||
*/
|
||||
public class MaisDocIndexItem {
|
||||
|
||||
private String linkHref = null;
|
||||
private String linkText = null;
|
||||
private String titlePostHref = null;
|
||||
private String titlePostText = null;
|
||||
|
||||
private String title = null;
|
||||
private String description = null;
|
||||
|
||||
public MaisDocIndexItem() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the linkHref
|
||||
*/
|
||||
public String getLinkHref() {
|
||||
return linkHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param linkHref the linkHref to set
|
||||
*/
|
||||
public void setLinkHref(String linkHref) {
|
||||
this.linkHref = linkHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the linkText
|
||||
*/
|
||||
public String getLinkText() {
|
||||
return linkText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param linkText the linkText to set
|
||||
*/
|
||||
public void setLinkText(String linkText) {
|
||||
this.linkText = linkText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titlePostHref
|
||||
*/
|
||||
public String getTitlePostHref() {
|
||||
return titlePostHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param titlePostHref the titlePostHref to set
|
||||
*/
|
||||
public void setTitlePostHref(String titlePostHref) {
|
||||
this.titlePostHref = titlePostHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the titlePostText
|
||||
*/
|
||||
public String getTitlePostText() {
|
||||
return titlePostText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param titlePostText the titlePostText to set
|
||||
*/
|
||||
public void setTitlePostText(String titlePostText) {
|
||||
this.titlePostText = titlePostText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocNavLink holds all fields of an navigation link.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public class MaisDocNavLink {
|
||||
|
||||
private String id = null;
|
||||
private String href = null;
|
||||
private String title = null;
|
||||
private String text = null;
|
||||
private boolean resetHref = false;
|
||||
|
||||
public MaisDocNavLink() {
|
||||
}
|
||||
|
||||
public MaisDocNavLink(String id,String href,String title,String text,boolean resetHref) {
|
||||
setId(id);
|
||||
setHref(href);
|
||||
setTitle(title);
|
||||
setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the href
|
||||
*/
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param href the href to set
|
||||
*/
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the text
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text the text to set
|
||||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resetHref
|
||||
*/
|
||||
public boolean isResetHref() {
|
||||
return resetHref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resetHref the resetHref to set
|
||||
*/
|
||||
public void setResetHref(boolean resetHref) {
|
||||
this.resetHref = resetHref;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNode defines the concept impl data tree nodes for which we write documents.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocNode {
|
||||
|
||||
private Object userData = null;
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private MaisDocNode parent = null;
|
||||
private List<MaisDocNode> nodes = null;
|
||||
|
||||
public MaisDocNode() {
|
||||
nodes = new ArrayList<MaisDocNode>(30);
|
||||
}
|
||||
|
||||
public MaisDocNode(Object userData,String id,String name,String description) {
|
||||
this();
|
||||
setUserData(userData);
|
||||
setId(id);
|
||||
setName(name);
|
||||
if (description==null) {
|
||||
description = name;
|
||||
}
|
||||
setDescription(description);
|
||||
}
|
||||
|
||||
public MaisDocNode addNode(MaisDocNode node) {
|
||||
node.setParent(this);
|
||||
nodes.add(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
public boolean removeNode(MaisDocNode node) {
|
||||
return nodes.remove(node);
|
||||
}
|
||||
|
||||
public List<MaisDocNode> getNodes() {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T toUserData(Class<T> type) {
|
||||
return (T)getUserData();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userData
|
||||
*/
|
||||
public Object getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userData the userData to set
|
||||
*/
|
||||
public void setUserData(Object userData) {
|
||||
this.userData = userData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
public MaisDocNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parent the parent to set
|
||||
*/
|
||||
public void setParent(MaisDocNode parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
/**
|
||||
* ApiDocNodeBody are the parts from which the content body is created.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public enum MaisDocNodeBody {
|
||||
|
||||
TREE_PATH,
|
||||
DESCRIPTION_LINKS,
|
||||
DESCRIPTION_NODE,
|
||||
SUMMARY,
|
||||
DETAIL
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ApiDocNodeData holds all data the is configed per node page.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public class MaisDocNodeData {
|
||||
|
||||
private String prefixPath;
|
||||
private String navSelected = null;
|
||||
private List<String> groupTypeKeys = null;
|
||||
private Map<String,List<MaisDocNavLink>> groupTypeLinks = null;
|
||||
private String prevLink = null;
|
||||
private String nextLink = null;
|
||||
private String framePath = null;;
|
||||
private List<MaisDocNavLink> navLinks = null;
|
||||
private List<MaisDocIndexItem> indexItems = null;
|
||||
|
||||
public MaisDocNodeData() {
|
||||
navLinks = new ArrayList<MaisDocNavLink>(12);
|
||||
groupTypeKeys = new ArrayList<String>(navLinks.size()/3);
|
||||
groupTypeLinks = new HashMap<String,List<MaisDocNavLink>>(groupTypeKeys.size());
|
||||
indexItems = new ArrayList<MaisDocIndexItem>(500);
|
||||
}
|
||||
|
||||
public List<MaisDocIndexItem> getIndexItems() {
|
||||
return indexItems;
|
||||
}
|
||||
|
||||
public void addIndexItem(MaisDocIndexItem indexItem) {
|
||||
indexItems.add(indexItem);
|
||||
}
|
||||
|
||||
public void addGroupTypeKey(String groupTypeKey) {
|
||||
groupTypeKeys.add(groupTypeKey);
|
||||
}
|
||||
|
||||
public List<String> getGroupTypeKeys() {
|
||||
return groupTypeKeys;
|
||||
}
|
||||
|
||||
public void addGroupTypeLink(String groupTypeKey,MaisDocNavLink link) {
|
||||
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = new ArrayList<MaisDocNavLink>(10);
|
||||
groupTypeLinks.put(groupTypeKey, result);
|
||||
}
|
||||
result.add(link);
|
||||
}
|
||||
|
||||
public List<MaisDocNavLink> getGroupTypeLinks(String groupTypeKey) {
|
||||
List<MaisDocNavLink> result = groupTypeLinks.get(groupTypeKey);
|
||||
if (result==null) {
|
||||
result = new ArrayList<MaisDocNavLink>(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public MaisDocNavLink getGroupTypeLink(String groupTypeKey,String group) {
|
||||
List<MaisDocNavLink> links = getGroupTypeLinks(groupTypeKey);
|
||||
for (MaisDocNavLink link:links) {
|
||||
if (link.getId().equals(group)) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clearGroupTypeLinks() {
|
||||
groupTypeLinks.clear();
|
||||
}
|
||||
|
||||
public List<MaisDocNavLink> getNavLinks() {
|
||||
return navLinks;
|
||||
}
|
||||
|
||||
public MaisDocNavLink getNavLinkById(String id) {
|
||||
for (MaisDocNavLink link:navLinks) {
|
||||
if (link.getId().equals(id)) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addNavLink(MaisDocNavLink link) {
|
||||
navLinks.add(link);
|
||||
}
|
||||
|
||||
public void removeNavLink(MaisDocNavLink link) {
|
||||
navLinks.remove(link);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prefixPath
|
||||
*/
|
||||
public String getPrefixPath() {
|
||||
return prefixPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prefixPath the prefixPath to set
|
||||
*/
|
||||
public void setPrefixPath(String prefixPath) {
|
||||
this.prefixPath = prefixPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the navSelected
|
||||
*/
|
||||
public String getNavSelected() {
|
||||
return navSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param navSelected the navSelected to set
|
||||
*/
|
||||
public void setNavSelected(String navSelected) {
|
||||
this.navSelected = navSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the prevLink
|
||||
*/
|
||||
public String getPrevLink() {
|
||||
return prevLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param prevLink the prevLink to set
|
||||
*/
|
||||
public void setPrevLink(String prevLink) {
|
||||
this.prevLink = prevLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nextLink
|
||||
*/
|
||||
public String getNextLink() {
|
||||
return nextLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nextLink the nextLink to set
|
||||
*/
|
||||
public void setNextLink(String nextLink) {
|
||||
this.nextLink = nextLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the framePath
|
||||
*/
|
||||
public String getFramePath() {
|
||||
return framePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param framePath the framePath to set
|
||||
*/
|
||||
public void setFramePath(String framePath) {
|
||||
this.framePath = framePath;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNodeDataConfigurator is for per node config of data.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 11, 2013
|
||||
*/
|
||||
public interface MaisDocNodeDataConfigurator {
|
||||
|
||||
List<Class<?>> getTargetClasses();
|
||||
|
||||
void configNodeData(MaisDoc doc,MaisDocNode node,MaisDocNodeData data);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocNodeWriter are the parts from which the content body is created.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public interface MaisDocNodeWriter {
|
||||
|
||||
MaisDocNodeBody getNodeBody();
|
||||
List<Class<?>> getTargetClasses();
|
||||
List<Integer> getNodeBodyOrders();
|
||||
String getContentGroup();
|
||||
String getContentGroupType();
|
||||
|
||||
void writeNodeContent(MaisDocWriteEvent<MaisDocNode> e) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ApiDocPage defines seperate pages for the documentation.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocPage {
|
||||
|
||||
private String id = null;
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private List<MaisDocPageWriter> pageWriters = null;
|
||||
|
||||
public MaisDocPage() {
|
||||
pageWriters = new ArrayList<MaisDocPageWriter>(30);
|
||||
}
|
||||
|
||||
public MaisDocPage(String id,String name,String description,MaisDocPageWriter...writers) {
|
||||
this();
|
||||
setId(id);
|
||||
setName(name);
|
||||
setDescription(description);
|
||||
for (MaisDocPageWriter writer:writers) {
|
||||
addPageWriter(writer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the page writers.
|
||||
*/
|
||||
public List<MaisDocPageWriter> getPageWriters() {
|
||||
return pageWriters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param writer the writer to add.
|
||||
*/
|
||||
public void addPageWriter(MaisDocPageWriter writer) {
|
||||
pageWriters.add(writer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param writer the writer to add.
|
||||
*/
|
||||
public void removePageWriter(MaisDocPageWriter writer) {
|
||||
pageWriters.remove(writer);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* ApiDocPageWriter writes a page content part.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public interface MaisDocPageWriter {
|
||||
|
||||
void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* ApiDocRemoteUrl defines the javadoc package-list remote url.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 15, 2013
|
||||
*/
|
||||
public class MaisDocRemoteClass {
|
||||
|
||||
public final static String REMOTE_FILE = "package-list";
|
||||
private Logger logger = Logger.getLogger(MaisDocRemoteClass.class.getName());
|
||||
private String docUrl = null;
|
||||
private String packageListUrl = null;
|
||||
private List<String> packageList = null;
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass.
|
||||
*/
|
||||
private MaisDocRemoteClass() {
|
||||
packageList = new ArrayList<String>(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass with a javadoc url to fetch the package-list from.
|
||||
* @param docUrl The remote javadoc base url.
|
||||
*/
|
||||
public MaisDocRemoteClass(String docUrl) {
|
||||
this();
|
||||
setDocUrl(docUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the ApiDocRemoteClass with a javadoc url. but fetched the package-list from the packageListUrl.
|
||||
* @param docUrl The remote javadoc base url.
|
||||
* @param packageListUrl The remote/local package-list url.
|
||||
*/
|
||||
public MaisDocRemoteClass(String docUrl,String packageListUrl) {
|
||||
this(docUrl);
|
||||
setPackageListUrl(packageListUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns remote url for a class or null if no remote package excists for the class.
|
||||
* @param cls The class to get the remote url for.
|
||||
* @return The remote url of the class requested or null if none if found.
|
||||
*/
|
||||
public String getRemoteUrl(Class<?> cls) {
|
||||
if (cls==null) {
|
||||
return null;
|
||||
}
|
||||
if (cls.isArray()) {
|
||||
return null;
|
||||
}
|
||||
if (cls.getPackage()==null) {
|
||||
return null;
|
||||
}
|
||||
String packageName = cls.getPackage().getName();
|
||||
logger.fine("Search "+packageName+" in "+packageList.size()+" of "+docUrl);
|
||||
if (packageList.contains(packageName)) {
|
||||
String baseUrl = getDocUrlClean();
|
||||
String packagePath = packageName.replaceAll("\\.", "/");
|
||||
String fullUrl = baseUrl+packagePath+"/"+cls.getSimpleName()+".html";
|
||||
return fullUrl;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the docUrl by sometimes appending postfix slash.
|
||||
* @return The cleaned doc url.
|
||||
*/
|
||||
private String getDocUrlClean() {
|
||||
String baseUrl = getDocUrl();
|
||||
if (baseUrl.endsWith("/")==false) {
|
||||
baseUrl += "/";
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches and parses the package-list file.
|
||||
* @throws IOException If error happend.
|
||||
*/
|
||||
public void parseRemotePackageList() throws IOException {
|
||||
packageList.clear();
|
||||
String baseUrl = getDocUrlClean();
|
||||
baseUrl += REMOTE_FILE;
|
||||
URL url = new URL(baseUrl);
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setConnectTimeout(2000);
|
||||
conn.setReadTimeout(2000);
|
||||
parseRemoteFile(conn.getInputStream(), conn.getContentEncoding());
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsed the inputStream into the packagList values.
|
||||
* @param in The inputStream.
|
||||
* @param enc The encoding of the inputStream.
|
||||
* @throws IOException When error on inputStream.
|
||||
*/
|
||||
private void parseRemoteFile(InputStream in,String enc) throws IOException {
|
||||
if (enc==null) {
|
||||
enc = "UTF-8";
|
||||
}
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in,Charset.forName(enc)));
|
||||
try {
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null) {
|
||||
String lineClean = line.trim();
|
||||
packageList.add(lineClean);
|
||||
logger.finer("Adding remote package: '"+lineClean+"'");
|
||||
}
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the docUrl
|
||||
*/
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param docUrl the docUrl to set
|
||||
*/
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the packageListUrl
|
||||
*/
|
||||
public String getPackageListUrl() {
|
||||
return packageListUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param packageListUrl the packageListUrl to set
|
||||
*/
|
||||
public void setPackageListUrl(String packageListUrl) {
|
||||
this.packageListUrl = packageListUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the packageList
|
||||
*/
|
||||
public List<String> getPackageList() {
|
||||
return packageList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
|
||||
import org.x4o.maisdoc.flake.MaisDocContentWriter;
|
||||
|
||||
/**
|
||||
* ApiDocWriteEvent holds the needed objects to process write events of content parts.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 May 12, 2013
|
||||
*/
|
||||
public class MaisDocWriteEvent<T> {
|
||||
|
||||
private MaisDoc doc = null;
|
||||
private T eventObject = null;
|
||||
private MaisDocContentWriter writer = null;
|
||||
|
||||
/**
|
||||
* Creates an ApiDocNodeBodyEvent.
|
||||
* @param doc The ApiDoc we are writing.
|
||||
* @param writer The content writer to write to.
|
||||
* @param eventObject The event we are firing this event for.
|
||||
*/
|
||||
public MaisDocWriteEvent(MaisDoc doc,MaisDocContentWriter writer,T eventObject) {
|
||||
this.doc=doc;
|
||||
this.writer=writer;
|
||||
this.eventObject=eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the doc
|
||||
*/
|
||||
public MaisDoc getDoc() {
|
||||
return doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the event
|
||||
*/
|
||||
public T getEventObject() {
|
||||
return eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the writer
|
||||
*/
|
||||
public MaisDocContentWriter getWriter() {
|
||||
return writer;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2014, Willem Cazander
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**
|
||||
* The Api Doc Dom classes.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @since 1.0 May 12,2013
|
||||
*/
|
||||
package org.x4o.maisdoc.model;
|
||||
Loading…
Add table
Add a link
Reference in a new issue