Examples of ErrorUpdate


Examples of edu.isi.karma.controller.update.ErrorUpdate

//    }
//    if (true) return null;
   
    if (al == null) {
      logger.error("The alignment model is null.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. The alignment model is null."));
    }
   
    DirectedWeightedMultigraph<Node, LabeledLink> tree = al.getSteinerTree();
     
    if (tree == null) {
      logger.error("The alignment tree is null.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. The alignment model is null."));
    }

    DataSource source = new DataSource(wk.getTitle(), tree);
   
    Map<WebService, Map<String, String>> servicesAndMappings =
      WebServiceLoader.getInstance().getServicesWithInputContainedInModel(source.getModel(), null);
   
    if (servicesAndMappings == null) {
      logger.error("Cannot find any services to be invoked according to this source model.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. Cannot find any services to be invoked according to this source model."));
    }
   
    // For now, we just use the first service,
    // later we can suggest the user a list of available services and user select among them
    WebService service = null;
    Iterator<WebService> itr = servicesAndMappings.keySet().iterator();
    if (itr != null && itr.hasNext()) {
      service = itr.next();
    }
   
    if (service == null) {
      logger.error("Cannot find any services to be invoked according to this source model.");
      return new UpdateContainer(new ErrorUpdate(
        "Error occured while populating the source. Cannot find any services to be invoked according to this source model."));
    }
   
    List<String> requestIds = new ArrayList<String>();
    Map<String, String> serviceToSourceAttMapping =  servicesAndMappings.get(service);
    List<String> requestURLStrings = getUrlStrings(service, source, wk, serviceToSourceAttMapping, requestIds);
    if (requestURLStrings == null || requestURLStrings.size() == 0) {
      logger.error("Data table does not have any row.");
      return new UpdateContainer(new ErrorUpdate("Data table does not have any row."))
    }
   
   
    InvocationManager invocatioManager;
    try {
      String encoding = wk.getEncoding();
      invocatioManager = new InvocationManager(getUrlColumnName(wk), requestIds, requestURLStrings, encoding);
      logger.info("Requesting data with includeURL=" + true + ",includeInput=" + true + ",includeOutput=" + true);
      Table serviceTable = invocatioManager.getServiceData(false, false, true);
//      logger.debug(serviceTable.getPrintInfo());
      ServiceTableUtil.populateWorksheet(serviceTable, wk, workspace.getFactory(), selection);
      logger.info("The service " + service.getUri() + " has been invoked successfully.");


    } catch (MalformedURLException e) {
      logger.error("Malformed service request URL.");
      return new UpdateContainer(new ErrorUpdate("Malformed service request URL."));
    } catch (KarmaException e) {
      logger.error(e.getMessage());
      return new UpdateContainer(new ErrorUpdate(e.getMessage()));
    }
   
    // Create new vWorksheet using the new header order
    List<HNodePath> columnPaths = new ArrayList<HNodePath>();
    for (HNode node : wk.getHeaders().getSortedHNodes()) {
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

        addMappingToResults(results, temp);
        //        predicates.clear();
        //        otherClasses.clear();
      } catch (KarmaException e) {
        LOG.error("Unable to load data to augment: ", e);
        return new UpdateContainer(new ErrorUpdate(e.getMessage()));
      }
    }


    List<String> resultSubjects = results.get("resultSubjects");
    List<String> resultPredicates = results.get("resultPredicates");
    List<String> resultObjects = results.get("resultObjects");
    List<String> resultClass = results.get("resultClasses");
    AddValuesCommandFactory addFactory = new AddValuesCommandFactory();

    for (int i = 0; i < resultPredicates.size(); i++) {
      String subject = incoming ? resultObjects.get(i) : resultSubjects.get(i);
      List<String> rowIds = SubjectURIToRowId.get(subject);
      boolean isNewNode = false;
      for (String RowId : rowIds) {
        String predicate = resultPredicates.get(i);
        String otherClass = resultClass.get(i);
        JSONArray array = new JSONArray();
        JSONObject obj = new JSONObject();
        JSONObject obj2 = new JSONObject();
        if (otherClass != null && !otherClass.trim().isEmpty())
          obj.put("URIs", incoming ? resultSubjects.get(i) : resultObjects.get(i));
        else
          obj.put("values", incoming ? resultSubjects.get(i) : resultObjects.get(i));
        obj2.put("rowId", RowId);
        obj2.put("rowIdHash", "");
        obj2.put("values", obj);
        array.put(obj2);
        JSONArray input = new JSONArray();
        JSONObject obj3 = new JSONObject();
        obj3.put("name", "AddValues");
        obj3.put("value", array.toString());
        obj3.put("type", "other");
        input.put(obj3);
        try {
          OntologyManager ontMgr = workspace.getOntologyManager();
          Label label = ontMgr.getUriLabel(incoming ? otherClass : predicate);
          AddValuesCommand command = (AddValuesCommand) addFactory.createCommand(input, workspace, hNodeId, worksheetId, hnode.getHTableId(), label.getDisplayName(), HNodeType.AugmentData, selection.getName());
          command.doIt(workspace);
          outputColumns.addAll(command.getOutputColumns());
          isNewNode |= command.isNewNode();
          if (command.isNewNode())
            appliedCommands.push(command);
          newhNodeId = command.getNewHNodeId();


        } catch(Exception e) {
          e.printStackTrace();
          return new UpdateContainer(new ErrorUpdate(e.getMessage()));
        }
      }
      if (isNewNode && alignment.GetTreeRoot() != null) {
        HNode tableHNode =workspace.getFactory().getHNode(newhNodeId);
        String nestedHNodeId = tableHNode.getNestedTable().getHNodeIdFromColumnName("values");
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      this.generateTransformedValues(workspace, worksheet, f, hNode, transformedRows, errorValues, 5);
      return new UpdateContainer(new PythonPreviewResultsUpdate(transformedRows, errorValues));
    } catch (Exception e) {
      logger.error("Error while creating python results preview", e);
      String message = e.toString();
      return new UpdateContainer(new ErrorUpdate("Error executing python script: " + message));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

       
        return c;
      //return null;
    } catch (Exception e) {
      e.printStackTrace();
      return new UpdateContainer(new ErrorUpdate("Error!"));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

            uc.append(WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(wsht.getId(), SuperSelectionManager.DEFAULT_SELECTION));
            new File(fileName).delete();

        } catch (Exception e1) {
          logger.error(e1.getMessage(), e1);
          uc = new UpdateContainer(new ErrorUpdate(e1.getMessage()));
        }
    return uc;
   
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

          logger.info("Created : " + fileName);
            new File(fileName).delete();

        } catch (Exception e1) {
          logger.error(e1.getMessage(), e1);
          uc = new UpdateContainer(new ErrorUpdate(e1.getMessage()));
        }
    return uc;
   
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      if(contentType.equalsIgnoreCase("application/json")) {
        uc = processJSON(entity, workspace);
      } else if(contentType.equalsIgnoreCase("text/csv")) {
        uc = processCSV(entity, workspace);
      } else {
        uc = new UpdateContainer(new ErrorUpdate("Could not parse content type : " + contentType));
      }
         
    } catch (Exception e) {
      logger.error(e.getMessage());
      uc = new UpdateContainer(new ErrorUpdate("Error ! " + e.getMessage()));
    }
    return uc;

  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      MultipleValueEditColumnCommand mvecc = (MultipleValueEditColumnCommand) mfc.createCommand(multiCellEditInput, workspace);
      mvecc.doIt(workspace);
     
    } catch (Exception e) {
      logger.error("Error occured during python transformation.",e);
      return new UpdateContainer(new ErrorUpdate("Error occured while applying Python transformation to the column."));
    }

    worksheet.getMetadataContainer().getColumnMetadata().addColumnPythonTransformation(newHNodeId, this.transformationCode);
    worksheet.getMetadataContainer().getColumnMetadata().addPreviousCommandId(newHNodeId, this.id);
    worksheet.getMetadataContainer().getColumnMetadata().addColumnDerivedFrom(newHNodeId, hNodeId);
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

          }
        }
      });
    } catch (Exception e1) {
      logger.error("Error creating JSON response for model names!", e1);
      return new UpdateContainer(new ErrorUpdate("Error occured while getting models!"));
    }
  }
View Full Code Here

Examples of edu.isi.karma.controller.update.ErrorUpdate

      return c;
    } catch (Exception e) {
      logger.error("Error in AddColumnCommand" + e.toString());
      Util.logException(logger, e);
      e.printStackTrace();
      return new UpdateContainer(new ErrorUpdate(e.getMessage()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.