Class: WirisPlugin::GenericParamsProviderImpl

Inherits:
Object
  • Object
show all
Extended by:
ParamsProviderInterface
Includes:
Wiris
Defined in:
lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ParamsProviderInterface

ParamsProvider

Constructor Details

#initialize(properties) ⇒ GenericParamsProviderImpl

Returns a new instance of GenericParamsProviderImpl.



11
12
13
14
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 11

def initialize(properties)
  super()
  @properties = properties
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



10
11
12
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 10

def properties
  @properties
end

Instance Method Details

#getParameter(param, dflt) ⇒ Object



15
16
17
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 15

def getParameter(param,dflt)
  return PropertiesTools::getProperty(@properties,param,dflt)
end

#getParametersObject



26
27
28
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 26

def getParameters()
  return @properties
end

#getRenderParameters(configuration) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 29

def getRenderParameters(configuration)
  renderParams = PropertiesTools::newProperties()
  renderParameterList = configuration::getProperty(ConfigurationKeys::EDITOR_PARAMETERS_LIST,ConfigurationKeys::EDITOR_PARAMETERS_DEFAULT_LIST)::split(",")
    for i in 0..renderParameterList::length-1
      key = renderParameterList[i]
      value = PropertiesTools::getProperty(@properties,key)
      if value!=nil
        PropertiesTools::setProperty(renderParams,key,value)
      end
      i+=1
    end
  return renderParams
end

#getRequiredParameter(param) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 18

def getRequiredParameter(param)
  parameter = PropertiesTools::getProperty(@properties,param,nil)
  if parameter!=nil
    return parameter
  else 
    raise Exception,("Error: parameter"+param)+"is required"
  end
end

#getServiceParametersObject



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb', line 42

def getServiceParameters()
  serviceParams = PropertiesTools::newProperties()
  serviceParamListArray = Std::split(ConfigurationKeys::SERVICES_PARAMETERS_LIST,",")
    for i in 0..serviceParamListArray::length()-1
      key = serviceParamListArray::_(i)
      value = PropertiesTools::getProperty(@properties,key)
      if value!=nil
        PropertiesTools::setProperty(serviceParams,key,value)
      end
      i+=1
    end
  return serviceParams
end