本文整理汇总了Java中org.pentaho.reporting.libraries.base.util.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于org.pentaho.reporting.libraries.base.util包,在下文中一共展示了StringUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseQuery
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private void parseQuery(Element e, SampleDataFactory df) {
String name = e.getAttribute("name");
if (StringUtils.isEmpty(name)) {
return;
}
Element query = getFirst(e, "static-query");
String queryText = null;
if (query != null) {
queryText = query.getTextContent();
}
Element queryScript = getFirst(e, "script");
String queryScriptText = null;
String queryLanguage = null;
if (query != null) {
queryScriptText = queryScript.getTextContent();
queryLanguage = queryScript.getAttribute("language");
if (StringUtils.isEmpty(queryLanguage)) {
queryLanguage = df.getGlobalScriptLanguage();
}
}
df.setQuery(name, queryText, queryLanguage, queryScriptText);
}
示例2: performUpdate
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
protected void performUpdate()
{
QueryDialogModel<String> dialogModel = getDialogModel();
final Query<String> selectedQuery = dialogModel.getSelectedQuery();
if (selectedQuery == null)
{
return;
}
String text = queryTextArea.getText();
if (StringUtils.isEmpty(text))
{
text = null;
}
if (ObjectUtilities.equal(text, selectedQuery.getQueryScript()))
{
return;
}
dialogModel.updateSelectedQuery(selectedQuery.updateQuery(text));
}
示例3: createDataFactory
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private SampleDataFactory createDataFactory()
{
SampleDataFactory dataFactory = new SampleDataFactory();
String selectedItem = (String) connectUrlModel.getSelectedItem();
if (StringUtils.isEmpty(selectedItem) == false &&
SampleDataFactory.YAHOO_QUERY_DEFAULT.equals(selectedItem) == false)
{
dataFactory.setUrlPattern(selectedItem);
}
dataFactory.setGlobalScriptLanguage(dialogModel.getGlobalScriptLanguage());
dataFactory.setGlobalScript(dialogModel.getGlobalScript());
for (Query<String> q : dialogModel)
{
dataFactory.setQuery(q.getName(), q.getQuery(), q.getQueryLanguage(), q.getQueryScript());
}
return dataFactory;
}
示例4: computeGreetingName
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private String computeGreetingName()
{
if (StringUtils.isEmpty(getField()))
{
return null;
}
Object raw = getDataRow().get(getField());
if (raw == null)
{
return null;
}
String text = String.valueOf(raw);
if (StringUtils.isEmpty(text))
{
return null;
}
return text;
}
示例5: validateStep
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
/**
* @return true if the query can be executed.
*/
protected boolean validateStep()
{
// If we have no createdDataFactory and we don't have anything in the model then we can't continue
final AbstractReportDefinition reportDefinition = getEditorModel().getReportDefinition();
if (reportDefinition.getDataFactory() == null ||
StringUtils.isEmpty(reportDefinition.getQuery()))
{
DebugLog.log("Have no query or no datafactory " + //$NON-NLS-1$
reportDefinition.getDataFactory() + " " + reportDefinition.getQuery()); //$NON-NLS-1$
return false;
}
// if we have a DataFactory and a query make sure that they are contained in cdf.
final String queryName = reportDefinition.getQuery();
if (df == null || df.isQueryExecutable(queryName, new StaticDataRow()) == false)
{
return false;
}
try
{
final AbstractReportDefinition abstractReportDefinition =
(AbstractReportDefinition) reportDefinition.derive();
abstractReportDefinition.setDataFactory(df);
final DataSchemaModel schemaModel = WizardEditorModel.compileDataSchemaModel(abstractReportDefinition);
return schemaModel.isValid();
}
catch (Exception ee)
{
getDesignTimeContext().userError(ee);
return false;
}
}
示例6: writeConfig
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private void writeConfig(final XmlWriter xmlWriter, final SampleDataFactory dataFactory) throws IOException
{
final AttributeList configAttrs = new AttributeList();
if (StringUtils.isEmpty(dataFactory.getUrlPattern()) == false)
{
configAttrs.setAttribute(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.URL_PATTERN_ATTR, dataFactory.getUrlPattern());
}
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.CONFIG_TAG, configAttrs, XmlWriterSupport.CLOSE);
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:10,代码来源:SampleDataFactoryBundleWriterHandler.java
示例7: writeGlobalScript
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private void writeGlobalScript(final XmlWriter xmlWriter, final SampleDataFactory dataFactory) throws IOException
{
final String globalScript = dataFactory.getGlobalScript();
final String globalScriptLanguage = dataFactory.getGlobalScriptLanguage();
if (StringUtils.isEmpty(globalScript) == false && StringUtils.isEmpty(globalScriptLanguage) == false)
{
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.GLOBAL_SCRIPT_TAG,
SampleDataFactoryTags.LANGUAGE_ATTR, globalScriptLanguage, XmlWriterSupport.OPEN);
xmlWriter.writeTextNormalized(globalScript, false);
xmlWriter.writeCloseTag();
}
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:13,代码来源:SampleDataFactoryBundleWriterHandler.java
示例8: writeQueries
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private void writeQueries(final XmlWriter xmlWriter,
final SampleDataFactory dataFactory) throws IOException
{
final String globalScriptLanguage = dataFactory.getGlobalScriptLanguage();
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.QUERY_DEFINITIONS_TAG, XmlWriterSupport.OPEN);
final String[] queryNames = dataFactory.getQueryNames();
for (int i = 0; i < queryNames.length; i++)
{
final String queryName = queryNames[i];
final String query = dataFactory.getQuery(queryName);
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.QUERY_TAG, SampleDataFactoryTags.NAME_ATTR, queryName, XmlWriterSupport.OPEN);
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.STATIC_QUERY_TAG, XmlWriterSupport.OPEN);
xmlWriter.writeTextNormalized(query, false);
xmlWriter.writeCloseTag();
final String queryScriptLanguage = dataFactory.getScriptingLanguage(queryName);
final String queryScript = dataFactory.getScript(queryName);
if (StringUtils.isEmpty(queryScript) == false &&
(StringUtils.isEmpty(queryScriptLanguage) == false || StringUtils.isEmpty(globalScriptLanguage) == false))
{
if (StringUtils.isEmpty(queryScriptLanguage))
{
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.SCRIPT_TAG, XmlWriterSupport.OPEN);
}
else
{
xmlWriter.writeTag(SampleDataSourceModule.NAMESPACE, SampleDataFactoryTags.SCRIPT_TAG, SampleDataFactoryTags.LANGUAGE_ATTR, queryScriptLanguage, XmlWriterSupport.OPEN);
}
xmlWriter.writeTextNormalized(queryScript, false);
xmlWriter.writeCloseTag();
}
xmlWriter.writeCloseTag();
}
xmlWriter.writeCloseTag();
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:40,代码来源:SampleDataFactoryBundleWriterHandler.java
示例9: startParsing
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
protected void startParsing(final Attributes attrs) throws SAXException
{
urlPattern = attrs.getValue(getUri(), SampleDataFactoryTags.URL_PATTERN_ATTR);
if (StringUtils.isEmpty(urlPattern))
{
throw new ParseException
(String.format("Mandatory attribute '%s' missing.", SampleDataFactoryTags.URL_PATTERN_ATTR), getLocator());
}
}
示例10: parseGlobalScript
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
private void parseGlobalScript(final Element root, SampleDataFactory df) {
final Element e = getFirst(root, SampleDataFactoryTags.GLOBAL_SCRIPT_TAG);
if (e == null) {
return;
}
String lang = e.getAttribute(SampleDataFactoryTags.LANGUAGE_ATTR);
if (lang != null) {
String script = e.getTextContent();
if (!StringUtils.isEmpty(script)) {
df.setGlobalScript(script);
df.setGlobalScriptLanguage(lang);
}
}
}
示例11: performConfiguration
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
public DataFactory performConfiguration(final DesignTimeContext context,
final SampleDataFactory input,
final String selectedQueryName)
{
this.designTimeContext = context;
this.dialogModel.clear();
this.connectUrlModel.removeAllElements();
this.connectUrlModel.addElement(SampleDataFactory.YAHOO_QUERY_DEFAULT);
this.connectUrlModel.setSelectedItem(SampleDataFactory.YAHOO_QUERY_DEFAULT);
if (input != null)
{
if (StringUtils.isEmpty(input.getUrlPattern()) == false &&
SampleDataFactory.YAHOO_QUERY_DEFAULT.equals(input.getUrlPattern()) == false)
{
this.connectUrlModel.insertElementAt(input.getUrlPattern(), 0);
this.connectUrlModel.setSelectedItem(input.getUrlPattern());
}
Query<String> selectedQuery = null;
for (String queryName : input.getQueryNames())
{
Query<String> query = new Query<>(queryName, input.getQuery(queryName),
input.getScriptingLanguage(queryName), input.getScript(queryName));
if (queryName.equals(selectedQueryName))
{
selectedQuery = query;
}
this.dialogModel.addQuery(query);
}
this.dialogModel.setSelectedQuery(selectedQuery);
}
if (performEdit() == false)
{
return null;
}
return createDataFactory();
}
示例12: performTranslationTest
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
protected void performTranslationTest(String function)
{
FunctionDescription functionDesc = context.getFunctionRegistry().getMetaData(function);
assertFalse(StringUtils.isEmpty(functionDesc.getDisplayName(Locale.ENGLISH)));
assertFalse(StringUtils.isEmpty(functionDesc.getDescription(Locale.ENGLISH)));
int count = functionDesc.getParameterCount();
for (int x = 0; x < count; x++)
{
assertFalse(StringUtils.isEmpty(functionDesc.getParameterDescription(x, Locale.ENGLISH)));
assertFalse(StringUtils.isEmpty(functionDesc.getParameterDisplayName(x, Locale.ENGLISH)));
}
}
示例13: getProtocolFromString
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
public static int getProtocolFromString(String protocolCode, int defaultProtocol){
if(StringUtils.equals(protocolCode, PROTOCOL_STRING_IMAP) ) return PROTOCOL_IMAP;
else if(StringUtils.equals(protocolCode, PROTOCOL_STRING_POP3) ) return PROTOCOL_POP3;
else if(StringUtils.equals(protocolCode, PROTOCOL_STRING_MBOX) ) return PROTOCOL_MBOX;
return defaultProtocol;
}
示例14: init
import org.pentaho.reporting.libraries.base.util.StringUtils; //导入依赖的package包/类
public void init() throws ModelerException{
propPanel = (XulEditpanel) document.getElementById("propertiesPanel"); //$NON-NLS-1$
visualizationList = (XulMenuList)document.getElementById("visualizationlist"); //$NON-NLS-1$
bf.createBinding(workspace, "selectedVisualization", visualizationList, "selectedItem"); //$NON-NLS-1$//$NON-NLS-2$
bf.setBindingType(Binding.Type.ONE_WAY);
visualizationsBinding = bf.createBinding(this, "visualizationNames", visualizationList, "elements"); //$NON-NLS-1$//$NON-NLS-2$
//TODO: migrate this "source" code elsewhere or remove it entirely
XulLabel sourceLabel = (XulLabel) document.getElementById(SOURCE_NAME_LABEL_ID);
XulLabel relational_sourceLabel = (XulLabel) document.getElementById(this.RELATIONAL_NAME_LABEL_ID);
String tableName = ""; //$NON-NLS-1$
bf.createBinding(workspace, "sourceName", sourceLabel, "value"); //$NON-NLS-1$//$NON-NLS-2$
bf.createBinding(workspace, "sourceName", relational_sourceLabel, "value");
if( workspace.getModelSource() != null && workspace.getModelSource() instanceof OutputStepModelerSource) {
// for now just list the first table in the first physical workspace
DatabaseMeta databaseMeta = ((ISpoonModelerSource) workspace.getModelSource()).getDatabaseMeta();
List<IPhysicalModel> physicalModels = workspace.getDomain().getPhysicalModels();
if( physicalModels != null && physicalModels.size() > 0 ) {
List<? extends IPhysicalTable> tables = physicalModels.get(0).getPhysicalTables();
if( tables != null && tables.size() > 0 ) {
tableName = tables.get(0).getName(LocalizedString.DEFAULT_LOCALE);
}
}
} else if (workspace.getModelSource() != null && workspace.getModelSource() instanceof TableModelerSource) {
tableName = workspace.getModelSource().getTableName();
}
if(StringUtils.isEmpty(tableName)) {
tableName = ModelerMessagesHolder.getMessages().getString("ModelerController.Datasource");
}
//TODO: move all this datasource stuff into models! use the existing property form validation to show messages.
datasourceButtonBinding = bf.createBinding(workspace, "sourceName", this, "sourceNameForCheck");
workspace.setSourceName(tableName);
bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
bf.createBinding(this.propPanel, "visible", this, "propVisible"); //$NON-NLS-1$//$NON-NLS-2$
try{
datasourceButtonBinding.fireSourceChanged();
// modelNameBinding.fireSourceChanged();
visualizationsBinding.fireSourceChanged();
} catch(Exception e){
throw new ModelerException(e);
}
super.init();
setModellingMode(ModelerMode.ANALYSIS_AND_REPORTING);
}