List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:cn.newtouch.util.Struts2Utils.java
/** * ?contentTypeheaders.//from w w w .j a v a 2s . c o m */ private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) { // ?headers? String encoding = DEFAULT_ENCODING; boolean noCache = DEFAULT_NOCACHE; for (String header : headers) { String headerName = StringUtils.substringBefore(header, ":"); String headerValue = StringUtils.substringAfter(header, ":"); if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) { encoding = headerValue; } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) { noCache = Boolean.parseBoolean(headerValue); } else { throw new IllegalArgumentException(headerName + "??header"); } } HttpServletResponse response = ServletActionContext.getResponse(); // headers? String fullContentType = contentType + ";charset=" + encoding; response.setContentType(fullContentType); if (noCache) { ServletUtils.setDisableCacheHeader(response); } return response; }
From source file:com.microsoft.alm.plugin.context.ServerContextManager.java
public synchronized void remove(final String serverUri) { if (StringUtils.isEmpty(serverUri)) { return;/*from w ww. jav a 2 s . c om*/ } final String key = ServerContext.getKey(serverUri); final ServerContext context = get(key); if (context != null) { getStore().forgetServerContext(key); contextMap.remove(key); if (StringUtils.equalsIgnoreCase(key, getLastUsedContextKey())) { clearLastUsedContext(); } } }
From source file:hydrograph.ui.engine.converter.impl.SFTPConvertorHelper.java
/** * authentication details/*from w ww. ja va 2 s .c o m*/ * @param ftp */ private void addAuthenticationDetails(SFTP sftp) { Map<String, FTPAuthOperationDetails> authDetails = (Map<String, FTPAuthOperationDetails>) properties .get(PropertyNameConstants.FTP_AUTH.value()); FTPAuthOperationDetails authenticationDetails = null; if (authDetails != null && !authDetails.isEmpty()) { for (Map.Entry<String, FTPAuthOperationDetails> map : authDetails.entrySet()) { authenticationDetails = map.getValue(); if (StringUtils.equalsIgnoreCase(map.getKey(), "User ID and Key")) { if (authenticationDetails.getField2() != null && StringUtils.isNotBlank(authenticationDetails.getField2())) { sftp.setPrivateKeyPath(authenticationDetails.getField2()); } } else { if (authenticationDetails.getField2() != null && StringUtils.isNotBlank(authenticationDetails.getField2())) { sftp.setPassword(authenticationDetails.getField2()); } } sftp.setUserName(authenticationDetails.getField1()); } } }
From source file:com.shallop.codedrill.common.web.struts2.Struts2Utils.java
/** * ?contentTypeheaders./*from w w w. j a va2s . com*/ */ private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) { //?headers? String encoding = DEFAULT_ENCODING; boolean noCache = DEFAULT_NOCACHE; for (String header : headers) { String headerName = StringUtils.substringBefore(header, ":"); String headerValue = StringUtils.substringAfter(header, ":"); if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) { encoding = headerValue; } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) { noCache = Boolean.parseBoolean(headerValue); } else { throw new IllegalArgumentException(headerName + "??header"); } } // HttpServletResponse response = ServletActionContext.getResponse(); HttpServletResponse response = null; //headers? String fullContentType = contentType + ";charset=" + encoding; response.setContentType(fullContentType); if (noCache) { ServletUtils.setDisableCacheHeader(response); } return response; }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.databasecomponents.DatabaseTestConnectionWidget.java
private String getComponentType() { if (StringUtils.equalsIgnoreCase(getComponent().getType(), ORACLE)) { return ORACLE; } else if (StringUtils.equalsIgnoreCase(getComponent().getType(), REDSHIFT)) { return REDSHIFT; } else if (StringUtils.equalsIgnoreCase(getComponent().getType(), MYSQL)) { return MYSQL; } else if (StringUtils.equalsIgnoreCase(getComponent().getType(), TERADATA)) { return TERADATA; }// w ww. j av a 2 s . co m return ""; }
From source file:com.bfd.harpc.config.ServerConfig.java
/** * ?/*from w ww. ja v a2 s . c o m*/ * <p> * * @param serverNode * @param rpcMonitor * @return {@link IServer} * @throws ClassNotFoundException */ protected IServer createServer(ServerNode serverNode, RpcMonitor rpcMonitor) throws ClassNotFoundException { IServer server = null; if (StringUtils.equalsIgnoreCase(protocol, "thrift")) { TProcessor processor = reflectProcessor(rpcMonitor, serverNode); server = new ThriftServer(processor, serverNode, maxWorkerThreads, minWorkerThreads, rpcMonitor); } else if (StringUtils.equalsIgnoreCase(protocol, "avro")) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Class<?> protocolIface = reflectProtocolClass(); Responder responder = new SpecificResponder(reflectProtocolClass(), getProxy(classLoader, protocolIface, ref, rpcMonitor, serverNode)); server = new AvroServer(responder, serverNode, maxWorkerThreads, minWorkerThreads, rpcMonitor); } else { throw new RpcException(RpcException.CONFIG_EXCEPTION, "Unsupport protocal,please check the params 'protocal'!"); } return server; }
From source file:com.szl.common.utils.Struts2Utils.java
/** * ?contentTypeheaders./*from w ww . ja v a2s .c o m*/ */ private static HttpServletResponse initResponseHeader(final String contentType, final String... headers) { //?headers? String encoding = DEFAULT_ENCODING; boolean noCache = DEFAULT_NOCACHE; for (String header : headers) { String headerName = StringUtils.substringBefore(header, ":"); String headerValue = StringUtils.substringAfter(header, ":"); if (StringUtils.equalsIgnoreCase(headerName, HEADER_ENCODING)) { encoding = headerValue; } else if (StringUtils.equalsIgnoreCase(headerName, HEADER_NOCACHE)) { noCache = Boolean.parseBoolean(headerValue); } else { throw new IllegalArgumentException(headerName + "??header"); } } HttpServletResponse response = ServletActionContext.getResponse(); //headers? String fullContentType = contentType + ";charset=" + encoding; response.setContentType(fullContentType); if (noCache) { ServletUtils.setNoCacheHeader(response); } return response; }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassComposite.java
/** * Create the composite.//from ww w.j a v a 2 s.c om * @param parent * @param style */ public OperationClassComposite(TransformDialog transformDialog, Composite parent, int style, final MappingSheetRow mappingSheetRow, Component component, WidgetConfig widgetConfig, TransformMapping transformMapping) { super(parent, style); setLayout(new GridLayout(1, false)); this.component = component; this.transformDialog = transformDialog; mainComposite = new Composite(this, SWT.NONE); mainComposite.setLayout(new GridLayout(3, false)); mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); this.transformMapping = transformMapping; configurationForTransformWidget = (OperationClassConfig) widgetConfig; if (StringUtils.equalsIgnoreCase(Constants.AGGREGATE, configurationForTransformWidget.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.CUMULATE, configurationForTransformWidget.getComponentName()) || StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE, configurationForTransformWidget.getComponentName())) { isAggregateOrCumulate = true; } else { isAggregateOrCumulate = false; } if (StringUtils.equalsIgnoreCase(Constants.TRANSFORM, configurationForTransformWidget.getComponentName())) { isTransForm = true; } else { isTransForm = false; } createOperationInputTable(); Composite composite = new Composite(mainComposite, SWT.NONE); composite.setLayout(new GridLayout(4, false)); GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_composite.heightHint = 191; gd_composite.widthHint = 272; composite.setLayoutData(gd_composite); new Label(composite, SWT.NONE); lblSwitchTo = new Label(composite, SWT.NONE); lblSwitchTo.setText("Switch to"); Composite radioButtonComposite = new Composite(composite, SWT.NONE); GridLayout radioButtonCompositeLayout = new GridLayout(2, false); radioButtonCompositeLayout.marginWidth = 0; radioButtonComposite.setLayout(radioButtonCompositeLayout); radioButtonComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); switchToExpressionButton = new Button(radioButtonComposite, SWT.RADIO); switchToExpressionButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { } }); switchToExpressionButton.setText("Expression"); switchToClassButton = new Button(radioButtonComposite, SWT.RADIO); switchToClassButton.setText("Class"); switchToClassButton.setSelection(true); if (!isAggregateOrCumulate && !isTransForm) { radioButtonComposite.setVisible(false); lblSwitchTo.setVisible(false); } else { radioButtonComposite.setVisible(true); lblSwitchTo.setVisible(true); } new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); Label lblExpression = new Label(composite, SWT.NONE); GridData gd_lblExpression = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gd_lblExpression.minimumWidth = 70; gd_lblExpression.heightHint = 15; lblExpression.setLayoutData(gd_lblExpression); lblExpression.setText("Operation Id"); operationIdTextBox = new Text(composite, SWT.BORDER); operationIdTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); composite_1 = new Composite(composite, SWT.NONE); composite_1.setLayout(new GridLayout(1, false)); GridData gd_composite_1 = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 4); gd_composite_1.heightHint = 80; gd_composite_1.widthHint = 90; composite_1.setLayoutData(gd_composite_1); composite_2 = new Composite(composite_1, SWT.NONE); GridData gd_composite_2 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_composite_2.heightHint = 75; gd_composite_2.widthHint = 80; composite_2.setLayoutData(gd_composite_2); composite_2.setLayout(new GridLayout(1, false)); browseButton = new Button(composite_2, SWT.NONE); browseButton.setToolTipText(Messages.OPERATION_COMPOSITE_BROWSE_BUTTON_TOOL_TIP); GridData gd_browseButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); if (OSValidator.isMac()) { gd_browseButton.horizontalIndent = -5; gd_browseButton.widthHint = 40; } else { gd_browseButton.widthHint = 28; } gd_browseButton.heightHint = 25; browseButton.setLayoutData(gd_browseButton); browseButton.setText("..."); new Label(composite_2, SWT.NONE); btnIsParam = new Button(composite_2, SWT.CHECK); GridData gd_btnIsParam = new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1); gd_btnIsParam.heightHint = 19; gd_btnIsParam.widthHint = 75; btnIsParam.setLayoutData(gd_btnIsParam); btnIsParam.setAlignment(SWT.CENTER); btnIsParam.setText(Messages.IS_PARAM); btnIsParam.setSelection(mappingSheetRow.isWholeOperationParameter()); new Label(composite, SWT.NONE); Label lblNewLabel = new Label(composite, SWT.NONE); GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gd_lblNewLabel.minimumWidth = 50; lblNewLabel.setLayoutData(gd_lblNewLabel); lblNewLabel.setText("Class"); operationTextBox = new Text(composite, SWT.BORDER); operationTextBox.setEditable(false); operationTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); Label lblParameter = new Label(composite, SWT.NONE); GridData gd_lblParameter = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); gd_lblParameter.minimumWidth = 50; lblParameter.setLayoutData(gd_lblParameter); lblParameter.setText("Parameter"); parameterTextBox = new Text(composite, SWT.BORDER); parameterTextBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); parameterTextBox.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { Text text = (Text) e.widget; mappingSheetRow.setWholeOperationParameterValue(text.getText()); } }); parameterTextBox.setEnabled(mappingSheetRow.isWholeOperationParameter()); if (mappingSheetRow.getWholeOperationParameterValue() != null) parameterTextBox.setText(mappingSheetRow.getWholeOperationParameterValue()); createOperationOutputFieldTable(); setAllWidgetsOnIsParamButton(btnIsParam); disabledWidgetsifWholeOperationIsParameter(btnIsParam, mappingSheetRow.isWholeOperationParameter()); if (mappingSheetRow.getOperationClassPath() != null) { operationTextBox.setText(mappingSheetRow.getOperationClassPath()); } createExternalOperationComposite(mappingSheetRow); }
From source file:hydrograph.ui.expression.editor.util.ExpressionEditorUtil.java
public void addFocusListenerToSearchTextBox(final Text searchTextBox) { searchTextBox.setToolTipText(Messages.SEARCH_TEXT_BOX_TOOLTIP); searchTextBox.addFocusListener(new FocusListener() { @Override//ww w.j av a 2s . com public void focusLost(FocusEvent e) { searchTextBox.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry(128, 128, 128)); if (StringUtils.isBlank(searchTextBox.getText())) { searchTextBox.setText(Constants.DEFAULT_SEARCH_TEXT); } } @Override public void focusGained(FocusEvent e) { searchTextBox.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry(0, 0, 0)); if (StringUtils.equalsIgnoreCase(Constants.DEFAULT_SEARCH_TEXT, searchTextBox.getText())) { searchTextBox.setText(Constants.EMPTY_STRING); } } }); }
From source file:hydrograph.ui.propertywindow.filter.FilterLogicWidget.java
private void addSelectionListerner() { button.addSelectionListener(new SelectionAdapter() { @Override//from w ww. j a va2s. com public void widgetSelected(SelectionEvent e) { FilterLogicDataStructure clonedDataStructure = (FilterLogicDataStructure) dataStructure.clone(); FilterExpressionOperationDialog dialog = new FilterExpressionOperationDialog( Display.getCurrent().getActiveShell(), clonedDataStructure, getComponent(), propertyDialogButtonBar, widgetConfig, getInputSchema()); if (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.FILTER)) { dialog.setTitle("Filter Editor"); } else if (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.PARTITION_BY_EXPRESSION)) { dialog.setTitle("Partition Logic Editor"); } if (dialog.open() == IDialogConstants.OK_ID) { dataStructure = clonedDataStructure; } showHideErrorSymbol(widgets); if (dialog.isYesButtonPressed()) { propertyDialog.pressOK(); } else if (dialog.isNoButtonPressed()) { propertyDialog.pressCancel(); } } }); }