Skip to content

Commit

Permalink
Address feedback comments (#35868)
Browse files Browse the repository at this point in the history
* Feedback review items

* Review feedback

* Remove options package

* Updates

* Updates

* Fix build

* Fix build

* Fix build

* fix build

* Fix tests

* Remove redundant imports

* Fix build

* Fix build

* Fix build

* Add copyright message

* Address comments

* Fix build

* Fix build

* Address comments

* Update assets
  • Loading branch information
cparisineti authored Jul 13, 2023
1 parent dd9e569 commit 1df8b88
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 316 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/communication/azure-communication-jobrouter",
"Tag": "java/communication/azure-communication-jobrouter_276f0cc907"
"Tag": "java/communication/azure-communication-jobrouter_91731acd0d"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public final class ConditionalQueueSelector extends QueueSelectorAttachment {
/*
* The label selectors to attach
*/
@JsonProperty(value = "labelSelectors", required = true)
private List<QueueSelector> labelSelectors;
@JsonProperty(value = "queueSelectors", required = true)
private List<RouterQueueSelector> queueSelectors;

/**
* Get the condition property: A rule of one of the following types:
Expand Down Expand Up @@ -68,18 +68,18 @@ public ConditionalQueueSelector setCondition(RouterRule condition) {
*
* @return the labelSelectors value.
*/
public List<QueueSelector> getLabelSelectors() {
return this.labelSelectors;
public List<RouterQueueSelector> getQueueSelectors() {
return this.queueSelectors;
}

/**
* Set the labelSelectors property: The label selectors to attach.
*
* @param labelSelectors the labelSelectors value to set.
* @param queueSelectors the labelSelectors value to set.
* @return the ConditionalQueueSelector object itself.
*/
public ConditionalQueueSelector setLabelSelectors(List<QueueSelector> labelSelectors) {
this.labelSelectors = labelSelectors;
public ConditionalQueueSelector setQueueSelectors(List<RouterQueueSelector> queueSelectors) {
this.queueSelectors = queueSelectors;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public final class ConditionalWorkerSelector extends WorkerSelectorAttachment {
/*
* The label selectors to attach
*/
@JsonProperty(value = "labelSelectors", required = true)
private List<WorkerSelector> labelSelectors;
@JsonProperty(value = "workerSelectors", required = true)
private List<RouterWorkerSelector> workerSelectors;

/**
* Get the condition property: A rule of one of the following types:
Expand Down Expand Up @@ -68,18 +68,18 @@ public ConditionalWorkerSelector setCondition(RouterRule condition) {
*
* @return the labelSelectors value.
*/
public List<WorkerSelector> getLabelSelectors() {
return this.labelSelectors;
public List<RouterWorkerSelector> getWorkerSelectors() {
return this.workerSelectors;
}

/**
* Set the labelSelectors property: The label selectors to attach.
*
* @param labelSelectors the labelSelectors value to set.
* @param workerSelectors the labelSelectors value to set.
* @return the ConditionalWorkerSelector object itself.
*/
public ConditionalWorkerSelector setLabelSelectors(List<WorkerSelector> labelSelectors) {
this.labelSelectors = labelSelectors;
public ConditionalWorkerSelector setWorkerSelectors(List<RouterWorkerSelector> workerSelectors) {
this.workerSelectors = workerSelectors;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

package com.azure.communication.jobrouter.models;

import com.azure.core.util.logging.ClientLogger;

/**
* Wrapper class for labels. Supports double, String and boolean types.
*/
public final class LabelValue {

private static final ClientLogger LOGGER = new ClientLogger(LabelValue.class);


/**
* Value to pass to server.
*/
Expand All @@ -17,7 +22,7 @@ public final class LabelValue {
* Constructor for numerical value.
* @param numericValue numeric value of label.
*/
public LabelValue(double numericValue) {
public LabelValue(Double numericValue) {
this.value = numericValue;
}

Expand All @@ -33,7 +38,7 @@ public LabelValue(String stringValue) {
* Constructor for boolean value.
* @param boolValue boolean value of label.
*/
public LabelValue(boolean boolValue) {
public LabelValue(Boolean boolValue) {
this.value = boolValue;
}

Expand All @@ -44,4 +49,37 @@ public LabelValue(boolean boolValue) {
public Object getValue() {
return this.value;
}

/**
* Returns Double value of object
* @return (Double) value.
*/
public Double getValueAsDouble() {
if (value.getClass() == Double.class) {
return (Double) this.value;
}
throw LOGGER.logExceptionAsError(new IllegalStateException("value is not of type Double."));
}

/**
* Returns String value of object
* @return (String) value.
*/
public String getValueAsString() {
if (value.getClass() == String.class) {
return (String) this.value;
}
throw LOGGER.logExceptionAsError(new IllegalStateException("value is not of type String."));
}

/**
* Returns Boolean value of object
* @return (Boolean) value.
*/
public Boolean getValueAsBoolean() {
if (value.getClass() == Boolean.class) {
return (Boolean) this.value;
}
throw LOGGER.logExceptionAsError(new IllegalStateException("value is not of type Boolean."));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ public final class StaticQueueSelector extends QueueSelectorAttachment {
* Describes a condition that must be met against a set of labels for queue
* selection
*/
@JsonProperty(value = "labelSelector", required = true)
private QueueSelector labelSelector;
@JsonProperty(value = "queueSelector", required = true)
private RouterQueueSelector queueSelector;

/**
* Get the labelSelector property: Describes a condition that must be met against a set of labels for queue
* selection.
*
* @return the labelSelector value.
*/
public QueueSelector getLabelSelector() {
return this.labelSelector;
public RouterQueueSelector getQueueSelector() {
return this.queueSelector;
}

/**
* Set the labelSelector property: Describes a condition that must be met against a set of labels for queue
* selection.
*
* @param labelSelector the labelSelector value to set.
* @param queueSelector the labelSelector value to set.
* @return the StaticQueueSelector object itself.
*/
public StaticQueueSelector setLabelSelector(QueueSelector labelSelector) {
this.labelSelector = labelSelector;
public StaticQueueSelector setQueueSelector(RouterQueueSelector queueSelector) {
this.queueSelector = queueSelector;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ public final class StaticWorkerSelector extends WorkerSelectorAttachment {
* Describes a condition that must be met against a set of labels for
* worker selection
*/
@JsonProperty(value = "labelSelector", required = true)
private WorkerSelector labelSelector;
@JsonProperty(value = "workerSelector", required = true)
private RouterWorkerSelector workerSelector;

/**
* Get the labelSelector property: Describes a condition that must be met against a set of labels for worker
* selection.
*
* @return the labelSelector value.
*/
public WorkerSelector getLabelSelector() {
return this.labelSelector;
public RouterWorkerSelector getWorkerSelector() {
return this.workerSelector;
}

/**
* Set the labelSelector property: Describes a condition that must be met against a set of labels for worker
* selection.
*
* @param labelSelector the labelSelector value to set.
* @param workerSelector the labelSelector value to set.
* @return the StaticWorkerSelector object itself.
*/
public StaticWorkerSelector setLabelSelector(WorkerSelector labelSelector) {
this.labelSelector = labelSelector;
public StaticWorkerSelector setWorkerSelector(RouterWorkerSelector workerSelector) {
this.workerSelector = workerSelector;
return this;
}
}
Loading

0 comments on commit 1df8b88

Please sign in to comment.