Skip to content

Commit

Permalink
feat(element-template-generator): remove the value property and use t…
Browse files Browse the repository at this point in the history
…his annotation to other connetors
  • Loading branch information
mathias-vandaele committed Feb 18, 2025
1 parent 90b5d81 commit 7ae05bf
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*/
package io.camunda.connector.textract.model;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum DocumentLocationType {
@EnumValue(label = "S3", order = 1)
@DropdownItem(label = "S3", order = 1)
S3,
@EnumValue(label = "Camunda Document", order = 0)
@DropdownItem(label = "Camunda Document", order = 0)
UPLOADED;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package io.camunda.connector.textract.model;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum TextractExecutionType {
@EnumValue(label = "Real-time", order = 1)
@DropdownItem(label = "Real-time", order = 1)
SYNC,
@EnumValue(label = "Polling", order = 2)
@DropdownItem(label = "Polling", order = 2)
POLLING,
@EnumValue(label = "Asynchronous", order = 0)
@DropdownItem(label = "Asynchronous", order = 0)
ASYNC;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package io.camunda.connector.email.config;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum CryptographicProtocol {
@EnumValue(label = "None", order = 2)
@DropdownItem(label = "None", order = 2)
NONE,
@EnumValue(label = "TLS", order = 0)
@DropdownItem(label = "TLS", order = 0)
TLS,
@EnumValue(label = "SSL", order = 1)
@DropdownItem(label = "SSL", order = 1)
SSL;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
package io.camunda.connector.email.outbound.protocols.actions;

import com.fasterxml.jackson.annotation.JsonEnumDefaultValue;
import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum ContentType {
@JsonEnumDefaultValue
@EnumValue(label = "PLAIN", order = 0)
@DropdownItem(label = "PLAIN", order = 0)
PLAIN("text/plain; charset=utf-8"),
@EnumValue(label = "HTML", order = 1)
@DropdownItem(label = "HTML", order = 1)
HTML("text/html; charset=utf-8"),
@EnumValue(label = "HTML & Plaintext", order = 2)
@DropdownItem(label = "HTML & Plaintext", order = 2)
MULTIPART("multipart/mixed; charset=utf-8");

private final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package io.camunda.connector.email.outbound.protocols.actions;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum SortFieldImap {
@EnumValue(label = "Received Date", order = 0)
@DropdownItem(label = "Received Date", order = 0)
RECEIVED_DATE,
@EnumValue(label = "Sent Date", order = 1)
@DropdownItem(label = "Sent Date", order = 1)
SENT_DATE,
@EnumValue(label = "Size", order = 2)
@DropdownItem(label = "Size", order = 2)
SIZE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*/
package io.camunda.connector.email.outbound.protocols.actions;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;

public enum SortFieldPop3 {
@EnumValue(label = "Sent Date", order = 0)
@DropdownItem(label = "Sent Date", order = 0)
SENT_DATE,
@EnumValue(label = "Size", order = 1)
@DropdownItem(label = "Size", order = 1)
SIZE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*/
package io.camunda.connector.email.outbound.protocols.actions;

import io.camunda.connector.generator.java.annotation.EnumValue;
import io.camunda.connector.generator.java.annotation.DropdownItem;
import java.util.function.Function;

public enum SortOrder {
@EnumValue(order = 0, label = "ASC")
@DropdownItem(order = 0, label = "ASC")
ASC(comparison -> comparison),
@EnumValue(order = 1, label = "DESC")
@DropdownItem(order = 1, label = "DESC")
DESC(comparison -> -comparison);

private final Function<Integer, Integer> comparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface EnumValue {
public @interface DropdownItem {
/**
* Represents the order in which the dropdown will be shown, will be {@link Integer#MAX_VALUE } if
* not precised
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ private static List<DropdownModel> createDropdownModelList(Class<?> enumType) {
enumConstant -> {
try {
Field enumValue = enumType.getField(((Enum<?>) enumConstant).name());
if (enumValue.isAnnotationPresent(EnumValue.class)) {
EnumValue enumLabel = enumValue.getAnnotation(EnumValue.class);
if (enumValue.isAnnotationPresent(DropdownItem.class)) {
DropdownItem enumLabel = enumValue.getAnnotation(DropdownItem.class);
return new DropdownModel(
enumLabel.label(), enumValue.getName(), enumLabel.order());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public record MyConnectorInput(
String mayBeEmptyOrRegexValidatedJakartaStyle) {

enum MyEnum {
@EnumValue(label = "Value one", order = 0)
@DropdownItem(label = "Value one", order = 0)
VALUE1,
@EnumValue(label = "Value two", order = 1)
@DropdownItem(label = "Value two", order = 1)
VALUE2
}

Expand Down

0 comments on commit 7ae05bf

Please sign in to comment.