Java Code Examples for ims.vo.LookupInstanceCollection

The following are top voted examples for showing how to use ims.vo.LookupInstanceCollection. 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 populateTree(TreeNode[] collAvailable, ims.framework.controls.TreeNode parentNode, LookupInstanceCollection collSelected)
{
	if (collAvailable == null)
		return;

	for (int i = 0; i < collAvailable.length; i++)
	{
		SpecimenSite site = (SpecimenSite) collAvailable[i];
		
		ims.framework.controls.TreeNode itemNode = null;
		if (parentNode == null)
			itemNode = form.treInstances().getNodes().add(site, site.getText());
		else
			itemNode = parentNode.getNodes().add(site, site.getText());
		
		if(collSelected.indexOf(site) > -1)
		{
			itemNode.setChecked(true);
			if(itemNode.getParent() != null)
				itemNode.getParent().setChecked(true);
		}
			
	
		populateTree(collAvailable[i].getChildren(), itemNode, collSelected);
	}
}
 
Example 2
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 3
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}
 
Example 4
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 5
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateCombo(LookupTypeVo type)
{
	int typeId = type.getId();
	LookupInstanceCollection instColl;
	if (typeId < 0)
	{
		instColl = domain.getLookupService().getLookupCollection(type, true, false);
	}
	else
	{
		instColl = domain.getLookupService().getLookupCollection(typeId, ClassHelper.getLookupCollectionClass(typeId), ClassHelper.getLookupClass(typeId), true, true);
	}
	form.lyr1().Forms().cmbDefInst().clear();
	for (int i = 0; i < instColl.size(); i++)
	{
		LookupInstVo inst = instColl.getIndex(i);
		form.lyr1().Forms().cmbDefInst().newRow(inst, inst.getText(), inst.getImage());
	}
	
}
 
Example 6
Project: AvoinApotti   File: Logic.java   Source Code and License 6 votes vote down vote up
private void saveOrder()
{
	LookupInstanceCollection instColl = new LookupInstanceCollection();
	TreeNode rootNode = getRootNode();

	if (rootNode == null)
		return;

	LookupTypeVo type = (LookupTypeVo) rootNode.getValue();
	TreeNodeCollection coll = rootNode.getNodes();
	if (coll == null)
		return;
	
	addToOrderedColl(coll, instColl);		
	try
	{
		domain.saveInstanceOrder(type, instColl);
	}
	catch (StaleObjectException ex)
	{
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
	}
}
 
Example 7
Project: AvoinApotti   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection getLookupInstances(LookupTypeVo typeVo)
{
	LookupInstanceCollection collection = new LookupInstanceCollection();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup lookupType = factory.getLookup(typeVo.getId());
	if (null != lookupType)
	{
		java.util.Set set = lookupType.getInstances();
		for (Iterator iter = set.iterator(); iter.hasNext();)
		{
			LookupInstance element = (LookupInstance) iter.next();
			LookupInstVo valueObject = createLookupinstanceVo(element);
			collection.add(valueObject);
		}
	}
	return collection;
}
 
Example 8
Project: AvoinApotti   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection saveInstanceOrder(LookupTypeVo type, LookupInstanceCollection instances) throws StaleObjectException
{
	int typeId = type.getId();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup doType = factory.getLookup(typeId);
	for (int i = 0; i < instances.size(); i++)
	{
		LookupInstVo vo = instances.getIndex(i);
		ims.domain.lookups.LookupInstance doInstance = doType.getInstance(vo.getId());
		doInstance.getText();
		doInstance.setOrder(i);
		doInstance.setParent(getDomLookup(vo.getParentInstance()));
	}
	factory.save(doType);

	refreshCache(type);
	return getLookupInstances(type);
}
 
Example 9
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateTree(LookupInstanceCollection instColl, ChemoTxToxicityTypeVoCollection voColl)
{
	LookupInstVo[] roots = instColl.getRoots();
	for (int j = 0; j < roots.length; j++)
	{
		LookupInstVo inst = roots[j];

		grdToxicityRow newRow = form.grdToxicity().getRows().newRow();
		newRow.setColToxicity(((ChemoTherapyToxicityType)inst).getText());
		newRow.setColChemoToxicityType((ChemoTherapyToxicityType)inst);
		newRow.setValue((ChemoTherapyToxicityType)inst);

		fillToxicity(newRow, inst, voColl);
	}
	form.grdToxicity().expandAll();
}
 
Example 10
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateTree(TreeNode[] collAvailable, ims.framework.controls.TreeNode parentNode, LookupInstanceCollection collSelected)
{
	if (collAvailable == null)
		return;

	for (int i = 0; i < collAvailable.length; i++)
	{
		LookupInstVo instance = (LookupInstVo) collAvailable[i];
		
		ims.framework.controls.TreeNode itemNode = null;
		if (parentNode == null)
			itemNode = form.treInstances().getNodes().add(instance, instance.getText());
		else
			itemNode = parentNode.getNodes().add(instance, instance.getText());
		
		if(collSelected != null && collSelected.indexOf(instance) > -1)
		{
			itemNode.setChecked(true);
			if(itemNode.getParent() != null)
				itemNode.getParent().setChecked(true);
		}
			
	
		populateTree(collAvailable[i].getChildren(), itemNode, collSelected);
	}
}
 
Example 11
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 12
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}
 
Example 13
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 14
Project: openmaxims-linux   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection saveInstanceOrder(LookupTypeVo type, LookupInstanceCollection instances) throws StaleObjectException
{
	int typeId = type.getId();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup doType = factory.getLookup(typeId);
	for (int i = 0; i < instances.size(); i++)
	{
		LookupInstVo vo = instances.getIndex(i);
		ims.domain.lookups.LookupInstance doInstance = doType.getInstance(vo.getId());
		doInstance.getText();
		doInstance.setOrder(i);
		doInstance.setParent(getDomLookup(vo.getParentInstance()));
	}
	factory.save(doType);

	refreshCache(type);
	return getLookupInstances(type);
}
 
Example 15
Project: openMAXIMS   File: PatTreatmentPlanUpdateImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection getLookupInstances(LookupTypeVo typeVo)
{
	LookupInstanceCollection collection = new LookupInstanceCollection();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup lookupType = factory.getLookup(typeVo.getId());
	if (null != lookupType)
	{
		java.util.Set set = lookupType.getInstances();
		for (Iterator iter = set.iterator(); iter.hasNext();)
		{
			LookupInstance element = (LookupInstance) iter.next();
			LookupInstVo valueObject = createLookupinstanceVo(element);
			collection.add(valueObject);
		}
	}
	return collection;
}
 
Example 16
Project: openMAXIMS   File: ProtocolConfigurationImpl.java   Source Code and License 6 votes vote down vote up
/**
 * This method will return only those Protocol Actions with an external mapping of type 'Display Text'
 */
public LookupInstanceCollection getProtocolActions() 
{
	LookupTree lookups = (LookupTree) getDomainImpl(LookupTreeImpl.class);
	LookupInstanceCollection coll = lookups.getLookupInstances(new LookupTypeVo(ProtocolActions.TYPE_ID));
	
	LookupInstanceCollection newColl = new LookupInstanceCollection(); // This collection will only contain those with the external mapping
	// Need to loop through and get all the mappings
	for (int i=0; i<coll.size(); i++)
	{
		LookupInstVo vo = coll.getIndex(i);
		vo = lookups.getMappings(vo);
		if (vo.getLookupMappingForExtSystem(TaxonomyType.DISPLAY_TEXT.getText()) != null)
			newColl.add(vo);
	}
	
	return newColl;
}
 
Example 17
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateCombo(LookupTypeVo type)
{
	int typeId = type.getId();
	LookupInstanceCollection instColl;
	if (typeId < 0)
	{
		instColl = domain.getLookupService().getLookupCollection(type, true, false);
	}
	else
	{
		instColl = domain.getLookupService().getLookupCollection(typeId, ClassHelper.getLookupCollectionClass(typeId), ClassHelper.getLookupClass(typeId), true, true);
	}
	form.lyr1().Forms().cmbDefInst().clear();
	for (int i = 0; i < instColl.size(); i++)
	{
		LookupInstVo inst = instColl.getIndex(i);
		form.lyr1().Forms().cmbDefInst().newRow(inst, inst.getText(), inst.getImage());
	}
	
}
 
Example 18
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void saveOrder()
{
	LookupInstanceCollection instColl = new LookupInstanceCollection();
	TreeNode rootNode = getRootNode();

	if (rootNode == null)
		return;

	LookupTypeVo type = (LookupTypeVo) rootNode.getValue();
	TreeNodeCollection coll = rootNode.getNodes();
	if (coll == null)
		return;
	
	addToOrderedColl(coll, instColl);		
	try
	{
		domain.saveInstanceOrder(type, instColl);
	}
	catch (StaleObjectException ex)
	{
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
	}
}
 
Example 19
Project: openMAXIMS   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection getLookupInstances(LookupTypeVo typeVo)
{
	LookupInstanceCollection collection = new LookupInstanceCollection();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup lookupType = factory.getLookup(typeVo.getId());
	if (null != lookupType)
	{
		java.util.Set set = lookupType.getInstances();
		for (Iterator iter = set.iterator(); iter.hasNext();)
		{
			LookupInstance element = (LookupInstance) iter.next();
			LookupInstVo valueObject = createLookupinstanceVo(element);
			collection.add(valueObject);
		}
	}
	return collection;
}
 
Example 20
Project: openMAXIMS   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection saveInstanceOrder(LookupTypeVo type, LookupInstanceCollection instances) throws StaleObjectException
{
	int typeId = type.getId();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup doType = factory.getLookup(typeId);
	for (int i = 0; i < instances.size(); i++)
	{
		LookupInstVo vo = instances.getIndex(i);
		ims.domain.lookups.LookupInstance doInstance = doType.getInstance(vo.getId());
		doInstance.getText();
		doInstance.setOrder(i);
		doInstance.setParent(getDomLookup(vo.getParentInstance()));
	}
	factory.save(doType);

	refreshCache(type);
	return getLookupInstances(type);
}
 
Example 21
Project: openMAXIMS   File: ReferralExternalCodingImpl.java   Source Code and License 6 votes vote down vote up
private boolean searchAfterUncoded(LookupInstanceCollection codingStatuses)
{
	if(codingStatuses == null)
		return false;
	
	for(int i=0; i<codingStatuses.size(); i++)
	{
		if(codingStatuses.getIndex(i) == null)
			continue;
		
		if(CodingStatus.UNCODED.getID() == codingStatuses.getIndex(i).getID())
			return true;
	}
	
	return false;
}
 
Example 22
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private String getCommentsLabel(LookupInstanceCollection selectedLookupInstances)
{
	int size = selectedLookupInstances.size();
	
	StringBuilder tooltip = new StringBuilder();
	tooltip.append(size >0 ? "and also: ":"" );
	
	for (int i=1;i<size;i++)
	{
		boolean oneComment = i == size -1;

		tooltip.append(selectedLookupInstances.getIndex(i).getText() + (oneComment ? "": "; "));
	}	
	
	return tooltip.append(size > 1 ? "." : "").toString();	
}
 
Example 23
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateCommentsSearchFields(LookupInstanceCollection selectedLookupInstances)
{
	form.cmbComment().setValue(null);
	form.txtComments().setValue(null);
	form.txtComments().setTooltip(null);

	if (selectedLookupInstances == null || selectedLookupInstances.size() == 0)
		return;

	int commentsSelectedCount = selectedLookupInstances.size();

	if (commentsSelectedCount >=1)
	{	
		form.cmbComment().setValue((StructuredCodingComment) selectedLookupInstances.getIndex(0));

		if (commentsSelectedCount > 1)
		{
			String strLabel = getCommentsLabel(selectedLookupInstances);
			form.txtComments().setValue(strLabel);
			form.txtComments().setTooltip(strLabel);
		}	
	}
}
 
Example 24
Project: openMAXIMS   File: InpatientClinicalCodingWorklistImpl.java   Source Code and License 6 votes vote down vote up
private String getCodingStatusesLookupIDs(LookupInstanceCollection codingStatuses)
{
	if(codingStatuses == null)
		return null;
	
	int stSize = codingStatuses.size();
	
	if (stSize == 0)
		return null;
	
	StringBuilder str = new StringBuilder();
	String commaStr = "";
	for (int i=0;i<stSize;i++)
	{
		if (codingStatuses.getIndex(i) == null)
			continue;
		
		if((codingStatuses.getIndex(i).getID() == CodingStatus.UNCODED.getID()) || (codingStatuses.getIndex(i).getID() == CodingStatus.INPROGRESS.getID()))
			continue;
		
		str.append(commaStr + codingStatuses.getIndex(i).getID());
		commaStr = ", ";
	}
	
	return str.toString();
}
 
Example 25
Project: openMAXIMS   File: InpatientClinicalCodingWorklistImpl.java   Source Code and License 6 votes vote down vote up
private boolean searchAfterUncoded(LookupInstanceCollection codingStatuses)
{
	if(codingStatuses == null)
		return false;
	
	for(int i=0; i<codingStatuses.size(); i++)
	{
		if(codingStatuses.getIndex(i) == null)
			continue;
		
		if(CodingStatus.UNCODED.getID() == codingStatuses.getIndex(i).getID())
			return true;
	}
	
	return false;
}
 
Example 26
Project: openMAXIMS   File: InpatientClinicalCodingWorklistImpl.java   Source Code and License 6 votes vote down vote up
private boolean searchAfterInProgress(LookupInstanceCollection codingStatuses)
{
	if(codingStatuses == null)
		return false;
	
	for(int i=0; i<codingStatuses.size(); i++)
	{
		if(codingStatuses.getIndex(i) == null)
			continue;
		
		if(CodingStatus.INPROGRESS.getID() == codingStatuses.getIndex(i).getID())
			return true;
	}
	
	return false;
}
 
Example 27
Project: openMAXIMS   File: InpatientClinicalCodingWorklistImpl.java   Source Code and License 6 votes vote down vote up
private String getLookupIDs(LookupInstanceCollection collInstances)
{
	int stSize = collInstances.size();
	if (stSize == 0)
		return null;
	StringBuilder str = new StringBuilder();
	String commaStr = "";
	for (int i=0;i<stSize;i++)
	{
		if (collInstances.getIndex(i) == null)
			continue;
		str.append(commaStr + collInstances.getIndex(i).getID());
		commaStr = ", ";
	}
	return str.toString();
}
 
Example 28
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateTree(TreeNode[] collAvailable, ims.framework.controls.TreeNode parentNode, LookupInstanceCollection collSelected)
{
	if (collAvailable == null)
		return;

	for (int i = 0; i < collAvailable.length; i++)
	{
		SpecimenSite site = (SpecimenSite) collAvailable[i];
		
		ims.framework.controls.TreeNode itemNode = null;
		if (parentNode == null)
			itemNode = form.treInstances().getNodes().add(site, site.getText());
		else
			itemNode = parentNode.getNodes().add(site, site.getText());
		
		if(collSelected.indexOf(site) > -1)
		{
			itemNode.setChecked(true);
			if(itemNode.getParent() != null)
				itemNode.getParent().setChecked(true);
		}
			
	
		populateTree(collAvailable[i].getChildren(), itemNode, collSelected);
	}
}
 
Example 29
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 30
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateDataFromGrid(LookupInstanceCollection data,DynamicGridRowCollection rows)
{
	if (data == null)
		throw new CodingRuntimeException("Data is null. Loading to what?");
	if (isSingleSelect())
	{
		if (form.dyngrdLookup().getValue() instanceof LookupInstVo)
		{
			data.add((LookupInstVo) form.dyngrdLookup().getValue());
			
		}
		return;
	}
	if (rows == null)
		return;
	
	for (int i = 0 ; i < rows.size() ; i++)
	{
		if (Boolean.TRUE.equals(rows.get(i).getCells().get(getColumn(COL_SELECT)).getValue()))
			data.add((LookupInstVo) rows.get(i).getValue());
		populateDataFromGrid(data, rows.get(i).getRows());
	}
	
}
 
Example 31
Project: openMAXIMS   File: PatientImageSelectionImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection getLookupTypeInstance(Integer typeId) 
{
	LookupTypeVo vo = new LookupTypeVo();
	vo.setId(typeId);
	
	LookupTree domainLookupTree = (LookupTree) getDomainImpl(LookupTreeImpl.class);
	return domainLookupTree.getLookupInstances(vo);
}
 
Example 32
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateCombo(LookupTypeVo type)
{
	int typeId = type.getId();
	LookupInstanceCollection instColl;
	if (typeId < 0)
	{
		instColl = domain.getLookupService().getLookupCollection(type, true, false);
	}
	else
	{
		instColl = domain.getLookupService().getLookupCollection(typeId, ClassHelper.getLookupCollectionClass(typeId), ClassHelper.getLookupClass(typeId), true, true);
	}
	form.lyr1().Forms().cmbDefInst().clear();
	for (int i = 0; i < instColl.size(); i++)
	{
		LookupInstVo inst = instColl.getIndex(i);
		form.lyr1().Forms().cmbDefInst().newRow(inst, inst.getText(), inst.getImage());
	}
	
}
 
Example 33
Project: openMAXIMS   File: Logic.java   Source Code and License 6 votes vote down vote up
private void saveOrder()
{
	LookupInstanceCollection instColl = new LookupInstanceCollection();
	TreeNode rootNode = getRootNode();

	if (rootNode == null)
		return;

	LookupTypeVo type = (LookupTypeVo) rootNode.getValue();
	TreeNodeCollection coll = rootNode.getNodes();
	if (coll == null)
		return;
	
	addToOrderedColl(coll, instColl);		
	try
	{
		domain.saveInstanceOrder(type, instColl);
	}
	catch (StaleObjectException ex)
	{
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
	}
}
 
Example 34
Project: openmaxims-linux   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection getLookupInstances(LookupTypeVo typeVo)
{
	LookupInstanceCollection collection = new LookupInstanceCollection();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup lookupType = factory.getLookup(typeVo.getId());
	if (null != lookupType)
	{
		java.util.Set set = lookupType.getInstances();
		for (Iterator iter = set.iterator(); iter.hasNext();)
		{
			LookupInstance element = (LookupInstance) iter.next();
			LookupInstVo valueObject = createLookupinstanceVo(element);
			collection.add(valueObject);
		}
	}
	return collection;
}
 
Example 35
Project: openMAXIMS   File: LookupTreeImpl.java   Source Code and License 6 votes vote down vote up
public LookupInstanceCollection saveInstanceOrder(LookupTypeVo type, LookupInstanceCollection instances) throws StaleObjectException
{
	int typeId = type.getId();
	DomainFactory factory = getDomainFactory();
	ims.domain.lookups.Lookup doType = factory.getLookup(typeId);
	for (int i = 0; i < instances.size(); i++)
	{
		LookupInstVo vo = instances.getIndex(i);
		ims.domain.lookups.LookupInstance doInstance = doType.getInstance(vo.getId());
		doInstance.getText();
		doInstance.setOrder(i);
		doInstance.setParent(getDomLookup(vo.getParentInstance()));
	}
	factory.save(doType);

	refreshCache(type);
	return getLookupInstances(type);
}
 
Example 36
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateCombo(LookupTypeVo type)
{
	int typeId = type.getId();
	LookupInstanceCollection instColl;
	if (typeId < 0)
	{
		instColl = domain.getLookupService().getLookupCollection(type, true, false);
	}
	else
	{
		instColl = domain.getLookupService().getLookupCollection(typeId, ClassHelper.getLookupCollectionClass(typeId), ClassHelper.getLookupClass(typeId), true, true);
	}
	form.lyr1().Forms().cmbDefInst().clear();
	for (int i = 0; i < instColl.size(); i++)
	{
		LookupInstVo inst = instColl.getIndex(i);
		form.lyr1().Forms().cmbDefInst().newRow(inst, inst.getText(), inst.getImage());
	}
	
}
 
Example 37
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateTree(TreeNode[] collAvailable, ims.framework.controls.TreeNode parentNode, LookupInstanceCollection collSelected)
{
	if (collAvailable == null)
		return;

	for (int i = 0; i < collAvailable.length; i++)
	{
		SpecimenSite site = (SpecimenSite) collAvailable[i];
		
		ims.framework.controls.TreeNode itemNode = null;
		if (parentNode == null)
			itemNode = form.treInstances().getNodes().add(site, site.getText());
		else
			itemNode = parentNode.getNodes().add(site, site.getText());
		
		if(collSelected.indexOf(site) > -1)
		{
			itemNode.setChecked(true);
			if(itemNode.getParent() != null)
				itemNode.getParent().setChecked(true);
		}
			
	
		populateTree(collAvailable[i].getChildren(), itemNode, collSelected);
	}
}
 
Example 38
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void populateComboInstance(DynamicGridCell valueCell, int lookupTypeId) 
{
		
	LookupInstanceCollection instColl;
	
	instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, true);
	
    if(instColl == null)
	return;
    
   
    LookupInstVo[] roots = instColl.getRoots();	    
    for (int i = 0; i < roots.length; i++)
	{
    	valueCell.getItems().newItem(roots[i], roots[i].toString());
	}
    valueCell.setAutoPostBack(true);	    	
}
 
Example 39
Project: openmaxims-linux   File: Logic.java   Source Code and License 6 votes vote down vote up
private void saveOrder()
{
	LookupInstanceCollection instColl = new LookupInstanceCollection();
	TreeNode rootNode = getRootNode();

	if (rootNode == null)
		return;

	LookupTypeVo type = (LookupTypeVo) rootNode.getValue();
	TreeNodeCollection coll = rootNode.getNodes();
	if (coll == null)
		return;
	
	addToOrderedColl(coll, instColl);		
	try
	{
		domain.saveInstanceOrder(type, instColl);
	}
	catch (StaleObjectException ex)
	{
		engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue());
	}
}
 
Example 40
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void loadTree(LookupInstanceCollection collSelected)
{
	ims.framework.cn.data.TreeNode[] nodes = null;
	if(form.getGlobalContext().Core.getSelectLookupType().getId() == SpecimenSite.TYPE_ID)
	{
		SpecimenSiteCollection collSites = LookupHelper.getSpecimenSite(domain.getLookupService());
		nodes = collSites.getRootNodes();
	}
		
	populateTree(nodes, null, collSelected);	
}
 
Example 41
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateLinear(LookupInstanceCollection lookupCollection) {
	if (lookupCollection == null)
		return;
	
	for (int i = 0 ; i < lookupCollection.size() ; i++)
	{
		addRow(null, lookupCollection.getIndex(i),0);

		
	}
}
 
Example 42
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateGridFromData(LookupInstanceCollection insts,DynamicGridRowCollection rows)
{
	if (rows == null)
		return;
	
	if (isSingleSelect())
	{
		if (insts == null || insts.size() == 0)
		{
			form.dyngrdLookup().setValue(null);
			return;
		}
		if (insts.size() == 1)
		{
			form.dyngrdLookup().setValue(insts.getIndex(0));
			return;
		}
		throw new CodingRuntimeException("When the component is used as single select you can not set a value that contains more that 1 element");
		
}

	for (int i = 0 ; i < rows.size(); i++)
	{
		DynamicGridRow dgr = rows.get(i);

		dgr.getCells().get(getColumn(COL_SELECT)).setValue(insts != null && insts.indexOf((LookupInstVo) dgr.getValue())>-1);
	
		populateGridFromData(insts, dgr.getRows());
	}
	
}
 
Example 43
Project: AvoinApotti   File: PatientImageSelectionImpl.java   Source Code and License 5 votes vote down vote up
public LookupInstanceCollection getLookupTypeInstance(Integer typeId) 
{
	LookupTypeVo vo = new LookupTypeVo();
	vo.setId(typeId);
	
	LookupTree domainLookupTree = (LookupTree) getDomainImpl(LookupTreeImpl.class);
	return domainLookupTree.getLookupInstances(vo);
}
 
Example 44
Project: AvoinApotti   File: VoMapper.java   Source Code and License 5 votes vote down vote up
private LookupInstVo checkForExistingLookupInstance(int typeId, String lookupText)
{
	LookupInstanceCollection coll = svc.getLookupCollection(new LookupTypeVo(typeId));
	for (int i = 0; i < coll.size(); i++)
	{
		if (coll.getIndex(i).getText().equalsIgnoreCase(lookupText))
			return coll.getIndex(i);
	}
	return null;
}
 
Example 45
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateLookupTree(Integer lookupTypeId, Boolean activeOnly, Boolean showInstancesImage) 
{
	if(lookupTypeId == null)
		return;
	
	if(activeOnly == null)
		activeOnly = true;
	
	if(showInstancesImage == null)
		showInstancesImage = false;
	
	LookupTypeVo lookupType = new LookupTypeVo(lookupTypeId);
	LookupInstanceCollection instColl;
	
	if (lookupTypeId < 0)
	{
		instColl = domain.getLookupService().getLookupCollection(lookupType, true, activeOnly);
	}
	else
	{
		instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, activeOnly);
	}
	
	if(instColl == null)
		return;
	
	LookupInstVo[] roots = instColl.getRoots();
	
	fillLookupHierarchy(null, roots, showInstancesImage);
}
 
Example 46
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
/**
 * @param node
 * @param instColl
 *            populate a types instance nodes
 */
private void populateTree(TreeNode node, LookupInstanceCollection instColl, int nodeType, boolean isHierarchical)
{
	int instNodeType = form.treTypes().getNodes().size() + 1;
	LookupInstVo[] roots = instColl.getRoots();
	for (int j = 0; j < roots.length; j++)
	{
		LookupInstVo inst = roots[j];
		if (inst.isActive() == false && form.chkActiveOnly().getValue() == true)
			continue;
		TreeNode newNode = null;
		if (inst.getId() < 0 || !isHierarchical)
		{
			newNode = node.getNodes().add(inst, getDisplayString(inst), instNodeType, true);
		}
		else
		{
			newNode = node.getNodes().add(inst, getDisplayString(inst), instNodeType, new int[]{nodeType,instNodeType}, true);
		}				 
		Image img = getCorrectImage(inst);
		newNode.setExpandedImage(img);
		newNode.setCollapsedImage(img);
		newNode.setSelectedImage(img);

		fillLookupHierarchy(newNode, inst, nodeType, isHierarchical);
	}
}
 
Example 47
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addToOrderedColl(TreeNodeCollection nodes, LookupInstanceCollection instColl)
{
	if (nodes == null) return;
	for (int i = 0; i < nodes.size(); i++)
	{
		TreeNode node = nodes.get(i);
		LookupInstVo val = (LookupInstVo) node.getValue();			
		if (val != null)
			instColl.add(val);
		addToOrderedColl(node.getNodes(), instColl);
	}
}
 
Example 48
Project: AvoinApotti   File: ActivityImpl.java   Source Code and License 5 votes vote down vote up
public ActivityVoCollection listNTPFActivities(Boolean isActive, LookupInstanceCollection activityTypeInstancesToExclude) 
{
    DomainFactory factory = getDomainFactory();		
    
    String hql = " from Activity act "; 
    ArrayList markers = new ArrayList();
	ArrayList values = new ArrayList();
	StringBuffer condStr = new StringBuffer();
	String andStr = " ";
  
    if(isActive != null)
    {
    	condStr.append(andStr + " act.isActive = :isActive" );
		markers.add("isActive");
		values.add(isActive);		
		andStr = " and ";
    }
    if(activityTypeInstancesToExclude != null)
    {
    	for(int i=0;i<activityTypeInstancesToExclude.size();i++)
    	{
    		String paramName = "actType" + String.valueOf(i);
    		condStr.append(andStr + " act.activityType <> " + ":" + paramName );
			markers.add(paramName);
			values.add(getDomLookup(activityTypeInstancesToExclude.getIndex(i)));		
			andStr = " and ";
    	}
    }
	
    if(andStr.equals( " and "))
    	hql += " where ";
    
    hql += condStr.toString();
    List activities = factory.find(hql,markers,values);
    return ActivityVoAssembler.createActivityVoCollectionFromActivity(activities).sort();		
	
}
 
Example 49
Project: AvoinApotti   File: RulesEditorComponentImpl.java   Source Code and License 5 votes vote down vote up
public LookupInstanceCollection  getLookupTypeInstance(Integer typeId) 
{
	LookupTypeVo vo = new LookupTypeVo();
	vo.setId(typeId);
	
	LookupTree domainLookupTree = (LookupTree) getDomainImpl(LookupTreeImpl.class);
	return domainLookupTree.getLookupInstances(vo);
}
 
Example 50
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateSitesGrid()
{
	// get the collection of lookup instances and add a site row for each
	// one
	LookupInstanceCollection collSelected = form.getGlobalContext().Core.getSelectedLookupInstances();
	if (collSelected.size() == 0)
	{
		form.getContextMenus().getOCRRSpecimenSiteMOVE_UPItem().setVisible(false);
		form.getContextMenus().getOCRRSpecimenSiteMOVE_DOWNItem().setVisible(false);

	}

	form.lyrSelection().tabSites().grdSites().getRows().clear();

	for (int i = 0; i < collSelected.size(); i++)
	{
		grdSitesRow row = form.lyrSelection().tabSites().grdSites().getRows().newRow();
		row.setColSite((SpecimenSite) collSelected.getIndex(i));
		row.setValue((SpecimenSite) collSelected.getIndex(i));
	}

	form.getContextMenus().getOCRRSpecimenSiteSORTItem().setVisible(form.lyrSelection().tabSites().grdSites().getRows().size() > 0);
	if (form.lyrSelection().tabSites().grdSites().getSelectedRow() == null)
	{
		form.getContextMenus().getOCRRSpecimenSiteMOVE_UPItem().setVisible(false);
		form.getContextMenus().getOCRRSpecimenSiteMOVE_DOWNItem().setVisible(false);
	}

}
 
Example 51
Project: AvoinApotti   File: PathwayTargetConfigDialogImpl.java   Source Code and License 5 votes vote down vote up
private String getIdString(LookupInstanceCollection statusCollection)
{
	String idString = "";
	
	for(int i=0;i<statusCollection.size();i++)
	{
		idString += statusCollection.getIndex(i).getID();
		idString += ((statusCollection.size() - (i+1)) > 0 ? "," : "");
	}
	
	return idString;
}
 
Example 52
Project: AvoinApotti   File: Logic.java   Source Code and License 5 votes vote down vote up
protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException
{
	if(args != null )
	{
	
		Boolean activeOnly = true;
		LookupInstanceCollection instColl = null;
		Integer lookupTypeId = 0;
		
		if((args.length == 1 && args[0] != null && args[0] instanceof Integer))
		{
							
			lookupTypeId = (Integer) args[0];
			instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, activeOnly);
		}
		else if(args.length == 3 && args[0] != null && args[1] != null && args[2] != null && args[0] instanceof Integer && args[1] instanceof String && args[2] instanceof String)
		{
			lookupTypeId = (Integer) args[0];
			String Reason = (String)args[1];
			String Comment = (String) args[2];
			form.lblReason().setValue(Reason);
			form.lblComment().setValue(Comment);
			instColl = domain.getLookupService().getLookupCollection(lookupTypeId, ClassHelper.getLookupCollectionClass(lookupTypeId), ClassHelper.getLookupClass(lookupTypeId), true, activeOnly);
		}
		
		if(	instColl == null)
			return;
		
		
		LookupInstVo[] roots = instColl.getRoots();
		populateReasonCombo(roots);
					
	}
}
 
Example 53
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateTree(LookupInstanceCollection instColl, RadioTxToxicityTypeVoCollection voColl)
{
	LookupInstVo[] roots = instColl.getRoots();
	for (int j = 0; j < roots.length; j++)
	{
		LookupInstVo inst = roots[j];

		grdToxicityRow newRow = form.grdToxicity().getRows().newRow();
	//	newRow.setColToxicity(inst.getText());
		newRow.setColToxicity(((RadioTherapyToxicityType)inst).getText());

		fillToxicity(newRow, inst, voColl);
	}
	form.grdToxicity().expandAll();
}
 
Example 54
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void loadTree(LookupInstanceCollection collSelected)
{
	ims.framework.cn.data.TreeNode[] nodes = null;
	LookupService lookupService = domain.getLookupService();
	if(form.getGlobalContext().Core.getSelectLookupType().getId() == SpecimenSite.TYPE_ID)
	{
		SpecimenSiteCollection collSites = LookupHelper.getSpecimenSite(lookupService);
		nodes = collSites.getRootNodes();
	}
	else if (form.getGlobalContext().Core.getSelectLookupType().getId() == StructuredCodingComment.TYPE_ID)
	{
		engine.setCaption("Select Comments");
		StructuredCodingCommentCollection collComments = ims.clinical.vo.lookups.LookupHelper.getStructuredCodingComment(lookupService);
		nodes = collComments.getRootNodes();
	}
	else if (form.getGlobalContext().Core.getSelectLookupType().getId() == ReferralUrgency.TYPE_ID)
	{
		engine.setCaption("Select Referral Urgencies");
		ReferralUrgencyCollection collUrgencies = ims.RefMan.vo.lookups.LookupHelper.getReferralUrgency(lookupService);
		nodes = collUrgencies.getRootNodes();
	}
	else if (form.getGlobalContext().Core.getSelectLookupType().getId() == ProfileListType.TYPE_ID)
	{
		engine.setCaption("Select List Type(s)");
		ProfileListTypeCollection collListTypes = ims.scheduling.vo.lookups.LookupHelper.getProfileListType(lookupService);
		nodes = collListTypes.getRootNodes();
	}
	populateTree(nodes, null, collSelected);
	form.chkSelectAll().setValue(allNodesChecked());
}
 
Example 55
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private LookupInstanceCollection retrieveSelection(TreeNodeCollection collection, LookupInstanceCollection collSelected)
{			
	for(int i=0;i<collection.size();i++)
	{
		ims.framework.controls.TreeNode node = collection.get(i);
		if(node.isChecked() && (node.getNodes() == null || node.getNodes().size() == 0))
			collSelected.add((LookupInstVo) node.getValue());
		
		retrieveSelection(node.getNodes(), collSelected);
	}
	
	return collSelected;
}
 
Example 56
Project: openmaxims-linux   File: Logic.java   Source Code and License 5 votes vote down vote up
private void addToOrderedColl(TreeNodeCollection nodes, LookupInstanceCollection instColl)
{
	if (nodes == null) return;
	for (int i = 0; i < nodes.size(); i++)
	{
		TreeNode node = nodes.get(i);
		LookupInstVo val = (LookupInstVo) node.getValue();			
		if (val != null)
			instColl.add(val);
		addToOrderedColl(node.getNodes(), instColl);
	}
}
 
Example 57
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void populateGridFromData(LookupInstanceCollection insts,DynamicGridRowCollection rows)
{
	if (rows == null)
		return;
	
	if (isSingleSelect())
	{
		if (insts == null || insts.size() == 0)
		{
			form.dyngrdLookup().setValue(null);
			return;
		}
		if (insts.size() == 1)
		{
			form.dyngrdLookup().setValue(insts.getIndex(0));
			return;
		}
		throw new CodingRuntimeException("When the component is used as single select you can not set a value that contains more that 1 element");
		
}

	for (int i = 0 ; i < rows.size(); i++)
	{
		DynamicGridRow dgr = rows.get(i);

		dgr.getCells().get(getColumn(COL_SELECT)).setValue(insts != null && insts.indexOf((LookupInstVo) dgr.getValue())>-1);
	
		populateGridFromData(insts, dgr.getRows());
	}
	
}
 
Example 58
Project: openMAXIMS   File: PatientImageSelectionImpl.java   Source Code and License 5 votes vote down vote up
public LookupInstanceCollection getLookupTypeInstance(Integer typeId) 
{
	LookupTypeVo vo = new LookupTypeVo();
	vo.setId(typeId);
	
	LookupTree domainLookupTree = (LookupTree) getDomainImpl(LookupTreeImpl.class);
	return domainLookupTree.getLookupInstances(vo);
}
 
Example 59
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private void loadGroupSiteGrid() 
{
	LookupInstanceCollection coll = domain.loadGroupSiteLookup(domain.getLookupService()) != null ? domain.loadGroupSiteLookup(domain.getLookupService()) : null; //wdev-13961 
	
	if (coll == null)
		return;

	LookupInstVo[] roots = coll.getRoots();
	for (int k = 0; k < roots.length; k++)
	{
		LookupInstVo inst = roots[k];
		boolean bShowTick = false;
		TreatmentGroupSite tgs = new TreatmentGroupSite(inst.getId(), inst.getText(), inst.isActive(), null, inst.getImage(),inst.getColor(), inst.getOrder());
		
		bShowTick = showTick(tgs);

		if (inst.isActive() 
				|| bShowTick ) // bShowTick - may even show a Group/Site that is marked as inactive - but was instantiated at some stage.
		{
			TreeNode parentNode = form.treeTreatmentSite().getNodes().add(inst,inst.getText());

			parentNode.setCheckBoxVisible(true);

			parentNode.setChecked(bShowTick);

			addChildInstances(parentNode, inst);
		}

	}		
}
 
Example 60
Project: openMAXIMS   File: Logic.java   Source Code and License 5 votes vote down vote up
private Unit getUnitLkp(LookupInstanceCollection unitInstColl, String energy_unit) 
{
	for (int i=0;i<unitInstColl.size();i++) {
		LookupInstVo element = unitInstColl.getIndex(i);
		
		if (element.getID() == new Integer(energy_unit).intValue())
			return (Unit)element;
	}
	return null;
}