<commit_before>package com.huntering.beans.activity.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huntering.beans.account.entity.Account;
import com.huntering.beans.activity.entity.Activity;
import com.huntering.beans.activity.entity.ActivityPeopleConn;
import com.huntering.beans.activity.entity.ActivityRound;
import com.huntering.beans.activity.entity.FeedBack;
import com.huntering.beans.activity.entity.Job;
import com.huntering.beans.activity.repository.ActivityRepository;
import com.huntering.beans.message.service.MessageService;
import com.huntering.beans.profile.entity.Company;
import com.huntering.beans.profile.entity.People;
import com.huntering.beans.profile.service.CompanyService;
import com.huntering.beans.profile.service.PeopleCompanyService;
import com.huntering.beans.profile.service.PeopleService;
import com.huntering.common.plugin.entity.Stateable.PeopleRole;
import com.huntering.common.service.BaseService;
import com.huntering.dto.ActivityForm;
import com.huntering.dto.FeedBackForm;

/**
 * 
 * @author <NAME>
 *
 */
@Service
public class ActivityService extends BaseService<Activity, Long> {
	
	@Autowired
	private PeopleService peopleService;
	@Autowired
	private CompanyService companyService;
	@Autowired
	private PeopleCompanyService peopleCompanyService;
	@Autowired
	private JobService jobService;
	@Autowired
	private MessageService messageService;

    @Autowired
    private ActivityRepository getActivityRepository() {
        return (ActivityRepository) baseRepository;
    }

    public List<Activity> findByAccountId(Long accountId) {
    	return getActivityRepository().findByAccountId(accountId);
    }
    
    public Activity addActivity(Activity activity) {
    	// TODO add activity
    	return null;
    }
    
    public ActivityRound addActivityRound(long activityId, ActivityRound activityRound) {
    	// TODO add activityRound
    	return null;
    }

	public Activity addActivityRound(long activityId, ActivityForm activityForm, Account account) {
		Activity activity = getActivityRepository().findOne(activityId);
		if(activity != null) {
			People interviewee = activity.getPeople();
			
			People interviewer = new People();
			interviewer.setAccount(account);
			interviewer.setMdn(activityForm.getInterviewerMdn());
			interviewer.setFullName(activityForm.getInterviewerName());
			interviewer.setEmail(activityForm.getInterviewerEmail());
			interviewer.setSelf(false);
			peopleService.saveAndFlush(interviewer);
			
			// new round
			ActivityRound round = new ActivityRound();
			round.setAddress(activityForm.getAddress());
			round.setStartDate(activityForm.getStratTime());
			round.setEndDate(activityForm.getEndTime());
			int maxRound = 0;<commit_msg>fix compilation error<commit_after>package com.huntering.beans.activity.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huntering.beans.account.entity.Account;
import com.huntering.beans.activity.entity.Activity;
import com.huntering.beans.activity.entity.ActivityPeopleConn;
import com.huntering.beans.activity.entity.ActivityRound;
import com.huntering.beans.activity.entity.FeedBack;
import com.huntering.beans.activity.entity.Job;
import com.huntering.beans.activity.repository.ActivityRepository;
import com.huntering.beans.message.service.MessageService;
import com.huntering.beans.profile.entity.Company;
import com.huntering.beans.profile.entity.People;
import com.huntering.beans.profile.service.CompanyService;
import com.huntering.beans.profile.service.PeopleCompanyService;
import com.huntering.beans.profile.service.PeopleService;
import com.huntering.common.plugin.entity.Stateable.PeopleRole;
import com.huntering.common.service.BaseService;
import com.huntering.dto.ActivityForm;
import com.huntering.dto.FeedBackForm;

/**
 * 
 * @author <NAME>
 *
 */
@Service
public class ActivityService extends BaseService<Activity, Long> {
	
	@Autowired
	private PeopleService peopleService;
	@Autowired
	private CompanyService companyService;
	@Autowired
	private PeopleCompanyService peopleCompanyService;
	@Autowired
	private JobService jobService;
	@Autowired
	private MessageService messageService;

    @Autowired
    private ActivityRepository getActivityRepository() {
        return (ActivityRepository) baseRepository;
    }

    public List<Activity> findByAccountId(Long accountId) {
    	return getActivityRepository().findByAccountId(accountId);
    }
    
    public Activity addActivity(Activity activity) {
    	// TODO add activity
    	return null;
    }
    
    public ActivityRound addActivityRound(long activityId, ActivityRound activityRound) {
    	// TODO add activityRound
    	return null;
    }

	public Activity addActivityRound(long activityId, ActivityForm activityForm, Account account) {
		Activity activity = getActivityRepository().findOne(activityId);
		if(activity != null) {
			People interviewee = activity.getPeople();
			
			People interviewer = new People();
			interviewer.setAccount(account);
			interviewer.setMdn(activityForm.getInterviewerMdn());
			interviewer.setFullName(activityForm.getInterviewerName());
			interviewer.setEmail(activityForm.getInterviewerEmail());
			interviewer.setSelf(false);
			peopleService.saveAndFlush(interviewer);
			
			// new round
			ActivityRound round = new ActivityRound();
			round.setAddress(activityForm.getAddress());
			round.setStartDate(activityForm.getStartTime());
			round.setEndDate(activityForm.getEndTime());
			int maxRound = 0;
{'fraction_non_alphanumeric': 0.09475524475524476, 'fraction_numerical': 0.00034965034965034965, 'mean_word_length': 5.349611542730299, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6543595', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1632, 'n_words': 289}