Java Code Examples for ims.core.vo.lookups.OrganisationType

The following are top voted examples for showing how to use ims.core.vo.lookups.OrganisationType. 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: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromScreen() 
{
	OrganisationVo voOrganisation = form.getGlobalContext().Admin
			.getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
			.getOrganisationVo() : new OrganisationVo();
	PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
			.getAddress()
			: new PersonAddress();
	voAddress.setLine1(form.txtOrgAdd1().getValue());
	voAddress.setLine2(form.txtOrgAdd2().getValue());
	voAddress.setLine3(form.txtOrgAdd3().getValue());
	voAddress.setLine4(form.txtOrgAdd4().getValue());
	voAddress.setLine5(form.txtOrgAdd5().getValue());
	voAddress.setCounty(form.cmbCounty().getValue());
	voAddress.setPhone(form.txtOrgPhone().getValue());
	voAddress.setFax(form.txtOrgFax().getValue());
	voAddress.setPostCode(form.txtPostCode().getValue());
	
	voOrganisation.setAddress(voAddress);

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

	form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
	OrganisationVo practice = new OrganisationVo();
	
	if (form.getLocalContext().getPracticeIsNotNull())
		practice = form.getLocalContext().getPractice();
	practice = populatePracticeData(practice);
	
	practice.setType(OrganisationType.GPP);
	
	// this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
	// added to allow the ntpf to work as if using only practices. 
	if ( !practice.getLocationSitesIsNotNull())
	{				
		if (!canUseSurgery())
			practice = createOneMatchingChildSurgery(practice);
	}
	
	return doSavePractice(practice);
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
protected ims.core.vo.OrgShortVo populateDataFromScreen(ims.core.vo.OrgShortVo value)
{
	if(value == null)
		value = new ims.core.vo.OrgShortVo();

	PersonAddress voPersonAdress = new PersonAddress();
	voPersonAdress.setCounty(form.lyr1().tabOrg().cmbOrgCounty().getValue());
	voPersonAdress.setFax(form.lyr1().tabOrg().txtOrgFax().getValue());
	voPersonAdress.setLine1(form.lyr1().tabOrg().txtOrgAdd1().getValue());
	voPersonAdress.setLine2(form.lyr1().tabOrg().txtOrgAdd2().getValue());
	voPersonAdress.setLine3(form.lyr1().tabOrg().txtOrgAdd3().getValue());
	voPersonAdress.setLine4(form.lyr1().tabOrg().txtOrgAdd4().getValue());
	voPersonAdress.setLine5(form.lyr1().tabOrg().txtOrgAdd5().getValue());		
	voPersonAdress.setPhone(form.lyr1().tabOrg().txtOrgPhone().getValue());
	voPersonAdress.setPostCode(form.lyr1().tabOrg().txtOrgPostCode().getValue());

	value.setAddress(voPersonAdress);
	
	value.setCodeMappings(getCodeMappings(form.lyr1().tabOrg().grdMappings()));
	value.setComment(form.lyr1().tabOrg().txtOrgComment().getValue());
	value.setType(ims.core.vo.lookups.OrganisationType.SUPPLIER);
	value.setName(form.lyr1().tabOrg().txtOrgName().getValue());
	return value;
}
 
Example 4
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
public String getActiveHospitalCodeForClinic(ClinicRefVo clinicRefVo, TaxonomyType taxonomyType)
{
	DomainFactory factory = getDomainFactory();
	Clinic clinic = (Clinic)factory.getDomainObject(clinicRefVo);
	if (clinic==null)
		return null;
	
	Location loc = clinic.getClinicLocation();

	while (loc!=null&&(loc.isIsActive()&&loc.getType()!=null&&loc.getType().equals(getDomLookup(OrganisationType.HOSPITAL))))
	{
		loc=loc.getParentLocation();
	}
	if(loc!=null)
		return loc.getExtCode(taxonomyType.getID());
	return null;
}
 
Example 5
Project: AvoinApotti   File: NewOnwardReferralImpl.java   Source Code and License 6 votes vote down vote up
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();
}
 
Example 6
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromScreen() 
{
	OrganisationVo voOrganisation = form.getGlobalContext().Admin
			.getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
			.getOrganisationVo() : new OrganisationVo();
	PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
			.getAddress()
			: new PersonAddress();
	voAddress.setLine1(form.txtOrgAdd1().getValue());
	voAddress.setLine2(form.txtOrgAdd2().getValue());
	voAddress.setLine3(form.txtOrgAdd3().getValue());
	voAddress.setLine4(form.txtOrgAdd4().getValue());
	voAddress.setLine5(form.txtOrgAdd5().getValue());
	voAddress.setCounty(form.cmbCounty().getValue());
	voAddress.setPhone(form.txtOrgPhone().getValue());
	voAddress.setFax(form.txtOrgFax().getValue());
	voAddress.setPostCode(form.txtPostCode().getValue());
	
	voOrganisation.setAddress(voAddress);

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

	form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
 
Example 7
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
	OrganisationVo practice = new OrganisationVo();
	
	if (form.getLocalContext().getPracticeIsNotNull())
		practice = form.getLocalContext().getPractice();
	practice = populatePracticeData(practice);
	
	practice.setType(OrganisationType.GPP);
	
	// this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
	// added to allow the ntpf to work as if using only practices. 
	if ( !practice.getLocationSitesIsNotNull())
	{				
		if (!canUseSurgery())
			practice = createOneMatchingChildSurgery(practice);
	}
	
	return doSavePractice(practice);
}
 
Example 8
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
protected ims.core.vo.OrgShortVo populateDataFromScreen(ims.core.vo.OrgShortVo value)
{
	if(value == null)
		value = new ims.core.vo.OrgShortVo();

	PersonAddress voPersonAdress = new PersonAddress();
	voPersonAdress.setCounty(form.lyr1().tabOrg().cmbOrgCounty().getValue());
	voPersonAdress.setFax(form.lyr1().tabOrg().txtOrgFax().getValue());
	voPersonAdress.setLine1(form.lyr1().tabOrg().txtOrgAdd1().getValue());
	voPersonAdress.setLine2(form.lyr1().tabOrg().txtOrgAdd2().getValue());
	voPersonAdress.setLine3(form.lyr1().tabOrg().txtOrgAdd3().getValue());
	voPersonAdress.setLine4(form.lyr1().tabOrg().txtOrgAdd4().getValue());
	voPersonAdress.setLine5(form.lyr1().tabOrg().txtOrgAdd5().getValue());		
	voPersonAdress.setPhone(form.lyr1().tabOrg().txtOrgPhone().getValue());
	voPersonAdress.setPostCode(form.lyr1().tabOrg().txtOrgPostCode().getValue());

	value.setAddress(voPersonAdress);
	
	value.setCodeMappings(getCodeMappings(form.lyr1().tabOrg().grdMappings()));
	value.setComment(form.lyr1().tabOrg().txtOrgComment().getValue());
	value.setType(ims.core.vo.lookups.OrganisationType.SUPPLIER);
	value.setName(form.lyr1().tabOrg().txtOrgName().getValue());
	return value;
}
 
Example 9
Project: openMAXIMS   File: NewOnwardReferralImpl.java   Source Code and License 6 votes vote down vote up
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();
}
 
Example 10
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromScreen() 
{
	OrganisationVo voOrganisation = form.getGlobalContext().Admin
			.getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
			.getOrganisationVo() : new OrganisationVo();
	PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
			.getAddress()
			: new PersonAddress();
	voAddress.setLine1(form.txtOrgAdd1().getValue());
	voAddress.setLine2(form.txtOrgAdd2().getValue());
	voAddress.setLine3(form.txtOrgAdd3().getValue());
	voAddress.setLine4(form.txtOrgAdd4().getValue());
	voAddress.setLine5(form.txtOrgAdd5().getValue());
	voAddress.setCounty(form.cmbCounty().getValue());
	voAddress.setPhone(form.txtOrgPhone().getValue());
	voAddress.setFax(form.txtOrgFax().getValue());
	voAddress.setPostCode(form.txtPostCode().getValue());
	
	voOrganisation.setAddress(voAddress);

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

	form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
 
Example 11
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
	OrganisationVo practice = new OrganisationVo();
	
	if (form.getLocalContext().getPracticeIsNotNull())
		practice = form.getLocalContext().getPractice();
	practice = populatePracticeData(practice);
	
	practice.setType(OrganisationType.GPP);
	
	// this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
	// added to allow the ntpf to work as if using only practices. 
	if ( !practice.getLocationSitesIsNotNull())
	{				
		if (!canUseSurgery())
			practice = createOneMatchingChildSurgery(practice);
	}
	
	return doSavePractice(practice);
}
 
Example 12
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
protected ims.core.vo.OrgShortVo populateDataFromScreen(ims.core.vo.OrgShortVo value)
{
	if(value == null)
		value = new ims.core.vo.OrgShortVo();

	PersonAddress voPersonAdress = new PersonAddress();
	voPersonAdress.setCounty(form.lyr1().tabOrg().cmbOrgCounty().getValue());
	voPersonAdress.setFax(form.lyr1().tabOrg().txtOrgFax().getValue());
	voPersonAdress.setLine1(form.lyr1().tabOrg().txtOrgAdd1().getValue());
	voPersonAdress.setLine2(form.lyr1().tabOrg().txtOrgAdd2().getValue());
	voPersonAdress.setLine3(form.lyr1().tabOrg().txtOrgAdd3().getValue());
	voPersonAdress.setLine4(form.lyr1().tabOrg().txtOrgAdd4().getValue());
	voPersonAdress.setLine5(form.lyr1().tabOrg().txtOrgAdd5().getValue());		
	voPersonAdress.setPhone(form.lyr1().tabOrg().txtOrgPhone().getValue());
	voPersonAdress.setPostCode(form.lyr1().tabOrg().txtOrgPostCode().getValue());

	value.setAddress(voPersonAdress);
	
	value.setCodeMappings(getCodeMappings(form.lyr1().tabOrg().grdMappings()));
	value.setComment(form.lyr1().tabOrg().txtOrgComment().getValue());
	value.setType(ims.core.vo.lookups.OrganisationType.SUPPLIER);
	value.setName(form.lyr1().tabOrg().txtOrgName().getValue());
	return value;
}
 
Example 13
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
public String getActiveHospitalCodeForClinic(ClinicRefVo clinicRefVo, TaxonomyType taxonomyType)
{
	DomainFactory factory = getDomainFactory();
	Clinic clinic = (Clinic)factory.getDomainObject(clinicRefVo);
	if (clinic==null)
		return null;
	
	Location loc = clinic.getClinicLocation();

	while (loc!=null&&(loc.isIsActive()&&loc.getType()!=null&&loc.getType().equals(getDomLookup(OrganisationType.HOSPITAL))))
	{
		loc=loc.getParentLocation();
	}
	if(loc!=null)
		return loc.getExtCode(taxonomyType.getID());
	return null;
}
 
Example 14
Project: openMAXIMS   File: NewOnwardReferralImpl.java   Source Code and License 6 votes vote down vote up
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();
}
 
Example 15
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromScreen() 
{
	OrganisationVo voOrganisation = form.getGlobalContext().Admin
			.getOrganisationVoIsNotNull() ? form.getGlobalContext().Admin
			.getOrganisationVo() : new OrganisationVo();
	PersonAddress voAddress = voOrganisation.getAddressIsNotNull() ? voOrganisation
			.getAddress()
			: new PersonAddress();
	voAddress.setLine1(form.txtOrgAdd1().getValue());
	voAddress.setLine2(form.txtOrgAdd2().getValue());
	voAddress.setLine3(form.txtOrgAdd3().getValue());
	voAddress.setLine4(form.txtOrgAdd4().getValue());
	voAddress.setLine5(form.txtOrgAdd5().getValue());
	voAddress.setCounty(form.cmbCounty().getValue());
	voAddress.setPhone(form.txtOrgPhone().getValue());
	voAddress.setFax(form.txtOrgFax().getValue());
	voAddress.setPostCode(form.txtPostCode().getValue());
	
	voOrganisation.setAddress(voAddress);

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

	form.getGlobalContext().Admin.setOrganisationVo(voOrganisation);
}
 
Example 16
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
/**
 * This functions sets up a practice for save and calls doSavePractice
 * @return boolean indicating success (true)
 */
private boolean savePractice()
{
	OrganisationVo practice = new OrganisationVo();
	
	if (form.getLocalContext().getPracticeIsNotNull())
		practice = form.getLocalContext().getPractice();
	practice = populatePracticeData(practice);
	
	practice.setType(OrganisationType.GPP);
	
	// this code adds a surgery to the value object if USE_GP_SURGERIES is false and if one doesn't already exist 
	// added to allow the ntpf to work as if using only practices. 
	if ( !practice.getLocationSitesIsNotNull())
	{				
		if (!canUseSurgery())
			practice = createOneMatchingChildSurgery(practice);
	}
	
	return doSavePractice(practice);
}
 
Example 17
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
protected ims.core.vo.OrgShortVo populateDataFromScreen(ims.core.vo.OrgShortVo value)
{
	if(value == null)
		value = new ims.core.vo.OrgShortVo();

	PersonAddress voPersonAdress = new PersonAddress();
	voPersonAdress.setCounty(form.lyr1().tabOrg().cmbOrgCounty().getValue());
	voPersonAdress.setFax(form.lyr1().tabOrg().txtOrgFax().getValue());
	voPersonAdress.setLine1(form.lyr1().tabOrg().txtOrgAdd1().getValue());
	voPersonAdress.setLine2(form.lyr1().tabOrg().txtOrgAdd2().getValue());
	voPersonAdress.setLine3(form.lyr1().tabOrg().txtOrgAdd3().getValue());
	voPersonAdress.setLine4(form.lyr1().tabOrg().txtOrgAdd4().getValue());
	voPersonAdress.setLine5(form.lyr1().tabOrg().txtOrgAdd5().getValue());		
	voPersonAdress.setPhone(form.lyr1().tabOrg().txtOrgPhone().getValue());
	voPersonAdress.setPostCode(form.lyr1().tabOrg().txtOrgPostCode().getValue());

	value.setAddress(voPersonAdress);
	
	value.setCodeMappings(getCodeMappings(form.lyr1().tabOrg().grdMappings()));
	value.setComment(form.lyr1().tabOrg().txtOrgComment().getValue());
	value.setType(ims.core.vo.lookups.OrganisationType.SUPPLIER);
	value.setName(form.lyr1().tabOrg().txtOrgName().getValue());
	return value;
}
 
Example 18
Project: openmaxims-linux   File: OrganisationAndLocationImpl.java   Source Code and License 6 votes vote down vote up
public String getActiveHospitalCodeForClinic(ClinicRefVo clinicRefVo, TaxonomyType taxonomyType)
{
	DomainFactory factory = getDomainFactory();
	Clinic clinic = (Clinic)factory.getDomainObject(clinicRefVo);
	if (clinic==null)
		return null;
	
	Location loc = clinic.getClinicLocation();

	while (loc!=null&&(loc.isIsActive()&&loc.getType()!=null&&loc.getType().equals(getDomLookup(OrganisationType.HOSPITAL))))
	{
		loc=loc.getParentLocation();
	}
	if(loc!=null)
		return loc.getExtCode(taxonomyType.getID());
	return null;
}
 
Example 19
Project: AvoinApotti   File: DirectoryOfServiceAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisations() {
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 20
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private OrganisationVo populatePracticeData(OrganisationVo value)
{			
	value.setAddress(populateAddressData(AddressType.PRACTICE));  // WDEV-15936 - specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setComment(form.ctnDetails().txtDetailsComment().getValue());
	value.setType(OrganisationType.GPP);
	value.setCommChannels(populateCommChannelsFromScreen());
	value.setPctCode(form.ctnDetails().txtPCT().getValue());
	value.setParent(null);
	
	return value;
}
 
Example 21
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param b
 */
private void populateSupplierCollection(Boolean bActive) 
{
	OrgShortVo voOrg = new OrgShortVo();
	
	voOrg.setName(form.txtSupplierName().getValue());
	
	OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive);

	if(voCollOrg == null || voCollOrg.size() == 0)
	{
		engine.showMessage("No results found.");
	}

	OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection();
	OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection();
	
	for(int i=0;i<voCollOrg.size();i++)
	{
		if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue())
			voCollActiveOrgs.add(voCollOrg.get(i));
		else
			voCollInactiveOrgs.add(voCollOrg.get(i));
	}
	
	form.getLocalContext().setActiveSuppliers(voCollActiveOrgs);
	form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs);	
}
 
Example 22
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
private List listDomOrganisation(OrgShortVo filter)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID() + " and o.type.id != " + OrganisationType.GPP.getID();//wdev-5364
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;

	if (filter.getNameIsNotNull() && filter.getName().length() > 0)
	{
		condStr.append(" o.upperName like :OrgName");
		markers.add("OrgName");
		values.add(filter.getName().toUpperCase() + "%");
		andStr = " and ";

		hql += andStr + condStr.toString();
		orgs = factory.find(hql, markers, values);
	}
	else
	{
		orgs = factory.find(hql);
	}
	return orgs;
}
 
Example 23
Project: AvoinApotti   File: LocationServiceImpl.java   Source Code and License 5 votes vote down vote up
public OrgShortVoCollection listOrganisation()
{
	DomainFactory factory = getDomainFactory();

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " and ";
	List orgs = null;

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID();

	condStr.append(andStr + " (o.type != :GP or o.type.id is null)");
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);

	condStr.append(andStr + " o.parentOrganisation is null");
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values);

	return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs).sort();
}
 
Example 24
Project: AvoinApotti   File: ClinicListImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisation() 
{
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 25
Project: AvoinApotti   File: ReferralOutcomeComponentImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();

}
 
Example 26
Project: openMAXIMS   File: DirectoryOfServiceAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisations() {
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 27
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private OrganisationVo populatePracticeData(OrganisationVo value)
{			
	value.setAddress(populateAddressData(AddressType.PRACTICE));  // WDEV-15936 - specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setComment(form.ctnDetails().txtDetailsComment().getValue());
	value.setType(OrganisationType.GPP);
	value.setCommChannels(populateCommChannelsFromScreen());
	value.setPctCode(form.ctnDetails().txtPCT().getValue());
	value.setParent(null);
	
	return value;
}
 
Example 28
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param b
 */
private void populateSupplierCollection(Boolean bActive) 
{
	OrgShortVo voOrg = new OrgShortVo();
	
	voOrg.setName(form.txtSupplierName().getValue());
	
	OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive);

	if(voCollOrg == null || voCollOrg.size() == 0)
	{
		engine.showMessage("No results found.");
	}

	OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection();
	OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection();
	
	for(int i=0;i<voCollOrg.size();i++)
	{
		if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue())
			voCollActiveOrgs.add(voCollOrg.get(i));
		else
			voCollInactiveOrgs.add(voCollOrg.get(i));
	}
	
	form.getLocalContext().setActiveSuppliers(voCollActiveOrgs);
	form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs);	
}
 
Example 29
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
private List listDomOrganisation(OrgShortVo filter)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID() + " and o.type.id != " + OrganisationType.GPP.getID();//wdev-5364
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;

	if (filter.getNameIsNotNull() && filter.getName().length() > 0)
	{
		condStr.append(" o.upperName like :OrgName");
		markers.add("OrgName");
		values.add(filter.getName().toUpperCase() + "%");
		andStr = " and ";

		hql += andStr + condStr.toString();
		orgs = factory.find(hql, markers, values);
	}
	else
	{
		orgs = factory.find(hql);
	}
	return orgs;
}
 
Example 30
Project: openMAXIMS   File: LocationServiceImpl.java   Source Code and License 5 votes vote down vote up
public OrgShortVoCollection listOrganisation()
{
	DomainFactory factory = getDomainFactory();

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " and ";
	List orgs = null;

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID();

	condStr.append(andStr + " (o.type != :GP or o.type.id is null)");
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);

	condStr.append(andStr + " o.parentOrganisation is null");
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values);

	return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs).sort();
}
 
Example 31
Project: openMAXIMS   File: ClinicListImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisation() 
{
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 32
Project: openMAXIMS   File: ReferralOutcomeComponentImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();

}
 
Example 33
Project: openMAXIMS   File: ClientAddressImpl.java   Source Code and License 5 votes vote down vote up
public OrgLiteVoCollection listLHOs()
{
	StringBuffer hql = new StringBuffer();
	hql.append(" from Organisation o");
	hql.append(" where");
	hql.append(" o.type.id = :lho and o.isActive = 1 order by o.name asc");

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(getDomainFactory().find(hql.toString(), new String[] { "lho" }, new Object[] { OrganisationType.LHO.getID() }));
}
 
Example 34
Project: openMAXIMS   File: DirectoryOfServiceAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisations() {
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 35
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private OrganisationVo populatePracticeData(OrganisationVo value)
{			
	value.setAddress(populateAddressData(AddressType.PRACTICE));  // WDEV-15936 - specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setComment(form.ctnDetails().txtDetailsComment().getValue());
	value.setType(OrganisationType.GPP);
	value.setCommChannels(populateCommChannelsFromScreen());
	value.setPctCode(form.ctnDetails().txtPCT().getValue());
	value.setParent(null);
	
	return value;
}
 
Example 36
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param b
 */
private void populateSupplierCollection(Boolean bActive) 
{
	OrgShortVo voOrg = new OrgShortVo();
	
	voOrg.setName(form.txtSupplierName().getValue());
	
	OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive);

	if(voCollOrg == null || voCollOrg.size() == 0)
	{
		engine.showMessage("No results found.");
	}

	OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection();
	OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection();
	
	for(int i=0;i<voCollOrg.size();i++)
	{
		if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue())
			voCollActiveOrgs.add(voCollOrg.get(i));
		else
			voCollInactiveOrgs.add(voCollOrg.get(i));
	}
	
	form.getLocalContext().setActiveSuppliers(voCollActiveOrgs);
	form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs);	
}
 
Example 37
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
private List listDomOrganisation(OrgShortVo filter)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID() + " and o.type.id != " + OrganisationType.GPP.getID();//wdev-5364
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;

	if (filter.getNameIsNotNull() && filter.getName().length() > 0)
	{
		condStr.append(" o.upperName like :OrgName");
		markers.add("OrgName");
		values.add(filter.getName().toUpperCase() + "%");
		andStr = " and ";

		hql += andStr + condStr.toString();
		orgs = factory.find(hql, markers, values);
	}
	else
	{
		orgs = factory.find(hql);
	}
	return orgs;
}
 
Example 38
Project: openMAXIMS   File: LocationServiceImpl.java   Source Code and License 5 votes vote down vote up
public OrgShortVoCollection listOrganisation()
{
	DomainFactory factory = getDomainFactory();

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " and ";
	List orgs = null;

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID();

	condStr.append(andStr + " (o.type != :GP or o.type.id is null)");
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);

	condStr.append(andStr + " o.parentOrganisation is null");
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values);

	return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs).sort();
}
 
Example 39
Project: openMAXIMS   File: ClinicListImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisation() 
{
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 40
Project: openMAXIMS   File: ReferralOutcomeComponentImpl.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("unchecked")
public OrgLiteVoCollection listAllSuppliers() 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation org ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	condStr.append(andStr + " org.type.id = " + OrganisationType.SUPPLIER.getID());
	andStr = " and ";

	condStr.append(andStr + "org.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);	

	hql += " where ";
	hql += condStr.toString();

	List locations = factory.find(hql, markers, values, 1000);

	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(locations).sort();

}
 
Example 41
Project: openmaxims-linux   File: DirectoryOfServiceAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationLiteVoCollection listOrganisations() {
	String hql = "from Organisation as org where  (org.type is not null  and org.type.id not in (:gpp,:supp,:pct) and org.isActive = 1 and org.parentOrganisation is null) order by org.upperName asc ";
	List<?> list = getDomainFactory().find(hql,new String[]{"gpp","supp","pct"},new Object[]{OrganisationType.GPP.getId(),OrganisationType.SUPPLIER.getId(),OrganisationType.NHS_PCT.getId()});
	if (list == null || list.size() == 0)
		return null;
	return OrganisationLiteVoAssembler.createOrganisationLiteVoCollectionFromOrganisation(list);
}
 
Example 42
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private OrganisationVo populatePracticeData(OrganisationVo value)
{			
	value.setAddress(populateAddressData(AddressType.PRACTICE));  // WDEV-15936 - specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setComment(form.ctnDetails().txtDetailsComment().getValue());
	value.setType(OrganisationType.GPP);
	value.setCommChannels(populateCommChannelsFromScreen());
	value.setPctCode(form.ctnDetails().txtPCT().getValue());
	value.setParent(null);
	
	return value;
}
 
Example 43
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param b
 */
private void populateSupplierCollection(Boolean bActive) 
{
	OrgShortVo voOrg = new OrgShortVo();
	
	voOrg.setName(form.txtSupplierName().getValue());
	
	OrgShortVoCollection voCollOrg = domain.listOrganisationForType(OrganisationType.SUPPLIER, voOrg, bActive);

	if(voCollOrg == null || voCollOrg.size() == 0)
	{
		engine.showMessage("No results found.");
	}

	OrgShortVoCollection voCollActiveOrgs = new OrgShortVoCollection();
	OrgShortVoCollection voCollInactiveOrgs = new OrgShortVoCollection();
	
	for(int i=0;i<voCollOrg.size();i++)
	{
		if(voCollOrg.get(i).getIsActiveIsNotNull() && voCollOrg.get(i).getIsActive().booleanValue())
			voCollActiveOrgs.add(voCollOrg.get(i));
		else
			voCollInactiveOrgs.add(voCollOrg.get(i));
	}
	
	form.getLocalContext().setActiveSuppliers(voCollActiveOrgs);
	form.getLocalContext().setInActiveSuppliers(voCollInactiveOrgs);	
}
 
Example 44
Project: openmaxims-linux   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
private List listDomOrganisation(OrgShortVo filter)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID() + " and o.type.id != " + OrganisationType.GPP.getID();//wdev-5364
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;

	if (filter.getNameIsNotNull() && filter.getName().length() > 0)
	{
		condStr.append(" o.upperName like :OrgName");
		markers.add("OrgName");
		values.add(filter.getName().toUpperCase() + "%");
		andStr = " and ";

		hql += andStr + condStr.toString();
		orgs = factory.find(hql, markers, values);
	}
	else
	{
		orgs = factory.find(hql);
	}
	return orgs;
}
 
Example 45
Project: openmaxims-linux   File: LocationServiceImpl.java   Source Code and License 5 votes vote down vote up
public OrgShortVoCollection listOrganisation()
{
	DomainFactory factory = getDomainFactory();

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " and ";
	List orgs = null;

	String hql = " from Organisation o where o.type.id != " + OrganisationType.SUPPLIER.getID();

	condStr.append(andStr + " (o.type != :GP or o.type.id is null)");
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);

	condStr.append(andStr + " o.parentOrganisation is null");
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values);

	return OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs).sort();
}
 
Example 46
Project: AvoinApotti   File: LocationProvider.java   Source Code and License 4 votes vote down vote up
public boolean hasLocations(IAppUser user)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);
	andStr = " and ";

	condStr.append(andStr + " ((o.type != :GP and o.type != :SUP) or o.type.id is null)"); 	//WDEV-11814
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));
	markers.add("SUP");		//WDEV-11814
	values.add(getDomLookup(OrganisationType.SUPPLIER)); 	//WDEV-11814
	andStr = " and ";

	hql += " where ";		
	hql += condStr.toString();
	hql += " order by o.id ";
	
	List list = factory.find(hql, markers, values);
			
	boolean res = false;
	Iterator<Organisation> iterator = list.iterator();
	while ( iterator.hasNext() )
	{
	  	res = checkForValidLocation(iterator.next());
	  	if (res)
			return true;
		else
			continue;  
	}

	return false;
}
 
Example 47
Project: AvoinApotti   File: LocationTurningpointProvider.java   Source Code and License 4 votes vote down vote up
/**
 * Function used to determine if an Organization has locations
 */
public boolean hasLocations(IAppUser user)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);
	andStr = " and ";

	condStr.append(andStr + " ((o.type != :GP and o.type != :SUP) or o.type.id is null)");	//WDEV-11814
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));
	markers.add("SUP");		//WDEV-11814
	values.add(getDomLookup(OrganisationType.SUPPLIER)); 	//WDEV-11814
	andStr = " and ";

	hql += " where ";		
	hql += condStr.toString();
	hql += " order by o.id ";
	
	List list = factory.find(hql, markers, values);
			
	boolean res = false;
	Iterator<Organisation> iterator = list.iterator();
	while ( iterator.hasNext() )
	{
	  	res = checkForValidLocation(iterator.next(), user);
	  	if (res)
			return true;
		else
			continue;  
	}

	return false;
}
 
Example 48
Project: AvoinApotti   File: LocationRefManProvider.java   Source Code and License 4 votes vote down vote up
/**
 * Function used to determine if an Organization has locations
 */
public boolean hasLocations(IAppUser user)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);
	andStr = " and ";

	condStr.append(andStr + " ((o.type != :GP and o.type != :SUP) or o.type.id is null)");	//WDEV-11814
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));
	markers.add("SUP");		//WDEV-11814
	values.add(getDomLookup(OrganisationType.SUPPLIER)); 	//WDEV-11814
	andStr = " and ";

	hql += " where ";		
	hql += condStr.toString();
	hql += " order by o.id ";
	
	List list = factory.find(hql, markers, values);
			
	boolean res = false;
	Iterator<Organisation> iterator = list.iterator();
	while ( iterator.hasNext() )
	{
	  	res = checkForValidLocation(iterator.next(), user);
	  	if (res)
			return true;
		else
			continue;  
	}

	return false;
}
 
Example 49
Project: AvoinApotti   File: DemographicsImpl.java   Source Code and License 4 votes vote down vote up
public GpLiteToPracticeLiteVo synchronizeGPPracticeDetails(String strGPCode)  throws StaleObjectException, UniqueKeyViolationException
{
	Gp_practice gpPracticeRecord = (Gp_practice) getDTOInstance(Gp_practice.class);
	gpPracticeRecord.Filter.Gp_code = strGPCode;
	GP voGP = null;
	
	Result gpPracticeGetResult = gpPracticeRecord.get();
	if (gpPracticeGetResult != null)
		return null;
	
	Gp_practiceRecord gp_practice_record = gpPracticeRecord.DataCollection.get(0);
	OrganisationVo voSavedPractice = null;
	if (gpPracticeGetResult == null && gp_practice_record != null) 
	{
		// Extract the organisation which is in effect the practice and the location site
		// which is in effect the surgery and synchronise them withthe current date.			
		
		// If the Practice is in csp, get it and populate from dto, otherwise just populate from dto.
		try
		{
			voSavedPractice = saveOrganisation(populatePracticeFromDTORecord(gp_practice_record));
		}
		catch (UniqueKeyViolationException e)
		{
			// DARA TODO Comm Channels
		}
						
		voGP =  saveGP(populateGpFromDTORecord(gp_practice_record, voSavedPractice));
		
		GpLiteToPracticeLiteVo voGpLiteToPracticeLite = new GpLiteToPracticeLiteVo();
		// Just need a get here to see if you already have a gppracticeslite record.
		
		GpPracticeLiteVo voGpPracticeLite = new GpPracticeLiteVo();
		voGpPracticeLite.setAddress(voSavedPractice.getAddress());
		voGpPracticeLite.setID_Organisation(voSavedPractice.getID_Organisation());
		voGpPracticeLite.setIsActive(voSavedPractice.getIsActive());
		voGpPracticeLite.setName(voSavedPractice.getName());
		voGpPracticeLite.setType(OrganisationType.GPP);
		
		LocSiteShortVo voLocSiteShort = getLocSiteShortByTaxonomyType(gp_practice_record.Gp_practice_id, TaxonomyType.PAS);
		LocSiteShortVoCollection voCollLocations = new LocSiteShortVoCollection();
		voCollLocations.add(voLocSiteShort);
		voGpPracticeLite.setSurgeries(voCollLocations);
		
		voGpLiteToPracticeLite.setGp(voGP == null ? null : voGP);
		voGpLiteToPracticeLite.setPractice(voGpPracticeLite);
		return voGpLiteToPracticeLite;
		
	}
	
	return null;
	
	
}
 
Example 50
Project: AvoinApotti   File: TaxonomySearchCmpImpl.java   Source Code and License 4 votes vote down vote up
private TaxonomyMapCollection searchPracticeCodes(TaxonomyMap filter) throws ims.domain.exceptions.DomainInterfaceException
{
	// TODO Auto-generated method stub
	try{

		ArrayList names = new ArrayList();
		ArrayList values = new ArrayList();
			
		StringBuffer taxonomyHql = new StringBuffer(" select distinct org from Organisation org join org.codeMappings as mappings" +
						" where mappings.taxonomyName = :taxonomyType and upper(mappings.taxonomyCode) like :taxonomyCode and org.type = :gpPractice");
			
		names.add("taxonomyType");
		names.add("taxonomyCode");
		names.add("gpPractice");
		
		values.add(getDomLookup(TaxonomyType.NAT_LOC_CODE));
		values.add("%"+filter.getDescription().toUpperCase()+"%");
		values.add(getDomLookup(OrganisationType.GPP));
		
		OrgVoCollection  coll = OrgVoAssembler.createOrgVoCollectionFromOrganisation(getDomainFactory().find(taxonomyHql.toString(), names, values));
		
		TaxonomyMapCollection coll_ret = new TaxonomyMapCollection();
		
		if (coll != null && coll.size()>0)
		{							
			for (int i = 0; i < coll.size(); i++)
			{
				OrgVo vo= coll.get(i);
				
				/*TaxonomyMap tmCAB = new TaxonomyMap();
				tmCAB.setTaxonomyName(TaxonomyType.ICAB);
				tmCAB.setDescription(vo.getName());
				tmCAB.setTaxonomyCode(vo.getCodeMappings().getMappingValue(TaxonomyType.ICAB));		*/
				
				TaxonomyMap tmNAT = new TaxonomyMap();
				tmNAT.setTaxonomyName(TaxonomyType.NAT_LOC_CODE);
				tmNAT.setDescription(vo.getName());
				tmNAT.setTaxonomyCode(vo.getCodeMappings().getMappingValue(TaxonomyType.NAT_LOC_CODE));
				
				//coll_ret.add(tmCAB);
				coll_ret.add(tmNAT);
			}				 
		}	
		return coll_ret;
	}
	catch (DomainRuntimeException e)
	{
		throw new ims.domain.exceptions.DomainInterfaceException("Please contact your system administrator.\n\nError:\n" + e.getMessage());
	}			
}
 
Example 51
Project: AvoinApotti   File: LocationMultipleSelectDialogImpl.java   Source Code and License 4 votes vote down vote up
private String getInvalidTypes() 
{
	return Integer.toString(OrganisationType.GPP.getID())+","+Integer.toString(OrganisationType.SUPPLIER.getID());
}
 
Example 52
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 4 votes vote down vote up
public ims.core.vo.OrganisationVo saveOrganisation(ims.core.vo.OrganisationVo organisation) throws UniqueKeyViolationException, StaleObjectException
{
	DomainFactory factory = getDomainFactory();
	HashMap<?,?> map = new HashMap<Object, Object>();
	Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, organisation,map);
	
	if (!(organisation.getTypeIsNotNull() && organisation.getType().equals(OrganisationType.GPP)))
	{
		// uniqueness constraint removed form the database - must be implemented in code. 
		if (checkOrganisationNameisUnique(organisation.getName(), organisation) != null)
		{
			throw new UniqueKeyViolationException("A record with the same name already exists, Please change");
		}
	}
	
	try
	{
		doOrg.setUpperNames();
		factory.save(doOrg);
		
		//WDEV-10574
		REMOTE_LOC_CACHE.clear();
	}
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doOrg, "codeMappings", organisation.getCodeMappings(), "getName");
		
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		//WDEV-12600 - Check if the child location don't contain duplicate mappings
		if (organisation.getRelatedOrganisationsIsNotNull())
		{
			checkChildsForDuplicateTaxonoy(organisation.getRelatedOrganisations(), map, factory);
		}
		//WDEV-12600 - Check if the child location don't contain duplicate mappings
		if (organisation.getLocationSitesIsNotNull())
		{
			checkChildsForDuplicateTaxonoy(organisation.getLocationSites(), map, factory);

		}
		
		throw new UniqueKeyViolationException("A record with the same details already exists, Please change", e);
	}
	return OrganisationVoAssembler.create(doOrg);
}
 
Example 53
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 4 votes vote down vote up
public OrganisationVoCollection listPCTs(String value, Boolean activeOnly) {
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;

	condStr.append(andStr + " o.type.id = " + OrganisationType.NHS_PCT.getID());
	andStr = " and ";


	if (activeOnly != null && activeOnly.booleanValue())
	{
		condStr.append(andStr + " o.isActive = :isActive");
		markers.add("isActive");
		values.add(activeOnly);
		andStr = " and ";
	}
	
	
	if (null!=value && value.length() > 0)
	{
		condStr.append(andStr);
		condStr.append(" o.upperName like :OrgName");
		markers.add("OrgName");
		values.add(value.toUpperCase() + "%");
		andStr = " and ";

	}
	hql += " where ";
	hql +=  condStr.toString();
	orgs = factory.find(hql, markers, values);



	OrganisationVoCollection voCollOrgs = OrganisationVoAssembler.createOrganisationVoCollectionFromOrganisation(orgs);
	voCollOrgs.sort();
	return voCollOrgs;
}
 
Example 54
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 4 votes vote down vote up
@SuppressWarnings("unchecked")
private List<Integer> listOrganisationByOrganisation(Integer node) {
	String getOrgHql ="select org.id from Organisation as org where (org.parentOrganisation.id = :parentId  and org.isActive = 1 and org.type.id not in (:supp,:gpp,:nhs_pct) and org.type is not null)";
	return getDomainFactory().find(getOrgHql,new String[]{"parentId","supp","gpp","nhs_pct"},new Object[]{node,OrganisationType.SUPPLIER.getID(),OrganisationType.GPP.getID(),OrganisationType.NHS_PCT.getID()});
}
 
Example 55
Project: AvoinApotti   File: GPPracticeSelectImpl.java   Source Code and License 4 votes vote down vote up
/**
* list Practices by either Practice name or Partial Address
*/
public ims.core.vo.OrganisationVoCollection listPractices(ims.core.vo.OrganisationVo organisationFilter)
{ 
	DomainFactory factory = getDomainFactory();

	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	String hql = " from Organisation org "; 
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";
	
	condStr.append(andStr + " org.type = :orgType");
	markers.add("orgType");
	values.add(getDomLookup(OrganisationType.GPP));
	
	if (organisationFilter.getName() != null && organisationFilter.getName().length() > 0)
	{
		condStr.append(" and upper(org.name) like :practiceName");
		markers.add("practiceName");
		values.add("%" + organisationFilter.getName().toUpperCase() + "%");
	}
	else if (organisationFilter.getAddress() != null)
	{
		if (organisationFilter.getAddress().getLine1() != null && organisationFilter.getAddress().getLine1().length() > 0)
		{
			condStr.append(" and upper(org.address.line1) like :partialAddress");
			condStr.append(" or upper(org.address.line2) like :partialAddress");
			condStr.append(" or upper(org.address.line3) like :partialAddress");
			condStr.append(" or upper(org.address.line4) like :partialAddress");
			condStr.append(" or upper(org.address.line5) like :partialAddress");
			markers.add("partialAddress");
			values.add("%" + organisationFilter.getAddress().getLine1().toUpperCase() + "%");
		}
	}
		
				
	hql += " where " + condStr.toString();
	
	List orgs = factory.find(hql,markers,values);
	
	return OrganisationVoAssembler.createOrganisationVoCollectionFromOrganisation(orgs).sort();
}
 
Example 56
Project: AvoinApotti   File: SupplierImpl.java   Source Code and License 4 votes vote down vote up
public OrgShortVoCollection listOrganisationForType(OrganisationType type, OrgShortVo voOrgShort, Boolean bActive)
{
	if (type == null)
		throw new DomainRuntimeException("No type provided for listOrganisationForType");

	DomainFactory factory = getDomainFactory();
	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();

	String hql = " from Organisation o ";
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	List orgs = null;
	condStr.append(andStr + " o.type.id = " + type.getID());
	andStr = " and ";

	if (voOrgShort != null && voOrgShort.getNameIsNotNull())
	{			
		String name = voOrgShort.getName();
		if (name.endsWith("%")) 
			name = name.substring(0,name.length()-1);
			
		condStr.append(andStr + " (upper(o.name) like :orgName ");
		markers.add("orgName");
		values.add("%"+ name.toUpperCase() + "%"); 			
		condStr.append(")");	
		andStr = " and ";
	}
	
	if (bActive != null)
	{
		condStr.append(andStr + "o.isActive = :active");
		markers.add("active");
		values.add(bActive);
	}

	hql += " where ";
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values, 1000);

	OrgShortVoCollection voCollOrgs = OrgShortVoAssembler.createOrgShortVoCollectionFromOrganisation(orgs);
	voCollOrgs.sort();
	return voCollOrgs;
}
 
Example 57
Project: AvoinApotti   File: LocationStartupSelectionImpl.java   Source Code and License 4 votes vote down vote up
@SuppressWarnings("unchecked")
private ims.core.vo.OrgLiteVoCollection listOrganizations(OrganisationRefVo organization) 
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";
	
	List orgs = null;

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);
	andStr = " and ";
	
	condStr.append(andStr + " (o.type != :GP or o.type.id is null)");
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));
	andStr = " and ";
	
	condStr.append(andStr + " (o.type != :PCT or o.type.id is null)");
	markers.add("PCT");
	values.add(getDomLookup(OrganisationType.NHS_PCT));
	andStr = " and ";
	
	condStr.append(andStr + " (o.type != :SP or o.type.id is null)");
	markers.add("SP");
	values.add(getDomLookup(OrganisationType.SUPPLIER));
	andStr = " and ";
					
	if(organization == null)
	{
		condStr.append(andStr + " o.parentOrganisation is null");
		andStr = " and ";
	}
	else
	{
		condStr.append(andStr + " o.parentOrganisation.id = :parentOrg");
		markers.add("parentOrg");
		values.add(organization.getID_Organisation());
		andStr = " and ";
	}
	
	hql += " where ";
	hql += condStr.toString();

	orgs = factory.find(hql, markers, values);
	OrgLiteVoCollection result = OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(orgs).sort();		
	return result;
}
 
Example 58
Project: AvoinApotti   File: ReferralDetailsImpl.java   Source Code and License 4 votes vote down vote up
public OrgLiteVoCollection listAllSuppliers()
{
	List orgs = getDomainFactory().find("from Organisation org where org.type.id = " + OrganisationType.SUPPLIER.getID() + "and org.isActive = " + Boolean.TRUE);
	return OrgLiteVoAssembler.createOrgLiteVoCollectionFromOrganisation(orgs);
}
 
Example 59
Project: AvoinApotti   File: ContractConfigurationImpl.java   Source Code and License 4 votes vote down vote up
private String getInvalidTypes() 
{
	return Integer.toString(OrganisationType.GPP.getID())+","+Integer.toString(OrganisationType.SUPPLIER.getID());
}
 
Example 60
Project: openMAXIMS   File: LocationProvider.java   Source Code and License 4 votes vote down vote up
public boolean hasLocations(IAppUser user)
{
	DomainFactory factory = getDomainFactory();

	String hql = " from Organisation o ";
	ArrayList<String> markers = new ArrayList<String>();
	ArrayList<Serializable> values = new ArrayList<Serializable>();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";

	condStr.append(andStr + " o.isActive = :isActive");
	markers.add("isActive");
	values.add(Boolean.TRUE);
	andStr = " and ";

	condStr.append(andStr + " ((o.type != :GP and o.type != :SUP) or o.type.id is null)"); 	//WDEV-11814
	markers.add("GP");
	values.add(getDomLookup(OrganisationType.GPP));
	markers.add("SUP");		//WDEV-11814
	values.add(getDomLookup(OrganisationType.SUPPLIER)); 	//WDEV-11814
	andStr = " and ";

	hql += " where ";		
	hql += condStr.toString();
	hql += " order by o.id ";
	
	List list = factory.find(hql, markers, values);
			
	boolean res = false;
	Iterator<Organisation> iterator = list.iterator();
	while ( iterator.hasNext() )
	{
	  	res = checkForValidLocation(iterator.next());
	  	if (res)
			return true;
		else
			continue;  
	}

	return false;
}