Skip to content

Commit

Permalink
[GITFLOW]merging 'hotfix-1.70.1' into 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MateStrysewske committed Mar 31, 2022
2 parents ff03028 + b1c399e commit 8f1c48b
Show file tree
Hide file tree
Showing 47 changed files with 478 additions and 278 deletions.
2 changes: 1 addition & 1 deletion sormas-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>de.symeda.sormas</groupId>
<artifactId>sormas-base</artifactId>
<version>1.70.0</version>
<version>1.70.1</version>
<relativePath>../sormas-base</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,6 @@ public interface PersonFacade {
void mergePerson(PersonDto leadPerson, PersonDto otherPerson);

PersonDto getByContext(PersonContext context, String contextUuid);

boolean isEnrolledInExternalJournal(String uuid);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* Copyright © 2016-2022 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
Expand All @@ -15,14 +15,15 @@

package de.symeda.sormas.api.sormastosormas;

import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.validation.ValidationErrors;
import java.util.List;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.validation.ValidationErrors;

public class SormasToSormasException extends Exception implements SormasToSormasI18nMessage {
public class SormasToSormasException extends SormasToSormasI18nMessageError {

private static final long serialVersionUID = 952700907523341584L;

Expand Down Expand Up @@ -60,7 +61,7 @@ public Object[] getArgs() {
}

@Override
public String getHumanMessage() {
protected String getHumanMessageUnsafe(){
if (StringUtils.isNotBlank(i18nTag) && ArrayUtils.isNotEmpty(args)) {
return String.format(I18nProperties.getString(i18nTag), args);
} else if (StringUtils.isNotBlank(i18nTag)) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2022 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.sormastosormas;

import java.util.Arrays;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* @author Alex Vidrean
* @since 25-Jun-21
*/
public abstract class SormasToSormasI18nMessageError extends Exception {

private final Logger logger = LoggerFactory.getLogger(getClass());

public SormasToSormasI18nMessageError(String message) {
super(message);
}

public SormasToSormasI18nMessageError() {
}

public abstract String getI18nTag();

public abstract Object[] getArgs();

protected abstract String getHumanMessageUnsafe() throws Exception;

public String getHumanMessage() {
try {
return getHumanMessageUnsafe();
} catch (Exception e) {
String error =
String.format("Formatting the human readable message failed. I18nTag: %s, arguments: %s", getI18nTag(), Arrays.toString(getArgs()));
logger.error(error);
return error;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2021 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* Copyright © 2016-2022 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.sormastosormas.validation;

import com.fasterxml.jackson.annotation.JsonIgnore;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.SormasToSormasI18nMessage;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class ValidationErrorGroup implements SormasToSormasI18nMessage, Serializable {
import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;

import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.SormasToSormasI18nMessageError;

public class ValidationErrorGroup extends SormasToSormasI18nMessageError implements Serializable {

private static final long serialVersionUID = 2075921523238507571L;

Expand All @@ -39,6 +38,7 @@ public class ValidationErrorGroup implements SormasToSormasI18nMessage, Serializ
private List<ValidationErrorMessage> messages = new ArrayList<>();

public ValidationErrorGroup() {
super();
messages = new ArrayList<>();

}
Expand Down Expand Up @@ -74,7 +74,7 @@ public void setUuid(String uuid) {
@Override
public Object[] getArgs() {
return new Object[] {
uuid };
uuid };
}

public List<ValidationErrorMessage> getMessages() {
Expand All @@ -87,7 +87,7 @@ public void setMessages(List<ValidationErrorMessage> messages) {

@JsonIgnore
@Override
public String getHumanMessage() {
protected String getHumanMessageUnsafe() {
if (StringUtils.isNotBlank(uuid)) {
return String.format("%s %s", I18nProperties.getCaption(i18nTag), uuid);
} else {
Expand All @@ -97,8 +97,10 @@ public String getHumanMessage() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ValidationErrorGroup that = (ValidationErrorGroup) o;
return Objects.equals(i18nTag, that.i18nTag) && Objects.equals(uuid, that.uuid);
}
Expand All @@ -107,4 +109,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(i18nTag, uuid);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,89 +1,90 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2021 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
*
* Copyright © 2016-2022 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.sormastosormas.validation;

import com.fasterxml.jackson.annotation.JsonIgnore;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.SormasToSormasI18nMessage;
import org.apache.commons.lang3.ArrayUtils;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

public class ValidationErrorMessage implements SormasToSormasI18nMessage, Serializable {

private static final long serialVersionUID = 1693893611287329737L;

private String i18nTag;

private Object[] args;

public ValidationErrorMessage() {

}

public ValidationErrorMessage(String i18nProperty, Object... args) {
this.i18nTag = i18nProperty;
this.args = args;
}

public void setI18nTag(String i18nTag) {
this.i18nTag = i18nTag;
}

@Override
public String getI18nTag() {
return i18nTag;
}

public void setArgs(Object[] args) {
this.args = args;
}

@Override
public Object[] getArgs() {
return args;
}

@JsonIgnore
@Override
public String getHumanMessage() {
if (ArrayUtils.isNotEmpty(args)) {
return I18nProperties.getValidationError(i18nTag, args);
} else {
return I18nProperties.getValidationError(i18nTag);
}
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ValidationErrorMessage that = (ValidationErrorMessage) o;
return Objects.equals(i18nTag, that.i18nTag) && Arrays.equals(args, that.args);
}

@Override
public int hashCode() {
int result = Objects.hash(i18nTag);
result = 31 * result + Arrays.hashCode(args);
return result;
}
}
import org.apache.commons.lang3.ArrayUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;

import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.sormastosormas.SormasToSormasI18nMessageError;

public class ValidationErrorMessage extends SormasToSormasI18nMessageError implements Serializable {

private static final long serialVersionUID = 1693893611287329737L;

private String i18nTag;

private Object[] args;

public ValidationErrorMessage() {

}

public ValidationErrorMessage(String i18nProperty, Object... args) {
this.i18nTag = i18nProperty;
this.args = args;
}

public void setI18nTag(String i18nTag) {
this.i18nTag = i18nTag;
}

@Override
public String getI18nTag() {
return i18nTag;
}

public void setArgs(Object[] args) {
this.args = args;
}

@Override
public Object[] getArgs() {
return args;
}

@JsonIgnore
@Override
protected String getHumanMessageUnsafe() {
if (ArrayUtils.isNotEmpty(args)) {
return I18nProperties.getValidationError(i18nTag, args);
} else {
return I18nProperties.getValidationError(i18nTag);
}
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ValidationErrorMessage that = (ValidationErrorMessage) o;
return Objects.equals(i18nTag, that.i18nTag) && Arrays.equals(args, that.args);
}

@Override
public int hashCode() {
int result = Objects.hash(i18nTag);
result = 31 * result + Arrays.hashCode(args);
return result;
}
}
Loading

0 comments on commit 8f1c48b

Please sign in to comment.