<commit_before>package gov.nih.nci.ncicb.cadsr.bulkloader.parser.translate;

import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.DataElementConceptList_ISO11179;
import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.DataElementConcept_ISO11179;
import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.ISO11179Elements;
import gov.nih.nci.ncicb.cadsr.domain.AdminComponentClassSchemeClassSchemeItem;
import gov.nih.nci.ncicb.cadsr.domain.DataElementConcept;
import gov.nih.nci.ncicb.cadsr.domain.DomainObjectFactory;
import gov.nih.nci.ncicb.cadsr.domain.ObjectClass;
import gov.nih.nci.ncicb.cadsr.domain.Property;

import java.util.List;

public class DataElementConceptTranslator extends AbstractTranslatorTemplate {

	@Override
	protected CaDSRObjectRegistry translateElement(ISO11179Elements iso11179Elements, CaDSRObjectRegistry objRegistry) {
		DataElementConceptList_ISO11179 isoDECList = iso11179Elements.getDataElementConcepts();
		List<DataElementConcept_ISO11179> isoDECList2 = isoDECList.getDataElementConcepts();
		for (DataElementConcept_ISO11179 isoDEC: isoDECList2) {
			DataElementConcept dec = getDEC(isoDEC, objRegistry);
			objRegistry.addDataElementConcept(isoDEC.getTagId(), dec);
		}
		
		return objRegistry;
	}
	
	private DataElementConcept getDEC(DataElementConcept_ISO11179 isoDEC, CaDSRObjectRegistry objRegistry) {
		String objRefId = isoDEC.getObjectClassRefId();
		String propRefId = isoDEC.getPropertyRefId();
		
		ObjectClass obj = objRegistry.getObjectClass(objRefId);
		Property prop = objRegistry.getProperty(propRefId);
		
		DataElementConcept dec = DomainObjectFactory.newDataElementConcept();
		dec.setObjectClass(obj);
		dec.setProperty(prop);
		
		String longName = util.getDECLongName(dec);
		String publicId = util.getIdentifier(isoDEC);
		Float version = util.getIdVersion(isoDEC);
		List<AdminComponentClassSchemeClassSchemeItem> acCSCSIList = util.getAdminComponentCSCSI(isoDEC, objRegistry);
		
		dec.setLongName(longName);
		dec.setPublicId(publicId);
		dec.setVersion(version);
		dec.setAcCsCsis(acCSCSIList);
		dec.setOrigin(util.getOrigin(isoDEC));
		
		return dec;
	}

}<commit_msg>set the CD selected by the user<commit_after>package gov.nih.nci.ncicb.cadsr.bulkloader.parser.translate;

import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.DataElementConceptList_ISO11179;
import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.DataElementConcept_ISO11179;
import gov.nih.nci.ncicb.cadsr.bulkloader.beans.castor.ISO11179Elements;
import gov.nih.nci.ncicb.cadsr.domain.AdminComponentClassSchemeClassSchemeItem;
import gov.nih.nci.ncicb.cadsr.domain.ConceptualDomain;
import gov.nih.nci.ncicb.cadsr.domain.DataElementConcept;
import gov.nih.nci.ncicb.cadsr.domain.DomainObjectFactory;
import gov.nih.nci.ncicb.cadsr.domain.ObjectClass;
import gov.nih.nci.ncicb.cadsr.domain.Property;

import java.util.List;

public class DataElementConceptTranslator extends AbstractTranslatorTemplate {

	@Override
	protected CaDSRObjectRegistry translateElement(ISO11179Elements iso11179Elements, CaDSRObjectRegistry objRegistry) {
		DataElementConceptList_ISO11179 isoDECList = iso11179Elements.getDataElementConcepts();
		List<DataElementConcept_ISO11179> isoDECList2 = isoDECList.getDataElementConcepts();
		for (DataElementConcept_ISO11179 isoDEC: isoDECList2) {
			DataElementConcept dec = getDEC(isoDEC, objRegistry);
			objRegistry.addDataElementConcept(isoDEC.getTagId(), dec);
		}
		
		return objRegistry;
	}
	
	private DataElementConcept getDEC(DataElementConcept_ISO11179 isoDEC, CaDSRObjectRegistry objRegistry) {
		String objRefId = isoDEC.getObjectClassRefId();
		String propRefId = isoDEC.getPropertyRefId();
		String cdRefId = isoDEC.getConceptualDomainRefId();
		
		ObjectClass obj = objRegistry.getObjectClass(objRefId);
		Property prop = objRegistry.getProperty(propRefId);
		ConceptualDomain conceptualDomain = objRegistry.getConceptualDomain(cdRefId);
		
		DataElementConcept dec = DomainObjectFactory.newDataElementConcept();
		dec.setObjectClass(obj);
		dec.setProperty(prop);
		dec.setConceptualDomain(conceptualDomain);
		
		String longName = util.getDECLongName(dec);
		String publicId = util.getIdentifier(isoDEC);
		Float version = util.getIdVersion(isoDEC);
		List<AdminComponentClassSchemeClassSchemeItem> acCSCSIList = util.getAdminComponentCSCSI(isoDEC, objRegistry);
		
		dec.setLongName(longName);
		dec.setPublicId(publicId);
		dec.setVersion(version);
		dec.setAcCsCsis(acCSCSIList);
		dec.setOrigin(util.getOrigin(isoDEC));
		
		return dec;
	}

}
{'fraction_non_alphanumeric': 0.09303867403314917, 'fraction_numerical': 0.02298342541436464, 'mean_word_length': 6.736752136752137, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7255895', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1531, 'n_words': 201}