dan-s1 commented on code in PR #8038: URL: https://github.com/apache/nifi/pull/8038#discussion_r1439062586
########## nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EncodeContent.java: ########## @@ -55,27 +59,105 @@ @CapabilityDescription("Encode or decode the contents of a FlowFile using Base64, Base32, or hex encoding schemes") public class EncodeContent extends AbstractProcessor { - public static final String ENCODE_MODE = "Encode"; - public static final String DECODE_MODE = "Decode"; - - public static final String BASE64_ENCODING = "base64"; - public static final String BASE32_ENCODING = "base32"; - public static final String HEX_ENCODING = "hex"; + public static final AllowableValue ENCODE_MODE = new AllowableValue("encode", "Encode", "Sets the operation mode to 'encode'."); + public static final AllowableValue DECODE_MODE = new AllowableValue("decode", "Decode", "Sets the operation mode to 'decoding'."); + + public static final AllowableValue BASE64_ENCODING = new AllowableValue("base64", "Base64", "Sets the encoding type to 'Base64'."); + public static final AllowableValue BASE32_ENCODING = new AllowableValue("base32", "Base32", "Sets the encoding type to 'Base32'."); + public static final AllowableValue HEX_ENCODING = new AllowableValue("hex", "Hexadecimal", "Sets the encoding type to 'Hexadecimal'."); + + /** + * Represents an allowable value that indicates the encoded FlowFile content should be output as a single line. + * When this value is set, the encoded content will not contain any line breaks or newlines, ensuring + * that the entire content is presented in a single, continuous line. + * <p> + * This value is particularly useful in scenarios where multiline output is not desired or could lead to issues, + * such as in certain data formats or when interfacing with systems that expect single-line input. + * </p> + */ + static final AllowableValue SINGLE_LINE_OUTPUT_TRUE = new AllowableValue("true", "True", "The encoded FlowFile content will be output as a single line."); + + + /** + * Represents an allowable value that indicates the encoded FlowFile content should be output as multiple lines. + * When this value is set, the encoded content will include appropriate line breaks or newlines, breaking + * the content into separate lines as required. + * <p> + * This setting is useful in scenarios where multi-line formatting is necessary or preferred, such as for + * improved readability, adherence to specific data formats, or compatibility with systems and tools that + * process multi-line input. + * </p> + */ + static final AllowableValue SINGLE_LINE_OUTPUT_FALSE = new AllowableValue("false", "False", "The encoded FlowFile content will be output as a multiple lines."); Review Comment: I would like to add to @exceptionfactory suggestion. Not only should there should be an enum as he said for the encodings, but I believe there should also be an enum for the single line options whereby you would not need to use the true and false for the values. You can use the actual enum value. So on line 150 instead of specifying each AllowableValue you could just specify the enum class, on lines 233-246 you could use a switch statement with the enum values instead of the if else testing for equality and in the in the `getStreamCallback` you could use the enum instead of a string for the encoding argument. Also when converting to the enum `SINGLE_LINE_OUTPUT_TRUE` and `SINGLE_LINE_OUTPUT_FALSE` should be renamed to `SINGLE_LINE` AND `MULTILINE`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org