|
|
|
@ -19,6 +19,7 @@ import org.gcube.informationsystem.utils.documentation.knowledge.Node;
|
|
|
|
|
import org.gcube.informationsystem.utils.documentation.knowledge.NodeElaborator;
|
|
|
|
|
import org.gcube.informationsystem.utils.documentation.knowledge.Tree;
|
|
|
|
|
import org.gcube.informationsystem.utils.documentation.model.DocumentationGenerator;
|
|
|
|
|
import org.gcube.informationsystem.utils.documentation.model.entities.ResourceDocumentationGenerator;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
@ -71,12 +72,10 @@ public class TreeGenerator extends Generator {
|
|
|
|
|
tree.addNode(type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void elaborateTree(final AccessType at, Tree tree, final File file) throws Exception {
|
|
|
|
|
logger.debug("Going to elaborate the following type tree\n{}", tree.toString());
|
|
|
|
|
|
|
|
|
|
NodeElaborator ne = new NodeElaborator() {
|
|
|
|
|
NodeElaborator documentationNE = new NodeElaborator() {
|
|
|
|
|
|
|
|
|
|
protected void writeSectionOnly(Type type, int level) throws Exception {
|
|
|
|
|
DocumentationGenerator dg = getDocumentationGenerator(type);
|
|
|
|
@ -108,15 +107,33 @@ public class TreeGenerator extends Generator {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tree.elaborate(ne);
|
|
|
|
|
tree.elaborate(documentationNE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void createUsageKnowledge(Tree tree) throws Exception {
|
|
|
|
|
|
|
|
|
|
NodeElaborator usageKnowledgeNE = new NodeElaborator() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void elaborate(Node node, int level) throws Exception {
|
|
|
|
|
Type type = node.getType();
|
|
|
|
|
ResourceDocumentationGenerator dg = new ResourceDocumentationGenerator(type);
|
|
|
|
|
dg.createUsageKnowledge();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tree.elaborate(usageKnowledgeNE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void generate() throws Exception {
|
|
|
|
|
|
|
|
|
|
File is = getFile(IS_MODEL_FILENAME, true);
|
|
|
|
|
File file = null;
|
|
|
|
|
|
|
|
|
|
Tree resourcesTree = types.get(AccessType.RESOURCE);
|
|
|
|
|
createUsageKnowledge(resourcesTree);
|
|
|
|
|
|
|
|
|
|
for(AccessType at : accessTypes) {
|
|
|
|
|
Type type = TypeMapper.createTypeDefinition(at.getTypeClass());
|
|
|
|
|
writeTypeToFile(type, is);
|
|
|
|
|