salomeTMF_plug.pluginxlsxml.Import
Class ImportXML2

java.lang.Object
  extended by salomeTMF_plug.pluginxlsxml.Import.ImportXML2
All Implemented Interfaces:
org.objectweb.salome_tmf.api.ApiConstants, org.objectweb.salome_tmf.ihm.IHMConstants, org.objectweb.salome_tmf.plugins.core.XMLLoaderPlugin

public class ImportXML2
extends java.lang.Object
implements org.objectweb.salome_tmf.api.ApiConstants, org.objectweb.salome_tmf.ihm.IHMConstants, org.objectweb.salome_tmf.plugins.core.XMLLoaderPlugin

Author:

Field Summary
 
Fields inherited from interface org.objectweb.salome_tmf.api.ApiConstants
ADMIN_SALOME_NAME, ADMINDESC, ADMINNAME, AUTOMATIC, COMMON_REQ, CONFIG_FILE_PATH, COPIE_CAMPAIGN, COPIE_FAMILY, COPIE_TEST, COPIE_TEST_LIST, DEFAULT_DATA_SET, DEFAULT_FAMILY_DESC, DEFAULT_FAMILY_NAME, DEFAULT_TESTLIST_DESC, DEFAULT_TESTLIST_NAME, DELETE_ACTION, DELETE_ATTACHMENT, DELETE_CAMPAIGN, DELETE_DATA_SET, DELETE_ENVIRONMENT, DELETE_EXECUTION, DELETE_EXECUTION_RESULT, DELETE_EXECUTION_TEST_RESULT, DELETE_FAMILY, DELETE_GROUP, DELETE_LOCK, DELETE_PARAMETER, DELETE_PARAMETER_FROM_TEST, DELETE_PARAMETER_INTO_ENV, DELETE_PROJECT, DELETE_PROJECT_CONF, DELETE_SCRIPT, DELETE_SUITE, DELETE_TEST, DELETE_TEST_FROM_CAMPAIGN, DELETE_USER, DELETE_USER_FROM_GROUP, DEVDESC, DEVNAME, EMPTY_NAME, FAIL, FINISHED, GUESTDESC, GUESTNAME, INCOMPLETED, INIT_SCRIPT, INSERT_ACTION, INSERT_ATTACHMENT, INSERT_CAMPAIGN, INSERT_DATA_SET, INSERT_ENV_INTO_EXEC, INSERT_ENVIRONMENT, INSERT_EXECUTION, INSERT_EXECUTION_RESULT, INSERT_EXECUTION_TEST_RESULT, INSERT_FAMILY, INSERT_GROUP, INSERT_LOCK, INSERT_PARAMETER, INSERT_PARAMETER_INTO_ACTION, INSERT_PARAMETER_INTO_ENV, INSERT_PARAMETER_INTO_TEST, INSERT_PROJECT, INSERT_SCRIPT, INSERT_SUITE, INSERT_TEST, INSERT_TEST_INTO_CAMPAIGN, INSERT_USER, INSERT_USER_INTO_GROUP, INTERRUPT, LOADING, MANUAL, PATH_TO_ADD_TO_TEMP, POST_SCRIPT, PRE_SCRIPT, READ_LOCK, SUCCESS, TEST_SCRIPT, UNKNOWN, UPDATE_ACTION, UPDATE_ATTACHMENT, UPDATE_CAMPAIGN, UPDATE_DATA_SET, UPDATE_ENVIRONMENT, UPDATE_EXECUTION, UPDATE_EXECUTION_RESULT, UPDATE_EXECUTION_TEST_RESULT, UPDATE_FAMILY, UPDATE_GROUP, UPDATE_PARAMETER, UPDATE_PARAMETER_INTO_ENV, UPDATE_PASSWORD, UPDATE_PERMISSION, UPDATE_PROJECT, UPDATE_SUITE, UPDATE_TEST, UPDATE_USER
 
Fields inherited from interface org.objectweb.salome_tmf.ihm.IHMConstants
CAMPAIGN_ROOT_NAME, PATH_TO_ADD_PROJECT_ICON, PATH_TO_ADMIN_GRP_ICON, PATH_TO_ADMIN_ICON, PATH_TO_ARROW_BACK_ICON, PATH_TO_ARROW_DOWN_ICON, PATH_TO_ARROW_ICON, PATH_TO_ARROW_UP_ICON, PATH_TO_BDD_ATTACH_ICON, PATH_TO_BLUE_ICON, PATH_TO_BROWN_ICON, PATH_TO_CAUTION_ICON, PATH_TO_DEFAULT_GRP_ICON, PATH_TO_DELETE_ICON, PATH_TO_ENGRENAGE_ICON, PATH_TO_FAIL_ICON, PATH_TO_FAIL2_ICON, PATH_TO_FILE_ATTACH_ICON, PATH_TO_FREEZED_PROJECT_ICON, PATH_TO_GOON_ICON, PATH_TO_GRAY_ICON, PATH_TO_GREEN_ICON, PATH_TO_ICAL_ICON, PATH_TO_MOVE_ICON, PATH_TO_OTHER_GRP_ICON, PATH_TO_PARAM_ICON, PATH_TO_PINK_ICON, PATH_TO_PROJECT_ICON, PATH_TO_PURPLE_ICON, PATH_TO_QSSCORE_ICON, PATH_TO_RED_ICON, PATH_TO_SALOME_INTRO_ICON, PATH_TO_SCREENSHOT_ICON, PATH_TO_STOP_ICON, PATH_TO_SUCCESS_ICON, PATH_TO_UNKNOW_ICON, PATH_TO_URL_ATTACH_ICON, PATH_TO_USER_ICON, PATH_TO_VIEW_ATTACH_ICON, PATH_TO_YELLOW_ICON, TEST_ROOT_NAME
 
Constructor Summary
ImportXML2(javax.swing.JDialog dialog, org.dom4j.Document document, java.util.ArrayList<org.objectweb.salome_tmf.data.Family> familySelectionList, java.util.ArrayList<org.objectweb.salome_tmf.data.TestList> suiteSelectionList, java.util.ArrayList<org.objectweb.salome_tmf.data.Test> testSelectionList, org.objectweb.salome_tmf.data.AdminVTData adminVTData, org.objectweb.salome_tmf.plugins.IPlugObject plugObject)
           
 
Method Summary
 void ajouterActions(org.dom4j.Element testElem, org.objectweb.salome_tmf.data.ManualTest test)
          Dans le cas où le test n'etait pas deja dans la BD, ajout des actions
 void ajouterAttachements(org.dom4j.Element elem, org.objectweb.salome_tmf.data.WithAttachment attachableElement)
          Dans le cas où attachableElement n'etait pas deja dans la BD, ajout des attachements
 void ajouterExecutions(org.dom4j.Element campElem, org.objectweb.salome_tmf.data.Campaign pCamp)
          Methode qui ajoute les executions aux campagnes qui n'etait pas au prealable dans la BD
 void ajouterResulExecs(org.dom4j.Element execElem, org.objectweb.salome_tmf.data.Execution pExecution)
          Methode qui rajoute les resultats d'execution a une campagne
 void ajouterScriptToExec(org.dom4j.Element script, org.objectweb.salome_tmf.data.Execution pExecution)
          Methode qui ajoute un script a une execution
 void ajoutParametresActions(org.dom4j.Element actionElem, org.objectweb.salome_tmf.data.Action pAction)
          Si l'action existait dans la BD, ajout ou mise a jour des parametres
 boolean detecterModif(org.objectweb.salome_tmf.data.Family pFamily, org.objectweb.salome_tmf.data.TestList suite, org.dom4j.Element testElem)
          On cherche a savoir si le test du projet possede des differences avec le test present dans le fichier XML, ces differences generant un conflit
 boolean existModifInParamsAction(org.dom4j.Element actionElem, org.objectweb.salome_tmf.data.Action action)
          Methode qui evalue si il y a une difference entre les parametres d'une action dans le document XML et ceux de cette meme action dans le projet Salome
 java.lang.String getDigest(java.io.File f)
          Gives MD5 of the given file
 void importInNewProject()
          Launch the import process from the createDialog in Administration of Salome
 void importInProject()
          Launch the import process
 boolean isAnnule()
          Verify if the task was cancelled
 boolean isInitSelection()
          Return true if the list of selected tests was initialized
 boolean mustKeepCopy(org.objectweb.salome_tmf.data.Campaign campaign, org.dom4j.Element campElem)
          Method which detects if the campaign in database must be copied or not.
 void setAnnule(boolean b)
          Cancel the current task
 void setDirXml(java.lang.String dirXml)
          Set the directory where the XML file is
 void setImportCampaign(boolean importCampaign)
          Set the field defines if campaigns are also imported
 void setInitSelection(boolean initSelection)
          True in parameter if the test selection has been already initialized
 void updateElementAttachement(org.dom4j.Element element, org.objectweb.salome_tmf.data.WithAttachment data, boolean isNewElement)
          Update attachments of an element
 void updateParametresTest(org.dom4j.Element testElem, org.objectweb.salome_tmf.data.Test test)
          Dans le cas où le test etait deja dans la BD, ajout des parametres
 void updateTestScript(org.dom4j.Element testElem, org.objectweb.salome_tmf.data.AutomaticTest test)
          Dans le cas où le test etait deja dans la BD, ajout ou mise a jour du script
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportXML2

public ImportXML2(javax.swing.JDialog dialog,
                  org.dom4j.Document document,
                  java.util.ArrayList<org.objectweb.salome_tmf.data.Family> familySelectionList,
                  java.util.ArrayList<org.objectweb.salome_tmf.data.TestList> suiteSelectionList,
                  java.util.ArrayList<org.objectweb.salome_tmf.data.Test> testSelectionList,
                  org.objectweb.salome_tmf.data.AdminVTData adminVTData,
                  org.objectweb.salome_tmf.plugins.IPlugObject plugObject)
Parameters:
dialog -
document -
familySelectionList -
suiteSelectionList -
testSelectionList -
adminVTData -
plugObject -
Method Detail

importInProject

public void importInProject()
                     throws java.lang.Exception
Launch the import process

Throws:
java.lang.Exception

importInNewProject

public void importInNewProject()
                        throws java.lang.Exception
Launch the import process from the createDialog in Administration of Salome

Throws:
java.lang.Exception

updateTestScript

public void updateTestScript(org.dom4j.Element testElem,
                             org.objectweb.salome_tmf.data.AutomaticTest test)
                      throws java.lang.Exception
Dans le cas où le test etait deja dans la BD, ajout ou mise a jour du script

Parameters:
testElem - element qui represente le test dans le document XML
test -
Throws:
java.lang.Exception

detecterModif

public boolean detecterModif(org.objectweb.salome_tmf.data.Family pFamily,
                             org.objectweb.salome_tmf.data.TestList suite,
                             org.dom4j.Element testElem)
                      throws java.lang.Exception
On cherche a savoir si le test du projet possede des differences avec le test present dans le fichier XML, ces differences generant un conflit

Parameters:
pFamily -
suite -
testElem - element test du document XML
Returns:
true si reel conflit, false sinon
Throws:
java.lang.Exception

getDigest

public java.lang.String getDigest(java.io.File f)
Gives MD5 of the given file

Parameters:
f -
Returns:
digest

existModifInParamsAction

public boolean existModifInParamsAction(org.dom4j.Element actionElem,
                                        org.objectweb.salome_tmf.data.Action action)
                                 throws java.lang.Exception
Methode qui evalue si il y a une difference entre les parametres d'une action dans le document XML et ceux de cette meme action dans le projet Salome

Parameters:
actionElem - element du document DOM4J contenant l'action
action - action dans le modele de SalomeTMF
Returns:
boolean
Throws:
java.lang.Exception

updateParametresTest

public void updateParametresTest(org.dom4j.Element testElem,
                                 org.objectweb.salome_tmf.data.Test test)
                          throws java.lang.Exception
Dans le cas où le test etait deja dans la BD, ajout des parametres

Parameters:
test - le test concerne
testElem - element qui represente le test dans le document XML
Throws:
java.lang.Exception

updateElementAttachement

public void updateElementAttachement(org.dom4j.Element element,
                                     org.objectweb.salome_tmf.data.WithAttachment data,
                                     boolean isNewElement)
Update attachments of an element

Specified by:
updateElementAttachement in interface org.objectweb.salome_tmf.plugins.core.XMLLoaderPlugin
Parameters:
element -
data -
isNewElement -

ajouterActions

public void ajouterActions(org.dom4j.Element testElem,
                           org.objectweb.salome_tmf.data.ManualTest test)
                    throws java.lang.Exception
Dans le cas où le test n'etait pas deja dans la BD, ajout des actions

Parameters:
testElem - element qui represente le test dans le document XML
test -
Throws:
java.lang.Exception

ajouterAttachements

public void ajouterAttachements(org.dom4j.Element elem,
                                org.objectweb.salome_tmf.data.WithAttachment attachableElement)
                         throws java.lang.Exception
Dans le cas où attachableElement n'etait pas deja dans la BD, ajout des attachements

Parameters:
elem - : element qui represente le WithAttachment dans le document XML
attachableElement -
Throws:
java.lang.Exception

ajoutParametresActions

public void ajoutParametresActions(org.dom4j.Element actionElem,
                                   org.objectweb.salome_tmf.data.Action pAction)
                            throws java.lang.Exception
Si l'action existait dans la BD, ajout ou mise a jour des parametres

Parameters:
pAction - identifiant de l'action
actionElem - element action du document comportant les donnees
Throws:
java.lang.Exception

ajouterExecutions

public void ajouterExecutions(org.dom4j.Element campElem,
                              org.objectweb.salome_tmf.data.Campaign pCamp)
                       throws java.lang.Exception
Methode qui ajoute les executions aux campagnes qui n'etait pas au prealable dans la BD

Parameters:
campElem - element representant la campagne dans le document XML
pCamp -
Throws:
java.lang.Exception

ajouterScriptToExec

public void ajouterScriptToExec(org.dom4j.Element script,
                                org.objectweb.salome_tmf.data.Execution pExecution)
                         throws java.lang.Exception
Methode qui ajoute un script a une execution

Parameters:
script - element script du document XML
pExecution -
Throws:
java.lang.Exception

ajouterResulExecs

public void ajouterResulExecs(org.dom4j.Element execElem,
                              org.objectweb.salome_tmf.data.Execution pExecution)
                       throws java.lang.Exception
Methode qui rajoute les resultats d'execution a une campagne

Parameters:
execElem - element representant l'execution d'une campagne dans le document XML
pExecution -
Throws:
java.lang.Exception

mustKeepCopy

public boolean mustKeepCopy(org.objectweb.salome_tmf.data.Campaign campaign,
                            org.dom4j.Element campElem)
                     throws java.lang.Exception
Method which detects if the campaign in database must be copied or not. The campaign in database must be copied if it contains tests which have been saved in the test plan or it does not contain the same tests.

Parameters:
campaign - campaign in DB
campElem - campaign in XML document
Returns:
boolean
Throws:
java.lang.Exception

setAnnule

public void setAnnule(boolean b)
Cancel the current task

Parameters:
b -

isAnnule

public boolean isAnnule()
Verify if the task was cancelled

Returns:
cancelled

setImportCampaign

public void setImportCampaign(boolean importCampaign)
Set the field defines if campaigns are also imported

Parameters:
importCampaign -

setDirXml

public void setDirXml(java.lang.String dirXml)
Set the directory where the XML file is

Parameters:
dirXml -

isInitSelection

public boolean isInitSelection()
Return true if the list of selected tests was initialized

Returns:
initSelection

setInitSelection

public void setInitSelection(boolean initSelection)
True in parameter if the test selection has been already initialized

Parameters:
initSelection -