Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 5a29d77

Browse files
authored
Merging release v0.8
2 parents 0f40c8b + 3a5556e commit 5a29d77

File tree

3 files changed

+40
-42
lines changed

3 files changed

+40
-42
lines changed

src/main/java/org/brapi/test/BrAPITestServer/service/pheno/ObservationUnitService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,10 @@ private void updateEntity(ObservationUnitPositionEntity entity, ObservationUnitP
543543
relationshipEntity.setLevelCode(level.getLevelCode());
544544
relationshipEntity.setLevelName(level.getLevelName());
545545
relationshipEntity.setLevelOrder(level.getLevelOrder());
546-
ObservationUnitEntity parentEntity = getObservationUnitEntity(level.getObservationUnitDbId());
547-
relationshipEntity.setObservationUnit(parentEntity);
546+
if(level.getObservationUnitDbId() != null) {
547+
ObservationUnitEntity parentEntity = getObservationUnitEntity(level.getObservationUnitDbId());
548+
relationshipEntity.setObservationUnit(parentEntity);
549+
}
548550
relationshipEntity.setPosition(entity);
549551
} catch (BrAPIServerException e) {
550552
e.printStackTrace();

src/main/java/org/brapi/test/BrAPITestServer/service/pheno/ScaleService.java

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -119,50 +119,46 @@ public ScaleEntity updateEntity(ScaleEntity entity, ScaleBaseClass scale) throws
119119

120120
ontologyService.updateOntologyReference(entity, scale.getOntologyReference());
121121

122-
if (scale.getValidValues() != null) {
123-
if (scale.getValidValues().isPresent()) {
124-
ScaleBaseClassValidValues validValues = scale.getValidValues().get();
125-
126-
Integer maxInt = NumberUtils.isCreatable(entity.getValidValueMax())
127-
? Integer.parseInt(entity.getValidValueMax())
128-
: null;
129-
Optional.ofNullable(UpdateUtility.replaceField(validValues.getMax(), maxInt))
130-
.ifPresent(t -> entity.setValidValueMax(t.toString()));
131-
entity.setValidValueMax(UpdateUtility.replaceField(validValues.getMaximumValue(), entity.getValidValueMax()));
132-
133-
Integer minInt = NumberUtils.isCreatable(entity.getValidValueMin())
134-
? Integer.parseInt(entity.getValidValueMin())
135-
: null;
136-
Optional.ofNullable(UpdateUtility.replaceField(validValues.getMin(), minInt))
137-
.ifPresent(t -> entity.setValidValueMin(t.toString()));
138-
entity.setValidValueMin(UpdateUtility.replaceField(validValues.getMinimumValue(), entity.getValidValueMin()));
139-
140-
if (validValues.getCategories() != null) {
141-
if (validValues.getCategories().isPresent()) {
142-
List<ScaleBaseClassValidValuesCategories> categories = validValues.getCategories().get();
143-
144-
if (entity.getValidValueCategories() != null) {
145-
for (ScaleValidValueCategoryEntity catEntity : entity.getValidValueCategories()) {
146-
catEntity.setScale(null);
147-
}
148-
}
149-
entity.setValidValueCategories(new ArrayList<>());
150-
entity.setValidValueCategories(categories.stream().map(cat -> {
151-
ScaleValidValueCategoryEntity catEntity = new ScaleValidValueCategoryEntity();
152-
catEntity.setLabel(cat.getLabel());
153-
catEntity.setValue(cat.getValue());
154-
catEntity.setScale(entity);
155-
return catEntity;
156-
}).collect(Collectors.toList()));
157-
} else {
158-
entity.setValidValueCategories(null);
122+
if (scale.getValidValues() != null && scale.getValidValues().isPresent()) {
123+
ScaleBaseClassValidValues validValues = scale.getValidValues().get();
124+
125+
Integer maxInt = NumberUtils.isCreatable(entity.getValidValueMax())
126+
? Integer.parseInt(entity.getValidValueMax())
127+
: null;
128+
Optional.ofNullable(UpdateUtility.replaceField(validValues.getMax(), maxInt))
129+
.ifPresent(t -> entity.setValidValueMax(t.toString()));
130+
entity.setValidValueMax(UpdateUtility.replaceField(validValues.getMaximumValue(), entity.getValidValueMax()));
131+
132+
Integer minInt = NumberUtils.isCreatable(entity.getValidValueMin())
133+
? Integer.parseInt(entity.getValidValueMin())
134+
: null;
135+
Optional.ofNullable(UpdateUtility.replaceField(validValues.getMin(), minInt))
136+
.ifPresent(t -> entity.setValidValueMin(t.toString()));
137+
entity.setValidValueMin(UpdateUtility.replaceField(validValues.getMinimumValue(), entity.getValidValueMin()));
138+
139+
if (validValues.getCategories() != null && validValues.getCategories().isPresent()) {
140+
List<ScaleBaseClassValidValuesCategories> categories = validValues.getCategories().get();
141+
142+
if (entity.getValidValueCategories() != null) {
143+
for (ScaleValidValueCategoryEntity catEntity : entity.getValidValueCategories()) {
144+
catEntity.setScale(null);
159145
}
160146
}
147+
entity.setValidValueCategories(new ArrayList<>());
148+
entity.setValidValueCategories(categories.stream().map(cat -> {
149+
ScaleValidValueCategoryEntity catEntity = new ScaleValidValueCategoryEntity();
150+
catEntity.setLabel(cat.getLabel());
151+
catEntity.setValue(cat.getValue());
152+
catEntity.setScale(entity);
153+
return catEntity;
154+
}).collect(Collectors.toList()));
161155
} else {
162156
entity.setValidValueCategories(null);
163-
entity.setValidValueMax(null);
164-
entity.setValidValueMin(null);
165157
}
158+
} else {
159+
entity.setValidValueCategories(null);
160+
entity.setValidValueMax(null);
161+
entity.setValidValueMin(null);
166162
}
167163

168164
return entity;

src/main/resources/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
application.properties
1+
properties/application.properties
22
/properties

0 commit comments

Comments
 (0)