org.eclipse.lyo.oslc4j.core

## Class OSLC4JUtils

- java.lang.Object
- - org.eclipse.lyo.oslc4j.core.OSLC4JUtils

-     public class OSLC4JUtils
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OSLC4JUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static com.hp.hpl.jena.datatypes.RDFDatatype` | `getDataTypeBasedOnResourceShapeType(HashSet<String> rdfTypesList, com.hp.hpl.jena.rdf.model.Property property)` This method receives the property name and the property value and tries to infer the property Data Type from the pre-defined list of Resource Shapes.
    `static String` | `getInferTypeFromShape()`
    `static String` | `getPublicURI()` Returns the value of org.eclipse.lyo.oslc4j.publicURI or null if not set.
    `static List<ResourceShape>` | `getShapes()` Returns a list of Resource Shapes to be used when inferring a property type from the Resource Shape.
    `static String` | `getUseBeanClassForParsing()`
    `static Object` | `getValueBasedOnResourceShapeType(HashSet<String> rdfTypesList, QName propertyQName, Object originalValue)` This method receives the property name and the property value and tries to infer the property type from the pre-defined list of Resource Shapes.
    `static boolean` | `inferTypeFromShape()`
    `static boolean` | `isHostResolutionDisabled()` Returns the boolean value of org.eclipse.lyo.oslc4j.disableHostResolution Default is false if not set or invalid (hostname resolution will take place)
    `static boolean` | `isQueryResultListAsContainer()` Return if the query result list type will be http://www.w3.org/2000/01/rdf-schema#Container or there will be no type.
    `static boolean` | `relativeURIsAreDisabled()` Returns the boolean value of org.eclipse.lyo.oslc4j.disableRelativeURIs Default is true if not set or invalid (relative URIs will not be allowed)
    `static String` | `resolveURI(javax.servlet.http.HttpServletRequest request, boolean includePath)` Resolve a URI (usually a resource subject or info URI) based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution.
    `static void` | `setHostResolutionDisabled(boolean hostResDisabled)`
    `static void` | `setInferTypeFromShape(String inferTypeFromShape)`
    `static void` | `setPublicURI(String newPublicURI)` Sets the value of org.eclipse.lyo.oslc4j.publicURI
    `static void` | `setShapes(List<ResourceShape> shapes)` Sets a list of Resource Shapes to be used when inferring a property type from the Resource Shape.
    `static void` | `setUseBeanClassForParsing(String useBeanClassForParsing)`
    `static boolean` | `useBeanClassForParsing()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OSLC4JUtils

          public OSLC4JUtils()

  - ### Method Detail

    - #### getPublicURI

          public static String getPublicURI()

      Returns the value of org.eclipse.lyo.oslc4j.publicURI or null if not set.
      Returns:
        Public URI, or null if not set

    - #### setPublicURI

          public static void setPublicURI(String newPublicURI)
                                   throws MalformedURLException

      Sets the value of org.eclipse.lyo.oslc4j.publicURI
      Parameters:
        `newPublicURI` - The new public URI to use.
      Throws:
        `MalformedURLException`

    - #### useBeanClassForParsing

          public static boolean useBeanClassForParsing()

    - #### getUseBeanClassForParsing

          public static String getUseBeanClassForParsing()

    - #### setUseBeanClassForParsing

          public static void setUseBeanClassForParsing(String useBeanClassForParsing)

    - #### inferTypeFromShape

          public static boolean inferTypeFromShape()

    - #### getInferTypeFromShape

          public static String getInferTypeFromShape()

    - #### setInferTypeFromShape

          public static void setInferTypeFromShape(String inferTypeFromShape)

    - #### getShapes

          public static List<ResourceShape> getShapes()

      Returns a list of Resource Shapes to be used when inferring a property type from the Resource Shape. This method should only be used when the property inferTypeFromShape is set to true.
      Returns:
        List of Resource Shapes

    - #### setShapes

          public static void setShapes(List<ResourceShape> shapes)

      Sets a list of Resource Shapes to be used when inferring a property type from the Resource Shape. This method should only be used when the property inferTypeFromShape is set to true.
      Parameters:
        `shapes` - List of Resource Shapes

    - #### isHostResolutionDisabled

          public static boolean isHostResolutionDisabled()

      Returns the boolean value of org.eclipse.lyo.oslc4j.disableHostResolution Default is false if not set or invalid (hostname resolution will take place)
      Returns:
        true if host resolution is disabled, false if not set or invalid

    - #### setHostResolutionDisabled

          public static void setHostResolutionDisabled(boolean hostResDisabled)

    - #### resolveURI

          public static String resolveURI(javax.servlet.http.HttpServletRequest request,
                          boolean includePath)

      Resolve a URI (usually a resource subject or info URI) based on the settings of org.eclipse.lyo.oslc4j.publicURI and org.eclipse.lyo.oslc4j.disableHostResolution. If the publicURI property is set, it takes precedence and is used to build the full URI. If the disableHostResolution property is false or not set, resolution of the local hostname is attempted. If the disableHostResolution property is true or resolution has failed, the hostname is retrieved from the request. Query parameters from the request are not copied to the resolved URI.
      Parameters:
        `request` - - request to base resolved URI on
        `includePath` - - if the path (after the context root) should be included in the resolved URI
      Returns:
        String containing the resolved URI

    - #### relativeURIsAreDisabled

          public static boolean relativeURIsAreDisabled()

      Returns the boolean value of org.eclipse.lyo.oslc4j.disableRelativeURIs Default is true if not set or invalid (relative URIs will not be allowed)
      Returns:
        true if relative URIs are disabled, or if the property is not set or invalid.

    - #### isQueryResultListAsContainer

          public static boolean isQueryResultListAsContainer()

      Return if the query result list type will be http://www.w3.org/2000/01/rdf-schema#Container or there will be no type. Default is no type.

    - #### getValueBasedOnResourceShapeType

          public static Object getValueBasedOnResourceShapeType(HashSet<String> rdfTypesList,
                                                QName propertyQName,
                                                Object originalValue)
                                                         throws DatatypeConfigurationException,
                                                                IllegalArgumentException,
                                                                InstantiationException,
                                                                InvocationTargetException

      This method receives the property name and the property value and tries to infer the property type from the pre-defined list of Resource Shapes. Then returns the corresponding java object for the given object value. Returns a null object when it was not possible to infer the property type from the list of Resource Shapes.
      Parameters:
        `rdfTypesList` -
        `propertyQName` - Property information
        `originalValue` - Property value
      Returns:
        Java object related to the Resource Shape type.
      Throws:
        `DatatypeConfigurationException` - , IllegalArgumentException, InstantiationException, InvocationTargetException on
        `IllegalArgumentException`
        `InstantiationException`
        `InvocationTargetException`

    - #### getDataTypeBasedOnResourceShapeType

          public static com.hp.hpl.jena.datatypes.RDFDatatype getDataTypeBasedOnResourceShapeType(HashSet<String> rdfTypesList,
                                                                                  com.hp.hpl.jena.rdf.model.Property property)

      This method receives the property name and the property value and tries to infer the property Data Type from the pre-defined list of Resource Shapes. Returns a null object when it was not possible to infer the property Data Type from the list of Resource Shapes.
      Parameters:
        `rdfTypesList` - List of rdf:types
        `property` - Property information
      Returns:
        Java object related to the Resource Shape type.
      Throws:
        `DatatypeConfigurationException` - , IllegalArgumentException, InstantiationException, InvocationTargetException

Copyright © 2016. All rights reserved.