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

The following are top voted examples for showing how to use ims.core.resource.place.domain.objects.Location. 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: EDischargePatientReadyToLeaveComponentImpl.java   Source Code and License 6 votes vote down vote up
private LocationRefVo getHospital(ims.core.resource.place.vo.LocationRefVo voRef)
{
	LocMostVo voLocation = LocMostVoAssembler.create((Location)getDomainFactory().getDomainObject(voRef));
	
	if(voLocation != null && voLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return (LocationRefVo) voLocation;

	while(voLocation != null && voLocation.getParentLocation() != null)
	{
		voLocation = voLocation.getParentLocation();
		if(voLocation instanceof LocMostVo && voLocation.getType().equals(LocationType.HOSP))
			return (LocationRefVo) voLocation;
	}

	return voRef;
}
 
Example 2
Project: AvoinApotti   File: NewResultsImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 3
Project: AvoinApotti   File: OcsIfInboundImpl.java   Source Code and License 6 votes vote down vote up
public IfLocParentVo getLocParentByTaxType(String extId, TaxonomyType taxType)
{
	if (extId == null || taxType == null)
		return null;

	DomainFactory factory = getDomainFactory();
	String hql = " from Location l " +
	" join l.codeMappings as cm" +
	" where cm.taxonomyName = :taxType " + 
	" and cm.taxonomyCode = :extId ";

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

	if (locList != null && locList.size() == 1)
	{
		return IfLocParentVoAssembler.create((Location)locList.get(0));
	}
	else if (locList != null && locList.size() > 1)
	{
		throw new DomainRuntimeException("Non unique hit on Location by TaxonomyType " + taxType.getText() + " and code " + extId);
	}
	else
		return null;
}
 
Example 4
Project: AvoinApotti   File: WardSpecimenCollectionImpl.java   Source Code and License 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 5
Project: AvoinApotti   File: InpatientClinicalCodingWorklistImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 6
Project: AvoinApotti   File: LocationTurningpointProvider.java   Source Code and License 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 7
Project: AvoinApotti   File: LocationTurningpointProvider.java   Source Code and License 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 8
Project: AvoinApotti   File: LocationRefManProvider.java   Source Code and License 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 9
Project: AvoinApotti   File: CareContextSelectDialogImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospitalByWard(LocationRefVo currentWard) 
{
	DomainFactory factory = getDomainFactory();
	Location location = (Location)factory.getDomainObject(currentWard);
	
	if (location == null)
		return null;

	while (location!=null && (location.isIsActive() && location.getType()!=null && !location.getType().equals(getDomLookup(LocationType.HOSP))))
	{
		location = location.getParentLocation();
	}
	
	if(location != null)
		return location;
	
	return null;
}
 
Example 10
Project: AvoinApotti   File: ADTAdmissionDetailsComponentImpl.java   Source Code and License 6 votes vote down vote up
public LocationLiteVo getAdmissionWard(PASEventRefVo pasEventRef)
{
	if(pasEventRef == null || pasEventRef.getID_PASEvent()==null)
		throw new CodingRuntimeException("Cannot get PasEvent value on null pasEventRef.");
	
	StringBuffer hql = new StringBuffer("select admDet.pasEvent.location from AdmissionDetail as admDet left join admDet.pasEvent as pasEvent where pasEvent.id= :pasEventID ");
	
	DomainFactory factory = getDomainFactory();
	List<?> list = factory.find(hql.toString(), new String[] {"pasEventID"}, new Object[] {pasEventRef.getID_PASEvent()});
	
	if (list!=null && list.size()>0)
	{	
		return LocationLiteVoAssembler.create((Location) list.get(0));
	}
	
	return null;
	
}
 
Example 11
Project: AvoinApotti   File: BedInfoDialogImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 12
Project: AvoinApotti   File: ADTImpl.java   Source Code and License 6 votes vote down vote up
public void cancelInpatientLeave(PatientShort patient) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();

	Patient domPatient = PatientShortAssembler.extractPatient(factory, patient);
	InpatientEpisode epis = getCurrentAdmission(factory, patient);
	if (epis != null)
	{
	PASEvent pasevent=epis.getPasEvent();
	Location loc=(Location)factory.getDomainObject(Location.class, domPatient.getWard().getId());
	pasevent.setLocation(loc);
	epis.setPasEvent(pasevent);

	epis.setIsOnLeave(Boolean.FALSE);
	factory.save(epis);
	}
}
 
Example 13
Project: AvoinApotti   File: WardDataViewImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 14
Project: AvoinApotti   File: TheatreAdmissionImpl.java   Source Code and License 6 votes vote down vote up
public LocShortMappingsVo getBookingApptSessionLocation(Integer apptId) 
{
	if (apptId == null)
		return null;
	DomainFactory factory = getDomainFactory();		
	 
	ArrayList<String> marques = new ArrayList<String>();
	ArrayList<Object> values = new ArrayList<Object>();
	marques.add("id");
	values.add(apptId);	
	marques.add("locTypeWardID");
	values.add(LocationType.WARD.getID());
	
	String query = " select sessionLocation from Booking_Appointment as apptDetails left join apptDetails.session as sessionDetails left join sessionDetails.schLocation as sessionLocation left join sessionLocation.type as locationType where ( apptDetails.id = :id and sessionLocation.isActive = 1 and locationType.id = :locTypeWardID ) ";
	List<?> sessionLoc = factory.find(query, marques, values);
	
	if(sessionLoc != null && sessionLoc.size() > 0 && sessionLoc.get(0) instanceof Location)
		return LocShortMappingsVoAssembler.create((Location) sessionLoc.get(0));
	
	return null;
}
 
Example 15
Project: AvoinApotti   File: WardViewImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 16
Project: AvoinApotti   File: EmergencyHelper.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 17
Project: AvoinApotti   File: SessionManagementImpl.java   Source Code and License 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 18
Project: AvoinApotti   File: AdmissionDetailsImpl.java   Source Code and License 6 votes vote down vote up
/**
 * Method used to recursively retrieve the first parent hospital for a ward
 */
private LocationRefVo getHospitalForWard(LocationRefVo ward)
{
	Location domainWard = (Location) getDomainFactory().getDomainObject(Location.class, ward.getID_Location());
	Location parentLocation = domainWard.getParentLocation();
	
	
	if (parentLocation == null)
		return null;
	

	LocationRefVo hospital = new LocationRefVo(parentLocation.getId(), parentLocation.getVersion());
	
	if (parentLocation.getType() != null && LocationType.HOSP.getID() == parentLocation.getType().getId())
	{
		return hospital;
	}
	
	return getHospitalForWard(hospital);
}
 
Example 19
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
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);
			}
		}
}
 
Example 20
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
public LocMostVo getLocationByPostCode(String postCode) 
{
	if (postCode == null)
		return null;

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

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

	if (locList != null && locList.size() == 1)
	{
		return LocMostVoAssembler.create((Location) locList.get(0));
	}
	else if (locList != null && locList.size() > 1)
	{
		throw new DomainRuntimeException("Non unique hit on Location by Post Code " + postCode);
	}
	return null;
}
 
Example 21
Project: AvoinApotti   File: NewResultsOutpatientTabComponentImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 22
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
private Location getDomLocationByTaxonomyType(String extId, TaxonomyType taxonomyType, Class clazz)
{
	if (extId == null || taxonomyType == null)
		return null;

	String objName = (clazz.equals(Location.class)) ? "Location" : "LocSite";
	DomainFactory factory = getDomainFactory();
	String hql = " from " + objName + " l " +
	" join l.codeMappings as cm" +
	" where cm.taxonomyName = :taxType " + 
	" and cm.taxonomyCode = :extId ";

	List locList = factory.find(hql,new String[]{"taxType", "extId"}, new Object[]{getDomLookup(taxonomyType),extId});

	if (locList != null && locList.size() == 1)
	{
		return (Location) locList.get(0);
	}
	else if (locList != null && locList.size() > 1)
	{
		throw new DomainRuntimeException("Non unique hit on Location by TaxonomyType " + taxonomyType.getText() + " and code " + extId);
	}
	else
		return null;
}
 
Example 23
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
public ClinicListVoCollection listLocationsMin(LocationType locType)
{
	DomainFactory factory = getDomainFactory();
	ClinicListVoCollection voCollReturn = new ClinicListVoCollection();
	List lstClinics = factory.find("from Location l where l.type = :type and l.isActive= :isActive and l.isVirtual= :isVirtual", new String[]{"type", "isActive", "isVirtual"}, new Object[]{getDomLookup(locType), Boolean.TRUE, Boolean.FALSE});//wdev-2730

	for (Iterator iter = lstClinics.iterator(); iter.hasNext();)
	{
		Location doLocation = (Location) iter.next();
		ClinicListVo voBaseList = new ClinicListVo();
		voBaseList.setSingleID(doLocation.getId());
		voBaseList.setBoolValue(doLocation.isIsActive());
		voBaseList.setName(doLocation.getName());
		voBaseList.setDescription(doLocation.getExtCode(TaxonomyType.PAS.getId()));

		voCollReturn.add(voBaseList);
	}

	return voCollReturn;
}
 
Example 24
Project: AvoinApotti   File: NewResultsAllTabComponentImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 25
Project: AvoinApotti   File: DementiaWorklistImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if (doLocation == null)
		return null;

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

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

	return null;
}
 
Example 26
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
/**
* Gets the Active Hospital mapping for a particular location by walking up the Location tree until it hits a Hospital.
* http://jira/browse/WDEV-11637
*/

public String getActiveHospitalCodeForLoc(LocShortMappingsVo loc,TaxonomyType taxonomyType) {
	DomainFactory factory = getDomainFactory();
	Location location = (Location)factory.getDomainObject(loc);
	if (location==null)
		return null;

	while (location!=null&&
			(location.isIsActive()&&location.getType()!=null&&!location.getType().equals(getDomLookup(LocationType.HOSP)))
			)
	{
		location=location.getParentLocation();
	}
	if(location!=null)
		return location.getExtCode(taxonomyType.getID());
	return null;
}
 
Example 27
Project: AvoinApotti   File: DischargeSummaryScheduleSTHKFormImpl.java   Source Code and License 6 votes vote down vote up
private String getPrinter(DischargeDetailsRefVo dischargeDetails) 
{
	if(dischargeDetails == null 
		||	dischargeDetails.getID_DischargeDetails() == null)
		throw new CodingRuntimeException("DischargeDetailsRefVo is null or id not provided for getPrinter");	
	
	DomainFactory factory = getDomainFactory();
	DischargeDetails doDD = (DischargeDetails)factory.getDomainObject(DischargeDetails.class,dischargeDetails.getID_DischargeDetails());
	if (doDD.getDischargingWard() != null)
	{
		Location doLoc = (Location)factory.getDomainObject(Location.class,doDD.getDischargingWard().getId());
		PrinterVo voDefaultPrinter = LocationFullVoAssembler.create(doLoc).getDefaultPrinter();

		return voDefaultPrinter != null ? voDefaultPrinter.getName() : "";
	}
	return "";
}
 
Example 28
Project: AvoinApotti   File: LocationStartupSelectionImpl.java   Source Code and License 6 votes vote down vote up
public ims.core.vo.LocationLiteVoCollection listLocationsByLocation(ims.core.resource.place.vo.LocationRefVo location)
{
	Location doLocation = (Location) getDomainFactory().getDomainObject(location);
	LocationLiteVoCollection result =  LocationLiteVoAssembler.createLocationLiteVoCollectionFromLocation(doLocation.getLocations());
	
	if(result == null)
		return null;
	
	LocationLiteVoCollection activeLocations = new LocationLiteVoCollection();
	
	for(int x = 0; x < result.size(); x++)
	{
		LocationLiteVo selLocation = result.get(x);
		if(selLocation != null 
			&& selLocation.getIsActive() != null && selLocation.getIsActive().booleanValue()
			&& selLocation.getIsVirtualIsNotNull() && ! selLocation.getIsVirtual().booleanValue())//wdev-2730
			activeLocations.add(selLocation);
	}
	
	return activeLocations.sort();
}
 
Example 29
Project: AvoinApotti   File: MoveToWardSpecimenCollectionImpl.java   Source Code and License 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 30
Project: AvoinApotti   File: VTERiskAssessmentWorklistImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 31
Project: AvoinApotti   File: HospitalAtNightWorklistImpl.java   Source Code and License 6 votes vote down vote up
private Location getHospital(Location doLocation)
{
	if(doLocation == null)
		return null;
	
	if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
		return doLocation;

	while(doLocation.getParentLocation() != null) 
	{
		doLocation = doLocation.getParentLocation();
		if(doLocation instanceof Location && doLocation.getType().equals(getDomLookup(LocationType.HOSP)))
			return doLocation;
	}
	
	return null;
}
 
Example 32
Project: AvoinApotti   File: ReferralDetailsComponentImpl.java   Source Code and License 5 votes vote down vote up
/**
 * This function will return the parent location for provided location id 
 */
private Integer getParentLocationID(Integer location)
{
	String query = "select parentLocation from Location as parentLocation left join parentLocation.locations as loc where loc.id = " + location;
	Location result = (Location) getDomainFactory().findFirst(query);
	
	if (result == null)
		return null;
	
	return result.getId();
}
 
Example 33
Project: AvoinApotti   File: LocationProvider.java   Source Code and License 5 votes vote down vote up
public ILocation validateLocation(ILocation location) 
{
	if(location == null)
		return null;
	
	LocationLiteVo result = LocationLiteVoAssembler.create((Location)getDomainFactory().getDomainObject(Location.class, location.getID()));
	if(result != null && (result.getIsActive() == null || !result.getIsActive().booleanValue()))
		return null;
	
	return result;
}
 
Example 34
Project: AvoinApotti   File: SurgicalAuditPlannedActualProcedureDetailsImpl.java   Source Code and License 5 votes vote down vote up
public LocationLiteVo getLocationLiteVo(LocSiteRefVo locRef) 
{
	if( locRef == null)
		throw new DomainRuntimeException("Location cannot be null.");
	
	
	DomainFactory factory = getDomainFactory();
	Location doLocation = (Location) factory.getDomainObject(Location.class, locRef.getID_Location());
	return LocationLiteVoAssembler.create(doLocation);
}
 
Example 35
Project: AvoinApotti   File: LocationProvider.java   Source Code and License 5 votes vote down vote up
private boolean locationIsAllowed(Location location, IAppUser user) 
{
	if (location == null)
		return false;
	
	return true;
}
 
Example 36
Project: AvoinApotti   File: SurgicalAuditProcedureStaffDialogImpl.java   Source Code and License 5 votes vote down vote up
public ims.core.vo.LocationLiteVo getLocationLite(ims.core.resource.place.vo.LocationRefVo locRef)
{
	DomainFactory factory = getDomainFactory();
	Location doLocation = (Location)factory.getDomainObject(Location.class, locRef.getID_Location());
	return getHospital(doLocation);

}
 
Example 37
Project: AvoinApotti   File: LocationTurningpointProvider.java   Source Code and License 5 votes vote down vote up
public boolean locationIsAllowed(ILocation location, IAppUser user) 
{
	if (location == null)
		return false;

	if (user == null)
		return false;

	if (user.getMosId() == null)
		return true;

	DomainFactory factory = getDomainFactory();		
	MemberOfStaff memberOfStaff = (MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, user.getMosId());		
	Location locationShort = (Location) factory.getDomainObject(Location.class, location.getID());
			
	// If the member of staff has no locations - return false
	if (memberOfStaff.getLocations() == null)
		return false;		
	
	Iterator it = ((Iterable<HcpLocation>) memberOfStaff.getLocations()).iterator(); 
	while (it.hasNext()) 
	{ 
		HcpLocation hcpLocation = (HcpLocation) it.next(); 
		
		// Skip to next location if the HCP location is null or HCP location doesn't have a location 
		if (hcpLocation == null)
			continue;

		if (hcpLocation.getLocation() == null)
			continue;

		// The locations match - return true
		if (hcpLocation.getLocation().equals(locationShort))
			return true;			 
	}
			
	// No matching location found - return false			
	return false;
}
 
Example 38
Project: AvoinApotti   File: LocationRefManProvider.java   Source Code and License 5 votes vote down vote up
private boolean checkForValidLocation(Organisation bo, IAppUser user) 
{
	// Check is the organization is null (should never be true, but keep the check)
	if (bo == null)
		return false;		
	
	if (bo.getLocationSites() != null)
	{		
		Iterator it = ((Iterable<LocSite>) bo.getLocationSites()).iterator(); 
		while (it.hasNext()) 
		{ 
			LocSite locationsSite = (LocSite) it.next(); 
			
			// If the location site is allowed return true and end function here
			if (Boolean.TRUE.equals(locationsSite.isIsActive()) && Boolean.FALSE.equals(locationsSite.isIsVirtual()) && locationIsAllowed(locationsSite, user))
				return true;

			// If the location site is not allowed check it's locations for a valid location				
			Iterator locationSite = ((Iterable<Location>) locationsSite.getLocations()).iterator(); 
			while (locationSite.hasNext()) 
			{ 
				Location locSite = (Location)locationSite.next();
				if (checkForValidLocation(locSite, user))
					return true;
			}
		}
	}
	// At this point return false
	return false;		
}
 
Example 39
Project: AvoinApotti   File: EDischargeSTHKListImpl.java   Source Code and License 5 votes vote down vote up
public LocationLiteVo getWard(LocationRefVo voWardRef) 
{
	if (voWardRef != null && voWardRef.getID_LocationIsNotNull())
	{	
		DomainFactory factory = getDomainFactory();
		Location domLoc = (Location) factory.getDomainObject(Location.class, voWardRef.getID_Location());
		return LocationLiteVoAssembler.create(domLoc);
	}
	return null;
}
 
Example 40
Project: AvoinApotti   File: LocationRefManProvider.java   Source Code and License 5 votes vote down vote up
public boolean locationIsAllowed(ILocation location, IAppUser user) 
{
	if (location == null)
		return false;

	if (user == null)
		return false;

	if (user.getMosId() == null)
		return true;

	DomainFactory factory = getDomainFactory();		
	MemberOfStaff memberOfStaff = (MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, user.getMosId());		
	Location locationShort = (Location) factory.getDomainObject(Location.class, location.getID());
			
	// If the member of staff has no locations - return false
	if (memberOfStaff.getLocations() == null)
		return false;		
	
	Iterator it = ((Iterable<HcpLocation>) memberOfStaff.getLocations()).iterator(); 
	while (it.hasNext()) 
	{ 
		HcpLocation hcpLocation = (HcpLocation) it.next(); 
		
		// Skip to next location if the HCP location is null or HCP location doesn't have a location 
		if (hcpLocation == null)
			continue;

		if (hcpLocation.getLocation() == null)
			continue;

		// The locations match - return true
		if (hcpLocation.getLocation().equals(locationShort))
			return true;			 
	}
			
	// No matching location found - return false			
	return false;
}