Search in sources :

Example 1 with EipOptionModel

use of org.apache.camel.maven.packaging.model.EipOptionModel in project camel by apache.

the class UpdateReadmeMojo method generateEipModel.

private EipModel generateEipModel(String json) {
    List<Map<String, String>> rows = parseJsonSchema("model", json, false);
    EipModel eip = new EipModel();
    eip.setName(getSafeValue("name", rows));
    eip.setTitle(getSafeValue("title", rows));
    eip.setDescription(getSafeValue("description", rows));
    eip.setJavaType(getSafeValue("javaType", rows));
    eip.setLabel(getSafeValue("label", rows));
    eip.setDeprecated("true".equals(getSafeValue("deprecated", rows)));
    eip.setInput("true".equals(getSafeValue("input", rows)));
    eip.setOutput("true".equals(getSafeValue("output", rows)));
    rows = parseJsonSchema("properties", json, true);
    for (Map<String, String> row : rows) {
        EipOptionModel option = new EipOptionModel();
        option.setName(getSafeValue("name", row));
        option.setDisplayName(getSafeValue("displayName", row));
        option.setType(getSafeValue("type", row));
        option.setJavaType(getSafeValue("javaType", row));
        option.setRequired(getSafeValue("required", row));
        option.setDeprecated("true".equals(getSafeValue("deprecated", row)));
        option.setDescription(getSafeValue("description", row));
        option.setInput("true".equals(getSafeValue("input", row)));
        option.setOutput("true".equals(getSafeValue("output", row)));
        // lets put required in the description
        if ("true".equals(option.getRequired())) {
            String desc = "*Required* " + option.getDescription();
            option.setDescription(desc);
        }
        // skip option named id/description/expression/outputs
        if ("id".equals(option.getName()) || "description".equals(option.getName()) || "expression".equals(option.getName()) || "outputs".equals(option.getName())) {
            getLog().debug("Skipping option: " + option.getName());
        } else {
            eip.addEipOptionModel(option);
        }
    }
    return eip;
}
Also used : EipOptionModel(org.apache.camel.maven.packaging.model.EipOptionModel) EipModel(org.apache.camel.maven.packaging.model.EipModel) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 EipModel (org.apache.camel.maven.packaging.model.EipModel)1 EipOptionModel (org.apache.camel.maven.packaging.model.EipOptionModel)1