class PublicActivityResourceConverter extends AbstractConverter<PublicActivityResource, PublicActivity> {

	@Override
	public PublicActivity convert(final PublicActivityResource source, final PublicActivity target) {

		target.setName(source.getName());
		target.setBegDate(source.getBegDate());
		target.setEndDate(source.getEndDate());
		
		if (source.getPublicActivityTypeId() != null) {
			PublicActivityType publicActiveType = new PublicActivityType();
			publicActiveType.setId(source.getPublicActivityTypeId());
			target.setPublicActivityType(publicActiveType);
		}
		
		if (source.getTimePeriodId() != null) {
			TimePeriod timePeriod = new TimePeriod();
			timePeriod.setId(source.getTimePeriodId());
			target.setTimePeriod(timePeriod);
		}
		
		return target;
	}

}