Skip to content

Commit

Permalink
#183 added new validations
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony4m committed Nov 28, 2024
1 parent 47e9111 commit 60721a8
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 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.ui.utils;

import com.vaadin.v7.data.validator.AbstractValidator;

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

@SuppressWarnings("serial")
public class EbsAnimalDeathValidator extends AbstractValidator<String> {

public boolean isValidDeath;

public EbsAnimalDeathValidator(String errorMessage, boolean isValidDeath) {
super(errorMessage);
this.isValidDeath = isValidDeath;
}

@Override
protected boolean isValidValue(String death) {
return DataHelper.isValidAnimalEbsDeath(isValidDeath);
}

public void setValidDeath(boolean validDeath) {
this.isValidDeath = validDeath;
}

@Override
public Class<String> getType() {
return String.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 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.ui.utils;

import com.vaadin.v7.data.validator.AbstractValidator;

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

@SuppressWarnings("serial")
public class EbsDateValidator extends AbstractValidator<String> {

public boolean isValidDate;

public EbsDateValidator(String errorMessage, boolean isValidDate) {
super(errorMessage);
this.isValidDate = isValidDate;
}

@Override
protected boolean isValidValue(String Date) {
return DataHelper.isValidEbsDate(isValidDate);
}

public void setValidDate(boolean isValidDate) {
this.isValidDate = isValidDate;
}

@Override
public Class<String> getType() {
return String.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 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.ui.utils;

import com.vaadin.v7.data.validator.AbstractValidator;

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

@SuppressWarnings("serial")
public class EbsPersonDeathValidator extends AbstractValidator<String> {

public boolean isValidDeath;

public EbsPersonDeathValidator(String errorMessage, boolean isValidDeath) {
super(errorMessage);
this.isValidDeath = isValidDeath;
}

@Override
protected boolean isValidValue(String death) {
return DataHelper.isValidPersonEbsDeath(isValidDeath);
}

public void setValidDeath(boolean validDeath) {
this.isValidDeath = validDeath;
}

@Override
public Class<String> getType() {
return String.class;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*******************************************************************************
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2018 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.ui.utils;

import com.vaadin.v7.data.validator.AbstractValidator;

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

@SuppressWarnings("serial")
public class EbsPhoneNumberValidator extends AbstractValidator<String> {

public EbsPhoneNumberValidator(String errorMessage) {
super(errorMessage);
}

@Override
protected boolean isValidValue(String phoneNumber) {
return DataHelper.isValidEbsPhoneNumber(phoneNumber);
}

@Override
public Class<String> getType() {
return String.class;
}
}

0 comments on commit 60721a8

Please sign in to comment.