R/GSPublishable.R

#' @docType class
#' @importFrom R6 R6Class
#' @export
#' 
#' @name GSPublishable
#' @title A GeoServer layer group publishable
#' @description This class models a GeoServer layer. This class is to be
#' used internally by \pkg{geosapi} for configuring layers or layer groups
#' within an object of class \code{GSLayerGroup}
#' @keywords geoserver rest api resource layer group publishable
#' @return Object of \code{\link{R6Class}} for modelling a GeoServer layer group publishable
#' @format \code{\link{R6Class}} object.
#' 
#' @examples
#'   publishable <- GSPublishable$new(name = "name", type = "layer")
#' 
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
GSPublishable <- R6Class("GSPublishable",
   inherit = GSRESTResource,
   
   public = list(
     #'@field full full
     full = TRUE,
     #'@field name name
     name = NULL,
     #'@field attr_type type of attribute
     attr_type = NULL,
     
     #'@description Initializes a \link{GSPublishable}
     #'@param xml an object of class \link{XMLInternalNode-class}
     #'@param name name
     #'@param type type
     initialize = function(xml = NULL, name, type){
       super$initialize(rootName = "published")
       if(!missing(xml) & !is.null(xml)){
         self$decode(xml)
       }else{
         if(!missing(name) & !missing(type)){
           self$setName(name)
           self$setType(type)
         }
       }
     },
     
     #'@description Decodes from XML
     #'@param xml an object of class \link{XMLInternalNode-class}
     decode = function(xml){
       names <- getNodeSet(xml, "//name")
       self$name <- xmlValue(names[[1]])
       self$attr_type <- xmlGetAttr(xml, "type")[1]
     },
     
     #'@description set name
     #'@param name name
     setName = function(name){
       self$name = name
     },
     
     #'@description Set type
     #'@param type type
     setType = function(type){
       self$attr_type = type
     }
     
   )                       
)

Try the geosapi package in your browser

Any scripts or data that you put into this service are public.

geosapi documentation built on Oct. 4, 2023, 5:06 p.m.