@Port(direction = Direction.INPUT, name = "Set Experiment to upload", order = 1) public void setExperiment(IExperiment selExp) { this.selExp = selExp; if (this.selExp.getMapIntraExpsColors() != null) { isInter = true; } else { isInter = false; } try { // First step, send Experiment data String json = generateJSON(); // Second step, receive Experiment bio_ID from BiofOmics String bioID = getBioID(json); if (!bioID.isEmpty()) { // Third step, set bio_ID in the Experiment boolean success = setBioID(bioID); if (success) { // Four step, create Experiment files and send them to // BiofOmics String zipPath = saveExpInTempFolder(); json = generateJSON(zipPath); // Call webService to upload the file int serverCode = uploadExperiment(json); if (serverCode < 400) { ShowDialog.showInfo( I18n.get("updloadOkTitle"), I18n.get("uploadOk1") + selExp.getName() + I18n.get("uploadOk2") + BewConstants.USER + "."); } else { if (serverCode == 401) { ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("uploadBadLogin")); } else if (serverCode == 500) { ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("uploadServerError")); } } } else { ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("uploadIDError")); } } else { ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("uploadIDError")); } } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("webServicesConnection")); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); ShowDialog.showError(I18n.get("updloadErrorTitle"), I18n.get("updloadError")); } }
/** * Set the intraExperiment. Select the type of Method to create and add it. * * @param exp intraExperiment. */ @Port(direction = Direction.INPUT, name = "Select Experiment", order = 2) public void selectExp(Experiment exp) { AddingElementDialog aed = null; AbstractMethodSheetConfigurator dsc; // If null, we have to create a new method if (method == null) { aed = new AddingElementDialog(new CreateMethodSheetConfigurator(), exp); aed.setVisible(true); dsc = (CreateMethodSheetConfigurator) aed.getSheet(); } // Else, we copy a created method else { List<String> condNames = new ArrayList<String>(); List<Integer> condValues = new ArrayList<Integer>(); List<String> condUnits = new ArrayList<String>(); for (Condition c : method.getArrayCondition().getElements()) { condNames.add(c.getName()); condValues.add(c.getConditionValues().size()); condUnits.add(c.getUnits()); } // We introduce the default name aed = new AddingElementDialog( new ImportMethodSheetConfigurator( I18n.get("comboNameDefault"), method.getUnits(), FunctionConstants.dataToArray(method.conditionsToMatrix()), condNames, condValues, condUnits, condNames.size()), exp); aed.setVisible(true); dsc = (ImportMethodSheetConfigurator) aed.getSheet(); } // If the user want to create the method (accept button) if (aed.isExit()) { List<String> conditionNames = dsc.getConditionNames(); List<String> conditionUnits = dsc.getConditionUnits(); String[] names = new String[conditionNames.size()]; int i = 0; for (String name : conditionNames) { names[i] = name; i++; } exp.addMetodo( FunctionConstants.createMethod( dsc.getSheetName(), dsc.getUnits(), dsc.getTableToObject(), names, conditionUnits.toArray(), dsc.getNumConditions(), exp)); } }