Skip to content

Commit

Permalink
#13250 Create Survey data structure (#13256)
Browse files Browse the repository at this point in the history
* #13250 Create Survey data structure

* #13250 Create Survey data structure - fixed api tests

---------

Co-authored-by: Levente Gal <levente.gal.ext@vitagroup.ag>
  • Loading branch information
leventegal-she and Levente Gal authored Jan 31, 2025
1 parent 101067d commit e28777d
Show file tree
Hide file tree
Showing 39 changed files with 1,885 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public enum FeatureType {
ImmutableMap.of(FeatureTypeProperty.EXCLUDE_NO_CASE_CLASSIFIED_CASES, Boolean.FALSE, FeatureTypeProperty.MAX_CHANGE_DATE_PERIOD, -1)),
ENVIRONMENT_MANAGEMENT(true, false, null, null, null),
SELF_REPORTING(true, false, null, null, null),
SURVEYS(true, false, null, null, null),

// FEATURE EXTENSIONS
ASSIGN_TASKS_TO_HIGHER_LEVEL(true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.utils.criteria.BaseCriteria;

public class SurveyCriteria extends BaseCriteria {
private static final long serialVersionUID = -7237755677408791266L;

private String freeText;
private Disease disease;

public String getFreeText() {
return freeText;
}

public void setFreeText(String freeText) {
this.freeText = freeText;
}

public SurveyCriteria freeText(String freeText) {
setFreeText(freeText);
return this;
}

public Disease getDisease() {
return disease;
}

public void setDisease(Disease disease) {
this.disease = disease;
}

public SurveyCriteria disease(Disease disease) {
setDisease(disease);
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.EntityDto;
import de.symeda.sormas.api.docgeneneration.DocumentTemplateReferenceDto;
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.DependingOnFeatureType;
import de.symeda.sormas.api.utils.FieldConstraints;

@DependingOnFeatureType(featureType = FeatureType.SURVEYS)
public class SurveyDto extends EntityDto {

private static final long serialVersionUID = 8680621267053679223L;

public static final String I18N_PREFIX = "Survey";

@NotBlank(message = Validations.requiredField)
@Size(max = FieldConstraints.CHARACTER_LIMIT_SMALL, message = Validations.textTooLong)
private String name;
@NotNull(message = Validations.requiredField)
private Disease disease;
private DocumentTemplateReferenceDto documentTemplate;
private DocumentTemplateReferenceDto emailTemplate;

public static SurveyDto build() {
SurveyDto survey = new SurveyDto();
survey.setUuid(DataHelper.createUuid());

return survey;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Disease getDisease() {
return disease;
}

public void setDisease(Disease disease) {
this.disease = disease;
}

public DocumentTemplateReferenceDto getDocumentTemplate() {
return documentTemplate;
}

public void setDocumentTemplate(DocumentTemplateReferenceDto documentTemplate) {
this.documentTemplate = documentTemplate;
}

public DocumentTemplateReferenceDto getEmailTemplate() {
return emailTemplate;
}

public void setEmailTemplate(DocumentTemplateReferenceDto emailTemplate) {
this.emailTemplate = emailTemplate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import java.util.List;

import javax.ejb.Remote;
import javax.validation.Valid;

import de.symeda.sormas.api.utils.SortProperty;

@Remote
public interface SurveyFacade {

SurveyDto save(@Valid SurveyDto dto);

SurveyDto getByUuid(String uuid);

long count(SurveyCriteria criteria);

List<SurveyIndexDto> getIndexList(SurveyCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties);

void deletePermanent(String uuid);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.uuid.AbstractUuidDto;

public class SurveyIndexDto extends AbstractUuidDto {

private static final long serialVersionUID = -5888585683689386052L;

private final String name;
private final Disease disease;

public SurveyIndexDto(String uuid, String name, Disease disease) {
super(uuid);
this.name = name;
this.disease = disease;
}

public String getName() {
return name;
}

public Disease getDisease() {
return disease;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import de.symeda.sormas.api.ReferenceDto;

public class SurveyReferenceDto extends ReferenceDto {
private static final long serialVersionUID = -8612115227784272980L;

public SurveyReferenceDto(String uuid, String caption) {
super(uuid, caption);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.survey;

import de.symeda.sormas.api.utils.criteria.BaseCriteria;

public class SurveyTokenCriteria extends BaseCriteria {

private static final long serialVersionUID = 4551275234176171493L;

private SurveyReferenceDto survey;
private String tokenLike;

public SurveyReferenceDto getSurvey() {
return survey;
}

public void setSurvey(SurveyReferenceDto survey) {
this.survey = survey;
}

public SurveyTokenCriteria survey(SurveyReferenceDto survey) {
setSurvey(survey);
return this;
}

public String getTokenLike() {
return tokenLike;
}

public void setTokenLike(String tokenLike) {
this.tokenLike = tokenLike;
}

public SurveyTokenCriteria tokenLike(String tokenLike) {
setTokenLike(tokenLike);
return this;
}
}
Loading

0 comments on commit e28777d

Please sign in to comment.