use of org.openmrs.person.PersonMergeLogData in project openmrs-core by openmrs.
the class PersonServiceImpl method deserialize.
/**
* Deserializes a <code>PersonMErgeLog</code> object
*
* @param personMergeLog the <code> PersonMergeLog</code> object to deserialize
* @throws SerializationException
*/
private void deserialize(PersonMergeLog personMergeLog) throws SerializationException {
PersonMergeLogData data = Context.getSerializationService().getDefaultSerializer().deserialize(personMergeLog.getSerializedMergedData(), PersonMergeLogData.class);
personMergeLog.setPersonMergeLogData(data);
}
use of org.openmrs.person.PersonMergeLogData in project openmrs-core by openmrs.
the class PersonMergeLogValidatorTest method validate_shouldFailValidationIfWinnerIsNull.
/**
* @see PersonMergeLogValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfWinnerIsNull() {
PersonMergeLog personMergeLog = new PersonMergeLog();
personMergeLog.setLoser(new Person());
personMergeLog.setPersonMergeLogData(new PersonMergeLogData());
PersonMergeLogValidator validator = new PersonMergeLogValidator();
Errors errors = new BindException(personMergeLog, "personMergeLog");
validator.validate(personMergeLog, errors);
Assert.assertTrue(errors.hasFieldErrors("winner"));
}
use of org.openmrs.person.PersonMergeLogData in project openmrs-core by openmrs.
the class PersonMergeLogValidatorTest method validate_shouldFailValidationIfFieldLengthsAreNotCorrect.
/**
* @see PersonMergeLogValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() {
PersonMergeLog personMergeLog = new PersonMergeLog();
personMergeLog.setWinner(new Person());
personMergeLog.setLoser(new Person());
personMergeLog.setPersonMergeLogData(new PersonMergeLogData());
personMergeLog.setVoidReason("too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
PersonMergeLogValidator validator = new PersonMergeLogValidator();
Errors errors = new BindException(personMergeLog, "personMergeLog");
validator.validate(personMergeLog, errors);
Assert.assertTrue(errors.hasFieldErrors("voidReason"));
}
use of org.openmrs.person.PersonMergeLogData in project openmrs-core by openmrs.
the class PersonMergeLogValidatorTest method validate_shouldPassValidationIfFieldLengthsAreCorrect.
/**
* @see PersonMergeLogValidator#validate(Object,Errors)
*/
@Test
public void validate_shouldPassValidationIfFieldLengthsAreCorrect() {
PersonMergeLog personMergeLog = new PersonMergeLog();
personMergeLog.setWinner(new Person());
personMergeLog.setLoser(new Person());
personMergeLog.setPersonMergeLogData(new PersonMergeLogData());
personMergeLog.setVoidReason("voidReason");
PersonMergeLogValidator validator = new PersonMergeLogValidator();
Errors errors = new BindException(personMergeLog, "personMergeLog");
validator.validate(personMergeLog, errors);
Assert.assertFalse(errors.hasFieldErrors());
}
Aggregations