Package edu.isi.karma.rep.metadata

Examples of edu.isi.karma.rep.metadata.WorksheetProperties


    worksheet = workspace.getWorksheet(worksheetId);
   
    JSONObject propertiesJson = null;
    try {
      propertiesJson = new JSONObject(properties);
      WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
      if (props == null) {
        props = new WorksheetProperties();
        worksheet.getMetadataContainer().setWorksheetProperties(props);
      }
     
      // Parse the properties and set WorksheetProperties data structure
      String graphLabel = propertiesJson.getString(Property.graphLabel.name());
      if (!graphLabel.trim().isEmpty()) {
        props.setPropertyValue(Property.graphLabel, graphLabel);
        props.setPropertyValue(Property.graphName, WorksheetProperties.createDefaultGraphName(graphLabel));
      }
     
      if (propertiesJson.getBoolean(Property.hasServiceProperties.name())) {
        props.setHasServiceProperties(true);
        // Service URL
        props.setPropertyValue(Property.serviceUrl,
            propertiesJson.getString(Property.serviceUrl.name()));
        // Service method
        props.setPropertyValue(Property.serviceRequestMethod,
            propertiesJson.getString(Property.serviceRequestMethod.name()));
        // Set the service invocation style if http method is POST
        if (propertiesJson.getString(Property.serviceRequestMethod.name())
            .equals(HttpMethods.POST.name())) {
          props.setPropertyValue(Property.serviceDataPostMethod,
              propertiesJson.getString(Property.serviceDataPostMethod.name()));
        }
      }
      if (propertiesJson.getBoolean("hasPrefix")) {
        props.setPropertyValue(Property.prefix,
            propertiesJson.getString(Property.prefix.name()));
      }
      if (propertiesJson.getBoolean("hasBaseURI")) {
        props.setPropertyValue(Property.baseURI,
            propertiesJson.getString(Property.baseURI.name()));
      }
    } catch (JSONException e) {
      e.printStackTrace();
      return new UpdateContainer(new ErrorUpdate("Malformed properties object received"));
View Full Code Here


            Property.prefix, "s")
    }
   
   
   
    WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
    try {
      final JSONObject propsJson = props.getJSONRepresentation();
      return new UpdateContainer(new AbstractUpdate() {
       
        @Override
        public void generateJson(String prefix, PrintWriter pw,
            VWorkspace vWorkspace) {
View Full Code Here

          VWorkspace vWorkspace) {
        JSONObject outputObject = new JSONObject();
        try {
          outputObject.put(JsonKeys.updateType.name(), "SetWorksheetProperties");
          outputObject.put(JsonKeys.worksheetId.name(), worksheetId);
          WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
          if (props.getPropertyValue(Property.baseURI) != null)
            outputObject.put(JsonKeys.baseURI.name(), props.getPropertyValue(Property.baseURI));
          if (props.getPropertyValue(Property.prefix) != null)
            outputObject.put(JsonKeys.prefix.name(), props.getPropertyValue(Property.prefix));
          if (props.getPropertyValue(Property.graphLabel) != null && !props.getPropertyValue(Property.graphLabel).trim().isEmpty())
            outputObject.put(JsonKeys.graphLabel.name(), props.getPropertyValue(Property.graphLabel));
          pw.println(outputObject.toString());
        } catch (JSONException e) {
          e.printStackTrace();
          logger.error("Error occured while generating JSON!");
        }
View Full Code Here

      con.add(mappingRes, hasWorksheetHistoryUri, historyLiteral);
   
  }

  public void addWorksheetProperties(Worksheet worksheet, Resource mappingRes) throws RepositoryException {
    WorksheetProperties props = worksheet.getMetadataContainer().getWorksheetProperties();
    if (props == null) {
      return;
    }
   
    // Service options (if present)
    if (props.hasServiceProperties()) {
      if (props.getPropertyValue(Property.serviceUrl) == null) {
        return;
      }
     
      // Request method triple
      URI reqMethodUri = f.createURI(Uris.KM_SERVICE_REQ_METHOD_URI);
      Value method = f.createLiteral(props.getPropertyValue(Property.serviceRequestMethod));
      con.add(mappingRes, reqMethodUri, method);
     
      // Service Url triple
      URI serUrlUri = f.createURI(Uris.KM_SERVICE_URL_URI);
      Value servUrl = f.createLiteral(props.getPropertyValue(Property.serviceUrl));
      con.add(mappingRes, serUrlUri, servUrl);
     
      if (props.getPropertyValue(Property.serviceRequestMethod).equals(HttpMethods.POST.name())) {
        // POST method related option triple
        URI postMethodUri = f.createURI(Uris.KM_SERVICE_POST_METHOD_TYPE_URI);
        Value methodUrl = f.createLiteral(props.getPropertyValue(Property.serviceDataPostMethod));
        con.add(mappingRes, postMethodUri, methodUrl);
      }
    }
  }
View Full Code Here

TOP

Related Classes of edu.isi.karma.rep.metadata.WorksheetProperties

Copyright © 2018 www.massapicom. 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.