private boolean isValidLocationFormat(final String location) { boolean valid = true; if (SentiloUtils.stringIsNotEmptyOrNull(location)) { final String[] coordinatesList = location.split(Constants.LOCATION_TOKEN_SPLITTER); for (int i = 0; i < coordinatesList.length && valid; i++) { valid = validateCoordinatesFormat(coordinatesList[i]); } } return valid; }
if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getDataType())) { sensor.setDataType(parseDataTypeValue(catalogSensor.getDataType())); if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getDescription())) { sensor.setDescription(catalogSensor.getDescription()); if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getType())) { sensor.setType(catalogSensor.getType()); if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getUnit())) { sensor.setUnit(catalogSensor.getUnit()); if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getTimeZone())) { sensor.setTimeZone(catalogSensor.getTimeZone());
if (SentiloUtils.stringIsNotEmptyOrNull(catalogComponent.getComponentDesc())) { component.setDescription(catalogComponent.getComponentDesc()); if (SentiloUtils.stringIsNotEmptyOrNull(catalogComponent.getComponentType())) { component.setComponentType(catalogComponent.getComponentType()); if (SentiloUtils.stringIsNotEmptyOrNull(catalogComponent.getLocation())) { component.setLocation(CatalogUtils.convertStringLocation(catalogComponent.getLocation()));
private static Alert buildAlertToUpdate(final CatalogAlert catalogAlert, final ApiAlertConverterContext context, final String catalogUser) { final Alert alert = context.getAlertService().find(new Alert(catalogAlert.getId())); final String entityId = StringUtils.hasText(catalogAlert.getEntity()) ? catalogAlert.getEntity() : context.getMessage().getEntityId(); // To confirm that an alert exists not only alert must be not null but also type and owner must // be equals if (alert != null && verifyType(alert.getType(), catalogAlert.getType()) && verifyOwner(alert, entityId)) { if (SentiloUtils.stringIsNotEmptyOrNull(catalogAlert.getName())) { alert.setName(catalogAlert.getName()); } if (SentiloUtils.stringIsNotEmptyOrNull(catalogAlert.getDescription())) { alert.setDescription(catalogAlert.getDescription()); } if (Type.INTERNAL.equals(alert.getType())) { if (SentiloUtils.stringIsNotEmptyOrNull(catalogAlert.getTrigger())) { alert.setTrigger(AlertTriggerType.valueOf(catalogAlert.getTrigger())); } if (SentiloUtils.stringIsNotEmptyOrNull(catalogAlert.getExpression())) { alert.setExpression(catalogAlert.getExpression()); } } alert.setUpdatedAt(new Date()); alert.setUpdatedBy(catalogUser); } else { final String errorMessage = String.format(ALERT_NOT_FOUND, catalogAlert.getId(), catalogAlert.getType()); context.getResults().addErrorMessage(errorMessage); } return alert; }
if (!SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getComponent())) { catalogSensor.setComponent(catalogSensor.getSensor()); if (!SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getComponentType())) { catalogSensor.setComponentType(Constants.DEFAULT_COMPONENT_TYPE); if (SentiloUtils.stringIsNotEmptyOrNull(catalogSensor.getComponentDesc())) { component.setDescription(catalogSensor.getComponentDesc());