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

项目:AvoinApotti    文件:Logic.java   
protected void onQmbHospitalTextSubmited(String value) throws ims.framework.exceptions.PresentationLogicException
{
    form.lyrSurgeryDetails().tabGenDet().qmbHospital().clear();

    OrganisationVo voOrg = new OrganisationVo();
    voOrg.setName(value);

    OrganisationVoCollection voColl = domain.listOrganisation(voOrg);
    for (int i = 0 ; i < voColl.size() ; i++)
    {
        if (voColl.get(i).getIsActiveIsNotNull() && voColl.get(i).getIsActive().booleanValue())
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().newRow(voColl.get(i), voColl.get(i).getName());

        if (voColl.size() == 1)
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().setValue(voColl.get(0));
        else if (voColl.size() > 1)
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().showOpened();        
    }
}
项目:AvoinApotti    文件:M02VoMapper.java   
private void linkGPtoPractice(GpToPracticesVoCollection coll, GP gpVo, OrganisationVo orgVo, int i, boolean bSetPrimary) throws HL7Exception,StaleObjectException
{

    orgVo = saveOrganisation(orgVo);        

    GpToPracticesVo link = new GpToPracticesVo();
    link.setGp(gpVo);
    link.setPractice(orgVo);

    if (bSetPrimary) //only HEARTS behaviour will set this
    {
        link.setIsPrimaryPractice(true);
        for (int j = 0; j < coll.size(); j++)
            coll.get(j).setIsPrimaryPractice(false);            
    }
    else if (ConfigFlag.HL7.HEARTS_GP_MODEL.getValue() == false)
    {
        // set the first practice to primary
        if (i == 0)
            link.setIsPrimaryPractice(true);
        else
            link.setIsPrimaryPractice(false);
    }
    coll.add(link);
}
项目:AvoinApotti    文件:M02VoMapper.java   
private OrganisationVo saveOrganisation(OrganisationVo orgVo) throws HL7Exception,StaleObjectException
    {
        String[] errors = orgVo.validate();
        if (errors != null)
        {
            throw new HL7Exception("Validation errors before save of GP Practice Org. " + VoMapper.toDisplayString(errors));                
        }           
        try
        {
            orgVo = orgLoc.saveOrganisation(orgVo);
        }
//      catch (StaleObjectException e)
//      {
//          LOG.error("GP Practice has been modified by another user/process - please try again");
//          throw new HL7Exception("LocationSite has been modified by another user/process - please try again", e);
//      }
        catch (UniqueKeyViolationException e)
        {
            LOG.error("UniqueKeyViolationException occurred saving GP Practice " + e.getMessage(), e);
            throw new HL7Exception("UniqueKeyViolationException occurred saveLocationSite " + e.getMessage(), e);
        }
        return orgVo;
    }
项目:AvoinApotti    文件:Logic.java   
private void populateDataFromScreen() 
{
    OrganisationVo voOrganisation = form.getGlobalContext().Admin
            .getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
            .getOrganisationVo() : new OrganisationVo();
    PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
            .getAddress()
            : new PersonAddress();
    voAddress.setLine1(form.txtOrgAdd1().getValue());
    voAddress.setLine2(form.txtOrgAdd2().getValue());
    voAddress.setLine3(form.txtOrgAdd3().getValue());
    voAddress.setLine4(form.txtOrgAdd4().getValue());
    voAddress.setLine5(form.txtOrgAdd5().getValue());
    voAddress.setCounty(form.cmbCounty().getValue());
    voAddress.setPhone(form.txtOrgPhone().getValue());
    voAddress.setFax(form.txtOrgFax().getValue());
    voAddress.setPostCode(form.txtPostCode().getValue());

    voOrganisation.setAddress(voAddress);

    voOrganisation.setIsActive(Boolean.TRUE);
    voOrganisation.setName(form.txtOrgName().getValue());
    voOrganisation.setType(OrganisationType.GPP);

    form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
项目:AvoinApotti    文件:Logic.java   
private void fillAccreditationCombos()
{
    if (getColByIdentifier(COL_ACCREDITATION) != null)
    {
        form.getLocalContext().setCollAccreditation(LookupHelper.getAccreditationLocationStatus(domain.getLookupService()));

        for (int i = 0; i < form.dyngrdOrganisationLocation().getRows().size() ; i++)
        {
            DynamicGridRow row = form.dyngrdOrganisationLocation().getRows().get(i);

            if (row.getValue() instanceof OrganisationVo)
            {
                DynamicGridCell cell2 = row.getCells().newCell(getColByIdentifier(COL_ACCREDITATION), DynamicCellType.EMPTY);
                if (cell2 != null)
                    cell2.setReadOnly(true);

                fillAccreditationForOrganisation(row);
            }
        }
    }       
}
项目:AvoinApotti    文件:Logic.java   
private void setRowAsPrimaryLocation(DynamicGridRow selectedRow)
{
    if (selectedRow == null )
        return;     

    if (selectedRow.getValue() instanceof OrganisationVo)
        return;         

    clearPrimaryLocations(form.dyngrdOrganisationLocation().getRows()); 

    if (selectedRow.getValue() instanceof HcpLocationVo || selectedRow.getValue() instanceof LocShortVo)
    {
        selectedRow.setTextColor(Color.Red);    
        selectedRow.setChecked(true);   
    }       
    form.getContextMenus().getMosLocationSetPrimaryLocationItem().setVisible(false);
}
项目:AvoinApotti    文件:Logic.java   
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
    OrganisationVo practice = new OrganisationVo();

    if (form.getLocalContext().getPracticeIsNotNull())
        practice = form.getLocalContext().getPractice();
    practice = populatePracticeData(practice);

    practice.setType(OrganisationType.GPP);

    // this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
    // added to allow the ntpf to work as if using only practices. 
    if ( !practice.getLocationSitesIsNotNull())
    {               
        if (!canUseSurgery())
            practice = createOneMatchingChildSurgery(practice);
    }

    return doSavePractice(practice);
}
项目:AvoinApotti    文件:Logic.java   
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
    if(practice == null)
        return null;

    int index = practice.getLocationSites().indexOf(surgery);
    if (index >= 0)
        return practice.getLocationSites().get(index);

    //Find the Location that's not in the practiceBeforeSave
    if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
    {
        for (int i = 0; i < practice.getLocationSites().size(); i++)
        {
            if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
            {
                return practice.getLocationSites().get(i);
            }
        }
    }

    return null;
}
项目:AvoinApotti    文件:Logic.java   
private boolean hasActiveChildren(OrganisationVo vo)
{
    if ((vo.getRelatedOrganisations() == null || vo.getRelatedOrganisations().size() == 0) &&
        (vo.getLocationSites() == null || vo.getLocationSites().size() == 0))
        return false;

    for (int i = 0; i < vo.getRelatedOrganisations().size(); i++)
    {
        OrganisationVo orgVo = vo.getRelatedOrganisations().get(i);
        if (orgVo.getIsActive().booleanValue())
            return true;
        if (hasActiveChildren(orgVo))
            return true;            
    }
    for (int i = 0; i < vo.getLocationSites().size(); i++)
    {
        LocMostVo locVo = vo.getLocationSites().get(i);
        if (locVo.getIsActive().booleanValue())
            return true;
        if (hasActiveChildren(locVo))
            return true;            
    }
    return false;
}
项目:AvoinApotti    文件:Logic.java   
private void populateScreenFromData(OrganisationVo value)
{
    clearTab(TABORG);
    PersonAddress voAddress = value.getAddress();
    if (voAddress != null)
    {
        form.ctn1().lyr1().tabOrg().txtOrgAdd1().setValue(voAddress.getLine1());
        form.ctn1().lyr1().tabOrg().txtOrgAdd2().setValue(voAddress.getLine2());
        form.ctn1().lyr1().tabOrg().txtOrgAdd3().setValue(voAddress.getLine3());
        form.ctn1().lyr1().tabOrg().txtOrgAdd4().setValue(voAddress.getLine4());
        form.ctn1().lyr1().tabOrg().txtOrgAdd5().setValue(voAddress.getLine5());
        form.ctn1().lyr1().tabOrg().txtOrgPhone().setValue(voAddress.getPhone());
        form.ctn1().lyr1().tabOrg().txtOrgFax().setValue(voAddress.getFax());
        form.ctn1().lyr1().tabOrg().txtOrgPostCode().setValue(voAddress.getPostCode());
        form.ctn1().lyr1().tabOrg().cmbOrgCounty().setValue(voAddress.getCounty());
    }

    populateOrgMappingsGrid(value.getCodeMappings());
    form.ctn1().lyr1().tabOrg().txtOrgComment().setValue(value.getComment());
    form.ctn1().lyr1().tabOrg().txtOrgName().setValue(value.getName());
    form.ctn1().lyr1().tabOrg().cmbOrgType().setValue(value.getType());
}
项目:AvoinApotti    文件:Logic.java   
private void createOrganisationHere()
{
    TreeNode node = form.treOrgLoc().getSelectedNode();
    if (node == null)
        return;

    if (!(node.getValue() instanceof OrganisationVo))
    {
        throw new CodingRuntimeException("Trying to add an Organistation under the wrong type");            
    }

    form.getLocalContext().setEditObject(new OrganisationVo());
    clearTab(TABORG);
    form.ctn1().lyr1().showtabOrg();        
    hideContextMenus();
    setFormMode(FormMode.EDIT);
    form.getContextMenus().getGenericGridAddItem().setVisible(true);
    form.getGlobalContext().setPrintersSelected(null);
    form.ctn1().lyr1().tabOrg().txtOrgName().setFocus();
    form.getLocalContext().setSavingRootOrg(null);

}
项目:AvoinApotti    文件:Logic.java   
private void editItem()
{
    TreeNode node = form.treOrgLoc().getSelectedNode();
    if (node == null)
        return;

    if (node.getValue() instanceof OrganisationVo)
    {
        form.getLocalContext().setEditObject((OrganisationVo) node.getValue());
        form.ctn1().lyr1().tabOrg().txtOrgName().setFocus();
    }
    else if (node.getValue() instanceof LocSiteVo)
    {
        form.getLocalContext().setEditObject((LocSiteVo) node.getValue());
        form.ctn1().lyr1().tabLocSite().txtLocSiteName().setFocus();
    }
    else if (node.getValue() instanceof LocMostVo)
    {
        form.getLocalContext().setEditObject((LocMostVo) node.getValue());
        form.ctn1().lyr1().tabLoc().txtLocName().setFocus();
    }

    hideContextMenus();
    setFormMode(FormMode.EDIT);
    form.getContextMenus().getGenericGridAddItem().setVisible(true);        
}
项目:AvoinApotti    文件:Logic.java   
private void save(OrganisationVo voOrg, LocSiteVo voLocSite, LocMostVo voLoc) throws UniqueKeyViolationException, StaleObjectException 
{
    if (voOrg != null)
    {   
        domain.saveOrganisation(voOrg);
    }
    else if (voLocSite != null)
    {   
        //wdev-12855
        if(form.getLocalContext().getEditObject() instanceof LocSiteVo && ((LocSiteVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLocSite.getVersion_Location() != ((LocSiteVo)form.getLocalContext().getEditObject()).getVersion_Location())
            throw new StaleObjectException(null);

        domain.saveLocationSite(voLocSite);
    }
    else if (voLoc != null)
    {
        //wdev-12855
        if(form.getLocalContext().getEditObject() instanceof LocMostVo && ((LocMostVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLoc.getVersion_Location() != ((LocMostVo)form.getLocalContext().getEditObject()).getVersion_Location())
            throw new StaleObjectException(null);
        domain.saveLocation(voLoc);
    }
    form.getLocalContext().setSavingRootOrg(null);
}
项目:AvoinApotti    文件:GPPracticeAdminImpl.java   
public void deletePractice(OrganisationVo orgToDelete) throws ForeignKeyViolationException
{
    if(orgToDelete == null)
        throw new RuntimeException("Cannot delete null OrganisationVo");

    DomainFactory factory = getDomainFactory();

    Organisation doOrganisation = OrganisationVoAssembler.extractOrganisation(factory, orgToDelete);

    if (doOrganisation.getLocationSites().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Surgeries associated with this Practice. Cannot delete.");
    }

    factory.delete(doOrganisation);
}
项目:AvoinApotti    文件:GPPracticeAdminImpl.java   
public OrganisationVo deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    if(locSiteToDelete == null)
        throw new RuntimeException("Cannot delete null LocSiteVo");

    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToDelete);

    if(doLocSite==null)
        return null;

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();

    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);
    //WDEV-12000 
    else
        return null;

    factory.delete(doLocSite);
    return OrganisationVoAssembler.create(doParentOrganisation); 
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
private void checkChildsForDuplicateTaxonoy(OrganisationVoCollection  childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
    if (childs == null || doMap==null)
        return;

    for (int i = 0 ; i < childs.size(); i++)
    {
        OrganisationVo orgVo = childs.get(i);
        Object doObj = doMap.get(orgVo);
        //If doObj is null it means that nothing changed in that record and hibernate didn't instantiated that record
        if (doObj instanceof Organisation)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory,doObj, "codeMappings", orgVo.getCodeMappings(), "getName");
            if (dupMessage!=null)
                throw new UniqueKeyViolationException(dupMessage);
        }
    }
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
/**
 * Move an existing organisation to a new location
 */
@SuppressWarnings("unchecked")
public void moveOrganisation(ims.core.vo.OrganisationVo orgToMove, ims.core.vo.OrganisationVo currentParent, ims.core.vo.OrganisationVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    Organisation doOrgToMove = OrganisationVoAssembler.extractOrganisation(factory, orgToMove);
    Organisation doOrgCurrentParent = OrganisationVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrganisationVoAssembler.extractOrganisation(factory, destParent);

    if (doOrgCurrentParent != null)
    {
        doOrgToMove.setParentOrganisation(null);
        doOrgCurrentParent.getRelatedOrganisations().remove(doOrgToMove);
    }
    if (doOrgDestParent != null)
    {
        doOrgToMove.setParentOrganisation(doOrgDestParent);
        doOrgDestParent.getRelatedOrganisations().add(doOrgToMove);
    }
    doOrgToMove.setUpperNames();
    factory.save(doOrgToMove);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
public void deleteOrganisation(OrganisationVo orgToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

    Organisation doOrganisation = OrganisationVoAssembler.extractOrganisation(factory, orgToDelete);
    Organisation doParentOrg = doOrganisation.getParentOrganisation();
    if (doParentOrg != null)
    {
        doParentOrg.getRelatedOrganisations().remove(doOrganisation);
    }

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doOrganisation);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Organization is in use and can not be deleted.");
    }
}
项目:AvoinApotti    文件:Logic.java   
protected void onQmbReferringOrgTextSubmited(String value) throws ims.framework.exceptions.PresentationLogicException
{
    if (form.lyr().tabReferralDetails().cmbSourceofReferral().getValue() != null && form.lyr().tabReferralDetails().cmbSourceofReferral().getValue().equals(ReferralSource.GPREFERRAL))
    {
        PracticeSearchCriteriaVo voGP = new PracticeSearchCriteriaVo();
        voGP.setName(value);
        voGP.setIsActive(new Boolean(true));

    }
    else
    {
        OrganisationVo voOrg = new OrganisationVo();
        voOrg.setName(value);

    }
}
项目:openmaxims-linux    文件:Logic.java   
private void save(OrganisationVo voOrg, LocSiteVo voLocSite, LocMostVo voLoc) throws UniqueKeyViolationException, StaleObjectException 
{
    if (voOrg != null)
    {   
        domain.saveOrganisation(voOrg);
    }
    else if (voLocSite != null)
    {   
        //wdev-12855
        if(form.getLocalContext().getEditObject() instanceof LocSiteVo && ((LocSiteVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLocSite.getVersion_Location() != ((LocSiteVo)form.getLocalContext().getEditObject()).getVersion_Location())
            throw new StaleObjectException(null);

        domain.saveLocationSite(voLocSite);
    }
    else if (voLoc != null)
    {
        //wdev-12855
        if(form.getLocalContext().getEditObject() instanceof LocMostVo && ((LocMostVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLoc.getVersion_Location() != ((LocMostVo)form.getLocalContext().getEditObject()).getVersion_Location())
            throw new StaleObjectException(null);
        domain.saveLocation(voLoc);
    }
    form.getLocalContext().setSavingRootOrg(null);
}
项目:openmaxims-linux    文件:M02VoMapper.java   
private void linkGPtoPractice(GpToPracticesVoCollection coll, GP gpVo, OrganisationVo orgVo, int i, boolean bSetPrimary) throws HL7Exception,StaleObjectException
{

    orgVo = saveOrganisation(orgVo);        

    GpToPracticesVo link = new GpToPracticesVo();
    link.setGp(gpVo);
    link.setPractice(orgVo);

    if (bSetPrimary) //only HEARTS behaviour will set this
    {
        link.setIsPrimaryPractice(true);
        for (int j = 0; j < coll.size(); j++)
            coll.get(j).setIsPrimaryPractice(false);            
    }
    else if (ConfigFlag.HL7.HEARTS_GP_MODEL.getValue() == false)
    {
        // set the first practice to primary
        if (i == 0)
            link.setIsPrimaryPractice(true);
        else
            link.setIsPrimaryPractice(false);
    }
    coll.add(link);
}
项目:openMAXIMS    文件:M02VoMapper.java   
private OrganisationVo updatePracticeStatus(OrganisationVo practiceVo)
{
if(practiceVo!=null&&practiceVo.getLocationSitesIsNotNull()&&practiceVo.getLocationSites().size()>0)
{
    practiceVo.setIsActive(Boolean.FALSE); //inactive 
    for (LocSiteVo surgery : practiceVo.getLocationSites())
    {
        if(surgery.getIsActiveIsNotNull()&&surgery.getIsActive().equals(Boolean.TRUE))
        {
            practiceVo.setIsActive(Boolean.TRUE); // if there is an active surgery the practice is active
            break;
        }
    }
}
return practiceVo;
}
项目:openMAXIMS    文件:M02VoMapper.java   
private void linkGPtoPractice(GpToPracticesVoCollection coll, GP gpVo, OrganisationVo orgVo, int i, boolean bSetPrimary) throws HL7Exception,StaleObjectException
{

    orgVo = saveOrganisation(orgVo);        

    GpToPracticesVo link = new GpToPracticesVo();
    link.setGp(gpVo);
    link.setPractice(orgVo);

    if (bSetPrimary) //only HEARTS behaviour will set this
    {
        link.setIsPrimaryPractice(true);
        for (int j = 0; j < coll.size(); j++)
            coll.get(j).setIsPrimaryPractice(false);            
    }
    else if (ConfigFlag.HL7.HEARTS_GP_MODEL.getValue() == false)
    {
        // set the first practice to primary
        if (i == 0)
            link.setIsPrimaryPractice(true);
        else
            link.setIsPrimaryPractice(false);
    }
    coll.add(link);
}
项目:openMAXIMS    文件:M02VoMapper.java   
private OrganisationVo saveOrganisation(OrganisationVo orgVo) throws HL7Exception,StaleObjectException
{
    String[] errors = orgVo.validate();
    if (errors != null)
    {
        throw new HL7Exception("Validation errors before save of GP Practice Org. " + VoMapper.toDisplayString(errors));                
    }           
    try
    {
        orgVo = orgLoc.saveOrganisation(orgVo);
    }
    catch (UniqueKeyViolationException e)
    {
        LOG.error("UniqueKeyViolationException occurred saving GP Practice " + e.getMessage(), e);
        throw new HL7Exception("UniqueKeyViolationException occurred saveLocationSite " + e.getMessage(), e);
    }
    return orgVo;
}
项目:openmaxims-linux    文件:Logic.java   
private void fillAccreditationCombos()
{
    if (getColByIdentifier(COL_ACCREDITATION) != null)
    {
        form.getLocalContext().setCollAccreditation(LookupHelper.getAccreditationLocationStatus(domain.getLookupService()));

        for (int i = 0; i < form.dyngrdOrganisationLocation().getRows().size() ; i++)
        {
            DynamicGridRow row = form.dyngrdOrganisationLocation().getRows().get(i);

            if (row.getValue() instanceof OrganisationVo)
            {
                DynamicGridCell cell2 = row.getCells().newCell(getColByIdentifier(COL_ACCREDITATION), DynamicCellType.EMPTY);
                if (cell2 != null)
                    cell2.setReadOnly(true);

                fillAccreditationForOrganisation(row);
            }
        }
    }       
}
项目:openmaxims-linux    文件:Logic.java   
private void populateDataFromScreen() 
{
    OrganisationVo voOrganisation = form.getGlobalContext().Admin
            .getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
            .getOrganisationVo() : new OrganisationVo();
    PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
            .getAddress()
            : new PersonAddress();
    voAddress.setLine1(form.txtOrgAdd1().getValue());
    voAddress.setLine2(form.txtOrgAdd2().getValue());
    voAddress.setLine3(form.txtOrgAdd3().getValue());
    voAddress.setLine4(form.txtOrgAdd4().getValue());
    voAddress.setLine5(form.txtOrgAdd5().getValue());
    voAddress.setCounty(form.cmbCounty().getValue());
    voAddress.setPhone(form.txtOrgPhone().getValue());
    voAddress.setFax(form.txtOrgFax().getValue());
    voAddress.setPostCode(form.txtPostCode().getValue());

    voOrganisation.setAddress(voAddress);

    voOrganisation.setIsActive(Boolean.TRUE);
    voOrganisation.setName(form.txtOrgName().getValue());
    voOrganisation.setType(OrganisationType.GPP);

    form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
项目:openMAXIMS    文件:Logic.java   
private void fillAccreditationCombos()
{
    if (getColByIdentifier(COL_ACCREDITATION) != null)
    {
        form.getLocalContext().setCollAccreditation(LookupHelper.getAccreditationLocationStatus(domain.getLookupService()));

        for (int i = 0; i < form.dyngrdOrganisationLocation().getRows().size() ; i++)
        {
            DynamicGridRow row = form.dyngrdOrganisationLocation().getRows().get(i);

            if (row.getValue() instanceof OrganisationVo)
            {
                DynamicGridCell cell2 = row.getCells().newCell(getColByIdentifier(COL_ACCREDITATION), DynamicCellType.EMPTY);
                if (cell2 != null)
                    cell2.setReadOnly(true);

                fillAccreditationForOrganisation(row);
            }
        }
    }       
}
项目:openMAXIMS    文件:Logic.java   
private void setRowAsPrimaryLocation(DynamicGridRow selectedRow)
{
    if (selectedRow == null )
        return;     

    if (selectedRow.getValue() instanceof OrganisationVo)
        return;         

    clearPrimaryLocations(form.dyngrdOrganisationLocation().getRows()); 

    if (selectedRow.getValue() instanceof HcpLocationVo || selectedRow.getValue() instanceof LocShortVo)
    {
        selectedRow.setTextColor(Color.Red);    
        selectedRow.setChecked(true);   
    }       
    form.getContextMenus().getMosLocationSetPrimaryLocationItem().setVisible(false);
}
项目:openMAXIMS    文件:Logic.java   
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
    OrganisationVo practice = new OrganisationVo();

    if (form.getLocalContext().getPracticeIsNotNull())
        practice = form.getLocalContext().getPractice();
    practice = populatePracticeData(practice);

    practice.setType(OrganisationType.GPP);

    // this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
    // added to allow the ntpf to work as if using only practices. 
    if ( !practice.getLocationSitesIsNotNull())
    {               
        if (!canUseSurgery())
            practice = createOneMatchingChildSurgery(practice);
    }

    return doSavePractice(practice);
}
项目:openMAXIMS    文件:Logic.java   
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
    if(practice == null)
        return null;

    int index = practice.getLocationSites().indexOf(surgery);
    if (index >= 0)
        return practice.getLocationSites().get(index);

    //Find the Location that's not in the practiceBeforeSave
    if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
    {
        for (int i = 0; i < practice.getLocationSites().size(); i++)
        {
            if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
            {
                return practice.getLocationSites().get(i);
            }
        }
    }

    return null;
}
项目:openMAXIMS    文件:Logic.java   
private void populateScreenFromData(OrganisationVo value)
{
    clearTab(TABORG);
    PersonAddress voAddress = value.getAddress();
    if (voAddress != null)
    {
        form.ctn1().lyr1().tabOrg().txtOrgAdd1().setValue(voAddress.getLine1());
        form.ctn1().lyr1().tabOrg().txtOrgAdd2().setValue(voAddress.getLine2());
        form.ctn1().lyr1().tabOrg().txtOrgAdd3().setValue(voAddress.getLine3());
        form.ctn1().lyr1().tabOrg().txtOrgAdd4().setValue(voAddress.getLine4());
        form.ctn1().lyr1().tabOrg().txtOrgAdd5().setValue(voAddress.getLine5());
        form.ctn1().lyr1().tabOrg().txtOrgPhone().setValue(voAddress.getPhone());
        form.ctn1().lyr1().tabOrg().txtOrgFax().setValue(voAddress.getFax());
        form.ctn1().lyr1().tabOrg().txtOrgPostCode().setValue(voAddress.getPostCode());
        form.ctn1().lyr1().tabOrg().cmbOrgCounty().setValue(voAddress.getCounty());
    }

    populateOrgMappingsGrid(value.getCodeMappings());
    form.ctn1().lyr1().tabOrg().txtOrgComment().setValue(value.getComment());
    form.ctn1().lyr1().tabOrg().txtOrgName().setValue(value.getName());
    form.ctn1().lyr1().tabOrg().cmbOrgType().setValue(value.getType());
}
项目:openmaxims-linux    文件:Logic.java   
private void createOrganisationHere()
{
    TreeNode node = form.treOrgLoc().getSelectedNode();
    if (node == null)
        return;

    if (!(node.getValue() instanceof OrganisationVo))
    {
        throw new CodingRuntimeException("Trying to add an Organistation under the wrong type");            
    }

    form.getLocalContext().setEditObject(new OrganisationVo());
    clearTab(TABORG);
    form.ctn1().lyr1().showtabOrg();        
    hideContextMenus();
    setFormMode(FormMode.EDIT);
    form.getContextMenus().getGenericGridAddItem().setVisible(true);
    form.getGlobalContext().setPrintersSelected(null);
    form.ctn1().lyr1().tabOrg().txtOrgName().setFocus();
    form.getLocalContext().setSavingRootOrg(null);

}
项目:openmaxims-linux    文件:OrganisationAndLocationImpl.java   
private void checkChildsForDuplicateTaxonoy(OrganisationVoCollection  childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
    if (childs == null || doMap==null)
        return;

    for (int i = 0 ; i < childs.size(); i++)
    {
        OrganisationVo orgVo = childs.get(i);
        Object doObj = doMap.get(orgVo);
        //If doObj is null it means that nothing changed in that record and hibernate didn't instantiated that record
        if (doObj instanceof Organisation)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory,doObj, "codeMappings", orgVo.getCodeMappings(), "getName");
            if (dupMessage!=null)
                throw new UniqueKeyViolationException(dupMessage);
        }
    }
}
项目:openMAXIMS    文件:Logic.java   
private void setParentNodeInLocalContext()
{
    TreeNode node = form.treOrgLoc().getSelectedNode();
    if (node == null)
        return;

    if (node.getValue() instanceof OrganisationVo)
    {
        form.getLocalContext().setSelectedParent((OrganisationVo) node.getValue());
    }
    else if (node.getValue() instanceof LocSiteVo)
    {
        form.getLocalContext().setSelectedParent((LocSiteVo) node.getValue());
    }
    else if (node.getValue() instanceof LocMostVo)
    {
        form.getLocalContext().setSelectedParent((LocMostVo) node.getValue());
    }
}
项目:openmaxims-linux    文件:Logic.java   
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
    if(practice == null)
        return null;

    int index = practice.getLocationSites().indexOf(surgery);
    if (index >= 0)
        return practice.getLocationSites().get(index);

    //Find the Location that's not in the practiceBeforeSave
    if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
    {
        for (int i = 0; i < practice.getLocationSites().size(); i++)
        {
            if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
            {
                return practice.getLocationSites().get(i);
            }
        }
    }

    return null;
}
项目:openMAXIMS    文件:GPPracticeAdminImpl.java   
public OrganisationVo deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    if(locSiteToDelete == null)
        throw new RuntimeException("Cannot delete null LocSiteVo");

    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToDelete);

    if(doLocSite==null)
        return null;

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();

    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);
    //WDEV-12000 
    else
        return null;

    factory.delete(doLocSite);
    return OrganisationVoAssembler.create(doParentOrganisation); 
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
private void checkChildsForDuplicateTaxonoy(OrganisationVoCollection  childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
    if (childs == null || doMap==null)
        return;

    for (int i = 0 ; i < childs.size(); i++)
    {
        OrganisationVo orgVo = childs.get(i);
        Object doObj = doMap.get(orgVo);
        //If doObj is null it means that nothing changed in that record and hibernate didn't instantiated that record
        if (doObj instanceof Organisation)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory,doObj, "codeMappings", orgVo.getCodeMappings(), "getName");
            if (dupMessage!=null)
                throw new UniqueKeyViolationException(dupMessage);
        }
    }
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
 * Move an existing organisation to a new location
 */
@SuppressWarnings("unchecked")
public void moveOrganisation(ims.core.vo.OrganisationVo orgToMove, ims.core.vo.OrganisationVo currentParent, ims.core.vo.OrganisationVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    Organisation doOrgToMove = OrganisationVoAssembler.extractOrganisation(factory, orgToMove);
    Organisation doOrgCurrentParent = OrganisationVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrganisationVoAssembler.extractOrganisation(factory, destParent);

    if (doOrgCurrentParent != null)
    {
        doOrgToMove.setParentOrganisation(null);
        doOrgCurrentParent.getRelatedOrganisations().remove(doOrgToMove);
    }
    if (doOrgDestParent != null)
    {
        doOrgToMove.setParentOrganisation(doOrgDestParent);
        doOrgDestParent.getRelatedOrganisations().add(doOrgToMove);
    }
    doOrgToMove.setUpperNames();
    factory.save(doOrgToMove);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public void deleteOrganisation(OrganisationVo orgToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

    Organisation doOrganisation = OrganisationVoAssembler.extractOrganisation(factory, orgToDelete);
    Organisation doParentOrg = doOrganisation.getParentOrganisation();
    if (doParentOrg != null)
    {
        doParentOrg.getRelatedOrganisations().remove(doOrganisation);
    }

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doOrganisation);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Organization is in use and can not be deleted.");
    }
}
项目:openmaxims-linux    文件:Logic.java   
protected void onQmbHospitalTextSubmited(String value) throws ims.framework.exceptions.PresentationLogicException
{
    form.lyrSurgeryDetails().tabGenDet().qmbHospital().clear();

    OrganisationVo voOrg = new OrganisationVo();
    voOrg.setName(value);

    OrganisationVoCollection voColl = domain.listOrganisation(voOrg);
    for (int i = 0 ; i < voColl.size() ; i++)
    {
        if (voColl.get(i).getIsActiveIsNotNull() && voColl.get(i).getIsActive().booleanValue())
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().newRow(voColl.get(i), voColl.get(i).getName());

        if (voColl.size() == 1)
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().setValue(voColl.get(0));
        else if (voColl.size() > 1)
            form.lyrSurgeryDetails().tabGenDet().qmbHospital().showOpened();        
    }
}