use of com.thinkbiganalytics.rest.model.LabelValue in project kylo by Teradata.
the class BasePolicyAnnotationTransformer method convertToLabelValue.
private List<LabelValue> convertToLabelValue(String[] values) {
if (values != null) {
List<LabelValue> list = new ArrayList<>();
for (String value : values) {
LabelValue labelValue = new LabelValue();
labelValue.setLabel(value);
labelValue.setValue(value);
list.add(labelValue);
}
return list;
}
return null;
}
use of com.thinkbiganalytics.rest.model.LabelValue in project kylo by Teradata.
the class ServiceLevelAgreementRestController method getAvailableServiceLevelAgreementTemplateActionClasses.
@GET
@Path("/available-sla-template-actions")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation("Gets the available SLA actions.")
@ApiResponses({ @ApiResponse(code = 200, message = "Returns the list of SLA actions used when creating/editing an SLA Email Template.", response = LabelValue.class, responseContainer = "List") })
public Set<LabelValue> getAvailableServiceLevelAgreementTemplateActionClasses() {
List<ServiceLevelAgreementActionUiConfigurationItem> actionItems = ServiceLevelAgreementActionConfigTransformer.instance().discoverActionConfigurations();
Set<LabelValue> set = new HashSet<>();
actionItems.stream().forEach(a -> {
a.getActionClasses().stream().forEach(c -> {
LabelValue labelValue = new LabelValue(a.getDisplayName(), c.getName());
set.add(labelValue);
});
});
return set;
}
use of com.thinkbiganalytics.rest.model.LabelValue in project kylo by Teradata.
the class DefaultFeedManagerFeedService method applyFeedSelectOptions.
@Override
public /**
* Applies new LableValue array to the FieldProperty.selectableValues {label = Category.Display Feed Name, value=category.system_feed_name}
*/
void applyFeedSelectOptions(List<FieldRuleProperty> properties) {
if (properties != null && !properties.isEmpty()) {
List<FeedSummary> feedSummaries = getFeedSummaryData();
List<LabelValue> feedSelection = new ArrayList<>();
for (FeedSummary feedSummary : feedSummaries) {
boolean isDisabled = feedSummary.getState() == Feed.State.DISABLED.name();
boolean canEditDetails = accessController.isEntityAccessControlled() ? feedSummary.hasAction(FeedAccessControl.EDIT_DETAILS.getSystemName()) : accessController.hasPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
Map<String, Object> labelValueProperties = new HashMap<>();
labelValueProperties.put("feed:disabled", isDisabled);
labelValueProperties.put("feed:editDetails", canEditDetails);
feedSelection.add(new LabelValue(feedSummary.getCategoryAndFeedDisplayName() + (isDisabled ? " (DISABLED) " : ""), feedSummary.getCategoryAndFeedSystemName(), isDisabled ? "This feed is currently disabled" : "", labelValueProperties));
}
feedSelection.sort(Comparator.comparing(LabelValue::getLabel, String.CASE_INSENSITIVE_ORDER));
for (FieldRuleProperty property : properties) {
property.setSelectableValues(feedSelection);
if (property.getValues() == null) {
// reset the intial values to be an empty arraylist
property.setValues(new ArrayList<>());
}
}
}
}
use of com.thinkbiganalytics.rest.model.LabelValue in project kylo by Teradata.
the class BasePolicyAnnotationTransformer method convertToLabelValue.
private LabelValue convertToLabelValue(PropertyLabelValue propertyLabelValue) {
if (propertyLabelValue != null) {
LabelValue labelValue = new LabelValue();
labelValue.setLabel(propertyLabelValue.label());
labelValue.setValue(propertyLabelValue.value());
return labelValue;
}
return null;
}
use of com.thinkbiganalytics.rest.model.LabelValue in project kylo by Teradata.
the class InMemoryFeedManagerFeedService method applyFeedSelectOptions.
@Override
public void applyFeedSelectOptions(List<FieldRuleProperty> properties) {
if (properties != null && !properties.isEmpty()) {
List<FeedSummary> feedSummaries = getFeedSummaryData();
List<LabelValue> feedSelection = new ArrayList<>();
for (FeedSummary feedSummary : feedSummaries) {
feedSelection.add(new LabelValue(feedSummary.getCategoryAndFeedDisplayName(), feedSummary.getCategoryAndFeedSystemName()));
}
for (FieldRuleProperty property : properties) {
property.setSelectableValues(feedSelection);
if (property.getValues() == null) {
// reset the intial values to be an empty arraylist
property.setValues(new ArrayList<>());
}
}
}
}
Aggregations