Java Code Examples for ims.core.resource.place.domain.objects.LocSite

The following are top voted examples for showing how to use ims.core.resource.place.domain.objects.LocSite. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: LocationProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false		
	return false;	
}
 
Example 2
Project: AvoinApotti   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}
 
Example 3
Project: AvoinApotti   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 4
Project: AvoinApotti   File: LocationRefManProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}
 
Example 5
Project: AvoinApotti   File: LocationRefManProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 6
Project: AvoinApotti   File: SessionManagementImpl.java   View source code 6 votes vote down vote up
private LocationLiteVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 7
Project: AvoinApotti   File: GPPracticeAdminImpl.java   View source code 6 votes vote down vote up
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); 
}
 
Example 8
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
/**
 * 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();		
}
 
Example 9
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
public LocSiteShortVo getLocSiteByPostCode(String postCode) 
{
	if (postCode == null)
		return null;

	DomainFactory factory = getDomainFactory();
	String hql = " from LocSite l where l.address.postCode = :postCode ";

	List locList = factory.find(hql,new String[]{"postCode"}, new Object[]{postCode});

	if (locList != null && locList.size() == 1)
	{
		return LocSiteShortVoAssembler.create((LocSite) locList.get(0));
	}
	else if (locList != null && locList.size() > 1)
	{
		throw new DomainRuntimeException("Non unique hit on LocationSite by Post Code " + postCode);
	}
	return null;
}
 
Example 10
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
public String getPracticeNationalCodeForSurgery(LocationRefVo surgery)
{
	DomainFactory factory = getDomainFactory();
	if (surgery==null)
		return null;
	
	 LocSite loc=(LocSite)factory.getDomainObject(surgery);//(Organisation.class, id));
	 if (loc!=null&&
			 loc.getType()!=null&&
			 loc.getType().equals(getDomLookup(LocationType.SURGERY))&&
			 loc.getParentOrganisation()!=null)
	 {
		 return loc.getParentOrganisation().getMappingValueOfType(getDomLookup(TaxonomyType.NAT_LOC_CODE));
	 }
	 else 
	 {
		 return null;
	 }
	 
}
 
Example 11
Project: AvoinApotti   File: TaxonomyCodeAdminImpl.java   View source code 6 votes vote down vote up
public LocSiteUpprNameVo saveSurgeryRecord(LocSiteUpprNameVo surgery)
		throws DomainInterfaceException, StaleObjectException,
		UniqueKeyViolationException 	
{
	
	if (!surgery.isValidated())
	{
		throw new DomainRuntimeException("LocSiteUpprNameVo Vo has not been validated.");
	}
	
	DomainFactory factory = getDomainFactory();			
	
	LocSite locSiteBo = LocSiteUpprNameVoAssembler.extractLocSite(factory, surgery);
	
	factory.save(locSiteBo);
	
	return LocSiteUpprNameVoAssembler.create(locSiteBo);			
}
 
Example 12
Project: AvoinApotti   File: MoveToWardSpecimenCollectionImpl.java   View source code 6 votes vote down vote up
private LocShortMappingsVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 13
Project: AvoinApotti   File: WardSpecimenCollectionImpl.java   View source code 6 votes vote down vote up
private LocShortMappingsVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 14
Project: openMAXIMS   File: LocationProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false		
	return false;	
}
 
Example 15
Project: openMAXIMS   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 16
Project: openmaxims-linux   File: GPPracticeAdminImpl.java   View source code 6 votes vote down vote up
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); 
}
 
Example 17
Project: openMAXIMS   File: InpatientListImpl.java   View source code 6 votes vote down vote up
private LocShortMappingsVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 18
Project: openmaxims-linux   File: TaxonomyCodeAdminImpl.java   View source code 6 votes vote down vote up
public LocSiteUpprNameVo saveSurgeryRecord(LocSiteUpprNameVo surgery)
		throws DomainInterfaceException, StaleObjectException,
		UniqueKeyViolationException 	
{
	
	if (!surgery.isValidated())
	{
		throw new DomainRuntimeException("LocSiteUpprNameVo Vo has not been validated.");
	}
	
	DomainFactory factory = getDomainFactory();			
	
	LocSite locSiteBo = LocSiteUpprNameVoAssembler.extractLocSite(factory, surgery);
	
	factory.save(locSiteBo);
	
	return LocSiteUpprNameVoAssembler.create(locSiteBo);			
}
 
Example 19
Project: openMAXIMS   File: MoveSessionDialogImpl.java   View source code 6 votes vote down vote up
private LocationLiteVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 20
Project: openMAXIMS   File: MoveSessionToLocationDialogImpl.java   View source code 6 votes vote down vote up
private LocationLiteVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 21
Project: openMAXIMS   File: MoveAndBookTheatreSlotImpl.java   View source code 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if (doLocation == null)
		return null;

	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();
		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}

	return null;
}
 
Example 22
Project: openMAXIMS   File: TheatreSessionManagementImpl.java   View source code 6 votes vote down vote up
private LocationLiteVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 23
Project: openMAXIMS   File: GPPracticeAdminImpl.java   View source code 6 votes vote down vote up
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); 
}
 
Example 24
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
/**
 * 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();		
}
 
Example 25
Project: openmaxims-linux   File: MoveToWardSpecimenCollectionImpl.java   View source code 6 votes vote down vote up
private LocShortMappingsVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 26
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
public LocSiteShortVo getLocSiteByPostCode(String postCode) 
{
	if (postCode == null)
		return null;

	DomainFactory factory = getDomainFactory();
	String hql = " from LocSite l where l.address.postCode = :postCode ";

	List locList = factory.find(hql,new String[]{"postCode"}, new Object[]{postCode});

	if (locList != null && locList.size() == 1)
	{
		return LocSiteShortVoAssembler.create((LocSite) locList.get(0));
	}
	else if (locList != null && locList.size() > 1)
	{
		throw new DomainRuntimeException("Non unique hit on LocationSite by Post Code " + postCode);
	}
	return null;
}
 
Example 27
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
public String getPracticeNationalCodeForSurgery(LocationRefVo surgery)
{
	DomainFactory factory = getDomainFactory();
	if (surgery==null)
		return null;
	
	 LocSite loc=(LocSite)factory.getDomainObject(surgery);//(Organisation.class, id));
	 if (loc!=null&&
			 loc.getType()!=null&&
			 loc.getType().equals(getDomLookup(LocationType.SURGERY))&&
			 loc.getParentOrganisation()!=null)
	 {
		 return loc.getParentOrganisation().getMappingValueOfType(getDomLookup(TaxonomyType.NAT_LOC_CODE));
	 }
	 else 
	 {
		 return null;
	 }
	 
}
 
Example 28
Project: openMAXIMS   File: TaxonomyCodeAdminImpl.java   View source code 6 votes vote down vote up
public LocSiteUpprNameVo saveSurgeryRecord(LocSiteUpprNameVo surgery)
		throws DomainInterfaceException, StaleObjectException,
		UniqueKeyViolationException 	
{
	
	if (!surgery.isValidated())
	{
		throw new DomainRuntimeException("LocSiteUpprNameVo Vo has not been validated.");
	}
	
	DomainFactory factory = getDomainFactory();			
	
	LocSite locSiteBo = LocSiteUpprNameVoAssembler.extractLocSite(factory, surgery);
	
	factory.save(locSiteBo);
	
	return LocSiteUpprNameVoAssembler.create(locSiteBo);			
}
 
Example 29
Project: openmaxims-linux   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}
 
Example 30
Project: openMAXIMS   File: BookEmergencyTheatreImpl.java   View source code 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if (doLocation == null)
		return null;

	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();
		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}

	return null;
}
 
Example 31
Project: openmaxims-linux   File: LocationCAREUKProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 32
Project: openMAXIMS   File: LocationProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false		
	return false;	
}
 
Example 33
Project: openMAXIMS   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}
 
Example 34
Project: openMAXIMS   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 35
Project: openMAXIMS   File: LocationRefManProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}
 
Example 36
Project: openMAXIMS   File: LocationRefManProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 37
Project: openMAXIMS   File: SessionManagementImpl.java   View source code 6 votes vote down vote up
private LocationLiteVo getHospital(Location doLocation)
{
	if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
	{
		return LocShortMappingsVoAssembler.create((LocSite) doLocation);
	}

	while (doLocation.getParentLocation() != null)
	{
		doLocation = doLocation.getParentLocation();

		if (doLocation instanceof LocSite && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		{
			return LocShortMappingsVoAssembler.create((LocSite) doLocation);
		}
	}

	return null;
}
 
Example 38
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
/**
 * 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();		
}
 
Example 39
Project: openmaxims-linux   File: LocationTurningpointProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(Location location, IAppUser user) 
{
	// If the location is null - then return false
	if (location == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(location.isIsActive()) && Boolean.FALSE.equals(location.isIsVirtual()) && locationIsAllowed(location, user))
		return true;
	
	if (location.getLocations() != null)
	{			
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<LocSite>) location.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location locationChild = (Location)locationSite.next();
			
			if (checkForValidLocation(locationChild, user))
				return true;
		}
	}
	
	// At this point return false
	return false;	
}
 
Example 40
Project: openmaxims-linux   File: LocationCAREUKProvider.java   View source code 6 votes vote down vote up
private boolean checkForValidLocation(LocSite locSite, IAppUser user) 
{
	// If the location is null - then return false
	if (locSite == null)
		return false;
	
	// If the location itself is an allowed location - return true
	if (Boolean.TRUE.equals(locSite.isIsActive()) && Boolean.FALSE.equals(locSite.isIsVirtual()) && locationIsAllowed(locSite, user))
		return true;
	
	if (locSite.getLocations() != null)
	{		
		// Recursively check the sub locations
		Iterator locationSite = ((Iterable<Location>) locSite.getLocations()).iterator(); 
		while (locationSite.hasNext()) 
		{ 
			Location location = (Location)locationSite.next();			
			if (checkForValidLocation(location, user))
				return true;
		}
	}
			
	// At this point return false
	return false;
}