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

项目: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 String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
    StringBuffer message = new StringBuffer();
    String[] gps = domain.listPatients(locVo);
    if(gps != null)
    {
        message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
        message.append(" " +gps.length + " Patients");
        /*for (int i = 0; i < gps.length; i++)
        {
            message.append(System.getProperty("line.separator"));
            message.append(gps[i]);
        }*/
    }
    else
    {
        message.append(excp.getMessage());
    }

    return message.toString();
}
项目:AvoinApotti    文件:Logic.java   
private boolean removeSurgery()
{
    LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
    if(locVo == null)
        return false;
    try
    {
        setPracticeToContext(domain.deleteLocSite(locVo));
        form.getLocalContext().setSurgery(null);
        form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
        if(canUseSurgery())
            open();
    }
    catch (ForeignKeyViolationException e)
    {
        engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
        return false;
    }

    return true;
}
项目:AvoinApotti    文件:Logic.java   
private void onGridSearchSelectionChanged()
{
    enableContextMenu();
    Object val = form.grdSearch().getValue();
    clearPracticeAndSurgeryLocalContext();
    if(val != null)
    {
        if(val instanceof OrganisationWithSitesVo)
        {
            setSelectedPractice((OrganisationWithSitesVo) val);
        }
        else if(val instanceof LocSiteVo)
        {
            setSelectedSurgery((LocSiteVo) val);
        }

        setActionAndFireEvent(PracticeSearch.SELECT);
    }
}
项目:AvoinApotti    文件:Logic.java   
public OrganisationWithSitesVo getParentPractice()
{
    LocSiteVo voLocSiteVo = getSelectedSurgery();
    if(voLocSiteVo != null)
    {
        for (int i = 0; i < form.grdSearch().getRows().size(); i++)
        {
            if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
            {
                OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
                if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
                    return organisationWithSitesVo; 
            }
        }
    }   

    return null;
}
项目:AvoinApotti    文件:Logic.java   
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
    if(voLocSite == null)
        return Boolean.FALSE; 

    for (int i = 0; i < form.grdSearch().getRows().size(); i++)
    {
        for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
        {
            if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
            {
                form.grdSearch().getRows().get(i).getRows().remove(j);
                setSelectedSurgery(null);
                //setSelectedPractice(null)
                enableContextMenu();
                setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
                return Boolean.TRUE;
            }
        }
    }

    return Boolean.FALSE;
}
项目: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    文件:OrgTreeHelper.java   
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
    if (locationSites == null)
        return;

    TreeNode locNode = null;
    for(int i=0; i < locationSites.size(); i++)
    {
        LocSiteVo voLoc = locationSites.get(i); 
        if (voLoc.getIsActive().booleanValue() == false && !showInactive)
            continue;

        Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;        

        //WDEV-6444 - if node is inactive disable drag dropping for that node
        if(voLoc.getIsActive().booleanValue() == false)
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
        else
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);

        locNode.setCollapsedImage(img);
        locNode.setExpandedImage(img);
        locNode.setCheckBoxVisible(showCheckBoxes);
        populateLocations(voLoc.getLocations().sort(), locNode);
    }       
}
项目: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(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
        if (childs == null || doMap==null)
            return;

        for (int i = 0 ; i < childs.size(); i++)
        {
            LocSiteVo locMostVo = childs.get(i);
            Object doObj = doMap.get(locMostVo);
            //If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
            if (doObj instanceof Location)
            {
                //I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
                //and it's possible to have a Location with same mappings and not a LocSite.
                Location loc =(Location) doObj;
                String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
                if (dupMessage!=null)
                    throw new UniqueKeyViolationException(dupMessage);
            }
        }
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
    Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

    //strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
    doLocSite.setParentOrganisation(doOrgDestParent);
    doOrgCurrentParent.getLocationSites().remove(doLocSite);
    factory.refresh(doOrgCurrentParent);
    doOrgDestParent.getLocationSites().add(doLocSite);
    factory.save(doLocSite);
    factory.refresh(doOrgCurrentParent);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();       
}
项目:openMAXIMS    文件:Logic.java   
protected void onDyngrdOrganisationLocationRowChecked(DynamicGridRow row)
{
    if (!row.isChecked())
    {
        if ( (row.getValue() instanceof LocSiteVo) || (row.getValue() instanceof HcpLocationVo) )
        {
            DynamicGridCell cell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION));
            if (cell != null)
                cell.setValue(null);

        }
    }
    //WDEV-20218
    checkedOrUncheckChildRow(row.getRows(), row.isChecked());

}
项目: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 String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
    StringBuffer message = new StringBuffer();
    String[] gps = domain.listPatients(locVo);
    if(gps != null)
    {
        message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
        message.append(" " +gps.length + " Patients");
        /*for (int i = 0; i < gps.length; i++)
        {
            message.append(System.getProperty("line.separator"));
            message.append(gps[i]);
        }*/
    }
    else
    {
        message.append(excp.getMessage());
    }

    return message.toString();
}
项目:openMAXIMS    文件:Logic.java   
private boolean removeSurgery()
{
    LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
    if(locVo == null)
        return false;
    try
    {
        setPracticeToContext(domain.deleteLocSite(locVo));
        form.getLocalContext().setSurgery(null);
        form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
        if(canUseSurgery())
            open();
    }
    catch (ForeignKeyViolationException e)
    {
        engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
        return false;
    }

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private void onGridSearchSelectionChanged()
{
    enableContextMenu();
    Object val = form.grdSearch().getValue();
    clearPracticeAndSurgeryLocalContext();
    if(val != null)
    {
        if(val instanceof OrganisationWithSitesVo)
        {
            setSelectedPractice((OrganisationWithSitesVo) val);
        }
        else if(val instanceof LocSiteVo)
        {
            setSelectedSurgery((LocSiteVo) val);
        }

        setActionAndFireEvent(PracticeSearch.SELECT);
    }
}
项目:openMAXIMS    文件:Logic.java   
public OrganisationWithSitesVo getParentPractice()
{
    LocSiteVo voLocSiteVo = getSelectedSurgery();
    if(voLocSiteVo != null)
    {
        for (int i = 0; i < form.grdSearch().getRows().size(); i++)
        {
            if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
            {
                OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
                if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
                    return organisationWithSitesVo; 
            }
        }
    }   

    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(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
        if (childs == null || doMap==null)
            return;

        for (int i = 0 ; i < childs.size(); i++)
        {
            LocSiteVo locMostVo = childs.get(i);
            Object doObj = doMap.get(locMostVo);
            //If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
            if (doObj instanceof Location)
            {
                //I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
                //and it's possible to have a Location with same mappings and not a LocSite.
                Location loc =(Location) doObj;
                String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
                if (dupMessage!=null)
                    throw new UniqueKeyViolationException(dupMessage);
            }
        }
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
    Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

    //strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
    doLocSite.setParentOrganisation(doOrgDestParent);
    doOrgCurrentParent.getLocationSites().remove(doLocSite);
    factory.refresh(doOrgCurrentParent);
    doOrgDestParent.getLocationSites().add(doLocSite);
    factory.save(doLocSite);
    factory.refresh(doOrgCurrentParent);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();       
}
项目:openmaxims-linux    文件:OrganisationAndLocationImpl.java   
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
    Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

    //strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
    doLocSite.setParentOrganisation(doOrgDestParent);
    doOrgCurrentParent.getLocationSites().remove(doLocSite);
    factory.refresh(doOrgCurrentParent);
    doOrgDestParent.getLocationSites().add(doLocSite);
    factory.save(doLocSite);
    factory.refresh(doOrgCurrentParent);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();       
}
项目: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    文件: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 String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
    StringBuffer message = new StringBuffer();
    String[] gps = domain.listPatients(locVo);
    if(gps != null)
    {
        message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
        message.append(" " +gps.length + " Patients");
        /*for (int i = 0; i < gps.length; i++)
        {
            message.append(System.getProperty("line.separator"));
            message.append(gps[i]);
        }*/
    }
    else
    {
        message.append(excp.getMessage());
    }

    return message.toString();
}
项目:openMAXIMS    文件:Logic.java   
private boolean removeSurgery()
{
    LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
    if(locVo == null)
        return false;
    try
    {
        setPracticeToContext(domain.deleteLocSite(locVo));
        form.getLocalContext().setSurgery(null);
        form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
        if(canUseSurgery())
            open();
    }
    catch (ForeignKeyViolationException e)
    {
        engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
        return false;
    }

    return true;
}
项目:openMAXIMS    文件:Logic.java   
private void onGridSearchSelectionChanged()
{
    enableContextMenu();
    Object val = form.grdSearch().getValue();
    clearPracticeAndSurgeryLocalContext();
    if(val != null)
    {
        if(val instanceof OrganisationWithSitesVo)
        {
            setSelectedPractice((OrganisationWithSitesVo) val);
        }
        else if(val instanceof LocSiteVo)
        {
            setSelectedSurgery((LocSiteVo) val);
        }

        setActionAndFireEvent(PracticeSearch.SELECT);
    }
}
项目:openmaxims-linux    文件:OrgTreeHelper.java   
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
    if (locationSites == null)
        return;

    TreeNode locNode = null;
    for(int i=0; i < locationSites.size(); i++)
    {
        LocSiteVo voLoc = locationSites.get(i); 
        if (voLoc.getIsActive().booleanValue() == false && !showInactive)
            continue;

        Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;        

        //WDEV-6444 - if node is inactive disable drag dropping for that node
        if(voLoc.getIsActive().booleanValue() == false)
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
        else
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);

        locNode.setCollapsedImage(img);
        locNode.setExpandedImage(img);
        locNode.setCheckBoxVisible(showCheckBoxes);
        populateLocations(voLoc.getLocations().sort(), locNode);
    }       
}
项目:openMAXIMS    文件:Logic.java   
public OrganisationWithSitesVo getParentPractice()
{
    LocSiteVo voLocSiteVo = getSelectedSurgery();
    if(voLocSiteVo != null)
    {
        for (int i = 0; i < form.grdSearch().getRows().size(); i++)
        {
            if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
            {
                OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
                if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
                    return organisationWithSitesVo; 
            }
        }
    }   

    return null;
}
项目:openMAXIMS    文件:Logic.java   
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
    if(voLocSite == null)
        return Boolean.FALSE; 

    for (int i = 0; i < form.grdSearch().getRows().size(); i++)
    {
        for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
        {
            if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
            {
                form.grdSearch().getRows().get(i).getRows().remove(j);
                setSelectedSurgery(null);
                //setSelectedPractice(null)
                enableContextMenu();
                setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
                return Boolean.TRUE;
            }
        }
    }

    return Boolean.FALSE;
}
项目:openMAXIMS    文件: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    文件:Logic.java   
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
    if(voLocSite == null)
        return Boolean.FALSE; 

    for (int i = 0; i < form.grdSearch().getRows().size(); i++)
    {
        for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
        {
            if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
            {
                form.grdSearch().getRows().get(i).getRows().remove(j);
                setSelectedSurgery(null);
                //setSelectedPractice(null)
                enableContextMenu();
                setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
                return Boolean.TRUE;
            }
        }
    }

    return Boolean.FALSE;
}
项目:openMAXIMS    文件:OrgTreeHelper.java   
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
    if (locationSites == null)
        return;

    TreeNode locNode = null;
    for(int i=0; i < locationSites.size(); i++)
    {
        LocSiteVo voLoc = locationSites.get(i); 
        if (voLoc.getIsActive().booleanValue() == false && !showInactive)
            continue;

        Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;        

        //WDEV-6444 - if node is inactive disable drag dropping for that node
        if(voLoc.getIsActive().booleanValue() == false)
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
        else
            locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);

        locNode.setCollapsedImage(img);
        locNode.setExpandedImage(img);
        locNode.setCheckBoxVisible(showCheckBoxes);
        populateLocations(voLoc.getLocations().sort(), locNode);
    }       
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
private void checkChildsForDuplicateTaxonoy(LocSiteVoCollection childs,Map<?, ?> doMap,DomainFactory factory) throws UniqueKeyViolationException
{
        if (childs == null || doMap==null)
            return;

        for (int i = 0 ; i < childs.size(); i++)
        {
            LocSiteVo locMostVo = childs.get(i);
            Object doObj = doMap.get(locMostVo);
            //If doObj is null it means that nothing has changed in that record and hibernate didn't instantiated that record
            if (doObj instanceof Location)
            {
                //I'm using new Location(((Location) doObj).getId(),((Location) doObj).getVersion()) because LocSite extends Location 
                //and it's possible to have a Location with same mappings and not a LocSite.
                Location loc =(Location) doObj;
                String dupMessage = Keywords.checkDuplicateTaxonomy(factory,new Location(loc.getId(),loc.getVersion()), "codeMappings", locMostVo.getCodeMappings(), "getName");
                if (dupMessage!=null)
                    throw new UniqueKeyViolationException(dupMessage);
            }
        }
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
    Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
    Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

    //strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
    doLocSite.setParentOrganisation(doOrgDestParent);
    doOrgCurrentParent.getLocationSites().remove(doLocSite);
    factory.refresh(doOrgCurrentParent);
    doOrgDestParent.getLocationSites().add(doLocSite);
    factory.save(doLocSite);
    factory.refresh(doOrgCurrentParent);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();       
}
项目:openmaxims-linux    文件:Logic.java   
private String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
    StringBuffer message = new StringBuffer();
    String[] gps = domain.listPatients(locVo);
    if(gps != null)
    {
        message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
        message.append(" " +gps.length + " Patients");
        /*for (int i = 0; i < gps.length; i++)
        {
            message.append(System.getProperty("line.separator"));
            message.append(gps[i]);
        }*/
    }
    else
    {
        message.append(excp.getMessage());
    }

    return message.toString();
}
项目:AvoinApotti    文件:DemographicsImpl.java   
public LocSiteVo getLocationSite(LocationRefVo locSiteId) 
{
    if(locSiteId == null)
        return null;

    DomainFactory factory = getDomainFactory();
    ims.core.resource.place.domain.objects.LocSite locSiteDO = (ims.core.resource.place.domain.objects.LocSite) factory.getDomainObject(ims.core.resource.place.domain.objects.LocSite.class, locSiteId.getID_Location());
    return LocSiteVoAssembler.create(locSiteDO);

}
项目:AvoinApotti    文件:M02VoMapper.java   
private void checkModifiedSurgery(LocSiteVoCollection locationSites, LocSiteVo siteVo)
{
    for (int i = 0; i < locationSites.size(); i++)
    {
        LocSiteVo vo =locationSites.get(i); 
        if (vo.equals(siteVo))
        {               
            if (vo.getAddress() == null) vo.setAddress(new PersonAddress());

            if (!siteVo.getAddressIsNotNull() || //msg surgery will be null if all fields cleared with HL7Null ("")
            !adrLinesEqual(vo.getAddress().getLine1(),siteVo.getAddress().getLine1()) ||                        
            !adrLinesEqual(vo.getAddress().getLine2(),siteVo.getAddress().getLine2()) ||
            !adrLinesEqual(vo.getAddress().getLine3(),siteVo.getAddress().getLine3()) || 
            !adrLinesEqual(vo.getAddress().getLine4(),siteVo.getAddress().getLine4()) || 
            !adrLinesEqual(vo.getAddress().getLine5(),siteVo.getAddress().getLine5()) ||
            !adrLinesEqual(vo.getAddress().getPostCode(),siteVo.getAddress().getPostCode()  )
            ||
            vo.getAddress().getCountyIsNotNull() && !vo.getAddress().getCounty().equals(siteVo.getAddress().getCounty())
            )
            {
                vo.setAddress(siteVo.getAddress());
                vo.setName(siteVo.getName());
            }
            setCommsChannels(vo.getCommChannels(),siteVo.getCommChannels());                
        }
    }
}
项目:AvoinApotti    文件:Logic.java   
protected void onDyngrdOrganisationLocationRowChecked(DynamicGridRow row)
{
    if (!row.isChecked())
    {
        if ( (row.getValue() instanceof LocSiteVo) || (row.getValue() instanceof HcpLocationVo) )
        {
            DynamicGridCell cell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION));
            if (cell != null)
                cell.setValue(null);

        }
    }

}
项目:AvoinApotti    文件:Logic.java   
private LocSiteVo populateSurgeryData(LocSiteVo value)
{
    value.setAddress(populateAddressData(AddressType.SURGERY));  // WDEV-15936 specify address type 
    value.setName(form.ctnDetails().txtDetailsName().getValue());       
    value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
    value.setCodeMappings(getCodeMappings());
    value.setType(LocationType.SURGERY);
    value.setCommChannels(populateCommChannelsFromScreen());

    return value;
}