Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<module>studymanager-core</module>
<module>studymanager-observation</module>
<module>studymanager-intervention</module>
<module>studymanager-goaltemplates</module>
<module>studymanager-services</module>
<module>studymanager</module>
</modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public ComponentFactory<C,P> init(ComponentFactoryProperties componentProperties

public abstract String getTitle();

public abstract String getDescription();

public List<Value> getProperties() {
return List.of();
}

public abstract <P extends ComponentProperties> Class<P> getPropertyClass();

public abstract String getDescription();

//TODO remove in a next step (as soon as interventions impl is done in FE for new props
public Map<String, Object> getDefaultProperties() {
HashMap<String, Object> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright LBI-DHP and/or licensed to LBI-DHP under one or more
* contributor license agreements (LBI-DHP: Ludwig Boltzmann Institute
* for Digital Health and Prevention -- A research institute of the
* Ludwig Boltzmann Gesellschaft, Österreichische Vereinigung zur
* Förderung der wissenschaftlichen Forschung).
* Licensed under the Elastic License 2.0.
*/
package io.redlink.more.studymanager.core.properties.model;

public class ConfigSection extends Value<Void> {
public ConfigSection(String id) {
super(id);
}

@Override
public Class<Void> getValueType() {
return Void.class;
}

@Override
public String getType() {
return "GROUPING";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.redlink.more.studymanager.core.properties.model;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.Objects;

public class IntegerRange {
Comment thread
westei marked this conversation as resolved.

private final int lower;
private final int upper;

@JsonCreator
public IntegerRange(int lower, int upper) {
this.lower = lower;
this.upper = upper;
}

public int getLower() {
return lower;
}

public int getUpper() {
return upper;
}

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
IntegerRange that = (IntegerRange) o;
return lower == that.lower && upper == that.upper;
}

@Override
public int hashCode() {
return Objects.hash(lower, upper);
}

@Override
public String toString() {
return "IntegerRange{" +
"lower=" + lower +
", upper=" + upper +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright LBI-DHP and/or licensed to LBI-DHP under one or more
* contributor license agreements (LBI-DHP: Ludwig Boltzmann Institute
* for Digital Health and Prevention -- A research institute of the
* Ludwig Boltzmann Gesellschaft, Österreichische Vereinigung zur
* Förderung der wissenschaftlichen Forschung).
* Licensed under the Elastic License 2.0.
*/
package io.redlink.more.studymanager.core.properties.model;

import io.redlink.more.studymanager.core.validation.ValidationIssue;

public class IntegerRangeValue extends Value<IntegerRange> {

private int min = 0;
private int max = Integer.MAX_VALUE;

public IntegerRangeValue(String id) {
super(id);
}

@Override
public String getType() {
return "INTEGER_RANGE";
}

@Override
public Class<IntegerRange> getValueType() {
return IntegerRange.class;
}

@Override
public ValidationIssue doValidate(IntegerRange range) {
if(range != null && range.getLower() > range.getUpper()) {
return ValidationIssue.error(this, "Lower bound of RangeValue MUST NOT be higer as the upper bound (lower:" + range.getLower() + ", upper: " + range.getUpper() + ")");
}
if (range != null && (range.getLower() < getMin() || range.getUpper() > getMax()) ) {
return ValidationIssue.error(this, "Value must between " + getMin() + " and " + getMax());
}
return ValidationIssue.NONE;
}

public int getMin() {
return min;
}

public IntegerRangeValue setMin(int min) {
this.min = min;
return this;
}

public int getMax() {
return max;
}

public IntegerRangeValue setMax(int max) {
this.max = max;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.redlink.more.studymanager.core.properties.model;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.Objects;

public class NamedIntegerRange extends IntegerRange {

private String name;

@JsonCreator
public NamedIntegerRange(String name, int lower, int upper) {
super(lower, upper);
this.name = name;
}

public String getName() {
return name;
}

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NamedIntegerRange that = (NamedIntegerRange) o;
return Objects.equals(name, that.name);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), name);
}

@Override
public String toString() {
return "NamedIntegerRange{" +
"name='" + name + '\'' +
"lower=" + getLower() +
", upper=" + getUpper() +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright LBI-DHP and/or licensed to LBI-DHP under one or more
* contributor license agreements (LBI-DHP: Ludwig Boltzmann Institute
* for Digital Health and Prevention -- A research institute of the
* Ludwig Boltzmann Gesellschaft, Österreichische Vereinigung zur
* Förderung der wissenschaftlichen Forschung).
* Licensed under the Elastic License 2.0.
*/
package io.redlink.more.studymanager.core.properties.model;

import io.redlink.more.studymanager.core.validation.ValidationIssue;

public class NamedIntegerRangeValue extends Value<NamedIntegerRange> {

private int min = 0;
private int max = Integer.MAX_VALUE;

public NamedIntegerRangeValue(String id) {
super(id);
}

@Override
public String getType() {
return "INTEGER_RANGE";
}

@Override
public Class<NamedIntegerRange> getValueType() {
return NamedIntegerRange.class;
}

@Override
public ValidationIssue doValidate(NamedIntegerRange namedRange) {
if(namedRange != null && namedRange.getName() == null || namedRange.getName().isBlank()) {
return ValidationIssue.error(this, "The name of the RangeValue MUST NOT be blank");
}
if(namedRange != null && namedRange.getLower() > namedRange.getUpper()) {
return ValidationIssue.error(this, "Lower bound of RangeValue MUST NOT be higer as the upper bound (lower:" + namedRange.getLower() + ", upper: " + namedRange.getUpper() + ")");
}
if (namedRange != null && (namedRange.getLower() < getMin() || namedRange.getUpper() > getMax()) ) {
return ValidationIssue.error(this, "Value must between " + getMin() + " and " + getMax());
}
return ValidationIssue.NONE;
}

public int getMin() {
return min;
}

public NamedIntegerRangeValue setMin(int min) {
this.min = min;
return this;
}

public int getMax() {
return max;
}

public NamedIntegerRangeValue setMax(int max) {
this.max = max;
return this;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright LBI-DHP and/or licensed to LBI-DHP under one or more
* contributor license agreements (LBI-DHP: Ludwig Boltzmann Institute
* for Digital Health and Prevention -- A research institute of the
* Ludwig Boltzmann Gesellschaft, Österreichische Vereinigung zur
* Förderung der wissenschaftlichen Forschung).
* Licensed under the Elastic License 2.0.
*/
package io.redlink.more.studymanager.core.properties.model;

public class ValueGroup extends Value<Void> {
public ValueGroup(String id) {
super(id);
}

@Override
public Class<Void> getValueType() {
return Void.class;
}

@Override
public String getType() {
return "GROUPING";
}
}
2 changes: 2 additions & 0 deletions studymanager-goaltemplates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# More Studymanager Goal Templates

61 changes: 61 additions & 0 deletions studymanager-goaltemplates/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.redlink.more</groupId>
<artifactId>studymanager-parent</artifactId>
<version>1.0.${revision}${sha1}${changelist}</version>
</parent>

<artifactId>studymanager-goaltemplates</artifactId>
<name>More Study Manager - Goal Templates</name>

<dependencies>
<dependency>
<groupId>io.redlink.more</groupId>
<artifactId>studymanager-core</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.13.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
</dependencies>

</project>
Loading
Loading