Руководство Разработчика для Cisco Cisco UCS Director 5.0

Скачать
Страница из 31
Cisco UCS Director Cloupia Script Cookbook  
 
 
12 
 
Defining the Input type in the Custom Task 
4.1
 
1.  Define the Custom task input as Text 
 
 
 
 
2.  Define the custom task input as Number 
 
 
 
CloupiaScript snippet for defining input as text and number are as follows: 
 
1.  Defined input as text 
 
function handleNumbers(){ 
var strInput=input.stringInput; 
var convertedCustomTaskStringInput = null; 
if(strInput != null){ 
//
 for primitives, use the java wrapper objects and pass 
that and it will work 
convertedCustomTaskStringInput = new 
java.lang.Integer( strInput); 
logger.addInfo(" 
convertedCustomTaskStringInput 
="+convertedCustomTaskStringInput); 

handleNumbers(); 
This  example expect the user input for the custom task. If the input is not null , the 
input string  is converted in to number and printed in the log.