List of usage examples for org.apache.commons.lang3 StringUtils endsWith
public static boolean endsWith(final CharSequence str, final CharSequence suffix)
Check if a CharSequence ends with a specified suffix.
null s are handled without exceptions.
From source file:com.dominion.salud.nomenclator.configuration.NOMENCLATORInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.dominion.salud.nomenclator.configuration"); ctx.setServletContext(servletContext); ctx.refresh();/*from w ww . j a va 2 s. c o m*/ logger.info(" Registrando servlets de configuracion"); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dispatcher.setInitParameter("contextClass", ctx.getClass().getName()); dispatcher.setLoadOnStartup(1); logger.info(" Agregando mapping: /"); dispatcher.addMapping("/"); logger.info(" Agregando mapping: /controller/*"); dispatcher.addMapping("/controller/*"); logger.info(" Agregando mapping: /services/*"); dispatcher.addMapping("/services/*"); servletContext.addListener(new ContextLoaderListener(ctx)); logger.info(" Servlets de configuracion registrados correctamente"); // Configuracion general logger.info(" Iniciando la configuracion del modulo"); NOMENCLATORConstantes._HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator) ? servletContext.getRealPath("/") : servletContext.getRealPath("/") + File.separator; NOMENCLATORConstantes._TEMP = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "temp" + File.separator; NOMENCLATORConstantes._VERSION = ResourceBundle.getBundle("version").getString("version"); NOMENCLATORConstantes._LOGS = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator + "logs"; NOMENCLATORConstantes._CONTEXT_NAME = servletContext.getServletContextName(); NOMENCLATORConstantes._CONTEXT_PATH = servletContext.getContextPath(); NOMENCLATORConstantes._CONTEXT_SERVER = servletContext.getServerInfo(); NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils.isNotBlank( ResourceBundle.getBundle("application").getString("nomenclator.enable.technical.information")) ? Boolean.parseBoolean(ResourceBundle.getBundle("application") .getString("nomenclator.enable.technical.information")) : false; PropertyConfigurator.configureAndWatch("log4j"); logger.info(" Configuracion general del sistema"); logger.info(" nomenclator.home: " + NOMENCLATORConstantes._HOME); logger.info(" nomenclator.temp: " + NOMENCLATORConstantes._TEMP); logger.info(" nomenclator.version: " + NOMENCLATORConstantes._VERSION); logger.info(" nomenclator.logs: " + NOMENCLATORConstantes._LOGS); logger.info(" nomenclator.context.name: " + NOMENCLATORConstantes._CONTEXT_NAME); logger.info(" nomenclator.context.path: " + NOMENCLATORConstantes._CONTEXT_PATH); logger.info(" nomenclator.context.server: " + NOMENCLATORConstantes._CONTEXT_SERVER); logger.info(" Parametrizacion del sistema"); logger.info(" nomenclator.enable.technical.information: " + NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION); logger.info(" Modulo configurado correctamente"); logger.info("MODULO INICIADO CORRECTAMENTE"); }
From source file:com.glaf.core.web.springmvc.MxSystemPropertyController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); String category = request.getParameter("category"); if (StringUtils.isNotEmpty(category)) { List<SystemProperty> rows = systemPropertyService.getSystemProperties(category); if (rows != null && !rows.isEmpty()) { for (SystemProperty p : rows) { if (StringUtils.equals(p.getInputType(), "combobox")) { if (StringUtils.isNotEmpty(p.getInitValue()) && StringUtils.startsWith(p.getInitValue(), "[") && StringUtils.endsWith(p.getInitValue(), "]")) { try { JSONArray array = JSON.parseArray(p.getInitValue()); p.setArray(array); StringBuffer buffer = new StringBuffer(); for (int i = 0, len = array.size(); i < len; i++) { JSONObject json = array.getJSONObject(i); buffer.append("<option value=\"").append(json.getString("value")).append("\">") .append(json.getString("name")).append("</option>") .append(FileUtils.newline); }//w w w . j ava2 s . c o m p.setSelectedScript(buffer.toString()); } catch (Exception ex) { ex.printStackTrace(); logger.error("parse json error :" + p.getInitValue(), ex); } } } } } request.setAttribute("rows", rows); } String jx_view = request.getParameter("jx_view"); if (StringUtils.isNotEmpty(jx_view)) { return new ModelAndView(jx_view, modelMap); } String x_view = ViewProperties.getString("sys_property.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/modules/sys/property/edit"); }
From source file:jenkins.plugins.asqatasun.ProjectAsqatasunAction.java
private String doBuildAuditResultUrl(String line, String webappUrl) { String auditId = StringUtils.substring(line, StringUtils.indexOf(line, ":") + 1).trim(); if (StringUtils.endsWith(webappUrl, "/")) { return webappUrl + URL_PREFIX_RESULT + auditId; } else {/*from w w w .jav a2 s . c om*/ return webappUrl + "/" + URL_PREFIX_RESULT + auditId; } }
From source file:com.cognifide.qa.bb.webelement.BobcatWebElement.java
/** * As there is known selenium// w w w . j a v a 2 s . co m * <a href="https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4446">4446</a> * bug this method retries sending keys until input field value is valid. * * @param keysToSend keyboard keys to send */ @Override public void sendKeys(CharSequence... keysToSend) { String textBefore = getValue(); if (isKeys(keysToSend[0]) || isUploadField(element)) { element.sendKeys(keysToSend); } else { for (int i = 0; i < SEND_KEYS_RETRIES; i++) { element.sendKeys(keysToSend); boolean success = StringUtils.endsWith(getValue(), keysToSend[0]); if (success) { break; } else { element.clear(); this.sendKeys(textBefore); } } } }
From source file:de.micromata.mgc.jpa.hibernatesearch.bridges.HistoryMasterClassBridge.java
@Override public void set(String name, Object value, Document document, LuceneOptions luceneOptions) { if (value == null) { log.error("Error in history class bridge: Object is null."); return;/*w w w . java2 s . c o m*/ } HistoryMasterBaseDO<?, ?> hm = (HistoryMasterBaseDO<?, ?>) value; if (hm.getEntityId() != null) { Field field = new LongField("entityId", hm.getEntityId(), Field.Store.YES); document.add(field); } else { log.error("Error in history class bridge: entityId is null."); } if (hm.getEntityName() != null) { Field field = new StringField("entityName", hm.getEntityName(), TabAttrFieldBridge.DEFAULT_STORE); document.add(field); } else { log.error("Error in history class bridge: entityName is null."); } if (hm.getModifiedAt() != null) { Field field = new LongField("modifiedAt", hm.getModifiedAt().getTime(), TabAttrFieldBridge.DEFAULT_STORE); document.add(field); } else { log.error("Error in history class bridge: modifiedAt is null."); } if (hm.getAttributeKeys() != null) { for (String key : hm.getAttributeKeys()) { String svalue = hm.getStringAttribute(key); if (StringUtils.isBlank(svalue) == true) { log.debug("HistoryMaster class bridge: value of attribute key: " + key + " is null."); continue; } if (StringUtils.endsWith(key, ":ov") == true) { String indexv = svalue; if (indexv.length() > MAX_FULLTEXT_FIELDLENGTH) { indexv = indexv.substring(0, MAX_FULLTEXT_FIELDLENGTH); } Field field = new StringField("oldValue", indexv, TabAttrFieldBridge.DEFAULT_STORE); document.add(field); } } } else { log.debug("HistoryMaster class bridge: attribute keys list is null."); } }
From source file:com.sonicle.webtop.core.versioning.SqlScript.java
private void readFile(InputStreamReader readable) throws IOException { this.statements = new ArrayList<>(); String lines[] = null;// w ww .ja v a2s .c o m StringBuilder sbsql = null; Scanner s = new Scanner(readable); s.useDelimiter("(;( )?(\r)?\n)"); while (s.hasNext()) { String block = s.next(); block = StringUtils.replace(block, "\r", ""); if (!StringUtils.isEmpty(block)) { // Remove remaining ; at the end of the block (only if this block is the last one) if (!s.hasNext() && StringUtils.endsWith(block, ";")) block = StringUtils.left(block, block.length() - 1); sbsql = new StringBuilder(); lines = StringUtils.split(block, "\n"); for (String line : lines) { if (CommentLine.matches(line)) continue; sbsql.append(StringUtils.trim(line)); sbsql.append(" "); } if (sbsql.length() > 0) statements.add(sbsql.toString()); } } }
From source file:io.wcm.maven.plugins.contentpackage.unpacker.ContentUnpacker.java
private boolean applyXmlExcludes(String name) { if (this.excludeNodes.length == 0 & this.excludeProperties.length == 0) { return false; }//from w w w . j a v a2s.c om return StringUtils.endsWith(name, "/.content.xml"); }
From source file:com.cognifide.aet.job.common.datafilters.jserrorsfilter.JsErrorsFilter.java
private boolean matchSourceFile(String paramValue, String errorValue) { return StringUtils.isEmpty(paramValue) || StringUtils.endsWith(errorValue, paramValue); }
From source file:com.erudika.scoold.core.Profile.java
public static final String id(String userid) { if (StringUtils.endsWith(userid, Config.SEPARATOR + "profile")) { return userid; } else {//from w ww .j a v a 2 s .c om return userid != null ? userid + Config.SEPARATOR + "profile" : null; } }
From source file:com.cognifide.qa.bb.utils.YamlReader.java
private static InputStream readFile(String path) { String fullPath = StringUtils.endsWith(path, YAML) ? path : path + YAML; return YamlReader.class.getResourceAsStream(fullPath); }