class AdminUnitResourceConverter extends AbstractConverter<AdminUnitResource, AdminUnit> {

	@Override
	public AdminUnit convert(final AdminUnitResource source, final AdminUnit target) {
		
		target.setBegDate(source.getBegDate());
		target.setEndDate(source.getEndDate());
		target.setId(source.getId());
		target.setIdentifier(source.getIdentifier());
		target.setIdentifier1(source.getIdentifier1());
		target.setIdentifier2(source.getIdentifier2());
		target.setIdentifier3(source.getIdentifier3());
		target.setName(source.getName());
		
		if (source.getParentId() != null) {
			AdminUnit parent = new AdminUnit();
			parent.setId(source.getParentId());
			target.setParent(parent);
		}
		
		if (source.getAdminUnitTypeId() != null) {
			AdminUnitType adminUnitType = new AdminUnitType();
			adminUnitType.setId(source.getAdminUnitTypeId());
			target.setAdminUnitType(adminUnitType);
		}
		
		return target;
	}

}