-
Notifications
You must be signed in to change notification settings - Fork 5
/
ISOAbstractCatalogue.R
178 lines (162 loc) · 6.43 KB
/
ISOAbstractCatalogue.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#' ISOAbstractCatalogue
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO abstract catalogue
#' @return Object of \code{\link{R6Class}} for modelling an ISOAbstracCatalogue
#' @format \code{\link{R6Class}} object.
#'
#' @references
#' ISO 19139:2007 Metadata - XML schema implementation
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOAbstractCatalogue <- R6Class("ISOAbstractCatalogue",
inherit = ISOAbstractObject,
private = list(
document = TRUE,
xmlElement = "AbstractCT_Catalogue",
xmlNamespacePrefix = "GMX"
),
public = list(
#'@field name name [1..1]: character
name = NULL,
#'@field scope scope [1..*]: character
scope = list(),
#'@field fieldOfApplication fieldOfApplication [0.*]: character
fieldOfApplication = list(),
#'@field versionNumber versionNumber [1..1]: character
versionNumber = NULL,
#'@field versionDate versionDate [1..1]: Date/Posix
versionDate = NULL,
#'@field language language [0..1]: character
language = NULL,
#'@field characterSet character set [0..1]: character
characterSet = NULL,
#'@field locale locale [0..*]: ISOLocale
locale = list(),
#'@field subCatalogue subCatalogue [0..*]: ISOAbstractCatalogue
subCatalogue = list(),
#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
initialize = function(xml = NULL){
super$initialize(xml = xml)
},
#'@description Sets the name. Locale names can be specified as
#'@param name name
#'@param locales locales, object of class \link{list}
setName = function(name, locales = NULL){
if(!is(name,"character")) name <- as(name, "character")
if(!is.null(locales)){
name <- self$createLocalisedProperty(name, locales)
}
self$name <- name
},
#'@description Adds scope
#'@param scope scope
#'@param locales locales, object of class \link{list}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addScope = function(scope, locales = NULL){
if(!is.null(locales)){
scope <- self$createLocalisedProperty(scope, locales)
}
return(self$addListElement("scope", scope))
},
#'@description Deletes scope
#'@param scope scope
#'@param locales locales, object of class \link{list}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delScope = function(scope, locales = NULL){
if(!is.null(locales)){
scope <- self$createLocalisedProperty(scope, locales)
}
return(self$delListElement("scope", scope))
},
#'@description Adds field of application
#'@param fieldOfApplication field of application
#'@param locales locales, object of class \link{list}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addFieldOfApplication = function(fieldOfApplication, locales = NULL){
if(!is.null(locales)){
fieldOfApplication <- self$createLocalisedProperty(fieldOfApplication, locales)
}
return(self$addListElement("fieldOfApplication", fieldOfApplication))
},
#'@description Deletes field of application
#'@param fieldOfApplication field of application
#'@param locales locales, object of class \link{list}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delFieldOfApplication = function(fieldOfApplication){
if(!is.null(locales)){
fieldOfApplication <- self$createLocalisedProperty(fieldOfApplication, locales)
}
return(self$delListElement("fieldOfApplication", fieldOfApplication))
},
#'@description Set version number
#'@param versionNumber version number
setVersionNumber = function(versionNumber){
if(!is(versionNumber,"character")) versionNumber <- as(versionNumber, "character")
self$versionNumber <- versionNumber
},
#'@description Set version date
#'@param versionDate version date
setVersionDate = function(versionDate){
self$versionDate <- versionDate
},
#'@description Set language
#'@param locale object of class \link{ISOLanguage} or any \link{character}
#' from values returned by \code{ISOLanguages$values()}
setLanguage = function(locale){
if(is(locale, "character")){
locale <- ISOLanguage$new(value = locale)
}
self$language <- locale
},
#'@description Set charset
#'@param charset object of class \link{ISOCharacterSet} or any \link{character}
#' from values returned by \code{ISOCharacterSet$values()}
setCharacterSet = function(charset){
if(is(charset, "character")){
charset <- ISOCharacterSet$new(value = charset)
}
self$characterSet <- charset
},
#'@description Adds locale
#'@param locale object of class \link{ISOLocale}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addLocale = function(locale){
if(!is(locale,"ISOLocale")){
stop("The argument should be a 'ISOLocale' object")
}
return(self$addListElement("locale", locale))
},
#'@description Deletes locale
#'@param locale object of class \link{ISOLocale}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delLocale = function(locale){
if(!is(locale,"ISOLocale")){
stop("The argument should be a 'ISOLocale' object")
}
return(self$delListElement("locale", locale))
},
#'@description Add sub catalogue
#'@param subCatalogue object of class \link{ISOAbstractCatalogue}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addSubCatalogue = function(subCatalogue){
if(!is(subCatalogue, "ISOAbstractCatalogue")){
stop("The argument should be an object inheriting 'ISOAbstractCatalogue")
}
return(self$addListElement("subCatalogue", subCatalogue))
},
#'@description Deletes sub catalogue
#'@param subCatalogue object of class \link{ISOAbstractCatalogue}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delSubCatalogue = function(subCatalogue){
if(!is(subCatalogue, "ISOAbstractCatalogue")){
stop("The argument should be an object inheriting 'ISOAbstractCatalogue")
}
return(self$delListElement("subCatalogue", subCatalogue))
}
)
)