It easiest to make most Legacy REST Web Services requests with the RestComponentHelper and RestRepositoryHelper classes. These two classes simplify calling into the server by providing methods which hide the complexity of assembling the data for the request. All the methods for both classes are static and each returns a RestResult object and throws RestClientException. See the JavaDoc for more information about each method.

atg.rest.client.RestComponentHelper

The methods of the RestComponentHelper class allow access to components, properties, and methods. Each of the methods accepts a Map of parameters, which control the request. For more information and examples, see Accessing Components with the Java Client Library.

  • public static RestResult getComponent(String pComponentPath, Map<String,Object> pParams, RestSession pSession)

    Returns all the properties of the specified Nucleus component.

  • public static RestResult getPropertyValue(String pComponentPath, String pProperty, Map<String,Object> pParams, RestSession pSession)

    Returns the requested property from the specified Nucleus component.

  • public static RestResult setPropertyValue(String pComponentPath, String pProperty, Object pValue, Map<String,Object> pParams, RestSession pSession)

    Sets a value on the specified Nucleus component property.

  • public static RestResult executeMethod(String pComponentPath, String pMethodName, Object[] pArguments, Map<String,Object> pParams, RestSession pSession)

    Calls a public method on the specified Nucleus component.

    The Object[] pArguments parameter is an array of method arguments. This parameter should contain one Object for each of the method parameters. For example, if the method takes an int, then a java.lang.Integer object should be passed. The Java client library handles converting the object for transport to the server and the Legacy REST module handles converting it to an int. If any parameter object is passed as a String, the parameter will be transported to the server without any changes. This means that a method that takes an int can have a java.lang.String object with a value of 2, for example, passed. For parameters that are complex objects, the object can be passed as a parameter and the library will attempt to convert it for transport. When the request is sent to the server, a new instance will be constructed and its properties populated with the values from the original object. Collections and Maps can also be transported.

    For more information, see Calling Methods with the Java Client Library.

atg.rest.client.RestRepositoryHelper Class

The methods of the RestRepositoryHelper class allow you to access repository items, execute RQL queries, retrieve individual property values, set property values, create items, and remove items. Each of the methods takes a Nucleus repository path and item descriptor name as its first two arguments, as well as a Map of parameters, which control various aspects of the request. For more information and examples, see Accessing Repository Items with the Java Client Library.

  • public static RestResult createItem(String pRepositoryPath, String pItemDescriptorName, Map<String,Object> pParams, RestSession pSession)

    Returns the ID of the newly created repository item.

  • public static RestResult createItem(String pRepositoryPath, String pItemDescriptorName, String pItemId, Map<String,Object> pParams, RestSession pSession)

    Returns the ID of the newly created repository item.

  • public static RestResult removeItem(String pRepositoryPath, String pItemDescriptorName, String pItemId, Map<String,Object> pParams, RestSession pSession)

    Returns true if the repository item was successfully removed; otherwise, returns false.

  • public static RestResult getItem(String pRepositoryPath, String pItemDescriptorName, String pItemId, Map<String,Object> pParams, RestSession pSession)

    Returns the contents of the repository item. If any of the properties are references to other items, Collections, arrays, or Maps, returns a REST URL that you can use to access the contents of the specific property. You can create a raw REST request to access the data for the property. For more information, see Creating a Raw REST Request.

  • public static RestResult getItems(String pRepositoryPath, String pItemDescriptorName, Map<String,Object> pParams, RestSession pSession)

    Returns a series of URLs, one for each item which is being returned. T to control the number of items returned, the atg-rest-index and atg-rest-count parameters can be passed into the pParams argument.

  • public static RestResult executeRQLQuery(String pRepositoryPath, String pItemDescriptorName, String pRQL, Map<String,Object> pParams, RestSession pSession)

    Returns a series of URLs, one for each item which is being returned. To control the number of items returned, the atg-rest-index and atg-rest-count parameters can be passed into the pParams argument.

    Note: Do not include parameters in the RQL queries that you perform via the Legacy REST Web Services. Make sure that all constants are explicitly included in the RQL statements. See information about parameters in RQL queries in the Repository Guide.

  • public static RestResult getPropertyValue(String pRepositoryPath, String pItemDescriptorName, String pItemId, String pProperty, Map<String,Object> pParams, RestSession pSession)

    Returns the value of the requested property. If the property is a Collection, Map, array, or reference to another repository item, returns a URL.

  • public static RestResult setPropertyValue(String pRepositoryPath, String pItemDescriptorName, String pItemId, String pProperty, Object pValue, Map<String,Object> pParams, RestSession pSession)


Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices