Java 类ims.core.vo.domain.TaxonomyMapAssembler 实例源码

项目:openMAXIMS    文件:PrivateInsuranceCompaniesImpl.java   
/**
    * Saves a PrivateInsuranceCompanyVo
    */
    public ims.core.vo.PrivateInsuranceCompanyVo savePrivateInsuranceCompanyVo(ims.core.vo.PrivateInsuranceCompanyVo privateInsuranceCompanyVo) throws ims.domain.exceptions.StaleObjectException
    {
//       Check for value to save
        if (privateInsuranceCompanyVo == null)
            throw new DomainRuntimeException("Domain Error - Can not save a null privateInsuranceCompanyVo record");

        // Check for validated record
        if (!privateInsuranceCompanyVo.isValidated())
            throw new DomainRuntimeException("Domain Error - privateInsuranceCompanyVo record must be validated before save");

        DomainFactory factory = getDomainFactory();
        PrivateInsuranceCompany privateInsuranceCompany = PrivateInsuranceCompanyVoAssembler.extractPrivateInsuranceCompany(factory, privateInsuranceCompanyVo);
        privateInsuranceCompany.getCodeMappings().clear();

        List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, privateInsuranceCompanyVo.getCodeMappings());
        privateInsuranceCompany.setCodeMappings(mappings);
        factory.save(privateInsuranceCompany);

        privateInsuranceCompanyVo = PrivateInsuranceCompanyVoAssembler.create(privateInsuranceCompany);

        return privateInsuranceCompanyVo;
    }
项目:AvoinApotti    文件:SpecimenContainerAddEditImpl.java   
public ims.ocrr.vo.PathSpecimenContainerVo savePathSpecimenContainer(ims.ocrr.vo.PathSpecimenContainerVo pathSpecimenContainer) throws ims.domain.exceptions.StaleObjectException
{
    if ( !pathSpecimenContainer.isValidated() )
        throw new DomainRuntimeException("Path Specimen Container has not been validated");

    DomainFactory factory = getDomainFactory();

    PathSpecimenContainer doPathSpecimenContainer = PathSpecimenContainerVoAssembler.extractPathSpecimenContainer(factory, pathSpecimenContainer);
    doPathSpecimenContainer.getTaxonomyMap().clear();
    List lst = TaxonomyMapAssembler.extractTaxonomyMapList(factory, pathSpecimenContainer.getTaxonomyMap());
    doPathSpecimenContainer.setTaxonomyMap(lst);
    factory.save(doPathSpecimenContainer);
    return PathSpecimenContainerVoAssembler.create(doPathSpecimenContainer);
}
项目:openMAXIMS    文件:SpecimenContainerAddEditImpl.java   
public ims.ocrr.vo.PathSpecimenContainerVo savePathSpecimenContainer(ims.ocrr.vo.PathSpecimenContainerVo pathSpecimenContainer) throws ims.domain.exceptions.StaleObjectException
{
    if ( !pathSpecimenContainer.isValidated() )
        throw new DomainRuntimeException("Path Specimen Container has not been validated");

    DomainFactory factory = getDomainFactory();

    PathSpecimenContainer doPathSpecimenContainer = PathSpecimenContainerVoAssembler.extractPathSpecimenContainer(factory, pathSpecimenContainer);
    doPathSpecimenContainer.getTaxonomyMap().clear();
    List lst = TaxonomyMapAssembler.extractTaxonomyMapList(factory, pathSpecimenContainer.getTaxonomyMap());
    doPathSpecimenContainer.setTaxonomyMap(lst);
    factory.save(doPathSpecimenContainer);
    return PathSpecimenContainerVoAssembler.create(doPathSpecimenContainer);
}
项目:openMAXIMS    文件:SpecimenContainerAddEditImpl.java   
public ims.ocrr.vo.PathSpecimenContainerVo savePathSpecimenContainer(ims.ocrr.vo.PathSpecimenContainerVo pathSpecimenContainer) throws ims.domain.exceptions.StaleObjectException
{
    if ( !pathSpecimenContainer.isValidated() )
        throw new DomainRuntimeException("Path Specimen Container has not been validated");

    DomainFactory factory = getDomainFactory();

    PathSpecimenContainer doPathSpecimenContainer = PathSpecimenContainerVoAssembler.extractPathSpecimenContainer(factory, pathSpecimenContainer);
    doPathSpecimenContainer.getTaxonomyMap().clear();
    List lst = TaxonomyMapAssembler.extractTaxonomyMapList(factory, pathSpecimenContainer.getTaxonomyMap());
    doPathSpecimenContainer.setTaxonomyMap(lst);
    factory.save(doPathSpecimenContainer);
    return PathSpecimenContainerVoAssembler.create(doPathSpecimenContainer);
}
项目:openmaxims-linux    文件:SpecimenContainerAddEditImpl.java   
public ims.ocrr.vo.PathSpecimenContainerVo savePathSpecimenContainer(ims.ocrr.vo.PathSpecimenContainerVo pathSpecimenContainer) throws ims.domain.exceptions.StaleObjectException
{
    if ( !pathSpecimenContainer.isValidated() )
        throw new DomainRuntimeException("Path Specimen Container has not been validated");

    DomainFactory factory = getDomainFactory();

    PathSpecimenContainer doPathSpecimenContainer = PathSpecimenContainerVoAssembler.extractPathSpecimenContainer(factory, pathSpecimenContainer);
    doPathSpecimenContainer.getTaxonomyMap().clear();
    List lst = TaxonomyMapAssembler.extractTaxonomyMapList(factory, pathSpecimenContainer.getTaxonomyMap());
    doPathSpecimenContainer.setTaxonomyMap(lst);
    factory.save(doPathSpecimenContainer);
    return PathSpecimenContainerVoAssembler.create(doPathSpecimenContainer);
}
项目:AvoinApotti    文件:MedicationListImpl.java   
/**
     * Save a Medication Vo
     */
    public ims.core.vo.MedicationVo saveMedicationVo(ims.core.vo.MedicationVo voMedication) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
    {
        if (!voMedication.isValidated())
        {
            throw new DomainRuntimeException("This MedicationVo has not been validated");
        }

        DomainFactory factory = getDomainFactory();

        voMedication.setMedicationName(voMedication.getMedicationName().trim());//wdev-1336

        // Bug Fix WDEV-1896 
        if (!voMedication.getID_MedicationIsNotNull())
        {
            List l = factory.find("from Medication m where upper(m.medicationName) = :medName", new String[]{"medName"}, new Object[]{voMedication.getMedicationName().toUpperCase()});
            if (l.size() > 0)
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.");
        }

        Medication domMedication = MedicationVoAssembler.extractMedication(factory, voMedication);  

        domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName()));

        try
        {
            //WDEV-4212
            domMedication.getTaxonomyMap().clear();
            domMedication.setTaxonomyMap(TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMedication.getTaxonomyMap()));

            factory.save(domMedication);
        }
        catch (UnqViolationUncheckedException e)
        {       
//          check which constraint was violated (name/taxononmy map)

            //name
            Medication med = Medication.getMedicationFromMedicationName(factory, voMedication.getMedicationName());
            if (med != null && med.getId() != null && !(med.getId().equals(voMedication.getID_Medication())))
            {
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.", e);  
            }

            //taxonomy map
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMedication, voMedication.getTaxonomyMap(), "getMedicationName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            throw (e);
        }

        return MedicationVoAssembler.create(domMedication);
    }
项目:AvoinApotti    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForHistology(TumourHistologyRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourHistology as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourHistology()}));
}
项目:AvoinApotti    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForTNM(TumourGroupSiteTNMValueRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourGroupSiteTNMValue as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourGroupSiteTNMValue()}));
}
项目:AvoinApotti    文件:MosAdminImpl.java   
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voMos.isValidated())
        throw new DomainRuntimeException("Member of staff has not been validated");

    DomainFactory factory = getDomainFactory();
    Hcp doHcp = null;
    voMos.getName().setUppers();
    if (voMos.getHcpIsNotNull())
    {
        //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct.
        voMos.getHcp().setMos(voMos);
        //WDEV-3653 added checks for getHcpTypeIsNotNull
        if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL))
            doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING))
            doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY))
            doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp());
        else
            doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp());
        //If we're adding a new MemberOfStaff, but the Associated hcp already exists
        if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) 
        {
            throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff");
        }

        if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819
            doHcp.setIsActive(Boolean.TRUE);
    }

    if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull())  // wdev-3819 
        voMos.setIsActive(Boolean.TRUE);

    MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos);
    domMemberOfStaff.setHcp(doHcp);


    domMemberOfStaff.getCodeMappings().clear();
    List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); 
    domMemberOfStaff.setCodeMappings(mappings);



    domMemberOfStaff.getCommChannels().clear();
    List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels());
    domMemberOfStaff.setCommChannels(commChannels);

    try 
    {
        //clearMosTaxonomyMaps(voMos,factory);
        factory.save(domMemberOfStaff);
    }
    catch (UnqViolationUncheckedException e)
    {
        String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName");
        if(dupMessage != null)
            throw new UniqueKeyViolationException(dupMessage);

        throw(e);
    }
    /*catch (ForeignKeyViolationException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }*/

    //JME: 20060814 : WDEV-1231
    this.clearMosAndHcp();

    return MemberOfStaffVoAssembler.create(domMemberOfStaff);

}
项目:openMAXIMS    文件:MedicationListImpl.java   
/**
     * Save a Medication Vo
     */
    public ims.core.vo.MedicationVo saveMedicationVo(ims.core.vo.MedicationVo voMedication) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
    {
        if (!voMedication.isValidated())
        {
            throw new DomainRuntimeException("This MedicationVo has not been validated");
        }

        DomainFactory factory = getDomainFactory();

        voMedication.setMedicationName(voMedication.getMedicationName().trim());//wdev-1336

        // Bug Fix WDEV-1896 
        if (!voMedication.getID_MedicationIsNotNull())
        {
            List l = factory.find("from Medication m where upper(m.medicationName) = :medName", new String[]{"medName"}, new Object[]{voMedication.getMedicationName().toUpperCase()});
            if (l.size() > 0)
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.");
        }

        Medication domMedication = MedicationVoAssembler.extractMedication(factory, voMedication);  

        domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName()));

        try
        {
            //WDEV-4212
            domMedication.getTaxonomyMap().clear();
            domMedication.setTaxonomyMap(TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMedication.getTaxonomyMap()));

            factory.save(domMedication);
        }
        catch (UnqViolationUncheckedException e)
        {       
//          check which constraint was violated (name/taxononmy map)

            //name
            Medication med = Medication.getMedicationFromMedicationName(factory, voMedication.getMedicationName());
            if (med != null && med.getId() != null && !(med.getId().equals(voMedication.getID_Medication())))
            {
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.", e);  
            }

            //taxonomy map
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMedication, voMedication.getTaxonomyMap(), "getMedicationName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            throw (e);
        }

        return MedicationVoAssembler.create(domMedication);
    }
项目:openMAXIMS    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForHistology(TumourHistologyRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourHistology as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourHistology()}));
}
项目:openMAXIMS    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForTNM(TumourGroupSiteTNMValueRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourGroupSiteTNMValue as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourGroupSiteTNMValue()}));
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voMos.isValidated())
        throw new DomainRuntimeException("Member of staff has not been validated");

    DomainFactory factory = getDomainFactory();
    Hcp doHcp = null;
    voMos.getName().setUppers();
    if (voMos.getHcpIsNotNull())
    {
        //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct.
        voMos.getHcp().setMos(voMos);
        //WDEV-3653 added checks for getHcpTypeIsNotNull
        if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL))
            doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING))
            doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY))
            doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp());
        else
            doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp());
        //If we're adding a new MemberOfStaff, but the Associated hcp already exists
        if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) 
        {
            throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff");
        }

        if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819
            doHcp.setIsActive(Boolean.TRUE);
    }

    if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull())  // wdev-3819 
        voMos.setIsActive(Boolean.TRUE);

    MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos);
    domMemberOfStaff.setHcp(doHcp);


    domMemberOfStaff.getCodeMappings().clear();
    List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); 
    domMemberOfStaff.setCodeMappings(mappings);



    domMemberOfStaff.getCommChannels().clear();
    List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels());
    domMemberOfStaff.setCommChannels(commChannels);

    try 
    {
        //clearMosTaxonomyMaps(voMos,factory);
        factory.save(domMemberOfStaff);
    }
    catch (UnqViolationUncheckedException e)
    {
        String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName");
        if(dupMessage != null)
            throw new UniqueKeyViolationException(dupMessage);

        throw(e);
    }
    /*catch (ForeignKeyViolationException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }*/

    //JME: 20060814 : WDEV-1231
    this.clearMosAndHcp();

    //WDEV-19576 MOS Master File HL7 message
    MemberOfStaffVo assembledMos = MemberOfStaffVoAssembler.create(domMemberOfStaff);
    triggerMOSMasterFileEvent(assembledMos);

    return assembledMos;

}
项目:openMAXIMS    文件:MedicationListImpl.java   
/**
     * Save a Medication Vo
     */
    public ims.core.vo.MedicationVo saveMedicationVo(ims.core.vo.MedicationVo voMedication) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
    {
        if (!voMedication.isValidated())
        {
            throw new DomainRuntimeException("This MedicationVo has not been validated");
        }

        DomainFactory factory = getDomainFactory();

        voMedication.setMedicationName(voMedication.getMedicationName().trim());//wdev-1336

        // Bug Fix WDEV-1896 
        if (!voMedication.getID_MedicationIsNotNull())
        {
            List l = factory.find("from Medication m where upper(m.medicationName) = :medName", new String[]{"medName"}, new Object[]{voMedication.getMedicationName().toUpperCase()});
            if (l.size() > 0)
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.");
        }

        Medication domMedication = MedicationVoAssembler.extractMedication(factory, voMedication);  

        domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName()));

        try
        {
            //WDEV-4212
            domMedication.getTaxonomyMap().clear();
            domMedication.setTaxonomyMap(TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMedication.getTaxonomyMap()));

            factory.save(domMedication);
        }
        catch (UnqViolationUncheckedException e)
        {       
//          check which constraint was violated (name/taxononmy map)

            //name
            Medication med = Medication.getMedicationFromMedicationName(factory, voMedication.getMedicationName());
            if (med != null && med.getId() != null && !(med.getId().equals(voMedication.getID_Medication())))
            {
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.", e);  
            }

            //taxonomy map
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMedication, voMedication.getTaxonomyMap(), "getMedicationName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            throw (e);
        }

        return MedicationVoAssembler.create(domMedication);
    }
项目:openMAXIMS    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForHistology(TumourHistologyRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourHistology as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourHistology()}));
}
项目:openMAXIMS    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForTNM(TumourGroupSiteTNMValueRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourGroupSiteTNMValue as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourGroupSiteTNMValue()}));
}
项目:openMAXIMS    文件:MosAdminImpl.java   
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voMos.isValidated())
        throw new DomainRuntimeException("Member of staff has not been validated");

    DomainFactory factory = getDomainFactory();
    Hcp doHcp = null;
    voMos.getName().setUppers();
    if (voMos.getHcpIsNotNull())
    {
        //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct.
        voMos.getHcp().setMos(voMos);
        //WDEV-3653 added checks for getHcpTypeIsNotNull
        if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL))
            doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING))
            doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY))
            doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp());
        else
            doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp());
        //If we're adding a new MemberOfStaff, but the Associated hcp already exists
        if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) 
        {
            throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff");
        }

        if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819
            doHcp.setIsActive(Boolean.TRUE);
    }

    if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull())  // wdev-3819 
        voMos.setIsActive(Boolean.TRUE);

    MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos);
    domMemberOfStaff.setHcp(doHcp);


    domMemberOfStaff.getCodeMappings().clear();
    List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); 
    domMemberOfStaff.setCodeMappings(mappings);



    domMemberOfStaff.getCommChannels().clear();
    List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels());
    domMemberOfStaff.setCommChannels(commChannels);

    try 
    {
        //clearMosTaxonomyMaps(voMos,factory);
        factory.save(domMemberOfStaff);
    }
    catch (UnqViolationUncheckedException e)
    {
        String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName");
        if(dupMessage != null)
            throw new UniqueKeyViolationException(dupMessage);

        throw(e);
    }
    /*catch (ForeignKeyViolationException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }*/

    //JME: 20060814 : WDEV-1231
    this.clearMosAndHcp();

    return MemberOfStaffVoAssembler.create(domMemberOfStaff);

}
项目:openmaxims-linux    文件:MedicationListImpl.java   
/**
     * Save a Medication Vo
     */
    public ims.core.vo.MedicationVo saveMedicationVo(ims.core.vo.MedicationVo voMedication) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException
    {
        if (!voMedication.isValidated())
        {
            throw new DomainRuntimeException("This MedicationVo has not been validated");
        }

        DomainFactory factory = getDomainFactory();

        voMedication.setMedicationName(voMedication.getMedicationName().trim());//wdev-1336

        // Bug Fix WDEV-1896 
        if (!voMedication.getID_MedicationIsNotNull())
        {
            List l = factory.find("from Medication m where upper(m.medicationName) = :medName", new String[]{"medName"}, new Object[]{voMedication.getMedicationName().toUpperCase()});
            if (l.size() > 0)
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.");
        }

        Medication domMedication = MedicationVoAssembler.extractMedication(factory, voMedication);  

        domMedication.setKeywords(Keywords.setupKeyWords(domMedication.getKeywords(), domMedication.getMedicationName()));

        try
        {
            //WDEV-4212
            domMedication.getTaxonomyMap().clear();
            domMedication.setTaxonomyMap(TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMedication.getTaxonomyMap()));

            factory.save(domMedication);
        }
        catch (UnqViolationUncheckedException e)
        {       
//          check which constraint was violated (name/taxononmy map)

            //name
            Medication med = Medication.getMedicationFromMedicationName(factory, voMedication.getMedicationName());
            if (med != null && med.getId() != null && !(med.getId().equals(voMedication.getID_Medication())))
            {
                throw new UniqueKeyViolationException("Medication record called \"" + voMedication.getMedicationName() + "\" already exists. Duplicates not allowed.", e);  
            }

            //taxonomy map
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMedication, voMedication.getTaxonomyMap(), "getMedicationName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            throw (e);
        }

        return MedicationVoAssembler.create(domMedication);
    }
项目:openmaxims-linux    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForHistology(TumourHistologyRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourHistology as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourHistology()}));
}
项目:openmaxims-linux    文件:TumourCategoryGroupSitesImpl.java   
public TaxonomyMapCollection getTaxonomyMapForTNM(TumourGroupSiteTNMValueRefVo refVo)
{
    return TaxonomyMapAssembler.createTaxonomyMapCollectionFromTaxonomyMap(
            getDomainFactory().find("select t2_1 from TumourGroupSiteTNMValue as t1_1 join t1_1.taxonomyMap as t2_1 where t1_1.id = :id", new String[]{"id"}, new Object[]{refVo.getID_TumourGroupSiteTNMValue()}));
}
项目:openmaxims-linux    文件:MosAdminImpl.java   
public MemberOfStaffVo saveMosVo(MemberOfStaffVo voMos) throws StaleObjectException, DomainInterfaceException, UniqueKeyViolationException
{
    if (!voMos.isValidated())
        throw new DomainRuntimeException("Member of staff has not been validated");

    DomainFactory factory = getDomainFactory();
    Hcp doHcp = null;
    voMos.getName().setUppers();
    if (voMos.getHcpIsNotNull())
    {
        //Ensure the HCP is pointing back to the same MOS, ie the 1-1 bidirectional must be correct.
        voMos.getHcp().setMos(voMos);
        //WDEV-3653 added checks for getHcpTypeIsNotNull
        if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.MEDICAL))
            doHcp = MedicVoAssembler.extractMedic(factory, (MedicVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.NURSING))
            doHcp = NurseVoAssembler.extractNurse(factory, (NurseVo) voMos.getHcp());
        else if (voMos.getHcp().getHcpTypeIsNotNull()&&voMos.getHcp().getHcpType().equals(HcpDisType.THERAPY))
            doHcp = TherapistVoAssembler.extractTherapist(factory, (TherapistVo) voMos.getHcp());
        else
            doHcp = HcpAssembler.extractHcp(factory, voMos.getHcp());
        //If we're adding a new MemberOfStaff, but the Associated hcp already exists
        if (null == voMos.getID_MemberOfStaff() && doHcp.getId() != null) 
        {
            throw new DomainInterfaceException("Hcp is already associated with another Member Of Staff");
        }

        if (null == doHcp.isIsActive() && doHcp.isIsActive() == null) // wdev-3819
            doHcp.setIsActive(Boolean.TRUE);
    }

    if (null == voMos.getID_MemberOfStaff() && !voMos.getIsActiveIsNotNull())  // wdev-3819 
        voMos.setIsActive(Boolean.TRUE);

    MemberOfStaff domMemberOfStaff = MemberOfStaffVoAssembler.extractMemberOfStaff(factory, voMos);
    domMemberOfStaff.setHcp(doHcp);


    domMemberOfStaff.getCodeMappings().clear();
    List mappings = TaxonomyMapAssembler.extractTaxonomyMapList(factory, voMos.getCodeMappings()); 
    domMemberOfStaff.setCodeMappings(mappings);



    domMemberOfStaff.getCommChannels().clear();
    List commChannels = CommChannelVoAssembler.extractCommunicationChannelList(factory,voMos.getCommChannels());
    domMemberOfStaff.setCommChannels(commChannels);

    try 
    {
        //clearMosTaxonomyMaps(voMos,factory);
        factory.save(domMemberOfStaff);
    }
    catch (UnqViolationUncheckedException e)
    {
        String dupMessage = Keywords.checkDuplicateTaxonomy(factory, domMemberOfStaff, "codeMappings", voMos.getCodeMappings(), "getName");
        if(dupMessage != null)
            throw new UniqueKeyViolationException(dupMessage);

        throw(e);
    }
    /*catch (ForeignKeyViolationException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }*/

    //JME: 20060814 : WDEV-1231
    this.clearMosAndHcp();

    return MemberOfStaffVoAssembler.create(domMemberOfStaff);

}