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

项目: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   
/**
 * 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    文件: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   
/**
 * 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    文件: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   
/**
 * 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    文件: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-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();       
}
项目: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    文件:GPPracticeAdminImpl.java   
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
    if(voLocSite == null || voLocSite.getID_Location() == null)
    {
        throw new DomainRuntimeException("Invalid record");
    }

    DomainFactory factory = getDomainFactory();
    LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);

    return LocSiteVoAssembler.create(domainObject);
}
项目:AvoinApotti    文件:GPPracticeAdminImpl.java   
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
    if (!orgVo.isValidated())
        throw new DomainRuntimeException("Org has not been validated");

    DomainFactory factory = getDomainFactory();
    Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
    if (doOrg == null)
        throw new StaleObjectException(doOrg);
    doOrg.setUpperNames();

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

        for (int i = 0; i < orgVo.getLocationSites().size(); i++)
        {
            LocSiteVo lsv = orgVo.getLocationSites().get(i);
            LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);

            dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

        }
        throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
    }

    return OrganisationVoAssembler.create(doOrg);
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
public void deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

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

    if (doLocSite.getServices().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Services associated with this Location Site. Cannot delete.");
    }
    if (doLocSite.getActivityLimitGroup().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Activity Limits associated with this Location Site. Cannot delete.");
    }

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();
    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doLocSite);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Location Site is in use and can not be deleted.");
    }
}
项目:openMAXIMS    文件:PdsGPDetailsInDemographicsCCImpl.java   
public ims.core.vo.LocSiteVo getLocationSite(ims.core.resource.place.vo.LocationRefVo locSiteId)
{
    if(locSiteId == null || locSiteId.getID_Location() == null) //WDEV-22208
        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);
}
项目:openMAXIMS    文件: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);

}
项目:openMAXIMS    文件:PDSDemographicsImpl.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);

}
项目:openMAXIMS    文件:GPDetailsInDemographicsCCImpl.java   
public ims.core.vo.LocSiteVo getLocationSite(ims.core.resource.place.vo.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);
}
项目:openMAXIMS    文件:GPPracticeAdminImpl.java   
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
    if(voLocSite == null || voLocSite.getID_Location() == null)
    {
        throw new DomainRuntimeException("Invalid record");
    }

    DomainFactory factory = getDomainFactory();
    LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);

    return LocSiteVoAssembler.create(domainObject);
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public void deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

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

    if (doLocSite.getServices().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Services associated with this Location Site. Cannot delete.");
    }
    if (doLocSite.getActivityLimitGroup().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Activity Limits associated with this Location Site. Cannot delete.");
    }

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();
    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doLocSite);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Location Site is in use and can not be deleted.");
    }
}
项目:openMAXIMS    文件: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);

}
项目:openMAXIMS    文件:GPPracticeAdminImpl.java   
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
    if(voLocSite == null || voLocSite.getID_Location() == null)
    {
        throw new DomainRuntimeException("Invalid record");
    }

    DomainFactory factory = getDomainFactory();
    LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);

    return LocSiteVoAssembler.create(domainObject);
}
项目:openMAXIMS    文件:GPPracticeAdminImpl.java   
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
    if (!orgVo.isValidated())
        throw new DomainRuntimeException("Org has not been validated");

    DomainFactory factory = getDomainFactory();
    Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
    if (doOrg == null)
        throw new StaleObjectException(doOrg);
    doOrg.setUpperNames();

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

        for (int i = 0; i < orgVo.getLocationSites().size(); i++)
        {
            LocSiteVo lsv = orgVo.getLocationSites().get(i);
            LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);

            dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

        }
        throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
    }

    return OrganisationVoAssembler.create(doOrg);
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public void deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

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

    if (doLocSite.getServices().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Services associated with this Location Site. Cannot delete.");
    }
    if (doLocSite.getActivityLimitGroup().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Activity Limits associated with this Location Site. Cannot delete.");
    }

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();
    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doLocSite);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Location Site is in use and can not be deleted.");
    }
}
项目:openmaxims-linux    文件: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);

}
项目:openmaxims-linux    文件:GPPracticeAdminImpl.java   
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
    if(voLocSite == null || voLocSite.getID_Location() == null)
    {
        throw new DomainRuntimeException("Invalid record");
    }

    DomainFactory factory = getDomainFactory();
    LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);

    return LocSiteVoAssembler.create(domainObject);
}
项目:openmaxims-linux    文件:GPPracticeAdminImpl.java   
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
    if (!orgVo.isValidated())
        throw new DomainRuntimeException("Org has not been validated");

    DomainFactory factory = getDomainFactory();
    Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
    if (doOrg == null)
        throw new StaleObjectException(doOrg);
    doOrg.setUpperNames();

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

        for (int i = 0; i < orgVo.getLocationSites().size(); i++)
        {
            LocSiteVo lsv = orgVo.getLocationSites().get(i);
            LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);

            dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

        }
        throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
    }

    return OrganisationVoAssembler.create(doOrg);
}
项目:openmaxims-linux    文件:OrganisationAndLocationImpl.java   
public void deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
    DomainFactory factory = getDomainFactory();

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

    if (doLocSite.getServices().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Services associated with this Location Site. Cannot delete.");
    }
    if (doLocSite.getActivityLimitGroup().size() > 0)
    {
        throw new ForeignKeyViolationException("There are Activity Limits associated with this Location Site. Cannot delete.");
    }

    Organisation doParentOrganisation = doLocSite.getParentOrganisation();
    if (doParentOrganisation != null)
        doParentOrganisation.getLocationSites().remove(doLocSite);

    // WDEV - 12551 - Display an appropriate message
    // when deleting fails
    try
    {
        factory.delete(doLocSite);
    }
    catch (Exception ex)
    {
        throw new ForeignKeyViolationException("Location Site is in use and can not be deleted.");
    }
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
/**
     * Save a location site and any locations
     */
    public ims.core.vo.LocSiteVo saveLocationSite(ims.core.vo.LocSiteVo locationSite) throws StaleObjectException, UniqueKeyViolationException
    {
        if (!locationSite.isValidated())
            throw new DomainRuntimeException("Location Site not Validated.");

        DomainFactory factory = getDomainFactory();
        HashMap<?,?> map = new HashMap<Object, Object>();
        LocSite doLocationSite = LocSiteVoAssembler.extractLocSite(factory, locationSite,map);

//       uniqueness constraint removed form the database - must be implemented in code. 
        if (checkLocationSiteNameIsUnique(locationSite.getName(), locationSite.getID_Location())!= null )
        {
            throw new UniqueKeyViolationException("A record with the same name already exists, Please change");
        }

        try
        {
            doLocationSite.setUpperNames();
            factory.save(doLocationSite);
            //WDEV-10574
            REMOTE_LOC_CACHE.clear();
        }
        catch (UnqViolationUncheckedException e)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocationSite, "codeMappings", locationSite.getCodeMappings(), "getName");

            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            //WDEV-12600 - Check if the child location don't contain duplicate mappings
            if (locationSite.getLocationsIsNotNull())
            {
                checkChildsForDuplicateTaxonoy(locationSite.getLocations(), map, factory);

            }

            throw new UniqueKeyViolationException("An Location Site with this name already exists, Please change", e);          
        }
        return LocSiteVoAssembler.create(doLocationSite);
    }
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
/**
 * moveLocation
 */
@SuppressWarnings("unchecked")
public void moveLocation(LocMostVo locToMove, ims.core.vo.LocSiteVo locSiteCurrentParent, LocMostVo locCurrentParent, ims.core.vo.LocSiteVo locSiteDestParent, LocMostVo locDestParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    Location doLocToMove = LocMostVoAssembler.extractLocation(factory, locToMove);
    Location doLocCurrentParent = LocMostVoAssembler.extractLocation(factory, locCurrentParent);
    Location doLocDestParent = LocMostVoAssembler.extractLocation(factory, locDestParent);

    LocSite doLocSiteCurrentParent = LocSiteVoAssembler.extractLocSite(factory, locSiteCurrentParent);
    LocSite doLocSiteDestParent = LocSiteVoAssembler.extractLocSite(factory, locSiteDestParent);

    if (doLocCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocCurrentParent.getLocations().size() > 0)
            doLocCurrentParent.getLocations().remove(doLocToMove);
    }
    else if (doLocSiteCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocSiteCurrentParent.getLocations().size() > 0)
            doLocSiteCurrentParent.getLocations().remove(doLocToMove);
    }

    if (locSiteDestParent != null)
    {
        doLocToMove.setParentLocation(doLocSiteDestParent);
        doLocSiteDestParent.getLocations().add(doLocToMove);
    }
    else if (locDestParent != null)
    {
        doLocToMove.setParentLocation(doLocDestParent);
        doLocDestParent.getLocations().add(doLocToMove);
    }
    if(doLocCurrentParent != null)
        factory.refresh(doLocCurrentParent);
    if(doLocSiteCurrentParent != null)
        factory.refresh(doLocSiteCurrentParent);

    factory.save(doLocToMove);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();

}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSite(Integer id)
{
    DomainFactory factory = getDomainFactory();
    return LocSiteVoAssembler.create((LocSite) factory.getDomainObject(LocSite.class, id));
}
项目:AvoinApotti    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSiteByTaxonomyType(String extId, TaxonomyType taxType) 
{
    return LocSiteVoAssembler.create(getDomLocSiteByTaxonomyType(extId, taxType));
}
项目:openMAXIMS    文件:GPPracticeAdminImpl.java   
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
    if (!orgVo.isValidated())
        throw new DomainRuntimeException("Org has not been validated");

    DomainFactory factory = getDomainFactory();
    Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
    if (doOrg == null)
        throw new StaleObjectException(doOrg);
    doOrg.setUpperNames();

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

        for (int i = 0; i < orgVo.getLocationSites().size(); i++)
        {
            LocSiteVo lsv = orgVo.getLocationSites().get(i);
            LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);

            dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

        }
        throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
    }

    //WDEV-19576 Practice Master File HL7 message
    OrganisationVo assembledOrg = OrganisationVoAssembler.create(doOrg);
    triggerGPPracticeMasterFileEvent(assembledOrg);

    return assembledOrg;

}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
     * Save a location site and any locations
     */
    public ims.core.vo.LocSiteVo saveLocationSite(ims.core.vo.LocSiteVo locationSite) throws StaleObjectException, UniqueKeyViolationException
    {
        if (!locationSite.isValidated())
            throw new DomainRuntimeException("Location Site not Validated.");

        DomainFactory factory = getDomainFactory();
        HashMap<?,?> map = new HashMap<Object, Object>();
        LocSite doLocationSite = LocSiteVoAssembler.extractLocSite(factory, locationSite,map);

//       uniqueness constraint removed form the database - must be implemented in code. 
        if (checkLocationSiteNameIsUnique(locationSite.getName(), locationSite.getID_Location())!= null )
        {
            throw new UniqueKeyViolationException("A record with the same name already exists, Please change");
        }

        try
        {
            doLocationSite.setUpperNames();
            factory.save(doLocationSite);
            //WDEV-10574
            REMOTE_LOC_CACHE.clear();
        }
        catch (UnqViolationUncheckedException e)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocationSite, "codeMappings", locationSite.getCodeMappings(), "getName");

            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            //WDEV-12600 - Check if the child location don't contain duplicate mappings
            if (locationSite.getLocationsIsNotNull())
            {
                checkChildsForDuplicateTaxonoy(locationSite.getLocations(), map, factory);

            }

            throw new UniqueKeyViolationException("An Location Site with this name already exists, Please change", e);          
        }

        return LocSiteVoAssembler.create(doLocationSite);
    }
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
 * moveLocation
 */
@SuppressWarnings("unchecked")
public void moveLocation(LocMostVo locToMove, ims.core.vo.LocSiteVo locSiteCurrentParent, LocMostVo locCurrentParent, ims.core.vo.LocSiteVo locSiteDestParent, LocMostVo locDestParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    Location doLocToMove = LocMostVoAssembler.extractLocation(factory, locToMove);
    Location doLocCurrentParent = LocMostVoAssembler.extractLocation(factory, locCurrentParent);
    Location doLocDestParent = LocMostVoAssembler.extractLocation(factory, locDestParent);

    LocSite doLocSiteCurrentParent = LocSiteVoAssembler.extractLocSite(factory, locSiteCurrentParent);
    LocSite doLocSiteDestParent = LocSiteVoAssembler.extractLocSite(factory, locSiteDestParent);

    if (doLocCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocCurrentParent.getLocations().size() > 0)
            doLocCurrentParent.getLocations().remove(doLocToMove);
    }
    else if (doLocSiteCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocSiteCurrentParent.getLocations().size() > 0)
            doLocSiteCurrentParent.getLocations().remove(doLocToMove);
    }

    if (locSiteDestParent != null)
    {
        doLocToMove.setParentLocation(doLocSiteDestParent);
        doLocSiteDestParent.getLocations().add(doLocToMove);
    }
    else if (locDestParent != null)
    {
        doLocToMove.setParentLocation(doLocDestParent);
        doLocDestParent.getLocations().add(doLocToMove);
    }
    if(doLocCurrentParent != null)
        factory.refresh(doLocCurrentParent);
    if(doLocSiteCurrentParent != null)
        factory.refresh(doLocSiteCurrentParent);

    factory.save(doLocToMove);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();

}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSite(Integer id)
{
    DomainFactory factory = getDomainFactory();
    return LocSiteVoAssembler.create((LocSite) factory.getDomainObject(LocSite.class, id));
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSiteByTaxonomyType(String extId, TaxonomyType taxType) 
{
    return LocSiteVoAssembler.create(getDomLocSiteByTaxonomyType(extId, taxType));
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
     * Save a location site and locations
     * LocMostVo is passed so that a single HL7 message can be constructed
     */
    public ims.core.vo.LocSiteVo saveLocationSite(ims.core.vo.LocSiteVo locationSite, ims.core.vo.LocMostVo childLoc) throws StaleObjectException, UniqueKeyViolationException
    {
        if (!locationSite.isValidated())
            throw new DomainRuntimeException("Location Site not Validated.");

        DomainFactory factory = getDomainFactory();
        HashMap<?,?> map = new HashMap<Object, Object>();
        LocSite doLocationSite = LocSiteVoAssembler.extractLocSite(factory, locationSite, map);
        Location doChildLoc = LocMostVoAssembler.extractLocation(factory, childLoc, map);

//       uniqueness constraint removed form the database - must be implemented in code. 
        if (checkLocationSiteNameIsUnique(locationSite.getName(), locationSite.getID_Location())!= null )
        {
            throw new UniqueKeyViolationException("A record with the same name already exists, Please change");
        }

        try
        {
            doLocationSite.setUpperNames();
            factory.save(doLocationSite);
            REMOTE_LOC_CACHE.clear();
        }
        catch (UnqViolationUncheckedException e)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocationSite, "codeMappings", locationSite.getCodeMappings(), "getName");

            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            if (locationSite.getLocationsIsNotNull())
            {
                checkChildsForDuplicateTaxonoy(locationSite.getLocations(), map, factory);
            }

            throw new UniqueKeyViolationException("An Location Site with this name already exists, Please change", e);          
        }

        //WDEV-19576 Ward Master File HL7 message
        if(doChildLoc!=null)
        {
            LocationRefVo locRefVo = LocMostVoAssembler.create(doChildLoc);
            triggerWardMasterFileEvent(locRefVo);
        }

        return LocSiteVoAssembler.create(doLocationSite);
    }
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
     * Save a location site and any locations
     */
    public ims.core.vo.LocSiteVo saveLocationSite(ims.core.vo.LocSiteVo locationSite) throws StaleObjectException, UniqueKeyViolationException
    {
        if (!locationSite.isValidated())
            throw new DomainRuntimeException("Location Site not Validated.");

        DomainFactory factory = getDomainFactory();
        HashMap<?,?> map = new HashMap<Object, Object>();
        LocSite doLocationSite = LocSiteVoAssembler.extractLocSite(factory, locationSite,map);

//       uniqueness constraint removed form the database - must be implemented in code. 
        if (checkLocationSiteNameIsUnique(locationSite.getName(), locationSite.getID_Location())!= null )
        {
            throw new UniqueKeyViolationException("A record with the same name already exists, Please change");
        }

        try
        {
            doLocationSite.setUpperNames();
            factory.save(doLocationSite);
            //WDEV-10574
            REMOTE_LOC_CACHE.clear();
        }
        catch (UnqViolationUncheckedException e)
        {
            String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doLocationSite, "codeMappings", locationSite.getCodeMappings(), "getName");

            if(dupMessage != null)
                throw new UniqueKeyViolationException(dupMessage);

            //WDEV-12600 - Check if the child location don't contain duplicate mappings
            if (locationSite.getLocationsIsNotNull())
            {
                checkChildsForDuplicateTaxonoy(locationSite.getLocations(), map, factory);

            }

            throw new UniqueKeyViolationException("An Location Site with this name already exists, Please change", e);          
        }
        return LocSiteVoAssembler.create(doLocationSite);
    }
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
/**
 * moveLocation
 */
@SuppressWarnings("unchecked")
public void moveLocation(LocMostVo locToMove, ims.core.vo.LocSiteVo locSiteCurrentParent, LocMostVo locCurrentParent, ims.core.vo.LocSiteVo locSiteDestParent, LocMostVo locDestParent) throws StaleObjectException
{
    DomainFactory factory = getDomainFactory();

    Location doLocToMove = LocMostVoAssembler.extractLocation(factory, locToMove);
    Location doLocCurrentParent = LocMostVoAssembler.extractLocation(factory, locCurrentParent);
    Location doLocDestParent = LocMostVoAssembler.extractLocation(factory, locDestParent);

    LocSite doLocSiteCurrentParent = LocSiteVoAssembler.extractLocSite(factory, locSiteCurrentParent);
    LocSite doLocSiteDestParent = LocSiteVoAssembler.extractLocSite(factory, locSiteDestParent);

    if (doLocCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocCurrentParent.getLocations().size() > 0)
            doLocCurrentParent.getLocations().remove(doLocToMove);
    }
    else if (doLocSiteCurrentParent != null)
    {
        doLocToMove.setParentLocation(null);
        if (doLocSiteCurrentParent.getLocations().size() > 0)
            doLocSiteCurrentParent.getLocations().remove(doLocToMove);
    }

    if (locSiteDestParent != null)
    {
        doLocToMove.setParentLocation(doLocSiteDestParent);
        doLocSiteDestParent.getLocations().add(doLocToMove);
    }
    else if (locDestParent != null)
    {
        doLocToMove.setParentLocation(doLocDestParent);
        doLocDestParent.getLocations().add(doLocToMove);
    }
    if(doLocCurrentParent != null)
        factory.refresh(doLocCurrentParent);
    if(doLocSiteCurrentParent != null)
        factory.refresh(doLocSiteCurrentParent);

    factory.save(doLocToMove);

    //WDEV-10574
    REMOTE_LOC_CACHE.clear();

}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSite(Integer id)
{
    DomainFactory factory = getDomainFactory();
    return LocSiteVoAssembler.create((LocSite) factory.getDomainObject(LocSite.class, id));
}
项目:openMAXIMS    文件:OrganisationAndLocationImpl.java   
public LocSiteVo getLocSiteByTaxonomyType(String extId, TaxonomyType taxType) 
{
    return LocSiteVoAssembler.create(getDomLocSiteByTaxonomyType(extId, taxType));
}