<commit_before>package ch.openech.client.ewk.event;

import static ch.openech.dm.person.Person.PERSON;

import java.util.Collections;
import java.util.List;

import ch.openech.client.preferences.OpenEchPreferences;
import ch.openech.dm.person.Nationality;
import ch.openech.dm.person.Person;
import ch.openech.mj.edit.form.Form;
import ch.openech.mj.edit.validation.ValidationMessage;
import ch.openech.xml.write.EchSchema;
import ch.openech.xml.write.WriterEch0020;

public class UndoSwissEvent extends PersonEventEditor<Person> {

	public UndoSwissEvent(EchSchema echSchema, OpenEchPreferences preferences) {
		super(echSchema, preferences);
	}

	@Override
	protected void fillForm(Form<Person> formPanel) {
		formPanel.line(PERSON.nationality);
		formPanel.line(PERSON.residence);
		formPanel.line(PERSON.foreign.nameOnPassport);
	}

	@Override
	protected List<String> getXml(Person person, Person changedPerson, WriterEch0020 writerEch0020) throws Exception {
		return Collections.singletonList(writerEch0020.undoSwiss(changedPerson));
	}

	@Override
	public Person load() {
		return getPerson();
	}

	@Override
	public void validate(Person object, List<ValidationMessage> resultList) {
		Nationality nationality = object.nationality;
		if (nationality == null || nationality.nationalityCountry == null || nationality.nationalityCountry.isEmpty()) {
			resultList.add(new ValidationMessage(Person.PERSON.nationality, "Nationalität muss gesetzt sein"));
		} else if (nationality != null && nationality.nationalityCountry != null && nationality.nationalityCountry.isSwiss()) {
			resultList.add(new ValidationMessage(Person.PERSON.nationality, "Nationalität darf nicht Schweiz sein"));
		}
	}
	
}
<commit_msg>UndoSwissEvent: Falsches Feld wurde angezeigt (residence statt residencePermit)<commit_after>package ch.openech.client.ewk.event;

import static ch.openech.dm.person.Person.PERSON;

import java.util.Collections;
import java.util.List;

import ch.openech.client.preferences.OpenEchPreferences;
import ch.openech.dm.person.Nationality;
import ch.openech.dm.person.Person;
import ch.openech.mj.edit.form.Form;
import ch.openech.mj.edit.validation.ValidationMessage;
import ch.openech.xml.write.EchSchema;
import ch.openech.xml.write.WriterEch0020;

public class UndoSwissEvent extends PersonEventEditor<Person> {

	public UndoSwissEvent(EchSchema echSchema, OpenEchPreferences preferences) {
		super(echSchema, preferences);
	}

	@Override
	protected void fillForm(Form<Person> formPanel) {
		formPanel.line(PERSON.nationality);
		formPanel.line(PERSON.foreign.residencePermit);
		formPanel.line(PERSON.foreign.nameOnPassport);
	}

	@Override
	protected List<String> getXml(Person person, Person changedPerson, WriterEch0020 writerEch0020) throws Exception {
		return Collections.singletonList(writerEch0020.undoSwiss(changedPerson));
	}

	@Override
	public Person load() {
		return getPerson();
	}

	@Override
	public void validate(Person object, List<ValidationMessage> resultList) {
		Nationality nationality = object.nationality;
		if (nationality == null || nationality.nationalityCountry == null || nationality.nationalityCountry.isEmpty()) {
			resultList.add(new ValidationMessage(PERSON.nationality, "Nationalität muss gesetzt sein"));
		} else if (nationality != null && nationality.nationalityCountry != null && nationality.nationalityCountry.isSwiss()) {
			resultList.add(new ValidationMessage(PERSON.nationality, "Nationalität darf nicht Schweiz sein"));
		}
	}
	
}

{'fraction_non_alphanumeric': 0.10607798165137615, 'fraction_numerical': 0.009174311926605505, 'mean_word_length': 6.193814432989691, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7590783', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1064, 'n_words': 203}