Android Open Source - sodf Rest Interaction Node






From Project

Back to project page sodf.

License

The source code is released under:

Copyright (c) 2013 Lorenz Lehmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project sodf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package lal.sodf.framework.ontology;
/*  w  w w .  j a va 2 s . c o  m*/
/**
 * A class that can be used to create a subtree of REST interactions.
 * This node can be added to the {@link <code>FunctionsNode</code> } as interactions parameter
 * @author Lorenz Lehmann
 *
 */
public class RestInteractionNode extends KeyNode {

  /**
   * Creates a new node with a rest interaction
   * @param parent The parent of this node
   * @param uri The REST URI
   * @param parameters The parameters to be used
   * @param restMethod The REST method, taken from {@link SodfVocabular.SodfVocabulary.SODF_HTTP_METHOD_*}
   */
  public RestInteractionNode(KeyNode parent, String uri, RestParameters[] parameters, String restMethod) {
    super(parent, SodfVocabulary.SODF_INTERACTION);
    buildChildren(uri, parameters, restMethod);
  }
  
  /**
   * Creates a new node with a rest interaction
   * @param uri The REST URI
   * @param parameters The parameters to be used
   * @param restMethod The REST method, taken from {@link SodfVocabular.SodfVocabulary.SODF_HTTP_METHOD_*}
   */
  public RestInteractionNode(String uri, RestParameters[] parameters, String restMethod) {
    super(SodfVocabulary.SODF_INTERACTION);
    buildChildren(uri, parameters, restMethod);
  }
  
  /** Build the children with the correct name */
  private void buildChildren(String uri, RestParameters[] parameters, String restMethod){
    //add the required children for the rest interaction
    addChild(new KeyValueNode(SodfVocabulary.SODF_INTERACTION_TYPE, SodfVocabulary.SODF_REST));
    //add the URI
    if (uri != null && !uri.equals("")) addChild(new KeyValueNode(SodfVocabulary.SODF_URI, uri));
    //add the parameters
    if (parameters != null && parameters.length > 0){
      //add a parameters node
      KeyNode param = new KeyNode(SodfVocabulary.SODF_REST_PARAMETERS);
      //add all parameters to this node
      for (int i = 0; i < parameters.length; i++){
        if (parameters[i] != null && parameters[i].key != null) {
          KeyNode blankContainer = new KeyNode(param,parameters[i].key);
          //add the name node if set
          if (parameters[i].parametersName != null && !parameters[i].parametersName.equals("")){
            blankContainer.addChild(new KeyValueNode(SodfVocabulary.SODF_REST_PARAMETERS_NAME, parameters[i].parametersName));                                    
          }
          //add the description node if set
          if (parameters[i].parametersDescription != null && !parameters[i].parametersDescription.equals("")){
            blankContainer.addChild(new KeyValueNode(SodfVocabulary.SODF_REST_PARAMETERS_DESCRIPTION, parameters[i].parametersDescription));            
          }          
        }
      }
      //add the parameters to this node
      addChild(param);
    }
    //add the rest method
    if (restMethod != null && !restMethod.equals("")) addChild(new KeyValueNode(SodfVocabulary.SODF_REST_METHOD, restMethod));    
  }

}




Java Source Code List

lal.apps.ontap.MainActivity.java
lal.apps.ontap.WifiVocabulary.java
lal.apps.smartfoodenvironment.activities.ExpiredActivity.java
lal.apps.smartfoodenvironment.activities.FactoryActivity.java
lal.apps.smartfoodenvironment.activities.MicrowaveActivity.java
lal.apps.smartfoodenvironment.activities.StartActivity.java
lal.apps.smartfoodenvironment.model.MicrowaveVocabulary.java
lal.apps.smartfoodenvironment.model.ProductFactory.java
lal.apps.smartfoodenvironment.model.ProductVocabulary.java
lal.sodf.example.MainActivity.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfCallback.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfFramework.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.SodfWrapper.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.CompressionAlgorithm.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Compressor.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.compressor.Gzip.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.CompressionAlgorithmNotFoundException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.DuplicateKeyException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.MalformedTypeException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.TagEmptyException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.exceptions.UnformattedTagException.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcContentWrapper.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.nfc.NfcHandler.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.FunctionsNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.KeyValueNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.MetadataNode.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.Node.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.PropertiesNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestInteractionNode.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.RestParameters.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfTree.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.ontology.SodfVocabulary.java
lal.sodf.framework.parser.SodfParser.java
lal.sodf.framework.parser.SodfParser.java
lal.sodf.framework.parser.SodfParser.java