Skip to content

Commit

Permalink
feat: add userAlias field to PortabilityJob class (#1334)
Browse files Browse the repository at this point in the history
* add userAlias field

* unfix tests
  • Loading branch information
alexeyqu-fb authored Feb 14, 2024
1 parent c787122 commit b587143
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public abstract class PortabilityJob {
private static final String NUMBER_OF_FAILED_FILES_KEY = "NUM_FAILED_FILES";
private static final String USER_TIMEZONE = "USER_TIMEZONE";
private static final String USER_LOCALE = "USER_LOCALE";
private static final String USER_ALIAS = "USER_ALIAS";

public static PortabilityJob.Builder builder() {
Instant now = Instant.now();
Expand Down Expand Up @@ -96,6 +97,9 @@ public static PortabilityJob fromMap(Map<String, Object> properties) {
String userLocale =
properties.containsKey(USER_LOCALE) ? (String) properties.get(USER_LOCALE) : null;

String userAlias =
properties.containsKey(USER_ALIAS) ? (String) properties.get(USER_ALIAS) : null;

TransferMode transferMode =
properties.containsKey(TRANSFER_MODE)
? TransferMode.valueOf((String) properties.get(TRANSFER_MODE))
Expand Down Expand Up @@ -129,6 +133,7 @@ public static PortabilityJob fromMap(Map<String, Object> properties) {
.build())
.setUserTimeZone(userTimeZone)
.setUserLocale(userLocale)
.setUserAlias(userAlias)
.setTransferMode(transferMode)
.build();
}
Expand Down Expand Up @@ -184,6 +189,10 @@ private static void isSet(String... strings) {
@JsonProperty("userLocale")
public abstract String userLocale();

@Nullable
@JsonProperty("userAlias")
public abstract String userAlias();

@Nullable
@JsonProperty("transferMode")
public abstract TransferMode transferMode();
Expand Down Expand Up @@ -246,6 +255,10 @@ public Map<String, Object> toMap() {
builder.put(USER_LOCALE, userLocale());
}

if (null != userAlias()) {
builder.put(USER_ALIAS, userAlias());
}

if (null != transferMode()) {
builder.put(TRANSFER_MODE, transferMode().toString());
}
Expand Down Expand Up @@ -340,6 +353,10 @@ public Builder setAndValidateJobAuthorization(JobAuthorization jobAuthorization)
@JsonProperty("userLocale")
public abstract Builder setUserLocale(String locale);

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("userAlias")
public abstract Builder setUserAlias(String alias);

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("transferMode")
public abstract Builder setTransferMode(TransferMode transferMode);
Expand Down

0 comments on commit b587143

Please sign in to comment.