information-system-model-do.../src/main/java/org/gcube/informationsystem/utils/documentation/model/relations/RelationDocumentationGenera...

49 lines
1.6 KiB
Java

package org.gcube.informationsystem.utils.documentation.model.relations;
import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.utils.documentation.model.DocumentationGenerator;
import org.gcube.informationsystem.utils.documentation.rst.table.Cell;
import org.gcube.informationsystem.utils.documentation.rst.table.Row;
import org.gcube.informationsystem.utils.documentation.rst.table.RowType;
import org.gcube.informationsystem.utils.documentation.rst.table.Table;
/**
* @author Luca Frosini (ISTI - CNR)
*/
public class RelationDocumentationGenerator<R extends Relation<? extends Resource, ? extends Entity>> extends DocumentationGenerator<R> {
public RelationDocumentationGenerator(Class<R> clz) {
super(clz, TypeMapper.getType(RelationElement.class));
}
protected Row getHeadingRow() {
Row row = new Row(RowType.HEADING);
Cell name = new Cell();
name.setText("Name");
row.appendCell(name);
Cell type = new Cell();
type.setText("Type");
row.appendCell(type);
Cell attributes = new Cell();
attributes.setText("Attributes");
row.appendCell(attributes);
Cell description = new Cell();
description.setText("Description");
row.appendCell(description);
return row;
}
@Override
protected Table getTable() {
Table table = new Table();
table.appendRow(getHeadingRow());
return table;
}
}