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:de.hybris.platform.secureportaladdon.cockpit.config.impl.TaskCellRenderer.java
/** * @return True if the user chose to approve the registration *///from w w w . j a va 2s . c o m protected boolean isApprovedDecision(final WorkflowDecisionModel decision) { return StringUtils.equalsIgnoreCase(decision.getCode(), SecureportaladdonConstants.Workflows.Decisions.REGISTRATION_APPROVED); }
From source file:hydrograph.ui.graph.debugconverter.DebugConverter.java
public Debug getParam() throws Exception { Map<String, SubjobDetails> componentNameAndLink = new HashMap(); Debug debug = new Debug(); ViewData viewData = null;/*w w w .j a va 2 s . co m*/ String componenetId = ""; String socket_Id = ""; IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); ELTGraphicalEditor editor = (ELTGraphicalEditor) page.getActiveEditor(); if (editor != null && editor instanceof ELTGraphicalEditor) { GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor) .getAdapter(GraphicalViewer.class); for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator .hasNext();) { EditPart editPart = iterator.next(); if (editPart instanceof ComponentEditPart) { Component component = ((ComponentEditPart) editPart).getCastedModel(); if (component instanceof SubjobComponent) { Link link = component.getInputLinks().get(0); String previousComponent = link.getSource().getComponentId(); traverseSubjob(component, debug, component.getComponentId(), previousComponent); } Map<String, Long> map = component.getWatcherTerminals(); if (!map.isEmpty()) { for (Entry<String, Long> entrySet : map.entrySet()) { List<Link> links = ((ComponentEditPart) editPart).getCastedModel() .getSourceConnections(); if (StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.SUBJOB_COMPONENT)) { for (Link link : links) { componentNameAndLink.clear(); boolean isWatch = link.getSource().getPort(link.getSourceTerminal()) .isWatched(); if (isWatch) { ViewDataUtils.getInstance().subjobParams(componentNameAndLink, component, new StringBuilder(), link.getSourceTerminal()); for (Entry<String, SubjobDetails> entry : componentNameAndLink.entrySet()) { String comp_soc = entry.getKey(); String[] split = StringUtils.split(comp_soc, "/."); componenetId = split[0]; for (int i = 1; i < split.length - 1; i++) { componenetId = componenetId + "." + split[i]; } socket_Id = split[split.length - 1]; } viewData = new ViewData(); viewData.setFromComponentId(componenetId); viewData.setOutSocketId(socket_Id); String portType = socket_Id.substring(0, 3); viewData.setOutSocketType(checkPortType(portType)); debug.getViewData().add(viewData); } } break; } else { viewData = new ViewData(); viewData.setFromComponentId(component.getComponentId()); viewData.setOutSocketId(entrySet.getKey()); String portType = entrySet.getKey().substring(0, 3); viewData.setOutSocketType(checkPortType(portType)); debug.getViewData().add(viewData); } } } } } } return debug; }
From source file:com.google.code.jerseyclients.asynchttpclient.AsyncHttpClientJerseyClientHandler.java
/** * @see com.sun.jersey.api.client.ClientHandler#handle(com.sun.jersey.api.client.ClientRequest) *///from w ww .j a v a 2 s . c o m public ClientResponse handle(final ClientRequest clientRequest) throws ClientHandlerException { final BoundRequestBuilder boundRequestBuilder = getBoundRequestBuilder(clientRequest); PerRequestConfig perRequestConfig = new PerRequestConfig(); perRequestConfig.setRequestTimeoutInMs(this.jerseyHttpClientConfig.getReadTimeOut()); if (this.jerseyHttpClientConfig.getProxyInformation() != null) { ProxyServer proxyServer = new ProxyServer(jerseyHttpClientConfig.getProxyInformation().getProxyHost(), jerseyHttpClientConfig.getProxyInformation().getProxyPort()); perRequestConfig = new PerRequestConfig(proxyServer, this.jerseyHttpClientConfig.getReadTimeOut()); } boundRequestBuilder.setPerRequestConfig(perRequestConfig); if (this.jerseyHttpClientConfig.getApplicationCode() != null) { boundRequestBuilder.addHeader(this.jerseyHttpClientConfig.getApplicationCodeHeader(), this.jerseyHttpClientConfig.getApplicationCode()); } if (this.jerseyHttpClientConfig.getOptionnalHeaders() != null) { for (Entry<String, String> entry : this.jerseyHttpClientConfig.getOptionnalHeaders().entrySet()) { boundRequestBuilder.addHeader(entry.getKey(), entry.getValue()); } } if (StringUtils.equalsIgnoreCase("POST", clientRequest.getMethod())) { if (clientRequest.getEntity() != null) { final RequestEntityWriter re = getRequestEntityWriter(clientRequest); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { re.writeRequestEntity(new CommittingOutputStream(baos) { @Override protected void commit() throws IOException { writeOutBoundHeaders(clientRequest.getHeaders(), boundRequestBuilder); } }); } catch (IOException ex) { throw new ClientHandlerException(ex); } boundRequestBuilder.setBody(new ByteArrayInputStream(baos.toByteArray())); } } else { writeOutBoundHeaders(clientRequest.getHeaders(), boundRequestBuilder); } try { StopWatch stopWatch = new StopWatch(); stopWatch.reset(); stopWatch.start(); Future<Response> futureResponse = boundRequestBuilder.execute(); Response response = futureResponse.get(); int httpReturnCode = response.getStatusCode(); stopWatch.stop(); log.info("time to call rest url " + clientRequest.getURI() + ", " + stopWatch.getTime() + " ms"); // in case of empty content returned we returned an empty stream // to return a null object if (httpReturnCode == Status.NO_CONTENT.getStatusCode()) { new ClientResponse(httpReturnCode, getInBoundHeaders(response), IOUtils.toInputStream(""), getMessageBodyWorkers()); } return new ClientResponse(httpReturnCode, getInBoundHeaders(response), response.getResponseBodyAsStream() == null ? IOUtils.toInputStream("") : response.getResponseBodyAsStream(), getMessageBodyWorkers()); } catch (Exception e) { if (e.getCause() != null && (e.getCause() instanceof TimeoutException)) { throw new ClientHandlerException(new SocketTimeoutException()); } throw new ClientHandlerException(e); } }
From source file:hydrograph.ui.engine.ui.util.ImportedSchemaPropagation.java
private TransformMapping getTransformMapping(Component component) { String componentName = component.getComponentName(); if (StringUtils.equalsIgnoreCase(Constants.TRANSFORM, componentName) || StringUtils.equalsIgnoreCase(Constants.AGGREGATE, componentName) || StringUtils.equalsIgnoreCase(Constants.NORMALIZE, componentName) || StringUtils.equalsIgnoreCase(Constants.GROUP_COMBINE, componentName) || StringUtils.equalsIgnoreCase(Constants.CUMULATE, componentName)) { TransformMapping transformMapping = (TransformMapping) component.getProperties() .get(Constants.OPERATION); if (transformMapping != null) { return transformMapping; }/*from w ww . j ava 2 s .c om*/ } return null; }
From source file:com.adobe.acs.commons.http.injectors.AbstractHtmlRequestInjector.java
@SuppressWarnings("squid:S3923") protected boolean accepts(final ServletRequest servletRequest, final ServletResponse servletResponse) { if (!(servletRequest instanceof HttpServletRequest) || !(servletResponse instanceof HttpServletResponse)) { return false; }/*from w w w .j a va 2 s . c o m*/ final HttpServletRequest request = (HttpServletRequest) servletRequest; if (!StringUtils.equalsIgnoreCase("get", request.getMethod())) { // Only inject on GET requests return false; } else if (StringUtils.equals(request.getHeader("X-Requested-With"), "XMLHttpRequest")) { // Do not inject into XHR requests return false; } else if (StringUtils.contains(request.getPathInfo(), ".") && !StringUtils.contains(request.getPathInfo(), ".html")) { // If extension is provided it must be .html return false; } else if (StringUtils.endsWith(request.getHeader("Referer"), "/editor.html" + request.getRequestURI())) { // Do not apply to pages loaded in the TouchUI editor.html return false; } else if (StringUtils.endsWith(request.getHeader("Referer"), "/cf")) { // Do not apply to pages loaded in the Classic Content Finder return false; } // Add HTML check if (log.isTraceEnabled()) { log.trace("Injecting HTML via AbstractHTMLRequestInjector"); } return true; }
From source file:jp.primecloud.auto.api.util.ValidateUtil.java
/** * * boolean?//from w w w.j ava 2 s. c o m * * @param value ?? * @param code ?? * @param params ?? */ public static void isBoolean(String value, String code, Object[] params) { if (StringUtils.equalsIgnoreCase("true", value) == false && StringUtils.equalsIgnoreCase("false", value) == false) { throw new AutoApplicationException(code, params); } }
From source file:hydrograph.ui.graph.debugconverter.SchemaHelper.java
/** * This function will write schema in xml file * @param schemaFilePath/*ww w . j a v a 2 s .c om*/ * @throws CoreException */ public void exportSchemaFile(String schemaFilePath) throws CoreException { Map<String, SubjobDetails> componentNameAndLink = new HashMap(); List<String> oldComponentIdList = new LinkedList<>(); File file = null; String socketName = null; String componentName; String component_Id = null; IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (activeEditor instanceof ELTGraphicalEditor) { ELTGraphicalEditor editor = (ELTGraphicalEditor) activeEditor; if (editor != null) { GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor) .getAdapter(GraphicalViewer.class); for (Object objectEditPart : graphicalViewer.getEditPartRegistry().values()) { if (objectEditPart instanceof ComponentEditPart) { List<Link> links = ((ComponentEditPart) objectEditPart).getCastedModel() .getSourceConnections(); for (Link link : links) { Component component = link.getSource(); if (StringUtils.equalsIgnoreCase(component.getComponentName(), Constants.SUBJOB_COMPONENT)) { Link inputLink = component.getInputLinks().get(0); String previousComponent = inputLink.getSource().getComponentId(); ViewDataUtils.getInstance().subjobParams(componentNameAndLink, component, new StringBuilder(), link.getSourceTerminal()); removeDuplicateKeys(oldComponentIdList, componentNameAndLink); createDebugXmls(component, schemaFilePath, component.getComponentId(), previousComponent); for (Entry<String, SubjobDetails> entry : componentNameAndLink.entrySet()) { String comp_soc = entry.getKey(); oldComponentIdList.add(comp_soc); String[] split = StringUtils.split(comp_soc, "/."); component_Id = split[0]; for (int i = 1; i < split.length - 1; i++) { component_Id = component_Id + "." + split[i]; } socketName = entry.getValue().getTargetTerminal(); } componentName = component_Id; } else { componentName = link.getSource().getComponentId(); socketName = link.getSourceTerminal(); } Object obj = link.getSource().getComponentEditPart(); List<PortEditPart> portEditPart = ((EditPart) obj).getChildren(); for (AbstractGraphicalEditPart part : portEditPart) { if (part instanceof PortEditPart) { boolean isWatch = ((PortEditPart) part).getPortFigure().isWatched(); if (isWatch && link.getSourceTerminal() .equals(((PortEditPart) part).getPortFigure().getTerminal())) { if (StringUtils.isNotBlank(schemaFilePath)) { String path = schemaFilePath.trim() + "_" + componentName + "_" + socketName; String filePath = ((IPath) new Path(path)) .addFileExtension(Constants.XML_EXTENSION_FOR_IPATH).toString(); List<GridRow> gridRowList = getSchemaGridRowList(link); file = new File(filePath); GridRowLoader gridRowLoader = new GridRowLoader( Constants.GENERIC_GRID_ROW, file); gridRowLoader.exportXMLfromGridRowsWithoutMessage(gridRowList); logger.debug("schema file created for : {}, {}", componentName, socketName); } } } } } } } } } }
From source file:hydrograph.ui.graph.action.subjob.SubJobUpdateAction.java
@Override protected boolean calculateEnabled() { List<Object> selectedObjects = getSelectedObjects(); if (selectedObjects != null && !selectedObjects.isEmpty() && selectedObjects.size() == 1) { for (Object obj : selectedObjects) { if (obj instanceof ComponentEditPart) { if (Constants.SUBJOB_COMPONENT .equalsIgnoreCase(((ComponentEditPart) obj).getCastedModel().getComponentName())) { ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); String currentJobName = editor.getActiveProject() + "." + editor.getJobName(); Job job = editor.getJobInstance(currentJobName); if (job != null && ((StringUtils.equalsIgnoreCase(job.getJobStatus(), JobStatus.RUNNING)) || (StringUtils.equalsIgnoreCase(job.getJobStatus(), JobStatus.SSHEXEC)))) { return false; }//from www.j a v a2 s . com return true; } } } } return false; }
From source file:info.magnolia.cms.security.MgnlGroup.java
/** * checks is any object exist with the given name under this node * @param name/* w w w.j a va2 s . c o m*/ * @param nodeName */ private boolean hasAny(String name, String nodeName) { try { HierarchyManager hm; if (StringUtils.equalsIgnoreCase(nodeName, NODE_ROLES)) hm = MgnlContext.getHierarchyManager(ContentRepository.USER_ROLES); else hm = MgnlContext.getHierarchyManager(ContentRepository.USER_GROUPS); Content node = groupNode.getContent(nodeName); for (Iterator iter = node.getNodeDataCollection().iterator(); iter.hasNext();) { NodeData nodeData = (NodeData) iter.next(); // check for the existence of this ID try { if (hm.getContentByUUID(nodeData.getString()).getName().equalsIgnoreCase(name)) { return true; } } catch (ItemNotFoundException e) { if (log.isDebugEnabled()) log.debug("Role [ " + name + " ] does not exist in the ROLES repository"); } catch (IllegalArgumentException e) { if (log.isDebugEnabled()) log.debug(nodeData.getHandle() + " has invalid value"); } } } catch (RepositoryException e) { log.debug(e.getMessage(), e); } return false; }
From source file:net.di2e.ddf.argo.probe.responder.ProbeHandler.java
@Override public void run() { LOGGER.debug("Listening for any multicast packets."); String data = ""; while (!isCanceled) { try {// www. j ava 2s . co m byte buf[] = new byte[1024]; DatagramPacket pack = new DatagramPacket(buf, buf.length); socket.receive(pack); data = new String(pack.getData(), pack.getOffset(), pack.getLength()); LOGGER.debug("Packet received with the following payload: {}.", data); Probe probe = JAXB.unmarshal(new StringReader(data), Probe.class); List<RespondTo> respondTo = probe.getRa().getRespondTo(); boolean ignoreProbe = false; if (ignoreProbesList != null && !ignoreProbesList.isEmpty()) { for (String ignoreProbeString : ignoreProbesList) { String updatedIgnoreString = expandRespondToAddress(ignoreProbeString); // TODO cache the request ID and use that instead of the local hostname if (StringUtils.equalsIgnoreCase(updatedIgnoreString, respondTo.get(0).getValue())) { LOGGER.debug( "Configuration is set to ignore probes that have a respondTo of '{}'. Incoming probe contains respondTo of '{}'. IGNORING PROBE.", ignoreProbeString, respondTo.get(0).getValue()); ignoreProbe = true; } } } if (!ignoreProbe) { List<String> contractIDs = probe.getScids().getServiceContractID(); // TODO handle the different contractID // URI contractId = probe.getContractID(); String probeId = probe.getId(); String response = generateServiceResponse(probe.getRespondToPayloadType(), contractIDs, probeId); if (StringUtils.isNotBlank(response)) { LOGGER.debug("Returning back to {} with the following response:\n{}", respondTo.get(0).getValue(), response); sendResponse(respondTo.get(0).getValue(), response, probe.getRespondToPayloadType()); } else { LOGGER.debug( "No services found that match the incoming contract IDs, not sending a response."); } } } catch (DataBindingException e) { LOGGER.warn("Issue parsing probe response: {}", data, e); } catch (SocketTimeoutException ste) { LOGGER.trace("Received timeout on socket, resetting socket to check for cancellation."); } catch (IOException ioe) { if (!isCanceled) { LOGGER.warn("Error while trying to receive a packet, shutting down listener", ioe); } break; } } if (isCanceled) { LOGGER.debug("Listener was canceled, not receiving any more multicast packets."); } }