Java Code Examples for ims.core.vo.LocSiteVo

The following are top voted examples for showing how to use ims.core.vo.LocSiteVo. 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 LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
	if(practice == null)
		return null;
	
	int index = practice.getLocationSites().indexOf(surgery);
	if (index >= 0)
		return practice.getLocationSites().get(index);

	//Find the Location that's not in the practiceBeforeSave
	if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
	{
		for (int i = 0; i < practice.getLocationSites().size(); i++)
		{
			if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
			{
				return practice.getLocationSites().get(i);
			}
		}
	}
	
	return null;
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
	StringBuffer message = new StringBuffer();
	String[] gps = domain.listPatients(locVo);
	if(gps != null)
	{
		message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
		message.append(" " +gps.length + " Patients");
		/*for (int i = 0; i < gps.length; i++)
		{
			message.append(System.getProperty("line.separator"));
			message.append(gps[i]);
		}*/
	}
	else
	{
		message.append(excp.getMessage());
	}
	
	return message.toString();
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean removeSurgery()
{
	LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
	if(locVo == null)
		return false;
	try
	{
		setPracticeToContext(domain.deleteLocSite(locVo));
		form.getLocalContext().setSurgery(null);
		form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
		if(canUseSurgery())
			open();
	}
	catch (ForeignKeyViolationException e)
	{
		engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
		return false;
	}
	
	return true;
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void onGridSearchSelectionChanged()
{
	enableContextMenu();
	Object val = form.grdSearch().getValue();
	clearPracticeAndSurgeryLocalContext();
	if(val != null)
	{
		if(val instanceof OrganisationWithSitesVo)
		{
			setSelectedPractice((OrganisationWithSitesVo) val);
		}
		else if(val instanceof LocSiteVo)
		{
			setSelectedSurgery((LocSiteVo) val);
		}
		
		setActionAndFireEvent(PracticeSearch.SELECT);
	}
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
public OrganisationWithSitesVo getParentPractice()
{
	LocSiteVo voLocSiteVo = getSelectedSurgery();
	if(voLocSiteVo != null)
	{
		for (int i = 0; i < form.grdSearch().getRows().size(); i++)
		{
			if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
			{
				OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
				if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
					return organisationWithSitesVo; 
			}
		}
	}	
	
	return null;
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
	if(voLocSite == null)
		return Boolean.FALSE; 
	
	for (int i = 0; i < form.grdSearch().getRows().size(); i++)
	{
		for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
		{
			if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
			{
				form.grdSearch().getRows().get(i).getRows().remove(j);
				setSelectedSurgery(null);
				//setSelectedPractice(null)
				enableContextMenu();
				setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
				return Boolean.TRUE;
			}
		}
	}
	
	return Boolean.FALSE;
}
 
Example 7
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void editItem()
{
	TreeNode node = form.treOrgLoc().getSelectedNode();
	if (node == null)
		return;

	if (node.getValue() instanceof OrganisationVo)
	{
		form.getLocalContext().setEditObject((OrganisationVo) node.getValue());
		form.ctn1().lyr1().tabOrg().txtOrgName().setFocus();
	}
	else if (node.getValue() instanceof LocSiteVo)
	{
		form.getLocalContext().setEditObject((LocSiteVo) node.getValue());
		form.ctn1().lyr1().tabLocSite().txtLocSiteName().setFocus();
	}
	else if (node.getValue() instanceof LocMostVo)
	{
		form.getLocalContext().setEditObject((LocMostVo) node.getValue());
		form.ctn1().lyr1().tabLoc().txtLocName().setFocus();
	}

	hideContextMenus();
	setFormMode(FormMode.EDIT);
	form.getContextMenus().getGenericGridAddItem().setVisible(true);		
}
 
Example 8
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void save(OrganisationVo voOrg, LocSiteVo voLocSite, LocMostVo voLoc) throws UniqueKeyViolationException, StaleObjectException 
{
	if (voOrg != null)
	{	
		domain.saveOrganisation(voOrg);
	}
	else if (voLocSite != null)
	{	
		//wdev-12855
		if(form.getLocalContext().getEditObject() instanceof LocSiteVo && ((LocSiteVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLocSite.getVersion_Location() != ((LocSiteVo)form.getLocalContext().getEditObject()).getVersion_Location())
			throw new StaleObjectException(null);
		
		domain.saveLocationSite(voLocSite);
	}
	else if (voLoc != null)
	{
		//wdev-12855
		if(form.getLocalContext().getEditObject() instanceof LocMostVo && ((LocMostVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLoc.getVersion_Location() != ((LocMostVo)form.getLocalContext().getEditObject()).getVersion_Location())
			throw new StaleObjectException(null);
		domain.saveLocation(voLoc);
	}
	form.getLocalContext().setSavingRootOrg(null);
}
 
Example 9
Project: AvoinApotti   File: OrgTreeHelper.java   Source Code and License 6 votes vote down vote up
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
	if (locationSites == null)
		return;
	
	TreeNode locNode = null;
	for(int i=0; i < locationSites.size(); i++)
	{
		LocSiteVo voLoc = locationSites.get(i);	
		if (voLoc.getIsActive().booleanValue() == false && !showInactive)
			continue;
		
		Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;		
		
		//WDEV-6444 - if node is inactive disable drag dropping for that node
		if(voLoc.getIsActive().booleanValue() == false)
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
		else
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);
		
		locNode.setCollapsedImage(img);
		locNode.setExpandedImage(img);
		locNode.setCheckBoxVisible(showCheckBoxes);
		populateLocations(voLoc.getLocations().sort(), locNode);
	}		
}
 
Example 10
Project: AvoinApotti   File: GPPracticeAdminImpl.java   Source Code and License 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 11
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 12
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 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 13
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
protected void onDyngrdOrganisationLocationRowChecked(DynamicGridRow row)
{
	if (!row.isChecked())
	{
		if ( (row.getValue() instanceof LocSiteVo) || (row.getValue() instanceof HcpLocationVo) )
		{
			DynamicGridCell cell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION));
			if (cell != null)
				cell.setValue(null);

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

}
 
Example 14
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
	if(practice == null)
		return null;
	
	int index = practice.getLocationSites().indexOf(surgery);
	if (index >= 0)
		return practice.getLocationSites().get(index);

	//Find the Location that's not in the practiceBeforeSave
	if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
	{
		for (int i = 0; i < practice.getLocationSites().size(); i++)
		{
			if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
			{
				return practice.getLocationSites().get(i);
			}
		}
	}
	
	return null;
}
 
Example 15
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
	StringBuffer message = new StringBuffer();
	String[] gps = domain.listPatients(locVo);
	if(gps != null)
	{
		message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
		message.append(" " +gps.length + " Patients");
		/*for (int i = 0; i < gps.length; i++)
		{
			message.append(System.getProperty("line.separator"));
			message.append(gps[i]);
		}*/
	}
	else
	{
		message.append(excp.getMessage());
	}
	
	return message.toString();
}
 
Example 16
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean removeSurgery()
{
	LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
	if(locVo == null)
		return false;
	try
	{
		setPracticeToContext(domain.deleteLocSite(locVo));
		form.getLocalContext().setSurgery(null);
		form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
		if(canUseSurgery())
			open();
	}
	catch (ForeignKeyViolationException e)
	{
		engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
		return false;
	}
	
	return true;
}
 
Example 17
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void onGridSearchSelectionChanged()
{
	enableContextMenu();
	Object val = form.grdSearch().getValue();
	clearPracticeAndSurgeryLocalContext();
	if(val != null)
	{
		if(val instanceof OrganisationWithSitesVo)
		{
			setSelectedPractice((OrganisationWithSitesVo) val);
		}
		else if(val instanceof LocSiteVo)
		{
			setSelectedSurgery((LocSiteVo) val);
		}
		
		setActionAndFireEvent(PracticeSearch.SELECT);
	}
}
 
Example 18
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
public OrganisationWithSitesVo getParentPractice()
{
	LocSiteVo voLocSiteVo = getSelectedSurgery();
	if(voLocSiteVo != null)
	{
		for (int i = 0; i < form.grdSearch().getRows().size(); i++)
		{
			if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
			{
				OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
				if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
					return organisationWithSitesVo; 
			}
		}
	}	
	
	return null;
}
 
Example 19
Project: openMAXIMS   File: GPPracticeAdminImpl.java   Source Code and License 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 20
Project: openMAXIMS   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 21
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   Source Code and License 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 22
Project: openmaxims-linux   File: OrganisationAndLocationImpl.java   Source Code and License 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 23
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
	if(practice == null)
		return null;
	
	int index = practice.getLocationSites().indexOf(surgery);
	if (index >= 0)
		return practice.getLocationSites().get(index);

	//Find the Location that's not in the practiceBeforeSave
	if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
	{
		for (int i = 0; i < practice.getLocationSites().size(); i++)
		{
			if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
			{
				return practice.getLocationSites().get(i);
			}
		}
	}
	
	return null;
}
 
Example 24
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private LocSiteVo getSavedSurgery(OrganisationVo practiceBeforeSave, OrganisationVo practice, LocSiteVo surgery)
{
	if(practice == null)
		return null;
	
	int index = practice.getLocationSites().indexOf(surgery);
	if (index >= 0)
		return practice.getLocationSites().get(index);

	//Find the Location that's not in the practiceBeforeSave
	if(practiceBeforeSave != null && practiceBeforeSave.getLocationSitesIsNotNull())
	{
		for (int i = 0; i < practice.getLocationSites().size(); i++)
		{
			if(practiceBeforeSave.getLocationSites().indexOf(practice.getLocationSites().get(i)) < 0)
			{
				return practice.getLocationSites().get(i);
			}
		}
	}
	
	return null;
}
 
Example 25
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
	StringBuffer message = new StringBuffer();
	String[] gps = domain.listPatients(locVo);
	if(gps != null)
	{
		message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
		message.append(" " +gps.length + " Patients");
		/*for (int i = 0; i < gps.length; i++)
		{
			message.append(System.getProperty("line.separator"));
			message.append(gps[i]);
		}*/
	}
	else
	{
		message.append(excp.getMessage());
	}
	
	return message.toString();
}
 
Example 26
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private boolean removeSurgery()
{
	LocSiteVo locVo = form.customControlPracticeAdmin().getSelectedSurgery();
	if(locVo == null)
		return false;
	try
	{
		setPracticeToContext(domain.deleteLocSite(locVo));
		form.getLocalContext().setSurgery(null);
		form.customControlPracticeAdmin().removeSurgeryFromGrid(locVo);
		if(canUseSurgery())
			open();
	}
	catch (ForeignKeyViolationException e)
	{
		engine.showMessage(getGpListMessageLoc(locVo,e)); //wdev-11819
		return false;
	}
	
	return true;
}
 
Example 27
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void onGridSearchSelectionChanged()
{
	enableContextMenu();
	Object val = form.grdSearch().getValue();
	clearPracticeAndSurgeryLocalContext();
	if(val != null)
	{
		if(val instanceof OrganisationWithSitesVo)
		{
			setSelectedPractice((OrganisationWithSitesVo) val);
		}
		else if(val instanceof LocSiteVo)
		{
			setSelectedSurgery((LocSiteVo) val);
		}
		
		setActionAndFireEvent(PracticeSearch.SELECT);
	}
}
 
Example 28
Project: openmaxims-linux   File: OrgTreeHelper.java   Source Code and License 6 votes vote down vote up
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
	if (locationSites == null)
		return;
	
	TreeNode locNode = null;
	for(int i=0; i < locationSites.size(); i++)
	{
		LocSiteVo voLoc = locationSites.get(i);	
		if (voLoc.getIsActive().booleanValue() == false && !showInactive)
			continue;
		
		Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;		
		
		//WDEV-6444 - if node is inactive disable drag dropping for that node
		if(voLoc.getIsActive().booleanValue() == false)
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
		else
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);
		
		locNode.setCollapsedImage(img);
		locNode.setExpandedImage(img);
		locNode.setCheckBoxVisible(showCheckBoxes);
		populateLocations(voLoc.getLocations().sort(), locNode);
	}		
}
 
Example 29
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
public OrganisationWithSitesVo getParentPractice()
{
	LocSiteVo voLocSiteVo = getSelectedSurgery();
	if(voLocSiteVo != null)
	{
		for (int i = 0; i < form.grdSearch().getRows().size(); i++)
		{
			if(form.grdSearch().getRows().get(i).getValue() instanceof OrganisationWithSitesVo)
			{
				OrganisationWithSitesVo organisationWithSitesVo = (OrganisationWithSitesVo)form.grdSearch().getRows().get(i).getValue();
				if(organisationWithSitesVo.getLocationSites().indexOf(voLocSiteVo) >= 0)
					return organisationWithSitesVo; 
			}
		}
	}	
	
	return null;
}
 
Example 30
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
	if(voLocSite == null)
		return Boolean.FALSE; 
	
	for (int i = 0; i < form.grdSearch().getRows().size(); i++)
	{
		for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
		{
			if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
			{
				form.grdSearch().getRows().get(i).getRows().remove(j);
				setSelectedSurgery(null);
				//setSelectedPractice(null)
				enableContextMenu();
				setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
				return Boolean.TRUE;
			}
		}
	}
	
	return Boolean.FALSE;
}
 
Example 31
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void save(OrganisationVo voOrg, LocSiteVo voLocSite, LocMostVo voLoc) throws UniqueKeyViolationException, StaleObjectException 
{
	if (voOrg != null)
	{	
		domain.saveOrganisation(voOrg);
	}
	else if (voLocSite != null)
	{	
		//wdev-12855
		if(form.getLocalContext().getEditObject() instanceof LocSiteVo && ((LocSiteVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLocSite.getVersion_Location() != ((LocSiteVo)form.getLocalContext().getEditObject()).getVersion_Location())
			throw new StaleObjectException(null);
		
		domain.saveLocationSite(voLocSite);
	}
	else if (voLoc != null)
	{
		//wdev-12855
		if(form.getLocalContext().getEditObject() instanceof LocMostVo && ((LocMostVo)form.getLocalContext().getEditObject()).getID_LocationIsNotNull() && voLoc.getVersion_Location() != ((LocMostVo)form.getLocalContext().getEditObject()).getVersion_Location())
			throw new StaleObjectException(null);
		domain.saveLocation(voLoc);
	}
	form.getLocalContext().setSavingRootOrg(null);
}
 
Example 32
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
public Boolean removeSurgeryFromGrid(LocSiteVo voLocSite)
{
	if(voLocSite == null)
		return Boolean.FALSE; 
	
	for (int i = 0; i < form.grdSearch().getRows().size(); i++)
	{
		for (int j = 0; j < form.grdSearch().getRows().get(i).getRows().size(); j++)
		{
			if(voLocSite.equals(form.grdSearch().getRows().get(i).getRows().get(j).getValue()))
			{
				form.grdSearch().getRows().get(i).getRows().remove(j);
				setSelectedSurgery(null);
				//setSelectedPractice(null)
				enableContextMenu();
				setActionAndFireEvent(PracticeSearch.SURGERYREMOVED);
				return Boolean.TRUE;
			}
		}
	}
	
	return Boolean.FALSE;
}
 
Example 33
Project: openMAXIMS   File: OrgTreeHelper.java   Source Code and License 6 votes vote down vote up
private void populateLocSites(LocSiteVoCollection locationSites, TreeNode orgNode)
{
	if (locationSites == null)
		return;
	
	TreeNode locNode = null;
	for(int i=0; i < locationSites.size(); i++)
	{
		LocSiteVo voLoc = locationSites.get(i);	
		if (voLoc.getIsActive().booleanValue() == false && !showInactive)
			continue;
		
		Image img = voLoc.getIsActive().booleanValue() ? locSiteImg : locSiteDisImg;		
		
		//WDEV-6444 - if node is inactive disable drag dropping for that node
		if(voLoc.getIsActive().booleanValue() == false)
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName());
		else
			locNode = orgNode.getNodes().add(voLoc, voLoc.getName(), LS_NODE, ORG_NODE, true);
		
		locNode.setCollapsedImage(img);
		locNode.setExpandedImage(img);
		locNode.setCheckBoxVisible(showCheckBoxes);
		populateLocations(voLoc.getLocations().sort(), locNode);
	}		
}
 
Example 34
Project: openMAXIMS   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 35
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   Source Code and License 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 36
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private String getGpListMessageLoc(LocSiteVo locVo, ForeignKeyViolationException excp)
{
	StringBuffer message = new StringBuffer();
	String[] gps = domain.listPatients(locVo);
	if(gps != null)
	{
		message.append("Cannot delete '" + locVo.getName() + "' as it is currently associated with");
		message.append(" " +gps.length + " Patients");
		/*for (int i = 0; i < gps.length; i++)
		{
			message.append(System.getProperty("line.separator"));
			message.append(gps[i]);
		}*/
	}
	else
	{
		message.append(excp.getMessage());
	}
	
	return message.toString();
}
 
Example 37
Project: AvoinApotti   File: DemographicsImpl.java   Source Code and License 5 votes vote down vote up
public LocSiteVo getLocationSite(LocationRefVo locSiteId) 
{
	if(locSiteId == null)
		return null;
	
	DomainFactory factory = getDomainFactory();
	ims.core.resource.place.domain.objects.LocSite locSiteDO = (ims.core.resource.place.domain.objects.LocSite) factory.getDomainObject(ims.core.resource.place.domain.objects.LocSite.class, locSiteId.getID_Location());
	return LocSiteVoAssembler.create(locSiteDO);

}
 
Example 38
Project: AvoinApotti   File: M02VoMapper.java   Source Code and License 5 votes vote down vote up
private void checkModifiedSurgery(LocSiteVoCollection locationSites, LocSiteVo siteVo)
{
	for (int i = 0; i < locationSites.size(); i++)
	{
		LocSiteVo vo =locationSites.get(i); 
		if (vo.equals(siteVo))
		{				
			if (vo.getAddress() == null) vo.setAddress(new PersonAddress());
			
			if (!siteVo.getAddressIsNotNull() || //msg surgery will be null if all fields cleared with HL7Null ("")
			!adrLinesEqual(vo.getAddress().getLine1(),siteVo.getAddress().getLine1()) ||						
			!adrLinesEqual(vo.getAddress().getLine2(),siteVo.getAddress().getLine2()) ||
			!adrLinesEqual(vo.getAddress().getLine3(),siteVo.getAddress().getLine3()) || 
			!adrLinesEqual(vo.getAddress().getLine4(),siteVo.getAddress().getLine4()) || 
			!adrLinesEqual(vo.getAddress().getLine5(),siteVo.getAddress().getLine5()) ||
			!adrLinesEqual(vo.getAddress().getPostCode(),siteVo.getAddress().getPostCode()	)
			||
			vo.getAddress().getCountyIsNotNull() && !vo.getAddress().getCounty().equals(siteVo.getAddress().getCounty())
			)
			{
				vo.setAddress(siteVo.getAddress());
				vo.setName(siteVo.getName());
			}
			setCommsChannels(vo.getCommChannels(),siteVo.getCommChannels());				
		}
	}
}
 
Example 39
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onDyngrdOrganisationLocationRowChecked(DynamicGridRow row)
{
	if (!row.isChecked())
	{
		if ( (row.getValue() instanceof LocSiteVo) || (row.getValue() instanceof HcpLocationVo) )
		{
			DynamicGridCell cell = row.getCells().get(form.dyngrdOrganisationLocation().getColumns().getByIdentifier(COL_ACCREDITATION));
			if (cell != null)
				cell.setValue(null);

		}
	}

}
 
Example 40
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private LocSiteVo populateSurgeryData(LocSiteVo value)
{
	value.setAddress(populateAddressData(AddressType.SURGERY));  // WDEV-15936 specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());		
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setType(LocationType.SURGERY);
	value.setCommChannels(populateCommChannelsFromScreen());
	
	return value;
}
 
Example 41
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * creates a LocSiteCollection with one LocSiteVo. point is to create a 1 to 1 mapping 
 * of practice - surgery for sites who are not visibly using surgeries. 
 * 
 * @param practice
 * @return practice with 1 surgery, populated from the screen (matches practice values)
 */
private OrganisationVo createOneMatchingChildSurgery(OrganisationVo practice) 
{
	LocSiteVoCollection surgeryCollection = new LocSiteVoCollection();
	LocSiteVo surgery = new LocSiteVo();
	surgery = populateSurgeryData(surgery);
	surgery.setName(surgery.getName() + " surgery");
	surgery.setCodeMappings(null);  // do not want to be creating duplicate location mappings. 
	surgery.setIsVirtual(false);  //wdev-4093 
	surgeryCollection.add(surgery);
	surgeryCollection.get(0).setParentOrganisation(practice);
	practice.setLocationSites(surgeryCollection);
		
	return practice;
}
 
Example 42
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param node
 */
private void treeViewSelectionChanged(ims.framework.controls.TreeNode node)
{
	clearInstanceControls();
	if (node == null)
		return;

	Object value = node.getValue();
	if (value instanceof LocSvcProviderSysVo)
	{
		LocSvcProviderSysVo voLocSvcProviderSys = (LocSvcProviderSysVo) value;
		populateScreenFromData(voLocSvcProviderSys.getProviderSystem());
		populateServiceProviders(node.getParent(), (LocationServiceVo) node.getParent().getValue());
		form.getLocalContext().setSelectedRecord((LocSvcProviderSysVo) value);
	}

	if (value instanceof LocShortVo)
	{
		populateLocationServices(node, (LocShortVo) node.getValue());
		if (value instanceof LocSiteVo)
		{
			LocSiteVo voLocSite = (LocSiteVo) node.getValue();
			populateLocations(voLocSite.getLocations(), node);
			node.setExpanded(true);
		}
	}

	if (value instanceof LocationServiceVo)
	{
		populateServiceProviders(node, (LocationServiceVo) node.getValue());
		form.getLocalContext().setSelectedRecord(null);
	}

	updateControlsState();
}
 
Example 43
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateMosDetailsForSelectedTreeNode()
{
	MemberOfStaffVo voMos = new MemberOfStaffVo();
	if (form.lyrLHS().tabOrganisation().isHeaderVisible())
	{
		if (form.lyrLHS().tabOrganisation().treOrganisation().getSelectedNode() != null)
		{
			if ((form.lyrLHS().tabOrganisation().treOrganisation().getSelectedNode().getValue() instanceof LocSiteVo) || (form.lyrLHS().tabOrganisation().treOrganisation().getSelectedNode().getValue() instanceof LocMostVo))
			{
				HcpLocationVo voHcpLocation = new HcpLocationVo();
				voHcpLocation.setLocation((LocMostVo) form.lyrLHS().tabOrganisation().treOrganisation().getSelectedNode().getValue());

				if (voMos.getLocationsIsNotNull())
				{
					voMos.getLocations().add(voHcpLocation);
				}
				else
				{
					HcpLocationVoCollection voCollLocations = new HcpLocationVoCollection();
					voCollLocations.add(voHcpLocation);
					voMos.setLocations(voCollLocations);
				}

				form.setMode(FormMode.EDIT);
				populateScreenFromMosVo(voMos);
				form.getGlobalContext().Admin.setSelectedMos(voMos);
				form.cmbType().setFocus();
			}
		}

	}
}
 
Example 44
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param voCollMosOrgLoc
 * @param newNode
 */
private void showOrgForMos(MosOrgLocVoCollection voCollMosOrgLoc, TreeNode mosNode)
{
	mosNode.getNodes().clear();
	for (int i = 0; i < voCollMosOrgLoc.size(); i++)
	{
		MosOrgLocVo vo = voCollMosOrgLoc.get(i);
		TreeNode orgNode = mosNode.getNodes().add(vo.getOrganisation(), vo.getOrganisation().getName());
		orgNode.setCollapsedImage(form.getImages().Admin.Organisation);
		HCPLocationLiteVo.mixedSort(vo.getHCPLocations());
		for (int j = 0; j < vo.getHCPLocations().size(); j++)
		{
			HCPLocationLiteVo locVo = vo.getHCPLocations().get(j);

			StringBuffer sb = new StringBuffer();
			sb.append(locVo.getLocation().getName());
			sb.append(locVo.getAccreditationStatusIsNotNull() ? " ," + locVo.getAccreditationStatus().toString() : "");

			TreeNode locNode = orgNode.getNodes().add(locVo, sb.toString());
			if (j == 0)
				locNode.setExpanded(true);

			if (locVo.getLocation() instanceof LocSiteVo || locVo.getLocation() instanceof LocSiteShortVo)
			{
				locNode.setCollapsedImage(form.getImages().Admin.LocationSite);
				locNode.setExpandedImage(form.getImages().Admin.LocationSite);
			}
			else
			{
				locNode.setCollapsedImage(form.getImages().Admin.Location);
				locNode.setExpandedImage(form.getImages().Admin.Location);
			}
		}
	}

}
 
Example 45
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onTreOrganisationSelectionChanged(TreeNode node) throws PresentationLogicException
{
	clearDetailControls();
	clearContextVariables();

	form.getContextMenus().getMosOrganisationEDITItem().setVisible(node.getValue() instanceof MemberOfStaffShortVo);

	if (node.getValue() instanceof LocSiteVo || node.getValue() instanceof LocMostVo)
	{
		populateMosForLocation((LocMostVo) node.getValue(), node);
	}

	else if (node.getValue() instanceof MemberOfStaffShortVo)
	{
		MemberOfStaffShortVo voMos = (MemberOfStaffShortVo) node.getValue();

		populateScreenFromMosVo(setContextVariables(voMos)); //WDEV-13921
		
		if (voMos.getHcpIsNotNull())
		{
			form.imbHCPDlg().setEnabledImage(form.cmbHcpDiciplineDetails().getValue().getCollapsedImage());
			form.imbHCPDlg().setDisabledImage(form.cmbHcpDiciplineDetails().getValue().getCollapsedImage());
			form.imbHCPDlg().setVisible(true);
		}
		else
		{
			form.imbHCPDlg().setVisible(false);
		}

	}
	else
	{
		form.getContextMenus().getMosOrganisationADDItem().setVisible(false);
	}

}
 
Example 46
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void enableContextMenu()
{
	boolean canBeVisible = getCanMakeVisibleContextMenu() && form.getMode().equals(FormMode.VIEW);
	boolean orgRecordSelected = form.grdSearch().getSelectedRowIndex() >= 0 && form.grdSearch().getValue() instanceof OrganisationWithSitesVo;
	boolean locSiteRecordSelected = form.grdSearch().getSelectedRowIndex() >= 0 && form.grdSearch().getValue() instanceof LocSiteVo;
	boolean canMakeRemovePracticeVisible = canBeVisible && orgRecordSelected && isRemoveContextMenuVisible();
	boolean canMakeSurgeryVisible = canBeVisible /*&& ConfigFlag.DOM.GP_USE_SURGERIES.getValue()*/ && !isSurgeryContextMenuInvisible(); 
	
	form.getContextMenus().getPracticeAdminNewPracticeItem().setVisible(canBeVisible);
	form.getContextMenus().getPracticeAdminEditPracticeItem().setVisible(canBeVisible && orgRecordSelected);
	form.getContextMenus().getPracticeAdminRemovePracticeItem().setVisible(canMakeRemovePracticeVisible);
	form.getContextMenus().getPracticeAdminNewSurgeryItem().setVisible(canMakeSurgeryVisible && orgRecordSelected);
	form.getContextMenus().getPracticeAdminEditSurgeryItem().setVisible(canMakeSurgeryVisible && locSiteRecordSelected);
	form.getContextMenus().getPracticeAdminRemoveSurgeryItem().setVisible(canMakeSurgeryVisible && locSiteRecordSelected);
}
 
Example 47
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void createLocation()
{
	TreeNode node = form.treOrgLoc().getSelectedNode();
	if (node == null)
		return;

	if (node.getValue() instanceof OrganisationVo)
	{
		form.getLocalContext().setEditObject(new LocSiteVo());
		clearTab(TABLOCSITE);
		form.ctn1().lyr1().showtabLocSite();
		form.ctn1().lyr1().tabLocSite().txtLocSiteName().setFocus();
		form.ctn1().lyr1().tabLocSite().chkDisplayInEDTrackingLocSite().setVisible(false);	//wdev-17000
		form.ctn1().lyr1().tabLocSite().chkDisplayInEDTrackingLocSite().setValue(null);		//wdev-17000
	}
	else
	{
		form.getLocalContext().setEditObject(new LocMostVo());
		clearTab(TABLOC);
		form.ctn1().lyr1().showtabLoc();	
		form.ctn1().lyr1().tabLoc().txtLocName().setFocus();
		form.ctn1().lyr1().tabLoc().chkDisplayInEDTrackingLoc().setVisible(false);  //wdev-17000
		form.ctn1().lyr1().tabLoc().chkDisplayInEDTrackingLoc().setValue(null);		//wdev-17000
	}

	hideContextMenus();
	setFormMode(FormMode.EDIT);
	form.getContextMenus().getGenericGridAddItem().setVisible(true);
	form.getGlobalContext().setPrintersSelected(null);		
	form.getLocalContext().setSavingRootOrg(null);
					
	form.getGlobalContext().setDefaultPrinter(null);
	form.getGlobalContext().setDesignatedPrinterForNewResults(null);
}
 
Example 48
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private String checkLocSiteNameIsUnique(LocSiteVo locSiteVo)
{
	if (locSiteVo != null && locSiteVo.getName() != null)
	{
		String dupMessage = domain.checkLocationSiteNameIsUnique(locSiteVo.getName(), locSiteVo.getID_Location());
		
		if(dupMessage != null)
			return dupMessage;
	}
	return null;
}
 
Example 49
Project: AvoinApotti   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
	if(voLocSite == null || voLocSite.getID_Location() == null)
	{
		throw new DomainRuntimeException("Invalid record");
	}
	
	DomainFactory factory = getDomainFactory();
	LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);
	
	return LocSiteVoAssembler.create(domainObject);
}
 
Example 50
Project: AvoinApotti   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
	if (!orgVo.isValidated())
		throw new DomainRuntimeException("Org has not been validated");
	
	DomainFactory factory = getDomainFactory();
	Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
	if (doOrg == null)
		throw new StaleObjectException(doOrg);
	doOrg.setUpperNames();
	
	try 
	{
		factory.save(doOrg);
	} 
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doOrg, "codeMappings", orgVo.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		for (int i = 0; i < orgVo.getLocationSites().size(); i++)
		{
			LocSiteVo lsv = orgVo.getLocationSites().get(i);
			LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);
			
			dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
			if(dupMessage != null)
				throw new UniqueKeyViolationException(dupMessage);
			
		}
		throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
	}
	
	return OrganisationVoAssembler.create(doOrg);
}
 
Example 51
Project: AvoinApotti   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public String[] listPatients(LocSiteVo locationsite) 
{
	if(locationsite == null)
		return null;
			
	StringBuffer hql = new StringBuffer();
	hql.append(" select p1_1.name.surname ");
	hql.append(" from Patient as p1_1 left join p1_1.gp as g1_1 left join g1_1.practices as g2_1 left join g2_1.practice as o1_1 left join o1_1.locationSites as l1_1");
	hql.append(" where ");
	hql.append("(l1_1.id = :LOC_ID)");
	hql.append(" and p1_1.isRIE is null");
	
	DomainFactory factory = getDomainFactory();
	List list = factory.find(hql.toString(), "LOC_ID", locationsite.getID_Location());
	
	String[] gpNames = new String[list.size()];
	for (int i = 0; i < list.size(); i++)
	{
		Object element = (Object) list.get(i);
		StringBuffer sb = new StringBuffer();
		if(element != null )
		{
			if(element instanceof String)
			{
				sb.append((String)element);
				sb.append(" ");
			}
			
		}
		gpNames[i] = sb.toString();
	}
	
	return gpNames;

}
 
Example 52
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   Source Code and License 5 votes vote down vote up
public void deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
	DomainFactory factory = getDomainFactory();

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

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

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

	// WDEV - 12551 - Display an appropriate message
	// when deleting fails
	try
	{
		factory.delete(doLocSite);
	}
	catch (Exception ex)
	{
		throw new ForeignKeyViolationException("Location Site is in use and can not be deleted.");
	}
}
 
Example 53
Project: AvoinApotti   File: SupplierImpl.java   Source Code and License 5 votes vote down vote up
public String isTaxonomyUnique(TaxonomyMapCollection map)
{
	DomainFactory factory = getDomainFactory();	
	
	if (map != null)
	{
		String result = "";
		for (int i = 0; i < map.size(); i++) 
		{
			java.util.List list = factory.find("select  l1_1.id, l1_1.name, l1_1.parentOrganisation.id, t1_1.taxonomyCode, l2_1.id from LocSite as l1_1 left join l1_1.codeMappings as t1_1 left join t1_1.taxonomyName as l2_1 where (t1_1.taxonomyCode = :code and l2_1.id = :name)", new String[]{"code" ,"name"}, new Object[]{map.get(i).getTaxonomyCode(), new Integer(map.get(i).getTaxonomyName().getID())});

			LocSiteVo itemLoc = new LocSiteVo();
			
			for (Iterator iter = list.iterator(); iter.hasNext();)
			{
				Object[] element = (Object[]) iter.next();
				itemLoc.setID_Location((Integer)element[0]);
				itemLoc.setName((String)element[1]);	
			}
			
			if (list.size() != 0 && 
					map.get(i).getTaxonomyCodeIsNotNull() &&
						itemLoc.getNameIsNotNull() &&
							map.get(i).getTaxonomyNameIsNotNull())
								result = "Item named '"+itemLoc.getName()+"' already has a "+(map.get(i).getTaxonomyName().toString()+" mapping with code = "+ map.get(i).getTaxonomyCode());
				
		}	
		return result;
	}
	
	return "";
}
 
Example 54
Project: openmaxims-linux   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public OrganisationVo saveOrg(OrganisationVo orgVo) throws StaleObjectException, UniqueKeyViolationException
{
	if (!orgVo.isValidated())
		throw new DomainRuntimeException("Org has not been validated");
	
	DomainFactory factory = getDomainFactory();
	Organisation doOrg = OrganisationVoAssembler.extractOrganisation(factory, orgVo);
	if (doOrg == null)
		throw new StaleObjectException(doOrg);
	doOrg.setUpperNames();
	
	try 
	{
		factory.save(doOrg);
	} 
	catch (UnqViolationUncheckedException e)
	{
		String dupMessage = Keywords.checkDuplicateTaxonomy(factory, doOrg, "codeMappings", orgVo.getCodeMappings(), "getName");
		if(dupMessage != null)
			throw new UniqueKeyViolationException(dupMessage);
		
		for (int i = 0; i < orgVo.getLocationSites().size(); i++)
		{
			LocSiteVo lsv = orgVo.getLocationSites().get(i);
			LocSite lsd = LocSiteVoAssembler.extractLocSite(factory, lsv);
			
			dupMessage = Keywords.checkDuplicateTaxonomy(factory, lsd, "codeMappings", lsv.getCodeMappings(), "getName");
			if(dupMessage != null)
				throw new UniqueKeyViolationException(dupMessage);
			
		}
		throw new UniqueKeyViolationException("An Record with this name already exists, Please change", e);
	}
	
	return OrganisationVoAssembler.create(doOrg);
}
 
Example 55
Project: openmaxims-linux   File: GPPracticeAdminImpl.java   Source Code and License 5 votes vote down vote up
public LocSiteVo getLocSite(LocSiteVo voLocSite) 
{
	if(voLocSite == null || voLocSite.getID_Location() == null)
	{
		throw new DomainRuntimeException("Invalid record");
	}
	
	DomainFactory factory = getDomainFactory();
	LocSite domainObject = (LocSite)factory.getDomainObject(voLocSite);
	
	return LocSiteVoAssembler.create(domainObject);
}
 
Example 56
Project: openMAXIMS   File: M02VoMapper.java   Source Code and License 5 votes vote down vote up
private GP updateGpStatus(GP gp)
{
	if(gp!=null)
	{
		gp.setStatus(GPStatus.INACTIVE);
		String gMCCode = gp.getNationalCode();
		if(gp.getPracticesIsNotNull()&&gp.getPractices().size()>0 &&gMCCode!=null)
		{
			for (GpToPracticesVo gpToPracticesVo : gp.getPractices())
			{
				if(gpToPracticesVo.getPracticeIsNotNull()&&gpToPracticesVo.getPractice().getIsActive()!=null&&gpToPracticesVo.getPractice().getIsActive())
				{
					if(gpToPracticesVo.getPractice().getLocationSitesIsNotNull()&&gpToPracticesVo.getPractice().getLocationSites().size()>0)
					{
						for (LocSiteVo surgery : gpToPracticesVo.getPractice().getLocationSites()) {
							if(surgery.getIsActiveIsNotNull() && 
									surgery.getIsActive().equals(Boolean.TRUE)&&
									surgery.getPasCode()!=null&&
									gMCCode!=null&&
									gMCCode.trim()!=null&&
									surgery.getPasCode().toUpperCase().matches("\\S+_"+gMCCode.trim().toUpperCase()+"_\\S+")) //http://jira/browse/WDEV-15535 changed filter from PAS to GMC 
							{
								gp.setStatus(GPStatus.ACTIVE);
								break;
							}
						}
					}
				}
			}
		}
	}
	return gp;
}
 
Example 57
Project: openMAXIMS   File: M02VoMapper.java   Source Code and License 5 votes vote down vote up
private void checkModifiedSurgery(LocSiteVoCollection locationSites, LocSiteVo siteVo)
{
	for (int i = 0; i < locationSites.size(); i++)
	{
		LocSiteVo vo =locationSites.get(i); 
		if (vo.equals(siteVo))
		{				
			if (vo.getAddress() == null) vo.setAddress(new PersonAddress());
			
			if (!siteVo.getAddressIsNotNull() || //msg surgery will be null if all fields cleared with HL7Null ("")
			!adrLinesEqual(vo.getAddress().getLine1(),siteVo.getAddress().getLine1()) ||						
			!adrLinesEqual(vo.getAddress().getLine2(),siteVo.getAddress().getLine2()) ||
			!adrLinesEqual(vo.getAddress().getLine3(),siteVo.getAddress().getLine3()) || 
			!adrLinesEqual(vo.getAddress().getLine4(),siteVo.getAddress().getLine4()) || 
			!adrLinesEqual(vo.getAddress().getLine5(),siteVo.getAddress().getLine5()) ||
			!adrLinesEqual(vo.getAddress().getPostCode(),siteVo.getAddress().getPostCode()	)
			||
			vo.getAddress().getCountyIsNotNull() && !vo.getAddress().getCounty().equals(siteVo.getAddress().getCounty())
			)
			{
				vo.setAddress(siteVo.getAddress());
				vo.setName(siteVo.getName());
			}
			setCommsChannels(vo.getCommChannels(),siteVo.getCommChannels());				
		}
	}
}
 
Example 58
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private LocSiteVo populateSurgeryData(LocSiteVo value)
{
	value.setAddress(populateAddressData(AddressType.SURGERY));  // WDEV-15936 specify address type 
	value.setName(form.ctnDetails().txtDetailsName().getValue());		
	value.setIsActive(new Boolean(form.ctnDetails().chkDetailsActive().getValue()));
	value.setCodeMappings(getCodeMappings());
	value.setType(LocationType.SURGERY);
	value.setCommChannels(populateCommChannelsFromScreen());
	
	return value;
}
 
Example 59
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * creates a LocSiteCollection with one LocSiteVo. point is to create a 1 to 1 mapping 
 * of practice - surgery for sites who are not visibly using surgeries. 
 * 
 * @param practice
 * @return practice with 1 surgery, populated from the screen (matches practice values)
 */
private OrganisationVo createOneMatchingChildSurgery(OrganisationVo practice) 
{
	LocSiteVoCollection surgeryCollection = new LocSiteVoCollection();
	LocSiteVo surgery = new LocSiteVo();
	surgery = populateSurgeryData(surgery);
	surgery.setName(surgery.getName() + " surgery");
	surgery.setCodeMappings(null);  // do not want to be creating duplicate location mappings. 
	surgery.setIsVirtual(false);  //wdev-4093 
	surgeryCollection.add(surgery);
	surgeryCollection.get(0).setParentOrganisation(practice);
	practice.setLocationSites(surgeryCollection);
		
	return practice;
}
 
Example 60
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param node
 */
private void treeViewSelectionChanged(ims.framework.controls.TreeNode node)
{
	clearInstanceControls();
	if (node == null)
		return;

	Object value = node.getValue();
	if (value instanceof LocSvcProviderSysVo)
	{
		LocSvcProviderSysVo voLocSvcProviderSys = (LocSvcProviderSysVo) value;
		populateScreenFromData(voLocSvcProviderSys.getProviderSystem());
		populateServiceProviders(node.getParent(), (LocationServiceVo) node.getParent().getValue());
		form.getLocalContext().setSelectedRecord((LocSvcProviderSysVo) value);
	}

	if (value instanceof LocShortVo)
	{
		populateLocationServices(node, (LocShortVo) node.getValue());
		if (value instanceof LocSiteVo)
		{
			LocSiteVo voLocSite = (LocSiteVo) node.getValue();
			populateLocations(voLocSite.getLocations(), node);
			node.setExpanded(true);
		}
	}

	if (value instanceof LocationServiceVo)
	{
		populateServiceProviders(node, (LocationServiceVo) node.getValue());
		form.getLocalContext().setSelectedRecord(null);
	}

	updateControlsState();
}