Java 类ims.core.vo.CommunityServiceVo 实例源码

项目:AvoinApotti    文件:Logic.java   
public void newInstance() throws ims.framework.exceptions.PresentationLogicException
{
    clearInstanceControls();
    CommunityServiceVo voComSer = new CommunityServiceVo();         
    form.ctnServiceDetail().customControlAuth().initializeComponent();

    voComSer.setIsCurrentlyActive(Boolean.TRUE); 
    form.getLocalContext().setSelectedRecord(voComSer);

    form.setMode(FormMode.EDIT);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);

    form.grdDetails().setValue(null);

    form.ctnServiceDetail().cmbLocation().clear();

    form.ctnServiceDetail().chkSupplyServiceDetail().setEnabled(true);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);
    form.ctnServiceDetail().cmbLocation().setEnabled(true);
    form.ctnServiceDetail().cmbService().setEnabled(true);

    form.ctnServiceDetail().txtAreaLoc().setVisible(false);
    form.ctnServiceDetail().cmbLocation().setVisible(true);

}
项目:openMAXIMS    文件:Logic.java   
public void newInstance() throws ims.framework.exceptions.PresentationLogicException
{
    clearInstanceControls();
    CommunityServiceVo voComSer = new CommunityServiceVo();         
    form.ctnServiceDetail().customControlAuth().initializeComponent();

    voComSer.setIsCurrentlyActive(Boolean.TRUE); 
    form.getLocalContext().setSelectedRecord(voComSer);

    form.setMode(FormMode.EDIT);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);

    form.grdDetails().setValue(null);

    form.ctnServiceDetail().cmbLocation().clear();

    form.ctnServiceDetail().chkSupplyServiceDetail().setEnabled(true);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);
    form.ctnServiceDetail().cmbLocation().setEnabled(true);
    form.ctnServiceDetail().cmbService().setEnabled(true);

    form.ctnServiceDetail().txtAreaLoc().setVisible(false);
    form.ctnServiceDetail().cmbLocation().setVisible(true);

}
项目:openMAXIMS    文件:Logic.java   
public void newInstance() throws ims.framework.exceptions.PresentationLogicException
{
    clearInstanceControls();
    CommunityServiceVo voComSer = new CommunityServiceVo();         
    form.ctnServiceDetail().customControlAuth().initializeComponent();

    voComSer.setIsCurrentlyActive(Boolean.TRUE); 
    form.getLocalContext().setSelectedRecord(voComSer);

    form.setMode(FormMode.EDIT);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);

    form.grdDetails().setValue(null);

    form.ctnServiceDetail().cmbLocation().clear();

    form.ctnServiceDetail().chkSupplyServiceDetail().setEnabled(true);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);
    form.ctnServiceDetail().cmbLocation().setEnabled(true);
    form.ctnServiceDetail().cmbService().setEnabled(true);

    form.ctnServiceDetail().txtAreaLoc().setVisible(false);
    form.ctnServiceDetail().cmbLocation().setVisible(true);

}
项目:openmaxims-linux    文件:Logic.java   
public void newInstance() throws ims.framework.exceptions.PresentationLogicException
{
    clearInstanceControls();
    CommunityServiceVo voComSer = new CommunityServiceVo();         
    form.ctnServiceDetail().customControlAuth().initializeComponent();

    voComSer.setIsCurrentlyActive(Boolean.TRUE); 
    form.getLocalContext().setSelectedRecord(voComSer);

    form.setMode(FormMode.EDIT);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);

    form.grdDetails().setValue(null);

    form.ctnServiceDetail().cmbLocation().clear();

    form.ctnServiceDetail().chkSupplyServiceDetail().setEnabled(true);
    form.ctnServiceDetail().setcustomControlAuthEnabled(true);
    form.ctnServiceDetail().cmbLocation().setEnabled(true);
    form.ctnServiceDetail().cmbService().setEnabled(true);

    form.ctnServiceDetail().txtAreaLoc().setVisible(false);
    form.ctnServiceDetail().cmbLocation().setVisible(true);

}
项目:AvoinApotti    文件:Logic.java   
private void listSupportCommunityServices()
{
    ServiceCategoryCollection excludedColl = new ServiceCategoryCollection();
    excludedColl.add(ServiceCategory.PATHOLOGY_DISCIPLINE);
    excludedColl.add(ServiceCategory.RADIOLOGY_MODALITY);
    //WDEV-1913 
    ServiceVoCollection voCollService = domain.listService(excludedColl);
    form.ctnServiceDetail().cmbService().clear();

    for (int i = 0; i < voCollService.size(); i++)
        form.ctnServiceDetail().cmbService().newRow(voCollService.get(i), voCollService.get(i).getServiceName());

    form.grdDetails().getRows().clear();

    CommunityServiceVoCollection voColl = domain.listCommunityServicesByCareContext(form.getGlobalContext().Core.getCurrentCareContext(),Boolean.TRUE);
    CommunityServiceVo vo = null;   

    GenForm.grdDetailsRow row = null;
    if(voColl == null || voColl.size() == 0)
    {
        SupportNetworkServicesVoCollection voCollSns = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),Boolean.TRUE);

        if (voCollSns != null && voCollSns.size()>0)
        {
            //ask user if they want to copy in existing support network services records.
            form.getGlobalContext().Core.setYesNoDialogMessage("Do you want to copy the Support Network Services ?");
            engine.open(form.getForms().Core.YesNoDialog);
            return;
        }
    }

    for(int i=0;i<voColl.size();i++)
    {
        vo = voColl.get(i);
        row = form.grdDetails().getRows().newRow();
        if (vo.getServiceIsNotNull())
            row.setComunityService(vo.getService().getServiceName());
        row.setCurrentFrequency(vo.getCurrentFrequency());
        row.setRequested(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false); 
        row.setDischargeFrequency(vo.getDischargeFrequency());
        row.setInPlace(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
        row.setConfirmDate(vo.getConfirmedDate());
        row.setValue(vo);
    }

    //set selection back
    if (form.getLocalContext().getSelectedRecordIsNotNull())
    {
        //need to get timestamp from record retrieved from List call.
        GenForm.grdDetailsRow row1 = form.grdDetails().getRowByValue(form.getLocalContext().getSelectedRecord());
        if (row1 != null && row1.getValue() != null)
        {           

            form.grdDetails().setValue(form.getLocalContext().getSelectedRecord());
            populateInstanceControl(form.grdDetails().getValue());
        }
        else
            clearInstanceControls();
        form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
        updateControlsState();          
    }
    else        
        form.ctnServiceDetail().setCollapsed(true);

}
项目:AvoinApotti    文件:Logic.java   
public void populateInstanceControl(CommunityServiceVo vo)
{
    clearInstanceControls();

    form.getLocalContext().setSelectedRecord(vo);
    form.getContextMenus().getLIPUpdateItem().setVisible(true);

    if (vo.getLocationService() != null)
    {
        if (vo.getLocationService().getService() != null){
            form.ctnServiceDetail().cmbService().newRow(vo.getLocationService().getService(), vo.getLocationService().getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getLocationService().getService());
        }
        cmbServiceValueChanged();
    }

    if (vo.getSuppliedServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(true);
        form.ctnServiceDetail().txtAddressService().setValue(vo.getSuppliedService().getAddress());
        form.ctnServiceDetail().txtAreaLoc().setValue(vo.getSuppliedService().getServiceLocation());
        form.ctnServiceDetail().txtContactPerson().setValue(vo.getSuppliedService().getName());
        form.ctnServiceDetail().txtPhoneNoService().setValue(vo.getSuppliedService().getWorkPhone());
        if (vo.getServiceIsNotNull() && vo.getService().getServiceNameIsNotNull())
        {
            form.ctnServiceDetail().cmbService().newRow(vo.getService(),vo.getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getService());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(true);
        form.ctnServiceDetail().cmbLocation().setVisible(false);    


    }
    else if (vo.getLocationServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(false);
        if (vo.getLocationService().getLocation() != null)
        {
            if (locationExistsInCombo(vo.getLocationService().getLocation()) == false)
                form.ctnServiceDetail().cmbLocation().newRow(vo.getLocationService().getLocation(), vo.getLocationService().getLocation().getName());

            form.ctnServiceDetail().cmbLocation().setValue(vo.getLocationService().getLocation());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(false);
        form.ctnServiceDetail().cmbLocation().setVisible(true);         

        cmbLocationValueChanged();          
    }       

    form.ctnServiceDetail().customControlAuth().setValue(vo.getAuthoringInformation());     
    form.ctnServiceDetail().txtCFreq().setValue(vo.getCurrentFrequency());
    form.ctnServiceDetail().txtDFreq().setValue(vo.getDischargeFrequency());
    form.ctnServiceDetail().txtCommentsService().setValue(vo.getComments());
    form.ctnServiceDetail().chkInplace().setValue(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
    form.ctnServiceDetail().chkReqForDis().setValue(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false);
    form.ctnServiceDetail().dteConfirmDate().setValue(vo.getConfirmedDate());

    form.ctnServiceDetail().setCollapsed(false);
}
项目:AvoinApotti    文件:Logic.java   
public CommunityServiceVo populateDataFromScreen(CommunityServiceVo value) 
{
    CommunityServiceVo vo = form.getLocalContext().getSelectedRecord();

    if (vo.getID_CommunityServices() == null)
    {
        vo.setIsCurrentlyActive(Boolean.TRUE);
        vo.setCurrentFrequency(form.ctnServiceDetail().txtCFreq().getValue());
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());


        if (form.ctnServiceDetail().chkSupplyServiceDetail().getValue())
        {
            SuppNetworkServiceProfessionDetailVo voProf = new SuppNetworkServiceProfessionDetailVo();

            voProf.setAddress(form.ctnServiceDetail().txtAddressService().getValue());
            voProf.setName(form.ctnServiceDetail().txtContactPerson().getValue());
            voProf.setServiceLocation(form.ctnServiceDetail().txtAreaLoc().getValue());
            voProf.setWorkPhone(form.ctnServiceDetail().txtPhoneNoService().getValue());
            //supplied area/location
            vo.setSuppliedService(voProf);              
        }
        else
        {                   
            if (form.getLocalContext().getlocationService() != null)
                vo.setLocationService(form.getLocalContext().getlocationService());
            vo.setSuppliedService(null);
        }               
    }
    else
    {
        //only update frequecy and comments, in place and confirm date
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
    }

    //set for update as well
    vo.setAuthoringInformation(form.ctnServiceDetail().customControlAuth().getValue());
    vo.setService(form.ctnServiceDetail().cmbService().getValue());

    //default currently active to true
    if(vo.getIsCurrentlyActive() == null)
        vo.setIsCurrentlyActive(Boolean.TRUE);

    if (vo.getCareContext() == null)
        vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    if (vo.getClinicalContact() == null)
        vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

    return vo;
}
项目:AvoinApotti    文件:Logic.java   
public boolean save() throws ims.framework.exceptions.PresentationLogicException
{
    CommunityServiceVo vo = populateInstanceData();

    if (form.ctnServiceDetail().cmbService().getValue() == null)
    {
        engine.showMessage("Please select a Service Type");
        return false;
    }

    if ((!form.ctnServiceDetail().chkSupplyServiceDetail().getValue()) && form.ctnServiceDetail().cmbLocation().getValue() == null)
    {
        engine.showMessage("Please select a Location");
        return false;
    }

    if(vo.getAuthoringInformation() == null || vo.getAuthoringInformation().getAuthoringHcp() == null || vo.getAuthoringInformation().getAuthoringDateTime() == null)
    {
        engine.showMessage("Please enter Authoring Information");
        return false;
    }

    String[] arrErrors = vo.validate();
    if(arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return false;
    }
    try 
    {
        form.getLocalContext().setSelectedRecord(domain.saveCommunitService(vo));
    } 
    catch (StaleObjectException e) 
    {
        engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
        return false;
    }
    return true;

}
项目:AvoinApotti    文件:Logic.java   
protected CommunityServiceVo populateInstanceData() 
{               
    return populateDataFromScreen(form.getLocalContext().getSelectedRecord());
}
项目:AvoinApotti    文件:Logic.java   
private void insertServices()
{
    form.grdDetails().getRows().clear();

    Boolean bActiveOnly = Boolean.TRUE;

    SupportNetworkServicesVoCollection voColl = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),bActiveOnly);

    if (voColl != null && voColl.size()>0)
    {
        SupportNetworkServicesVo vo = null; 

        GenForm.grdDetailsRow row = null;
        for(int i=0;i<voColl.size();i++)
        {
            vo = voColl.get(i);
            row = form.grdDetails().getRows().newRow();
            if (vo.getSuppliedServiceIsNotNull())
                row.setComunityService(vo.getSuppliedService().getName());
            else if (vo.getServiceIsNotNull())
                row.setComunityService(vo.getService().getServiceName());
            row.setCurrentFrequency(vo.getFrequencyOfService());

            //create Community Service vo
            CommunityServiceVo voComSer = new CommunityServiceVo();
            voComSer.setCurrentFrequency(vo.getFrequencyOfService());

            //copy if supplied
            if (vo.getSuppliedServiceIsNotNull())
            {
                SuppNetworkServiceProfessionDetailVo voSerProfDet = new SuppNetworkServiceProfessionDetailVo();
                voSerProfDet.setAddress(vo.getSuppliedService().getAddress());
                voSerProfDet.setEmailAddress(vo.getSuppliedService().getEmailAddress());
                voSerProfDet.setMobilePhone(vo.getSuppliedService().getMobilePhone());
                voSerProfDet.setName(vo.getSuppliedService().getName());
                voSerProfDet.setServiceLocation(vo.getSuppliedService().getServiceLocation());
                voSerProfDet.setWorkPhone(vo.getSuppliedService().getWorkPhone());
                voComSer.setSuppliedService(voSerProfDet);
            }

            voComSer.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
            voComSer.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
            voComSer.setService(vo.getService());
            voComSer.setLocationService(vo.getLocationService());
            voComSer.setIsCurrentlyActive(new Boolean(true));
            voComSer.setComments(vo.getComments());

            String[] arrErrors = voComSer.validate();
            if(arrErrors != null)
            {
                engine.showErrors(arrErrors);           
            }
            try 
            {
                domain.saveCommunitService(voComSer);
            } 
            catch (StaleObjectException e) 
            {
                engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
                return;
            }

            row.setValue(voComSer);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private void listSupportCommunityServices()
{
    ServiceCategoryCollection excludedColl = new ServiceCategoryCollection();
    excludedColl.add(ServiceCategory.PATHOLOGY_DISCIPLINE);
    excludedColl.add(ServiceCategory.RADIOLOGY_MODALITY);
    //WDEV-1913 
    ServiceVoCollection voCollService = domain.listService(excludedColl);
    form.ctnServiceDetail().cmbService().clear();

    for (int i = 0; i < voCollService.size(); i++)
        form.ctnServiceDetail().cmbService().newRow(voCollService.get(i), voCollService.get(i).getServiceName());

    form.grdDetails().getRows().clear();

    CommunityServiceVoCollection voColl = domain.listCommunityServicesByCareContext(form.getGlobalContext().Core.getCurrentCareContext(),Boolean.TRUE);
    CommunityServiceVo vo = null;   

    GenForm.grdDetailsRow row = null;
    if(voColl == null || voColl.size() == 0)
    {
        SupportNetworkServicesVoCollection voCollSns = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),Boolean.TRUE);

        if (voCollSns != null && voCollSns.size()>0)
        {
            //ask user if they want to copy in existing support network services records.
            form.getGlobalContext().Core.setYesNoDialogMessage("Do you want to copy the Support Network Services ?");
            engine.open(form.getForms().Core.YesNoDialog);
            return;
        }
    }

    for(int i=0;i<voColl.size();i++)
    {
        vo = voColl.get(i);
        row = form.grdDetails().getRows().newRow();
        if (vo.getServiceIsNotNull())
            row.setComunityService(vo.getService().getServiceName());
        row.setCurrentFrequency(vo.getCurrentFrequency());
        row.setRequested(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false); 
        row.setDischargeFrequency(vo.getDischargeFrequency());
        row.setInPlace(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
        row.setConfirmDate(vo.getConfirmedDate());
        row.setValue(vo);
    }

    //set selection back
    if (form.getLocalContext().getSelectedRecordIsNotNull())
    {
        //need to get timestamp from record retrieved from List call.
        GenForm.grdDetailsRow row1 = form.grdDetails().getRowByValue(form.getLocalContext().getSelectedRecord());
        if (row1 != null && row1.getValue() != null)
        {           

            form.grdDetails().setValue(form.getLocalContext().getSelectedRecord());
            populateInstanceControl(form.grdDetails().getValue());
        }
        else
            clearInstanceControls();
        form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
        updateControlsState();          
    }
    else        
        form.ctnServiceDetail().setCollapsed(true);

}
项目:openMAXIMS    文件:Logic.java   
public void populateInstanceControl(CommunityServiceVo vo)
{
    clearInstanceControls();

    form.getLocalContext().setSelectedRecord(vo);
    form.getContextMenus().getLIPUpdateItem().setVisible(true);

    if (vo.getLocationService() != null)
    {
        if (vo.getLocationService().getService() != null){
            form.ctnServiceDetail().cmbService().newRow(vo.getLocationService().getService(), vo.getLocationService().getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getLocationService().getService());
        }
        cmbServiceValueChanged();
    }

    if (vo.getSuppliedServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(true);
        form.ctnServiceDetail().txtAddressService().setValue(vo.getSuppliedService().getAddress());
        form.ctnServiceDetail().txtAreaLoc().setValue(vo.getSuppliedService().getServiceLocation());
        form.ctnServiceDetail().txtContactPerson().setValue(vo.getSuppliedService().getName());
        form.ctnServiceDetail().txtPhoneNoService().setValue(vo.getSuppliedService().getWorkPhone());
        if (vo.getServiceIsNotNull() && vo.getService().getServiceNameIsNotNull())
        {
            form.ctnServiceDetail().cmbService().newRow(vo.getService(),vo.getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getService());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(true);
        form.ctnServiceDetail().cmbLocation().setVisible(false);    


    }
    else if (vo.getLocationServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(false);
        if (vo.getLocationService().getLocation() != null)
        {
            if (locationExistsInCombo(vo.getLocationService().getLocation()) == false)
                form.ctnServiceDetail().cmbLocation().newRow(vo.getLocationService().getLocation(), vo.getLocationService().getLocation().getName());

            form.ctnServiceDetail().cmbLocation().setValue(vo.getLocationService().getLocation());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(false);
        form.ctnServiceDetail().cmbLocation().setVisible(true);         

        cmbLocationValueChanged();          
    }       

    form.ctnServiceDetail().customControlAuth().setValue(vo.getAuthoringInformation());     
    form.ctnServiceDetail().txtCFreq().setValue(vo.getCurrentFrequency());
    form.ctnServiceDetail().txtDFreq().setValue(vo.getDischargeFrequency());
    form.ctnServiceDetail().txtCommentsService().setValue(vo.getComments());
    form.ctnServiceDetail().chkInplace().setValue(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
    form.ctnServiceDetail().chkReqForDis().setValue(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false);
    form.ctnServiceDetail().dteConfirmDate().setValue(vo.getConfirmedDate());

    form.ctnServiceDetail().setCollapsed(false);
}
项目:openMAXIMS    文件:Logic.java   
public CommunityServiceVo populateDataFromScreen(CommunityServiceVo value) 
{
    CommunityServiceVo vo = form.getLocalContext().getSelectedRecord();

    if (vo.getID_CommunityServices() == null)
    {
        vo.setIsCurrentlyActive(Boolean.TRUE);
        vo.setCurrentFrequency(form.ctnServiceDetail().txtCFreq().getValue());
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());


        if (form.ctnServiceDetail().chkSupplyServiceDetail().getValue())
        {
            SuppNetworkServiceProfessionDetailVo voProf = new SuppNetworkServiceProfessionDetailVo();

            voProf.setAddress(form.ctnServiceDetail().txtAddressService().getValue());
            voProf.setName(form.ctnServiceDetail().txtContactPerson().getValue());
            voProf.setServiceLocation(form.ctnServiceDetail().txtAreaLoc().getValue());
            voProf.setWorkPhone(form.ctnServiceDetail().txtPhoneNoService().getValue());
            //supplied area/location
            vo.setSuppliedService(voProf);              
        }
        else
        {                   
            if (form.getLocalContext().getlocationService() != null)
                vo.setLocationService(form.getLocalContext().getlocationService());
            vo.setSuppliedService(null);
        }               
    }
    else
    {
        //only update frequecy and comments, in place and confirm date
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
    }

    //set for update as well
    vo.setAuthoringInformation(form.ctnServiceDetail().customControlAuth().getValue());
    vo.setService(form.ctnServiceDetail().cmbService().getValue());

    //default currently active to true
    if(vo.getIsCurrentlyActive() == null)
        vo.setIsCurrentlyActive(Boolean.TRUE);

    if (vo.getCareContext() == null)
        vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    if (vo.getClinicalContact() == null)
        vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
public boolean save() throws ims.framework.exceptions.PresentationLogicException
{
    CommunityServiceVo vo = populateInstanceData();

    if (form.ctnServiceDetail().cmbService().getValue() == null)
    {
        engine.showMessage("Please select a Service Type");
        return false;
    }

    if ((!form.ctnServiceDetail().chkSupplyServiceDetail().getValue()) && form.ctnServiceDetail().cmbLocation().getValue() == null)
    {
        engine.showMessage("Please select a Location");
        return false;
    }

    if(vo.getAuthoringInformation() == null || vo.getAuthoringInformation().getAuthoringHcp() == null || vo.getAuthoringInformation().getAuthoringDateTime() == null)
    {
        engine.showMessage("Please enter Authoring Information");
        return false;
    }

    String[] arrErrors = vo.validate();
    if(arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return false;
    }
    try 
    {
        form.getLocalContext().setSelectedRecord(domain.saveCommunitService(vo));
    } 
    catch (StaleObjectException e) 
    {
        engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
        return false;
    }
    return true;

}
项目:openMAXIMS    文件:Logic.java   
protected CommunityServiceVo populateInstanceData() 
{               
    return populateDataFromScreen(form.getLocalContext().getSelectedRecord());
}
项目:openMAXIMS    文件:Logic.java   
private void insertServices()
{
    form.grdDetails().getRows().clear();

    Boolean bActiveOnly = Boolean.TRUE;

    SupportNetworkServicesVoCollection voColl = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),bActiveOnly);

    if (voColl != null && voColl.size()>0)
    {
        SupportNetworkServicesVo vo = null; 

        GenForm.grdDetailsRow row = null;
        for(int i=0;i<voColl.size();i++)
        {
            vo = voColl.get(i);
            row = form.grdDetails().getRows().newRow();
            if (vo.getSuppliedServiceIsNotNull())
                row.setComunityService(vo.getSuppliedService().getName());
            else if (vo.getServiceIsNotNull())
                row.setComunityService(vo.getService().getServiceName());
            row.setCurrentFrequency(vo.getFrequencyOfService());

            //create Community Service vo
            CommunityServiceVo voComSer = new CommunityServiceVo();
            voComSer.setCurrentFrequency(vo.getFrequencyOfService());

            //copy if supplied
            if (vo.getSuppliedServiceIsNotNull())
            {
                SuppNetworkServiceProfessionDetailVo voSerProfDet = new SuppNetworkServiceProfessionDetailVo();
                voSerProfDet.setAddress(vo.getSuppliedService().getAddress());
                voSerProfDet.setEmailAddress(vo.getSuppliedService().getEmailAddress());
                voSerProfDet.setMobilePhone(vo.getSuppliedService().getMobilePhone());
                voSerProfDet.setName(vo.getSuppliedService().getName());
                voSerProfDet.setServiceLocation(vo.getSuppliedService().getServiceLocation());
                voSerProfDet.setWorkPhone(vo.getSuppliedService().getWorkPhone());
                voComSer.setSuppliedService(voSerProfDet);
            }

            voComSer.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
            voComSer.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
            voComSer.setService(vo.getService());
            voComSer.setLocationService(vo.getLocationService());
            voComSer.setIsCurrentlyActive(new Boolean(true));
            voComSer.setComments(vo.getComments());

            String[] arrErrors = voComSer.validate();
            if(arrErrors != null)
            {
                engine.showErrors(arrErrors);           
            }
            try 
            {
                domain.saveCommunitService(voComSer);
            } 
            catch (StaleObjectException e) 
            {
                engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
                return;
            }

            row.setValue(voComSer);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private void listSupportCommunityServices()
{
    ServiceCategoryCollection excludedColl = new ServiceCategoryCollection();
    excludedColl.add(ServiceCategory.PATHOLOGY_DISCIPLINE);
    excludedColl.add(ServiceCategory.RADIOLOGY_MODALITY);
    //WDEV-1913 
    ServiceVoCollection voCollService = domain.listService(excludedColl);
    form.ctnServiceDetail().cmbService().clear();

    for (int i = 0; i < voCollService.size(); i++)
        form.ctnServiceDetail().cmbService().newRow(voCollService.get(i), voCollService.get(i).getServiceName());

    form.grdDetails().getRows().clear();

    CommunityServiceVoCollection voColl = domain.listCommunityServicesByCareContext(form.getGlobalContext().Core.getCurrentCareContext(),Boolean.TRUE);
    CommunityServiceVo vo = null;   

    GenForm.grdDetailsRow row = null;
    if(voColl == null || voColl.size() == 0)
    {
        SupportNetworkServicesVoCollection voCollSns = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),Boolean.TRUE);

        if (voCollSns != null && voCollSns.size()>0)
        {
            //ask user if they want to copy in existing support network services records.
            form.getGlobalContext().Core.setYesNoDialogMessage("Do you want to copy the Support Network Services ?");
            engine.open(form.getForms().Core.YesNoDialog);
            return;
        }
    }

    for(int i=0;i<voColl.size();i++)
    {
        vo = voColl.get(i);
        row = form.grdDetails().getRows().newRow();
        if (vo.getServiceIsNotNull())
            row.setComunityService(vo.getService().getServiceName());
        row.setCurrentFrequency(vo.getCurrentFrequency());
        row.setRequested(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false); 
        row.setDischargeFrequency(vo.getDischargeFrequency());
        row.setInPlace(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
        row.setConfirmDate(vo.getConfirmedDate());
        row.setValue(vo);
    }

    //set selection back
    if (form.getLocalContext().getSelectedRecordIsNotNull())
    {
        //need to get timestamp from record retrieved from List call.
        GenForm.grdDetailsRow row1 = form.grdDetails().getRowByValue(form.getLocalContext().getSelectedRecord());
        if (row1 != null && row1.getValue() != null)
        {           

            form.grdDetails().setValue(form.getLocalContext().getSelectedRecord());
            populateInstanceControl(form.grdDetails().getValue());
        }
        else
            clearInstanceControls();
        form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
        updateControlsState();          
    }
    else        
        form.ctnServiceDetail().setCollapsed(true);

}
项目:openMAXIMS    文件:Logic.java   
public void populateInstanceControl(CommunityServiceVo vo)
{
    clearInstanceControls();

    form.getLocalContext().setSelectedRecord(vo);
    form.getContextMenus().getLIPUpdateItem().setVisible(true);

    if (vo.getLocationService() != null)
    {
        if (vo.getLocationService().getService() != null){
            form.ctnServiceDetail().cmbService().newRow(vo.getLocationService().getService(), vo.getLocationService().getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getLocationService().getService());
        }
        cmbServiceValueChanged();
    }

    if (vo.getSuppliedServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(true);
        form.ctnServiceDetail().txtAddressService().setValue(vo.getSuppliedService().getAddress());
        form.ctnServiceDetail().txtAreaLoc().setValue(vo.getSuppliedService().getServiceLocation());
        form.ctnServiceDetail().txtContactPerson().setValue(vo.getSuppliedService().getName());
        form.ctnServiceDetail().txtPhoneNoService().setValue(vo.getSuppliedService().getWorkPhone());
        if (vo.getServiceIsNotNull() && vo.getService().getServiceNameIsNotNull())
        {
            form.ctnServiceDetail().cmbService().newRow(vo.getService(),vo.getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getService());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(true);
        form.ctnServiceDetail().cmbLocation().setVisible(false);    


    }
    else if (vo.getLocationServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(false);
        if (vo.getLocationService().getLocation() != null)
        {
            if (locationExistsInCombo(vo.getLocationService().getLocation()) == false)
                form.ctnServiceDetail().cmbLocation().newRow(vo.getLocationService().getLocation(), vo.getLocationService().getLocation().getName());

            form.ctnServiceDetail().cmbLocation().setValue(vo.getLocationService().getLocation());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(false);
        form.ctnServiceDetail().cmbLocation().setVisible(true);         

        cmbLocationValueChanged();          
    }       

    form.ctnServiceDetail().customControlAuth().setValue(vo.getAuthoringInformation());     
    form.ctnServiceDetail().txtCFreq().setValue(vo.getCurrentFrequency());
    form.ctnServiceDetail().txtDFreq().setValue(vo.getDischargeFrequency());
    form.ctnServiceDetail().txtCommentsService().setValue(vo.getComments());
    form.ctnServiceDetail().chkInplace().setValue(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
    form.ctnServiceDetail().chkReqForDis().setValue(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false);
    form.ctnServiceDetail().dteConfirmDate().setValue(vo.getConfirmedDate());

    form.ctnServiceDetail().setCollapsed(false);
}
项目:openMAXIMS    文件:Logic.java   
public CommunityServiceVo populateDataFromScreen(CommunityServiceVo value) 
{
    CommunityServiceVo vo = form.getLocalContext().getSelectedRecord();

    if (vo.getID_CommunityServices() == null)
    {
        vo.setIsCurrentlyActive(Boolean.TRUE);
        vo.setCurrentFrequency(form.ctnServiceDetail().txtCFreq().getValue());
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());


        if (form.ctnServiceDetail().chkSupplyServiceDetail().getValue())
        {
            SuppNetworkServiceProfessionDetailVo voProf = new SuppNetworkServiceProfessionDetailVo();

            voProf.setAddress(form.ctnServiceDetail().txtAddressService().getValue());
            voProf.setName(form.ctnServiceDetail().txtContactPerson().getValue());
            voProf.setServiceLocation(form.ctnServiceDetail().txtAreaLoc().getValue());
            voProf.setWorkPhone(form.ctnServiceDetail().txtPhoneNoService().getValue());
            //supplied area/location
            vo.setSuppliedService(voProf);              
        }
        else
        {                   
            if (form.getLocalContext().getlocationService() != null)
                vo.setLocationService(form.getLocalContext().getlocationService());
            vo.setSuppliedService(null);
        }               
    }
    else
    {
        //only update frequecy and comments, in place and confirm date
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
    }

    //set for update as well
    vo.setAuthoringInformation(form.ctnServiceDetail().customControlAuth().getValue());
    vo.setService(form.ctnServiceDetail().cmbService().getValue());

    //default currently active to true
    if(vo.getIsCurrentlyActive() == null)
        vo.setIsCurrentlyActive(Boolean.TRUE);

    if (vo.getCareContext() == null)
        vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    if (vo.getClinicalContact() == null)
        vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

    return vo;
}
项目:openMAXIMS    文件:Logic.java   
public boolean save() throws ims.framework.exceptions.PresentationLogicException
{
    CommunityServiceVo vo = populateInstanceData();

    if (form.ctnServiceDetail().cmbService().getValue() == null)
    {
        engine.showMessage("Please select a Service Type");
        return false;
    }

    if ((!form.ctnServiceDetail().chkSupplyServiceDetail().getValue()) && form.ctnServiceDetail().cmbLocation().getValue() == null)
    {
        engine.showMessage("Please select a Location");
        return false;
    }

    if(vo.getAuthoringInformation() == null || vo.getAuthoringInformation().getAuthoringHcp() == null || vo.getAuthoringInformation().getAuthoringDateTime() == null)
    {
        engine.showMessage("Please enter Authoring Information");
        return false;
    }

    String[] arrErrors = vo.validate();
    if(arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return false;
    }
    try 
    {
        form.getLocalContext().setSelectedRecord(domain.saveCommunitService(vo));
    } 
    catch (StaleObjectException e) 
    {
        engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
        return false;
    }
    return true;

}
项目:openMAXIMS    文件:Logic.java   
protected CommunityServiceVo populateInstanceData() 
{               
    return populateDataFromScreen(form.getLocalContext().getSelectedRecord());
}
项目:openMAXIMS    文件:Logic.java   
private void insertServices()
{
    form.grdDetails().getRows().clear();

    Boolean bActiveOnly = Boolean.TRUE;

    SupportNetworkServicesVoCollection voColl = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),bActiveOnly);

    if (voColl != null && voColl.size()>0)
    {
        SupportNetworkServicesVo vo = null; 

        GenForm.grdDetailsRow row = null;
        for(int i=0;i<voColl.size();i++)
        {
            vo = voColl.get(i);
            row = form.grdDetails().getRows().newRow();
            if (vo.getSuppliedServiceIsNotNull())
                row.setComunityService(vo.getSuppliedService().getName());
            else if (vo.getServiceIsNotNull())
                row.setComunityService(vo.getService().getServiceName());
            row.setCurrentFrequency(vo.getFrequencyOfService());

            //create Community Service vo
            CommunityServiceVo voComSer = new CommunityServiceVo();
            voComSer.setCurrentFrequency(vo.getFrequencyOfService());

            //copy if supplied
            if (vo.getSuppliedServiceIsNotNull())
            {
                SuppNetworkServiceProfessionDetailVo voSerProfDet = new SuppNetworkServiceProfessionDetailVo();
                voSerProfDet.setAddress(vo.getSuppliedService().getAddress());
                voSerProfDet.setEmailAddress(vo.getSuppliedService().getEmailAddress());
                voSerProfDet.setMobilePhone(vo.getSuppliedService().getMobilePhone());
                voSerProfDet.setName(vo.getSuppliedService().getName());
                voSerProfDet.setServiceLocation(vo.getSuppliedService().getServiceLocation());
                voSerProfDet.setWorkPhone(vo.getSuppliedService().getWorkPhone());
                voComSer.setSuppliedService(voSerProfDet);
            }

            voComSer.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
            voComSer.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
            voComSer.setService(vo.getService());
            voComSer.setLocationService(vo.getLocationService());
            voComSer.setIsCurrentlyActive(new Boolean(true));
            voComSer.setComments(vo.getComments());

            String[] arrErrors = voComSer.validate();
            if(arrErrors != null)
            {
                engine.showErrors(arrErrors);           
            }
            try 
            {
                domain.saveCommunitService(voComSer);
            } 
            catch (StaleObjectException e) 
            {
                engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
                return;
            }

            row.setValue(voComSer);
        }
    }
}
项目:openmaxims-linux    文件:Logic.java   
private void listSupportCommunityServices()
{
    ServiceCategoryCollection excludedColl = new ServiceCategoryCollection();
    excludedColl.add(ServiceCategory.PATHOLOGY_DISCIPLINE);
    excludedColl.add(ServiceCategory.RADIOLOGY_MODALITY);
    //WDEV-1913 
    ServiceVoCollection voCollService = domain.listService(excludedColl);
    form.ctnServiceDetail().cmbService().clear();

    for (int i = 0; i < voCollService.size(); i++)
        form.ctnServiceDetail().cmbService().newRow(voCollService.get(i), voCollService.get(i).getServiceName());

    form.grdDetails().getRows().clear();

    CommunityServiceVoCollection voColl = domain.listCommunityServicesByCareContext(form.getGlobalContext().Core.getCurrentCareContext(),Boolean.TRUE);
    CommunityServiceVo vo = null;   

    GenForm.grdDetailsRow row = null;
    if(voColl == null || voColl.size() == 0)
    {
        SupportNetworkServicesVoCollection voCollSns = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),Boolean.TRUE);

        if (voCollSns != null && voCollSns.size()>0)
        {
            //ask user if they want to copy in existing support network services records.
            form.getGlobalContext().Core.setYesNoDialogMessage("Do you want to copy the Support Network Services ?");
            engine.open(form.getForms().Core.YesNoDialog);
            return;
        }
    }

    for(int i=0;i<voColl.size();i++)
    {
        vo = voColl.get(i);
        row = form.grdDetails().getRows().newRow();
        if (vo.getServiceIsNotNull())
            row.setComunityService(vo.getService().getServiceName());
        row.setCurrentFrequency(vo.getCurrentFrequency());
        row.setRequested(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false); 
        row.setDischargeFrequency(vo.getDischargeFrequency());
        row.setInPlace(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
        row.setConfirmDate(vo.getConfirmedDate());
        row.setValue(vo);
    }

    //set selection back
    if (form.getLocalContext().getSelectedRecordIsNotNull())
    {
        //need to get timestamp from record retrieved from List call.
        GenForm.grdDetailsRow row1 = form.grdDetails().getRowByValue(form.getLocalContext().getSelectedRecord());
        if (row1 != null && row1.getValue() != null)
        {           

            form.grdDetails().setValue(form.getLocalContext().getSelectedRecord());
            populateInstanceControl(form.grdDetails().getValue());
        }
        else
            clearInstanceControls();
        form.getLocalContext().setSelectedRecord(form.grdDetails().getValue());
        updateControlsState();          
    }
    else        
        form.ctnServiceDetail().setCollapsed(true);

}
项目:openmaxims-linux    文件:Logic.java   
public void populateInstanceControl(CommunityServiceVo vo)
{
    clearInstanceControls();

    form.getLocalContext().setSelectedRecord(vo);
    form.getContextMenus().getLIPUpdateItem().setVisible(true);

    if (vo.getLocationService() != null)
    {
        if (vo.getLocationService().getService() != null){
            form.ctnServiceDetail().cmbService().newRow(vo.getLocationService().getService(), vo.getLocationService().getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getLocationService().getService());
        }
        cmbServiceValueChanged();
    }

    if (vo.getSuppliedServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(true);
        form.ctnServiceDetail().txtAddressService().setValue(vo.getSuppliedService().getAddress());
        form.ctnServiceDetail().txtAreaLoc().setValue(vo.getSuppliedService().getServiceLocation());
        form.ctnServiceDetail().txtContactPerson().setValue(vo.getSuppliedService().getName());
        form.ctnServiceDetail().txtPhoneNoService().setValue(vo.getSuppliedService().getWorkPhone());
        if (vo.getServiceIsNotNull() && vo.getService().getServiceNameIsNotNull())
        {
            form.ctnServiceDetail().cmbService().newRow(vo.getService(),vo.getService().getServiceName());
            form.ctnServiceDetail().cmbService().setValue(vo.getService());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(true);
        form.ctnServiceDetail().cmbLocation().setVisible(false);    


    }
    else if (vo.getLocationServiceIsNotNull())
    {
        form.ctnServiceDetail().chkSupplyServiceDetail().setValue(false);
        if (vo.getLocationService().getLocation() != null)
        {
            if (locationExistsInCombo(vo.getLocationService().getLocation()) == false)
                form.ctnServiceDetail().cmbLocation().newRow(vo.getLocationService().getLocation(), vo.getLocationService().getLocation().getName());

            form.ctnServiceDetail().cmbLocation().setValue(vo.getLocationService().getLocation());
        }

        form.ctnServiceDetail().txtAreaLoc().setVisible(false);
        form.ctnServiceDetail().cmbLocation().setVisible(true);         

        cmbLocationValueChanged();          
    }       

    form.ctnServiceDetail().customControlAuth().setValue(vo.getAuthoringInformation());     
    form.ctnServiceDetail().txtCFreq().setValue(vo.getCurrentFrequency());
    form.ctnServiceDetail().txtDFreq().setValue(vo.getDischargeFrequency());
    form.ctnServiceDetail().txtCommentsService().setValue(vo.getComments());
    form.ctnServiceDetail().chkInplace().setValue(vo.getIsServiceInPlaceIsNotNull()?vo.getIsServiceInPlace().booleanValue():false);
    form.ctnServiceDetail().chkReqForDis().setValue(vo.getIsDischargeServiceIsNotNull()?vo.getIsDischargeService().booleanValue():false);
    form.ctnServiceDetail().dteConfirmDate().setValue(vo.getConfirmedDate());

    form.ctnServiceDetail().setCollapsed(false);
}
项目:openmaxims-linux    文件:Logic.java   
public CommunityServiceVo populateDataFromScreen(CommunityServiceVo value) 
{
    CommunityServiceVo vo = form.getLocalContext().getSelectedRecord();

    if (vo.getID_CommunityServices() == null)
    {
        vo.setIsCurrentlyActive(Boolean.TRUE);
        vo.setCurrentFrequency(form.ctnServiceDetail().txtCFreq().getValue());
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());


        if (form.ctnServiceDetail().chkSupplyServiceDetail().getValue())
        {
            SuppNetworkServiceProfessionDetailVo voProf = new SuppNetworkServiceProfessionDetailVo();

            voProf.setAddress(form.ctnServiceDetail().txtAddressService().getValue());
            voProf.setName(form.ctnServiceDetail().txtContactPerson().getValue());
            voProf.setServiceLocation(form.ctnServiceDetail().txtAreaLoc().getValue());
            voProf.setWorkPhone(form.ctnServiceDetail().txtPhoneNoService().getValue());
            //supplied area/location
            vo.setSuppliedService(voProf);              
        }
        else
        {                   
            if (form.getLocalContext().getlocationService() != null)
                vo.setLocationService(form.getLocalContext().getlocationService());
            vo.setSuppliedService(null);
        }               
    }
    else
    {
        //only update frequecy and comments, in place and confirm date
        vo.setDischargeFrequency(form.ctnServiceDetail().txtDFreq().getValue());
        vo.setComments(form.ctnServiceDetail().txtCommentsService().getValue());
        vo.setIsServiceInPlace(new Boolean(form.ctnServiceDetail().chkInplace().getValue()));
        vo.setConfirmedDate(form.ctnServiceDetail().dteConfirmDate().getValue());
        vo.setIsDischargeService(new Boolean(form.ctnServiceDetail().chkReqForDis().getValue()));
    }

    //set for update as well
    vo.setAuthoringInformation(form.ctnServiceDetail().customControlAuth().getValue());
    vo.setService(form.ctnServiceDetail().cmbService().getValue());

    //default currently active to true
    if(vo.getIsCurrentlyActive() == null)
        vo.setIsCurrentlyActive(Boolean.TRUE);

    if (vo.getCareContext() == null)
        vo.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    if (vo.getClinicalContact() == null)
        vo.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

    return vo;
}
项目:openmaxims-linux    文件:Logic.java   
public boolean save() throws ims.framework.exceptions.PresentationLogicException
{
    CommunityServiceVo vo = populateInstanceData();

    if (form.ctnServiceDetail().cmbService().getValue() == null)
    {
        engine.showMessage("Please select a Service Type");
        return false;
    }

    if ((!form.ctnServiceDetail().chkSupplyServiceDetail().getValue()) && form.ctnServiceDetail().cmbLocation().getValue() == null)
    {
        engine.showMessage("Please select a Location");
        return false;
    }

    if(vo.getAuthoringInformation() == null || vo.getAuthoringInformation().getAuthoringHcp() == null || vo.getAuthoringInformation().getAuthoringDateTime() == null)
    {
        engine.showMessage("Please enter Authoring Information");
        return false;
    }

    String[] arrErrors = vo.validate();
    if(arrErrors != null)
    {
        engine.showErrors(arrErrors);
        return false;
    }
    try 
    {
        form.getLocalContext().setSelectedRecord(domain.saveCommunitService(vo));
    } 
    catch (StaleObjectException e) 
    {
        engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
        open();
        return false;
    }
    return true;

}
项目:openmaxims-linux    文件:Logic.java   
protected CommunityServiceVo populateInstanceData() 
{               
    return populateDataFromScreen(form.getLocalContext().getSelectedRecord());
}
项目:openmaxims-linux    文件:Logic.java   
private void insertServices()
{
    form.grdDetails().getRows().clear();

    Boolean bActiveOnly = Boolean.TRUE;

    SupportNetworkServicesVoCollection voColl = domain.listSupportNetworkServiceByPatient(form.getGlobalContext().Core.getPatientShort(),bActiveOnly);

    if (voColl != null && voColl.size()>0)
    {
        SupportNetworkServicesVo vo = null; 

        GenForm.grdDetailsRow row = null;
        for(int i=0;i<voColl.size();i++)
        {
            vo = voColl.get(i);
            row = form.grdDetails().getRows().newRow();
            if (vo.getSuppliedServiceIsNotNull())
                row.setComunityService(vo.getSuppliedService().getName());
            else if (vo.getServiceIsNotNull())
                row.setComunityService(vo.getService().getServiceName());
            row.setCurrentFrequency(vo.getFrequencyOfService());

            //create Community Service vo
            CommunityServiceVo voComSer = new CommunityServiceVo();
            voComSer.setCurrentFrequency(vo.getFrequencyOfService());

            //copy if supplied
            if (vo.getSuppliedServiceIsNotNull())
            {
                SuppNetworkServiceProfessionDetailVo voSerProfDet = new SuppNetworkServiceProfessionDetailVo();
                voSerProfDet.setAddress(vo.getSuppliedService().getAddress());
                voSerProfDet.setEmailAddress(vo.getSuppliedService().getEmailAddress());
                voSerProfDet.setMobilePhone(vo.getSuppliedService().getMobilePhone());
                voSerProfDet.setName(vo.getSuppliedService().getName());
                voSerProfDet.setServiceLocation(vo.getSuppliedService().getServiceLocation());
                voSerProfDet.setWorkPhone(vo.getSuppliedService().getWorkPhone());
                voComSer.setSuppliedService(voSerProfDet);
            }

            voComSer.setCareContext(form.getGlobalContext().Core.getCurrentCareContext());
            voComSer.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());
            voComSer.setService(vo.getService());
            voComSer.setLocationService(vo.getLocationService());
            voComSer.setIsCurrentlyActive(new Boolean(true));
            voComSer.setComments(vo.getComments());

            String[] arrErrors = voComSer.validate();
            if(arrErrors != null)
            {
                engine.showErrors(arrErrors);           
            }
            try 
            {
                domain.saveCommunitService(voComSer);
            } 
            catch (StaleObjectException e) 
            {
                engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
                return;
            }

            row.setValue(voComSer);
        }
    }
}