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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 6 votes vote down vote up
public OrganisationVo deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
	if(locSiteToDelete == null)
		throw new RuntimeException("Cannot delete null LocSiteVo");
	
	DomainFactory factory = getDomainFactory();

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

	if(doLocSite==null)
		return null;
	
	Organisation doParentOrganisation = doLocSite.getParentOrganisation();

	if (doParentOrganisation != null)
		doParentOrganisation.getLocationSites().remove(doLocSite);
	//WDEV-12000 
	else
		return null;

	factory.delete(doLocSite);
	return OrganisationVoAssembler.create(doParentOrganisation); 
}
 
Example 11
Project: AvoinApotti   File: OrganisationAndLocationImpl.java   View source code 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   View source code 6 votes vote down vote up
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();

	LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
	Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
	Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

	//strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
	doLocSite.setParentOrganisation(doOrgDestParent);
	doOrgCurrentParent.getLocationSites().remove(doLocSite);
	factory.refresh(doOrgCurrentParent);
	doOrgDestParent.getLocationSites().add(doLocSite);
	factory.save(doLocSite);
	factory.refresh(doOrgCurrentParent);
	
	//WDEV-10574
	REMOTE_LOC_CACHE.clear();		
}
 
Example 13
Project: openMAXIMS   File: Logic.java   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 6 votes vote down vote up
public OrganisationVo deleteLocSite(LocSiteVo locSiteToDelete) throws ForeignKeyViolationException
{
	if(locSiteToDelete == null)
		throw new RuntimeException("Cannot delete null LocSiteVo");
	
	DomainFactory factory = getDomainFactory();

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

	if(doLocSite==null)
		return null;
	
	Organisation doParentOrganisation = doLocSite.getParentOrganisation();

	if (doParentOrganisation != null)
		doParentOrganisation.getLocationSites().remove(doLocSite);
	//WDEV-12000 
	else
		return null;

	factory.delete(doLocSite);
	return OrganisationVoAssembler.create(doParentOrganisation); 
}
 
Example 20
Project: openMAXIMS   File: OrganisationAndLocationImpl.java   View source code 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   View source code 6 votes vote down vote up
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();

	LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
	Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
	Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

	//strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
	doLocSite.setParentOrganisation(doOrgDestParent);
	doOrgCurrentParent.getLocationSites().remove(doLocSite);
	factory.refresh(doOrgCurrentParent);
	doOrgDestParent.getLocationSites().add(doLocSite);
	factory.save(doLocSite);
	factory.refresh(doOrgCurrentParent);
	
	//WDEV-10574
	REMOTE_LOC_CACHE.clear();		
}
 
Example 22
Project: openmaxims-linux   File: OrganisationAndLocationImpl.java   View source code 6 votes vote down vote up
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();

	LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
	Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
	Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

	//strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
	doLocSite.setParentOrganisation(doOrgDestParent);
	doOrgCurrentParent.getLocationSites().remove(doLocSite);
	factory.refresh(doOrgCurrentParent);
	doOrgDestParent.getLocationSites().add(doLocSite);
	factory.save(doLocSite);
	factory.refresh(doOrgCurrentParent);
	
	//WDEV-10574
	REMOTE_LOC_CACHE.clear();		
}
 
Example 23
Project: openmaxims-linux   File: Logic.java   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 6 votes vote down vote up
/**
 * Move a location site
 */
@SuppressWarnings("unchecked")
public void moveLocSite(ims.core.vo.LocSiteVo locSiteToMove, OrgShortVo currentParent, OrgShortVo destParent) throws StaleObjectException
{
	DomainFactory factory = getDomainFactory();

	LocSite doLocSite = LocSiteVoAssembler.extractLocSite(factory, locSiteToMove);
	Organisation doOrgCurrentParent = OrgShortVoAssembler.extractOrganisation(factory, currentParent);
	Organisation doOrgDestParent = OrgShortVoAssembler.extractOrganisation(factory, destParent);

	//strange hibernate(v3) error was being generated here and session refresh problems so hence the factory.refresh() calls
	doLocSite.setParentOrganisation(doOrgDestParent);
	doOrgCurrentParent.getLocationSites().remove(doLocSite);
	factory.refresh(doOrgCurrentParent);
	doOrgDestParent.getLocationSites().add(doLocSite);
	factory.save(doLocSite);
	factory.refresh(doOrgCurrentParent);
	
	//WDEV-10574
	REMOTE_LOC_CACHE.clear();		
}
 
Example 36
Project: openmaxims-linux   File: Logic.java   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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;
}