<commit_before>package com.pineone.icbms.so.serviceprocessor.processor.context.handler;

import com.pineone.icbms.so.interfaces.database.dao.SessionDao;
import com.pineone.icbms.so.interfaces.database.model.ContextModelForDB;
import com.pineone.icbms.so.interfaces.database.model.ProfileForDB;
import com.pineone.icbms.so.interfaces.database.model.SessionEntity;
import com.pineone.icbms.so.interfaces.messagequeue.model.OrchestrationServiceForMQ;
import com.pineone.icbms.so.interfaces.messagequeue.producer.tracking.TrackingProducer;
import com.pineone.icbms.so.serviceprocessor.Const;
import com.pineone.icbms.so.serviceprocessor.processor.AProcessHandler;
import com.pineone.icbms.so.serviceutil.interfaces.database.IDatabaseManager;
import com.pineone.icbms.so.serviceutil.modelmapper.ModelMapper;
import com.pineone.icbms.so.serviceutil.state.StateStoreUtil;
import com.pineone.icbms.so.util.Settings2;
import com.pineone.icbms.so.util.conversion.DataConversion;
import com.pineone.icbms.so.util.conversion.ProfileTransFormData;
import com.pineone.icbms.so.util.http.ClientService;
import com.pineone.icbms.so.util.messagequeue.producer.DefaultProducerHandler;
import com.pineone.icbms.so.util.priority.Priority;
import com.pineone.icbms.so.util.session.DefaultSession;
import com.pineone.icbms.so.util.session.Session;
import com.pineone.icbms.so.virtualobject.context.contextmodel.IGenericContextModel;
import com.pineone.icbms.so.virtualobject.location.IGenericLocation;
import com.pineone.icbms.so.virtualobject.orchestrationservice.IGenericOrchestrationService;
import com.pineone.icbms.so.virtualobject.profile.IGenericProfile;
import org.springframework.beans.factory.annotation.Autowired;

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

/**
 * ContextModel handler.<BR/>
 * 상황모델에 대한 처리 로직
 * Created by uni4love on 2017. 1. 20..
 */
public class ContextModelHandler extends AProcessHandler<IGenericContextModel> {

//    @Autowired
//    SessionDao sessionDao;
    //SessionStore sessionStore;

    /**
     * constructor
     *
     * @param databaseManager DatabaseManager
     */
    public ContextModelHandler(IDatabaseManager databaseManager) {
        super(databaseManager);
    }

    /**
     * handle a message.<BR/>
     *
     * @param contextModel handle message
     */
    @Override
    public void handle(IGenericContextModel contextModel) {
        List<IGenericLocation> locationList = (List<IGenericLocation>) (contextModel.getState(Const.LOCATION_URI_LIST));
        handle(contextModel, locationList);
    }

    /**
     * ContextModel handle.<BR/>
     * 상황모델에 대한 처리
     * @param contextModel ContextModel
     */
    public void handle(IGenericContextModel contextModel, List<IGenericLocation> locationList) {

    	String contextModelId=null, contextModelName=null;

    	if (contextModel!=null) {
    		contextModelId = contextModel.getId();
    		ContextModelForDB cm = databaseManager.getContextModelById(contextModelId);
    		contextModelName = cm.getName();
    	}<commit_msg>존재하지 않는 CM에 대한 예외 처리<commit_after>package com.pineone.icbms.so.serviceprocessor.processor.context.handler;

import com.pineone.icbms.so.interfaces.database.dao.SessionDao;
import com.pineone.icbms.so.interfaces.database.model.ContextModelForDB;
import com.pineone.icbms.so.interfaces.database.model.ProfileForDB;
import com.pineone.icbms.so.interfaces.database.model.SessionEntity;
import com.pineone.icbms.so.interfaces.messagequeue.model.OrchestrationServiceForMQ;
import com.pineone.icbms.so.interfaces.messagequeue.producer.tracking.TrackingProducer;
import com.pineone.icbms.so.serviceprocessor.Const;
import com.pineone.icbms.so.serviceprocessor.processor.AProcessHandler;
import com.pineone.icbms.so.serviceutil.interfaces.database.IDatabaseManager;
import com.pineone.icbms.so.serviceutil.modelmapper.ModelMapper;
import com.pineone.icbms.so.serviceutil.state.StateStoreUtil;
import com.pineone.icbms.so.util.Settings2;
import com.pineone.icbms.so.util.conversion.DataConversion;
import com.pineone.icbms.so.util.conversion.ProfileTransFormData;
import com.pineone.icbms.so.util.http.ClientService;
import com.pineone.icbms.so.util.messagequeue.producer.DefaultProducerHandler;
import com.pineone.icbms.so.util.priority.Priority;
import com.pineone.icbms.so.util.session.DefaultSession;
import com.pineone.icbms.so.util.session.Session;
import com.pineone.icbms.so.virtualobject.context.contextmodel.IGenericContextModel;
import com.pineone.icbms.so.virtualobject.location.IGenericLocation;
import com.pineone.icbms.so.virtualobject.orchestrationservice.IGenericOrchestrationService;
import com.pineone.icbms.so.virtualobject.profile.IGenericProfile;
import org.springframework.beans.factory.annotation.Autowired;

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

/**
 * ContextModel handler.<BR/>
 * 상황모델에 대한 처리 로직
 * Created by uni4love on 2017. 1. 20..
 */
public class ContextModelHandler extends AProcessHandler<IGenericContextModel> {

//    @Autowired
//    SessionDao sessionDao;
    //SessionStore sessionStore;

    /**
     * constructor
     *
     * @param databaseManager DatabaseManager
     */
    public ContextModelHandler(IDatabaseManager databaseManager) {
        super(databaseManager);
    }

    /**
     * handle a message.<BR/>
     *
     * @param contextModel handle message
     */
    @Override
    public void handle(IGenericContextModel contextModel) {
        List<IGenericLocation> locationList = (List<IGenericLocation>) (contextModel.getState(Const.LOCATION_URI_LIST));
        handle(contextModel, locationList);
    }

    /**
     * ContextModel handle.<BR/>
     * 상황모델에 대한 처리
     * @param contextModel ContextModel
     */
    public void handle(IGenericContextModel contextModel, List<IGenericLocation> locationList) {

    	String contextModelId=null, contextModelName=null;

    	if (contextModel!=null) {
    		contextModelId = contextModel.getId();
    		ContextModelForDB cm = databaseManager.getContextModelById(contextModelId);
    		if (cm!=null) {
    			contextModelName = cm.getName();
    		} else {
    			log.warn("CM({}) is not exist ", contextModelId);
    		}
    	}
{'fraction_non_alphanumeric': 0.10579710144927536, 'fraction_numerical': 0.002898550724637681, 'mean_word_length': 4.585431654676259, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '2899415', 'n_tokens_mistral': 2092, 'n_tokens_neox': 2064, 'n_words': 275}