<commit_before>package com.client.core.base.model.helper;

import java.util.List;
import java.util.Set;

import com.client.core.AppContext;
import com.client.core.base.service.meta.BullhornEntityMetaService;
import org.apache.log4j.Logger;

import com.bullhornsdk.data.api.BullhornData;
import com.bullhornsdk.data.model.entity.core.standard.Candidate;
import com.bullhornsdk.data.model.entity.core.standard.ClientContact;
import com.bullhornsdk.data.model.entity.core.standard.ClientCorporation;
import com.bullhornsdk.data.model.entity.core.standard.CorporateUser;
import com.bullhornsdk.data.model.entity.core.standard.JobOrder;
import com.bullhornsdk.data.model.entity.core.standard.JobSubmission;
import com.bullhornsdk.data.model.entity.core.standard.Lead;
import com.bullhornsdk.data.model.entity.core.standard.Note;
import com.bullhornsdk.data.model.entity.core.standard.Opportunity;
import com.bullhornsdk.data.model.entity.core.standard.Placement;
import com.bullhornsdk.data.model.entity.core.standard.PlacementChangeRequest;
import com.bullhornsdk.data.model.entity.core.standard.PlacementCommission;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;
import com.bullhornsdk.data.model.entity.core.type.UpdateEntity;
import com.bullhornsdk.data.model.entity.embedded.UserType;
import com.bullhornsdk.data.model.parameter.QueryParams;
import com.bullhornsdk.data.model.parameter.standard.ParamFactory;
import com.bullhornsdk.data.model.response.crud.CrudResponse;

public abstract class AbstractTriggerHelper<E extends BullhornEntity> implements TriggerHelper<E> {

	private final BullhornEntityMetaService bullhornEntityMetaService;
	private final BullhornData bullhornData;

	protected final Integer updatingUserID;
	protected E newEntity;
	protected E oldEntity;
	protected CorporateUser updatingUser;
	protected UserType updatingUserUserType;
	protected final Logger log = Logger.getLogger(getClass());

	public AbstractTriggerHelper(Integer updatingUserID, BullhornData bullhornData) {
		super();
		this.bullhornEntityMetaService = AppContext.getApplicationContext().getBean(BullhornEntityMetaService.class);
		this.bullhornData = bullhornData;
		this.updatingUserID = updatingUserID;
	}

	@Override
	public abstract E getNewEntity();

	@Override
	public abstract void setNewEntity(E newDto);

	@Override
	public abstract E getOldEntity();

	@Override
	public abstract void setOldEntity(E oldDto);

	@Override
	public Integer getUpdatingUserID() {
		return updatingUserID;
	}

	@Override
	public CorporateUser getUpdatingUser() {
		if (updatingUser == null) {
			Set<String> corporateUserFields = bullhornEntityMetaService.getFieldNames(CorporateUser.class);

			corporateUserFields.add("userType(id)");

			setUpdatingUser(findEntity(CorporateUser.class, updatingUserID, corporateUserFields));
		}

		return updatingUser;
	}

	@Override
	public void setUpdatingUser(CorporateUser updatingUser) {
		this.updatingUser = updatingUser;
	}

	@Override
	public UserType getUpdatingUserUserType() {
		if (updatingUserUserType == null) {
			UserType userType = findEntity(UserType.class, getUpdatingUser().getUserType().getId());

			setUpdatingUserUserType(userType);
		}

		return updatingUserUserType;<commit_msg>fix: duplicate entry of userType field<commit_after>package com.client.core.base.model.helper;

import java.util.List;
import java.util.Set;

import com.client.core.AppContext;
import com.client.core.base.service.meta.BullhornEntityMetaService;
import org.apache.log4j.Logger;

import com.bullhornsdk.data.api.BullhornData;
import com.bullhornsdk.data.model.entity.core.standard.Candidate;
import com.bullhornsdk.data.model.entity.core.standard.ClientContact;
import com.bullhornsdk.data.model.entity.core.standard.ClientCorporation;
import com.bullhornsdk.data.model.entity.core.standard.CorporateUser;
import com.bullhornsdk.data.model.entity.core.standard.JobOrder;
import com.bullhornsdk.data.model.entity.core.standard.JobSubmission;
import com.bullhornsdk.data.model.entity.core.standard.Lead;
import com.bullhornsdk.data.model.entity.core.standard.Note;
import com.bullhornsdk.data.model.entity.core.standard.Opportunity;
import com.bullhornsdk.data.model.entity.core.standard.Placement;
import com.bullhornsdk.data.model.entity.core.standard.PlacementChangeRequest;
import com.bullhornsdk.data.model.entity.core.standard.PlacementCommission;
import com.bullhornsdk.data.model.entity.core.type.BullhornEntity;
import com.bullhornsdk.data.model.entity.core.type.UpdateEntity;
import com.bullhornsdk.data.model.entity.embedded.UserType;
import com.bullhornsdk.data.model.parameter.QueryParams;
import com.bullhornsdk.data.model.parameter.standard.ParamFactory;
import com.bullhornsdk.data.model.response.crud.CrudResponse;

public abstract class AbstractTriggerHelper<E extends BullhornEntity> implements TriggerHelper<E> {

	private final BullhornEntityMetaService bullhornEntityMetaService;
	private final BullhornData bullhornData;

	protected final Integer updatingUserID;
	protected E newEntity;
	protected E oldEntity;
	protected CorporateUser updatingUser;
	protected UserType updatingUserUserType;
	protected final Logger log = Logger.getLogger(getClass());

	public AbstractTriggerHelper(Integer updatingUserID, BullhornData bullhornData) {
		super();
		this.bullhornEntityMetaService = AppContext.getApplicationContext().getBean(BullhornEntityMetaService.class);
		this.bullhornData = bullhornData;
		this.updatingUserID = updatingUserID;
	}

	@Override
	public abstract E getNewEntity();

	@Override
	public abstract void setNewEntity(E newDto);

	@Override
	public abstract E getOldEntity();

	@Override
	public abstract void setOldEntity(E oldDto);

	@Override
	public Integer getUpdatingUserID() {
		return updatingUserID;
	}

	@Override
	public CorporateUser getUpdatingUser() {
		if (updatingUser == null) {
			Set<String> corporateUserFields = bullhornEntityMetaService.getFieldNames(CorporateUser.class);

			setUpdatingUser(findEntity(CorporateUser.class, updatingUserID, corporateUserFields));
		}

		return updatingUser;
	}

	@Override
	public void setUpdatingUser(CorporateUser updatingUser) {
		this.updatingUser = updatingUser;
	}

	@Override
	public UserType getUpdatingUserUserType() {
		if (updatingUserUserType == null) {
			UserType userType = findEntity(UserType.class, getUpdatingUser().getUserType().getId());

			setUpdatingUserUserType(userType);
		}

		return updatingUserUserType;
{'fraction_non_alphanumeric': 0.09517177344475394, 'fraction_numerical': 0.00030950170225936243, 'mean_word_length': 6.428735632183908, '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': '2499431', 'n_tokens_mistral': 2054, 'n_tokens_neox': 1935, 'n_words': 331}