Source:
<code>public Response createSituationTrigger(final SituationTriggerDTO situationTrigger) { final Collection<Situation> sits = Lists.newArrayList(); for (final Long situationId : situationTrigger.getSituationIds()) { final Situation situation = this.instanceService.getSituation(situationId); sits.add(situation); } ServiceTemplateInstance serviceInstance; try { serviceInstance = this.instanceService.getServiceTemplateInstance(situationTrigger.getServiceInstanceId(), false); } catch (final NotFoundException e) { serviceInstance = null; } NodeTemplateInstance nodeInstance = null; if (situationTrigger.getNodeInstanceId() != null) { nodeInstance = this.instanceService.getNodeTemplateInstance(situationTrigger.getNodeInstanceId()); } final Set<SituationTriggerProperty> inputs = Sets.newHashSet(); float eventProbability = -1.0f; <START> if (situationTrigger.getEventProbability() != -1.0f) { <END> eventProbability = situationTrigger.getEventProbability(); } String eventTime = null; if (situationTrigger.getEventTime() != null) { eventTime = situationTrigger.getEventTime(); } situationTrigger.getInputParams() .forEach(x -> inputs.add(new SituationTriggerProperty(x.getName(), x.getValue(), x.getType()))); final SituationTrigger sitTrig = this.instanceService.createNewSituationTrigger(sits, situationTrigger.isOnActivation(), situationTrigger.isSingleInstance(), serviceInstance, nodeInstance, situationTrigger.getInterfaceName(), situationTrigger.getOperationName(), inputs, eventProbability, eventTime); final URI instanceURI = UriUtil.generateSubResourceURI(this.uriInfo, sitTrig.getId().toString(), false); return Response.ok(instanceURI).build(); }</code><technical_language>.. no. do this. Floating point number comparisons need done properly run problems pretty quickly. While comparing != -1.0f **should** fine in theory, want correctly handle floating point comparisons board, implies falling Double.compare(d1, d2) (or Float.compare(f1, f2)) if want definitively precise (but smaller) floating point type here</technical_language>

Target:
public Response createSituationTrigger(final SituationTriggerDTO situationTrigger) { final Collection<Situation> sits = Lists.newArrayList(); for (final Long situationId : situationTrigger.getSituationIds()) { final Situation situation = this.instanceService.getSituation(situationId); sits.add(situation); } ServiceTemplateInstance serviceInstance; try { serviceInstance = this.instanceService.getServiceTemplateInstance(situationTrigger.getServiceInstanceId(), false); } catch (final NotFoundException e) { serviceInstance = null; } NodeTemplateInstance nodeInstance = null; if (situationTrigger.getNodeInstanceId() != null) { nodeInstance = this.instanceService.getNodeTemplateInstance(situationTrigger.getNodeInstanceId()); } final Set<SituationTriggerProperty> inputs = Sets.newHashSet(); float eventProbability = -1.0f; if (Float.compare(situationTrigger.getEventProbability(), eventProbability) != 0) { eventProbability = situationTrigger.getEventProbability(); } String eventTime = null; if (situationTrigger.getEventTime() != null) { eventTime = situationTrigger.getEventTime(); } situationTrigger.getInputParams() .forEach(x -> inputs.add(new SituationTriggerProperty(x.getName(), x.getValue(), x.getType()))); final SituationTrigger sitTrig = this.instanceService.createNewSituationTrigger(sits, situationTrigger.isOnActivation(), situationTrigger.isSingleInstance(), serviceInstance, nodeInstance, situationTrigger.getInterfaceName(), situationTrigger.getOperationName(), inputs, eventProbability, eventTime); final URI instanceURI = UriUtil.generateSubResourceURI(this.uriInfo, sitTrig.getId().toString(), false); return Response.ok(instanceURI).build(); }