uk.ac.ebi.intact.application.editor.struts.view.interaction
Class InteractionViewBean

java.lang.Object
  |
  +--uk.ac.ebi.intact.application.editor.struts.framework.util.AbstractEditViewBean
        |
        +--uk.ac.ebi.intact.application.editor.struts.view.interaction.InteractionViewBean
All Implemented Interfaces:
java.io.Serializable

public class InteractionViewBean
extends AbstractEditViewBean

Interaction edit view bean.

Version:
$Id: InteractionViewBean.java,v 1.36 2004/03/24 11:35:00 smudali Exp $
Author:
Sugath Mudali (smudali@ebi.ac.uk)
See Also:
Serialized Form

Constructor Summary
InteractionViewBean()
           
 
Method Summary
 void addExperiment(ExperimentBean expbean)
          Adds an Experiment.
 void addExperimentToHold(java.util.Collection exps)
          Adds an Experiment bean to hold if the new experiment doesn't already exists in the experiment hold collection and in the current experiment collection for this interaction.
 void addProtein(Protein protein)
          Adds an Protein.
 void addProteinToUpdate(ProteinBean pb)
          Adds a Protein bean to update.
 void addToRecentList(EditUserI user)
          Adds the current edit object to the recent edited item list.
 void clear()
          Deletes all the links to sub objects of the current edit object.
 void clearExperimentToHold()
          Clears all the experiments on hold.
 void clearTransactions()
          Clears any pending xrefs and annotations stored in the transaction containers.
 void delExperiment(ExperimentBean expbean)
          Removes an Experiment
 void delProtein(int pos)
          Removes a Protein from given position.
 boolean experimentExists(ExperimentBean expbean)
          True if given experiment exists in this object's experiment collection.
 java.util.List getAddBioSourceMenu()
           
 java.util.List getAddProteinRoleMenu()
          Returns the add menu for a Protein role.
 java.util.List getEditProteinRoleMenu()
          Returns the edit menu for a Protein role.
 ExperimentBean getExperiment(int index)
          Returns an ExperimentBean at given location.
 java.util.List getExperiments()
          Returns a collection of ExperimentBean objects.
 java.lang.String getHelpTag()
          Returns the help tag link for the current view bean; subclasses must override this method to return the help tag (if necessary) or else the link to the CV editor is returned.
 ExperimentBean getHoldExperiment(int index)
          Returns an ExperimentBean from a collection of 'hold' experiments at given location.
 java.util.List getHoldExperiments()
          Returns a collection of ExperimentBean objects on hold.
 java.lang.String getInteractionType()
           
 java.util.List getInteractionTypeMenu()
          The interaction type menu list.
 java.lang.Float getKD()
           
 java.lang.String getOrganism()
           
 java.util.List getOrganismMenu()
          The organism menu list.
 ProteinBean getProtein(int index)
          Returns a ProteinBean at given location.
 java.util.List getProteins()
          Returns a collection of ProteinBean objects.
 java.lang.String getSourceExperimentAc()
          Returns the AC of the source experiment.
 boolean hasDuplicates(ProteinBean pb)
          True if given protein bean already exists among current saved proteins.
 void hideExperimentToHold(ExperimentBean expbean)
          Hides an Experiment bean from hold.
 boolean isSourceFromAnExperiment()
          True when this bean is constructed from an experiment.
 void persistOthers(EditUserI user)
          Persist any sub objects of the edited object.
 void removeFromRecentList(EditUserI user)
          Removes the current edit object from the recent edited item list.
 void removeUnsavedProteins()
          Removes all the unsaved proteins for the current protein collection.
protected  void reset(AnnotatedObject annobj)
          Resets with the bean using an existing Annotated object.
protected  void reset(java.lang.Class clazz)
          Resets the bean with the current edit class.
 void sanityCheck(EditUserI user)
          Performs sanity check on a bean.
 void setInteractionType(java.lang.String interaction)
           
 void setKD(java.lang.Float kd)
           
 void setLayout(org.apache.struts.tiles.ComponentContext context)
          Sets the layout in given context.
 void setOrganism(java.lang.String organism)
           
 void setSourceExperimentAc(java.lang.String ac)
          Set the AC of the source experiment.
protected  void updateAnnotatedObject(EditUserI user)
          Gathers values in the view bean and updates the existing AnnotatedObject if it exists or create a new annotated object for the view and sets the annotated object.
 void updateFromForm(org.apache.struts.action.DynaActionForm dynaform)
          Updates the internal data from given form.
 void validate(EditUserI user)
          Validates the data in the view bean.
 
Methods inherited from class uk.ac.ebi.intact.application.editor.struts.framework.util.AbstractEditViewBean
addAnnotation, addXref, delAnnotation, delXref, equals, getAc, getAcLink, getAddDatabaseMenu, getAddTopicMenu, getAddXrefMenus, getAnnotatedObject, getAnnotations, getDefaultXrefQualifier, getEditClass, getEditDatabaseMenu, getEditorMenus, getEditTopicMenu, getEditXrefMenus, getFullName, getMenuFactory, getReadOnly, getShortLabel, getXrefs, persist, reset, saveComment, saveXref, setAnnotatedObject, setFullName, setMenuFactory, setShortLabel
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractionViewBean

public InteractionViewBean()
Method Detail

reset

protected void reset(java.lang.Class clazz)
Description copied from class: AbstractEditViewBean
Resets the bean with the current edit class. This method is called when creating a new annotated object (only the class or the type is known at that time).

Overrides:
reset in class AbstractEditViewBean
Parameters:
clazz - the Class of the new annotated object.

reset

protected void reset(AnnotatedObject annobj)
Description copied from class: AbstractEditViewBean
Resets with the bean using an existing Annotated object.

Overrides:
reset in class AbstractEditViewBean
Parameters:
annobj - AnnotatedObject object to set this bean.

updateAnnotatedObject

protected void updateAnnotatedObject(EditUserI user)
                              throws SearchException
Description copied from class: AbstractEditViewBean
Gathers values in the view bean and updates the existing AnnotatedObject if it exists or create a new annotated object for the view and sets the annotated object.

Specified by:
updateAnnotatedObject in class AbstractEditViewBean
Parameters:
user - to access the persistent system.
Throws:
SearchException - for errors in searching the persistent system.
 post: getAnnotatedObject() != null
 

persistOthers

public void persistOthers(EditUserI user)
                   throws IntactException,
                          SearchException
Description copied from class: AbstractEditViewBean
Persist any sub objects of the edited object. For example, proteins need to be persisted in a separate transaction for an Interaction

Overrides:
persistOthers in class AbstractEditViewBean
Parameters:
user - handler to the user to persist sub objects.
Throws:
SearchException - for errors in searching for objects in the persistent system.
IntactException - for errors in persisting.

addToRecentList

public void addToRecentList(EditUserI user)
Description copied from class: AbstractEditViewBean
Adds the current edit object to the recent edited item list. Interaction or Experiment beans must override this method.

Overrides:
addToRecentList in class AbstractEditViewBean
Parameters:
user - the user handle to add to the recent list.

removeFromRecentList

public void removeFromRecentList(EditUserI user)
Description copied from class: AbstractEditViewBean
Removes the current edit object from the recent edited item list. Interaction or Experiment beans must override this method.

Overrides:
removeFromRecentList in class AbstractEditViewBean
Parameters:
user - the user handle to remove from the recent list.

clear

public void clear()
Description copied from class: AbstractEditViewBean
Deletes all the links to sub objects of the current edit object.

Overrides:
clear in class AbstractEditViewBean

setLayout

public void setLayout(org.apache.struts.tiles.ComponentContext context)
Description copied from class: AbstractEditViewBean
Sets the layout in given context. This method is currently empty as the layout defaults to cv layout. Override this method to provide editor specific layout.

Overrides:
setLayout in class AbstractEditViewBean
Parameters:
context - the Tiles context to set the layout.

getHelpTag

public java.lang.String getHelpTag()
Description copied from class: AbstractEditViewBean
Returns the help tag link for the current view bean; subclasses must override this method to return the help tag (if necessary) or else the link to the CV editor is returned.

Overrides:
getHelpTag in class AbstractEditViewBean
Returns:
the tag as a String for the current view bean.

updateFromForm

public void updateFromForm(org.apache.struts.action.DynaActionForm dynaform)
Description copied from class: AbstractEditViewBean
Updates the internal data from given form.

Overrides:
updateFromForm in class AbstractEditViewBean
Parameters:
dynaform - the form to update the internal data.

sanityCheck

public void sanityCheck(EditUserI user)
                 throws ValidationException,
                        SearchException
Description copied from class: AbstractEditViewBean
Performs sanity check on a bean. Currently this method doesn't provide checks. Subclass must override this method to provide checks relevant to a view bean.

Overrides:
sanityCheck in class AbstractEditViewBean
Throws:
SearchException - for errors in searching for objects in the persistent system.
ValidationException - if sanity check fails.

validate

public void validate(EditUserI user)
              throws ValidationException,
                     SearchException
Description copied from class: AbstractEditViewBean
Validates the data in the view bean.

Overrides:
validate in class AbstractEditViewBean
Parameters:
user - handler to the user to access the DB.
Throws:
ValidationException - thrown when this bean contains invalid data. For example, an experiment must contain non null values for organism, interaction and identification. Currently this method is empty as no validations are preformed.
SearchException

getOrganismMenu

public java.util.List getOrganismMenu()
                               throws SearchException
The organism menu list.

Returns:
the organism menu consisting of organism short labels. The first item in the menu may contain '---Select---' if the current organism is not set.
Throws:
SearchException - for errors in generating menus.

getInteractionTypeMenu

public java.util.List getInteractionTypeMenu()
                                      throws SearchException
The interaction type menu list.

Returns:
the interaction type menu consisting of interaction type short labels. The first item in the menu may contain '---Select---' if the current interaction type is not set.
Throws:
SearchException - for errors in generating menus.

getEditProteinRoleMenu

public java.util.List getEditProteinRoleMenu()
                                      throws SearchException
Returns the edit menu for a Protein role.

Returns:
the Protein role menu.
Throws:
SearchException - for errors in constructing the menu.

getAddProteinRoleMenu

public java.util.List getAddProteinRoleMenu()
                                     throws SearchException
Returns the add menu for a Protein role.

Returns:
the Protein role menu.
Throws:
SearchException - for errors in constructing the menu.

getAddBioSourceMenu

public java.util.List getAddBioSourceMenu()
                                   throws SearchException
SearchException

setKD

public void setKD(java.lang.Float kd)

getKD

public java.lang.Float getKD()

setOrganism

public void setOrganism(java.lang.String organism)

getOrganism

public java.lang.String getOrganism()

setInteractionType

public void setInteractionType(java.lang.String interaction)

getInteractionType

public java.lang.String getInteractionType()

addExperiment

public void addExperiment(ExperimentBean expbean)
Adds an Experiment.

Parameters:
expbean - the Experiment bean to add.
 post: myExperimentsToAdd = myExperimentsToAdd@pre + 1
 post: myExperiments = myExperiments@pre + 1
 

experimentExists

public boolean experimentExists(ExperimentBean expbean)
True if given experiment exists in this object's experiment collection.

Parameters:
expbean - the bean to compare.
Returns:
true expbean exists in this object's experiment collection. The comparision uses the equals method of ExperimentBean class.
 post: return->true implies myExperimentsToAdd.exists(exbean)
 

delExperiment

public void delExperiment(ExperimentBean expbean)
Removes an Experiment

Parameters:
expbean - the Experiment bean to remove.
 post: myExperimentsToDel = myExperimentsToDel@pre - 1
 post: myExperiments = myExperiments@pre - 1
 

addExperimentToHold

public void addExperimentToHold(java.util.Collection exps)
Adds an Experiment bean to hold if the new experiment doesn't already exists in the experiment hold collection and in the current experiment collection for this interaction.

Parameters:
exps - a collection of Experiment to add.
 pre:  forall(obj : Object | obj.oclIsTypeOf(Experiment))
 

hideExperimentToHold

public void hideExperimentToHold(ExperimentBean expbean)
Hides an Experiment bean from hold.

Parameters:
expbean - an ExperimentBean to hide.
 pre: myExperimentsToHold->includes(expbean)
 post: myExperimentsToHold = myExperimentsToHold@pre - 1
 

clearExperimentToHold

public void clearExperimentToHold()
Clears all the experiments on hold.


getExperiments

public java.util.List getExperiments()
Returns a collection of ExperimentBean objects.
 post: return != null
 post: return->forall(obj : Object | obj.oclIsTypeOf(ExperimentBean))
 


getHoldExperiments

public java.util.List getHoldExperiments()
Returns a collection of ExperimentBean objects on hold.
 post: return != null
 post: return->forall(obj : Object | obj.oclIsTypeOf(ExperimentBean))
 


getExperiment

public ExperimentBean getExperiment(int index)
Returns an ExperimentBean at given location.

Parameters:
index - the position to return ExperimentBean.
Returns:
ExperimentBean at index.
 pre: index >=0 and index < myExperiments->size
 post: return != null
 post: return = myExperiments->at(index)
 

getHoldExperiment

public ExperimentBean getHoldExperiment(int index)
Returns an ExperimentBean from a collection of 'hold' experiments at given location.

Parameters:
index - the position to return ExperimentBean.
Returns:
ExperimentBean at index from 'hold' (or experiment not yet added) collection.
 pre: index >=0 and index < myExperimentsToHold->size
 post: return != null
 post: return = myExperimentsToHold->at(index)
 

addProtein

public void addProtein(Protein protein)
Adds an Protein.

Parameters:
protein - the Protein to add.
 post: myProteins = myProteins@pre + 1
 

delProtein

public void delProtein(int pos)
Removes a Protein from given position.

Parameters:
pos - the position in the current Protein collection.
 post: myProteinsToDel = myProteinsToDel@pre + 1
 post: myProteins = myProteins@pre - 1
 

addProteinToUpdate

public void addProteinToUpdate(ProteinBean pb)
Adds a Protein bean to update.

Parameters:
pb - a ProteinBean object to update.
 post: myProteinsToUpdate = myProteinsToUpdate@pre + 1
 post: myProteins = myProteins@pre
 

removeUnsavedProteins

public void removeUnsavedProteins()
Removes all the unsaved proteins for the current protein collection. A protein bean whose state equivalent to ProteinBean.SAVE_NEW is considered as unsaved.


hasDuplicates

public boolean hasDuplicates(ProteinBean pb)
True if given protein bean already exists among current saved proteins.

Parameters:
pb - the bean to compare.
Returns:
true if another 'saved' already exists.

getProteins

public java.util.List getProteins()
Returns a collection of ProteinBean objects.
 post: return != null
 post: return->forall(obj : Object | obj.oclIsTypeOf(ProteinBean))
 


getProtein

public ProteinBean getProtein(int index)
Returns a ProteinBean at given location.

Parameters:
index - the position to return ProteinBean.
Returns:
ProteinBean at index.
 pre: index >=0 and index < myProteins->size
 post: return != null
 post: return = myProteins->at(index)
 

clearTransactions

public void clearTransactions()
Description copied from class: AbstractEditViewBean
Clears any pending xrefs and annotations stored in the transaction containers.
 post: myAnnotsToAdd->isEmpty
 post: myAnnotsToDel->isEmpty
 post: myAnnotsToUpdate->isEmpty
 post: myXrefsToAdd->isEmpty
 post: myXrefsToDel->isEmpty
 post: myXrefsToUpdate->isEmpty
 

Overrides:
clearTransactions in class AbstractEditViewBean

getSourceExperimentAc

public java.lang.String getSourceExperimentAc()
Returns the AC of the source experiment.

Returns:
the AC of the source experiment if it is set; othewise null is returned.

setSourceExperimentAc

public void setSourceExperimentAc(java.lang.String ac)
Set the AC of the source experiment.

Parameters:
ac - the AC of the source experiment.

isSourceFromAnExperiment

public boolean isSourceFromAnExperiment()
True when this bean is constructed from an experiment.

Returns:
true if this bean is constructed from an experiment. For all otheer instances, false is returned.


IntAct Project - EMBL-EBI 2004 - intact-help@ebi.ac.uk