Skip to content

Commit

Permalink
Summary of updates:
Browse files Browse the repository at this point in the history
- Updated plugin selector mixin. Added no-auto-enable option to the install command.
- Plugin list command now uses arg groups, plugin get command uses mixin.
- Report-template pojo update and update generate-answerFile command to just copy a pre-made answer file.
- Updated to not use manually constructed json.
- Updated PredefinedFieldsTransformer to insert a placeholder for output columns fields that don't exist.
- Make upload/download methods start with lower case letters.
- Added the add/rm aliases to the install/uninstall commands.
- Moved POJOs to a new package & updated references to new pojo location
- Added plugin Get, Enable, and Disable commands
- Renamed upload command to install
- Renamed delete command to uninstall
- Created a plugin selector Mixin
- Update package location for SSCUrls
  • Loading branch information
MikeTheSnowman committed Aug 16, 2022
1 parent 2d27aff commit 1d71ced
Show file tree
Hide file tree
Showing 47 changed files with 719 additions and 182 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ lombok.config
fcli.log
/.apt_generated_tests/
/ReportTemplateDefAnswerTemplate.json*
/ReportTemplateDefAnswerTemplate.y*ml*
/*.rptdesign
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import com.fortify.cli.common.json.JacksonJsonNodeHelper;
import com.fortify.cli.common.json.transform.AbstractJsonNodeTransformer;
import com.fortify.cli.common.json.transform.IJsonNodeTransformer;
Expand All @@ -40,6 +41,7 @@
import lombok.experimental.Accessors;

public class PredefinedFieldsTransformer extends AbstractJsonNodeTransformer implements IJsonNodeTransformer {
private static final TextNode NOT_AVAILABLE_NODE = TextNode.valueOf("N/A");
private final LinkedHashMap<String, String> pathToHeaderMapping = new LinkedHashMap<>();
private final Function<String, String> fieldNameFormatter;
@Getter @Accessors(fluent=true) private boolean hasExplicitHeaders = false;
Expand Down Expand Up @@ -69,7 +71,13 @@ protected final ObjectNode transformObjectNode(ObjectNode input) {
}

private void addConvertedValue(ObjectNode output, String outputFieldName, ObjectNode input, String inputFieldPath) {
JsonNode value = getValue(input, inputFieldPath);
JsonNode value = null;
try{
value = getValue(input, inputFieldPath);
}catch (com.jayway.jsonpath.PathNotFoundException e){
value = NOT_AVAILABLE_NODE;
}

if ( value.isArray() ) {
output.put(outputFieldName,
StreamSupport.stream(value.spliterator(), false)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class Image {
public String imageType;
public String location;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class IssueParser {
@JacksonXmlElementWrapper(localName = "engine-type")
public String engine_type;
@JacksonXmlElementWrapper(localName = "supported-engine-versions")
public String supported_engine_versions;
@JacksonXmlElementWrapper(localName = "view-template")
public ViewTemplate view_template;
public String xsi;
public String text;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class Language {
public String id;
public String location;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.micronaut.core.annotation.ReflectiveAccess;

import java.util.List;

@ReflectiveAccess
@JacksonXmlRootElement(localName = "plugin")
public class Plugin {
@JacksonXmlElementWrapper(localName = "plugin-info")
public PluginInfo pluginInfo;
@JacksonXmlElementWrapper(localName = "issue-parser")
public IssueParser issue_parser;
public String xmlns;
public String xsi;
public String type;
public String id;
@JacksonXmlElementWrapper(localName = "api-version")
public String api_version;
public String text;

public static class Images {
public List<Image> image;
}

public static class Localization {
public List<Language> language;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class PluginInfo {
public String name;
public String version;
@JacksonXmlElementWrapper(localName = "data-version")
public int data_version;

public Vendor vendor;
public String description;
public Resources resources;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class Resources {
public Plugin.Localization localization;
public Plugin.Images images;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class Vendor {
public String name;
public String url;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.fortify.cli.ssc.domain.plugin.parser.xml;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class ViewTemplate {
public String description;
public String location;
public String text;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,11 +22,12 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate;
package com.fortify.cli.ssc.domain.report.template;

import com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums.ReportParameterType;
import io.micronaut.core.annotation.ReflectiveAccess;

import java.util.ArrayList;

@ReflectiveAccess
public class ReportParameter {
public ReportParameter(){}
Expand All @@ -35,6 +36,6 @@ public ReportParameter(){}
public String description;
public String identifier;
public ReportParameterType type;
public ReportParameterOption[] reportParameterOptions;
public ArrayList<ReportParameterOption> reportParameterOptions;
public int paramOrder;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate;
package com.fortify.cli.ssc.domain.report.template;

import io.micronaut.core.annotation.ReflectiveAccess;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,8 +22,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums;
package com.fortify.cli.ssc.domain.report.template;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public enum ReportParameterType {
BOOLEAN,
MULTI_PROJECT,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,8 +22,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums;
package com.fortify.cli.ssc.domain.report.template;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public enum ReportRenderingEngineType {
BIRT
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate;
package com.fortify.cli.ssc.domain.report.template;

import com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums.ReportRenderingEngineType;
import com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums.ReportType;
import io.micronaut.core.annotation.ReflectiveAccess;
import java.util.ArrayList;

@ReflectiveAccess
public class ReportTemplateDef {
public ReportTemplateDef(){}
public String name;
public boolean crossApp;
public String description;
public ReportType type;
public ReportRenderingEngineType renderingEngine;
public String fileName;
public ReportParameter[] parameters;
public String templateDocId;
public String guid;
public String name;
public int objectVersion;
public ArrayList<ReportParameter> parameters;
public int publishVersion;
public ReportRenderingEngineType renderingEngine;
public int templateDocId;
public ReportType type;
public String typeDefaultText;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,15 +22,12 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.existingReportTemplate;
package com.fortify.cli.ssc.domain.report.template;

import io.micronaut.core.annotation.ReflectiveAccess;

import java.util.ArrayList;

@ReflectiveAccess
public class ReportTemplateDef {
public ReportTemplateDef(){}
public class ReportTemplateDefResponse {
public int count;
public Data data;
public int errorCode;
Expand All @@ -40,22 +37,10 @@ public ReportTemplateDef(){}
public String stackTrace;
public int successCount;

public class Data{
public Data(){}
public boolean crossApp;
public String description;
public String fileName;
public String guid;
public class Data extends ReportTemplateDef {
public Integer id;
public int count;
public boolean inUse;
public String name;
public int objectVersion;
public ArrayList<Parameter> parameters;
public int publishVersion;
public String renderingEngine;
public int templateDocId;
public String type;
public String typeDefaultText;
public String _href;
}

Expand All @@ -64,25 +49,4 @@ public _href(){}
public String href;
}

public class Parameter{
public Parameter(){}
public String description;
public int id;
public String identifier;
public String name;
public int paramOrder;
public int reportDefinitionId;
public ArrayList<ReportParameterOption> reportParameterOptions;
public String type;
}

public class ReportParameterOption{
public ReportParameterOption(){}
public boolean defaultValue;
public String description;
public String displayValue;
public int id;
public int order;
public String reportValue;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
* (c) Copyright 2021 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
Expand All @@ -22,8 +22,11 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.report.template.newReportTemplate.enums;
package com.fortify.cli.ssc.domain.report.template;

import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public enum ReportType {
ISSUE,
PROJECT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
package com.fortify.cli.ssc.common.pojos.uploadResponse;
package com.fortify.cli.ssc.domain.uploadResponse;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
import io.micronaut.core.annotation.ReflectiveAccess;

@ReflectiveAccess
public class Code {
@JacksonXmlText(value = true)
int value;
public int value;
}
Loading

0 comments on commit 1d71ced

Please sign in to comment.