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.



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

def initialize(properties)
    super()
    self.properties = properties
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



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

def properties
  @properties
end

Instance Method Details

#getParameter(param, dflt) ⇒ Object



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

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

#getParametersObject



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

def getParameters()
    return self.properties
end

#getRenderParameters(configuration) ⇒ Object



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

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(self.properties,key)
        if value != nil
            PropertiesTools::setProperty(renderParams,key,value)
        end
        i+=1
    end
    return renderParams
end

#getRequiredParameter(param) ⇒ Object



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

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

#getServiceParametersObject



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

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(self.properties,key)
        if value != nil
            PropertiesTools::setProperty(serviceParams,key,value)
        end
        i+=1
    end
    return serviceParams
end