11/*
22 * SysML v2 REST/HTTP Pilot Implementation
3- * Copyright (C) 2021-2023 Twingineer LLC
3+ * Copyright (C) 2021-2025 Twingineer LLC
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU Lesser General Public License as published by
5959import java .util .stream .Stream ;
6060
6161import static dao .impl .jpa .JpaDao .paginateQuery ;
62+ import static org .omg .sysml .query .impl .PrimitiveConstraintImpl .extractId ;
6263
6364public class JpaDataDao implements DataDao {
6465
@@ -239,7 +240,7 @@ else if (constraint instanceof PrimitiveConstraint) {
239240 JsonNode constrainedValueJson ;
240241 try {
241242 constrainedValueJson = primitiveConstraint .getValue () != null ?
242- Json .mapper ().readTree (primitiveConstraint .getValue ()) :
243+ Json .mapper ().readTree (primitiveConstraint .getValue (). get ( 0 ) ) :
243244 null ;
244245 } catch (IOException e ) {
245246 throw new IllegalArgumentException (e );
@@ -279,13 +280,7 @@ else if (constraint instanceof PrimitiveConstraint) {
279280 } else if (Data .class .isAssignableFrom (property .getPropertyType ())) {
280281 Object _actualValue = JavaBeanHelper .getBeanPropertyValue (data , property );
281282 actualValue = _actualValue != null ? ((Data ) _actualValue ).getId () : null ;
282- constrainedValue = constrainedValueJson != null ?
283- JavaBeanHelper .convert (
284- // intentionally `textValue` instead of `asText` to get a null value for
285- // improved error reporting
286- constrainedValueJson .path ("@id" ).textValue (),
287- UUID .class
288- ) : null ;
283+ constrainedValue = constrainedValueJson != null ? extractId (constrainedValueJson ) : null ;
289284 if (constrainedValue == null ) {
290285 throw new IllegalArgumentException ();
291286 }
@@ -303,12 +298,18 @@ else if (constraint instanceof PrimitiveConstraint) {
303298 case LESS_THAN :
304299 comparisonResult = comparison < 0 ;
305300 break ;
301+ case LESS_THAN_OR_EQUALS :
302+ comparisonResult = comparison <= 0 ;
303+ break ;
306304 case EQUALS :
307305 comparisonResult = comparison == 0 ;
308306 break ;
309307 case GREATER_THAN :
310308 comparisonResult = comparison > 0 ;
311309 break ;
310+ case GREATER_THAN_OR_EQUALS :
311+ comparisonResult = comparison >= 0 ;
312+ break ;
312313 default :
313314 throw new UnsupportedOperationException ("Unsupported primitive constraint operator: " + primitiveConstraint .getOperator ().name ());
314315 }
0 commit comments