/** * Get a parsed property. * Handles properties, which may be parsed or unparsed, * and always returns a parsed property value. * @param name The property name. * @return The property value or null if property not defined. */ public static Object getProperty(Map<String, Object> properties, String name, String[] imports, IValueFetcher fetcher, ClassLoader classloader) { return getParsedValue(properties!=null ? properties.get(name) : null, imports, fetcher, classloader); }
/** * Returns the value as it is used in the (already loaded) model. * * @param key * @return Object */ private Object getValueFromModel(String key) { Object val; Argument argument = (Argument)model.getArgument(key); val = SJavaParser.getParsedValue(argument, model.getAllImports(), null, Starter.class.getClassLoader()); if(val == null) { // get default value val = SJavaParser.getParsedValue(argument.getDefaultValue(), model.getAllImports(), null, Starter.class.getClassLoader()); } return val; } }
/** * Get the configuration name. */ protected static String getConfigurationName(IModelInfo model, Map<String, Object> cmdargs) { String configname = (String)cmdargs.get(CONFIGURATION_NAME); if(configname==null) { Object val = null; IArgument arg = model.getArgument(CONFIGURATION_NAME); if(arg!=null) { val = arg.getDefaultValue(); } val = SJavaParser.getParsedValue(val, model.getAllImports(), null, Starter.class.getClassLoader()); // val = UnparsedExpression.getParsedValue(val, model.getAllImports(), null, model.getClassLoader()); configname = val!=null ? val.toString() : null; } return configname; }
val = SJavaParser.getParsedValue(val, model.getAllImports(), null, Starter.class.getClassLoader());
/** * Get the configuration name. */ private ConfigurationInfo getConfigurationInfo(IModelInfo model) { String configname = getConfigurationName();//(String)cmdargs.get(CONFIGURATION_NAME); if(configname==null) { Object val = null; IArgument arg = model.getArgument(CONFIGURATION_NAME); if(arg!=null) { val = arg.getDefaultValue(); } val = SJavaParser.getParsedValue(val, model.getAllImports(), null, Starter.class.getClassLoader()); // val = UnparsedExpression.getParsedValue(val, model.getAllImports(), null, model.getClassLoader()); configname = val!=null ? val.toString() : null; } ConfigurationInfo compConfig = configname!=null ? model.getConfiguration(configname) : model.getConfigurations().length>0 ? model.getConfigurations()[0] : null; return compConfig; }
vals = (String[])SJavaParser.getParsedValue(evt, container.getBpmnModel().getModelInfo().getAllImports(), null, container.getProjectClassLoader());
keystore = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); keystorepass = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); String errpage = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null);
/** * Evaluate the condition. * @return */ public static boolean evaluateCondition(IInternalAccess agent, MCondition cond, MElement owner, Map<String, Object> vals) { boolean ret = false; UnparsedExpression uexp = cond.getExpression(); try { Object res = SJavaParser.getParsedValue(uexp, agent.getModel().getAllImports(), CapabilityWrapper.getFetcher(agent, uexp.getLanguage(), vals), agent.getClassLoader()); if(res instanceof Boolean) { ret = ((Boolean)res).booleanValue(); } else { agent.getLogger().warning("Condition does not evaluate to boolean: "+uexp.getValue()); } } catch(Exception e) { agent.getLogger().warning("Condition evaluation produced exception: "+uexp.getValue()+", "+e); } return ret; }
val = SJavaParser.getParsedValue(val, model.getAllImports(), null, Starter.class.getClassLoader());
arguments.put(upes[i].getName(), SJavaParser.getParsedValue(upes[i], component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); arguments.put(margs[i].getName(), SJavaParser.getParsedValue(margs[i].getDefaultValue(), component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader()));
for(int i=0; i<upes.length; i++) addArgument(upes[i].getName(), SJavaParser.getParsedValue(upes[i], model.getAllImports(), getFetcher(), getClassLoader())); done.add(upes[i].getName()); SJavaParser.getParsedValue(margs[i].getDefaultValue(), model.getAllImports(), getFetcher(), getClassLoader())); for(int i=0; i<upes.length; i++) addDefaultResult(upes[i].getName(), SJavaParser.getParsedValue(upes[i], model.getAllImports(), getFetcher(), getClassLoader())); done.add(upes[i].getName()); SJavaParser.getParsedValue(res[i].getDefaultValue(), model.getAllImports(), getFetcher(), getClassLoader()));
keystore = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); keystorepass = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null); try errpage = (String)SJavaParser.getParsedValue(upex, null, component!=null? component.getFetcher(): null, component!=null? component.getClassLoader(): null);
/** * Init unset results from default values. */ protected void initDefaultResults() { // Init the results with initial or default values. ConfigurationInfo ci = component.getConfiguration()!=null ? component.getModel().getConfiguration(component.getConfiguration()) : null; if(ci!=null) { UnparsedExpression[] upes = ci.getResults(); for(int i=0; i<upes.length; i++) { results.put(upes[i].getName(), SJavaParser.getParsedValue(upes[i], component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); } } IArgument[] res = component.getModel().getResults(); for(int i=0; i<res.length; i++) { // Prevents unset results being added to be able to check whether a user has // set an argument explicitly to null or if it just is null (e.g. for field injections) if(!results.containsKey(res[i].getName()) && res[i].getDefaultValue().getValue()!=null) { results.put(res[i].getName(), SJavaParser.getParsedValue(res[i].getDefaultValue(), component.getModel().getAllImports(), component.getFetcher(), component.getClassLoader())); } } }
ser = SJavaParser.getParsedValue(impl, component.getModel().getAllImports(), fetcher, component.getClassLoader());
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getModel().getAllImports(), getFetcher(), getClassLoader());
Object val = SJavaParser.getParsedValue(upex, null, CapabilityWrapper.getFetcher(ia, upex.getLanguage(), vals), null); if(val instanceof Boolean)
fetcher.setValue("$servicetype", info.getType().getType(getClassLoader())); ser = SJavaParser.getParsedValue(impl, model.getAllImports(), fetcher, getClassLoader());
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getModel().getAllImports(), getFetcher(), getClassLoader());
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getComponent().getModel().getAllImports(), getComponent().getFetcher(), getComponent().getClassLoader());
if(upes[i].getValue()!=null) step = SJavaParser.getParsedValue(upes[i], getComponent().getModel().getAllImports(), getComponent().getFetcher(), getComponent().getClassLoader());