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:jp.co.tis.gsp.tools.dba.dialect.SqlserverDialect.java
@Override public void dropAll(String user, String password, String adminUser, String adminPassword, String schema) throws MojoExecutionException { Connection conn = null;// ww w. j a v a 2 s. c om Statement stmt = null; PreparedStatement dropStmt; try { conn = DriverManager.getConnection(url, adminUser, adminPassword); stmt = conn.createStatement(); // ??????? if (!existsSchema(conn, schema)) { stmt.execute("CREATE SCHEMA " + schema); conn.createStatement().execute("ALTER USER " + user + " WITH DEFAULT_SCHEMA = " + schema); if (!StringUtils.equalsIgnoreCase(schema, "dbo") && !StringUtils.equalsIgnoreCase(schema, "sys") && !StringUtils.equalsIgnoreCase(schema, "INFORMATION_SCHEMA")) { stmt.execute("ALTER AUTHORIZATION ON SCHEMA::" + schema + " TO " + user); } return; } else { conn.createStatement().execute("ALTER USER " + user + " WITH DEFAULT_SCHEMA = " + schema); if (!StringUtils.equalsIgnoreCase(schema, "dbo") && !StringUtils.equalsIgnoreCase(schema, "sys") && !StringUtils.equalsIgnoreCase(schema, "INFORMATION_SCHEMA")) { stmt.execute("ALTER AUTHORIZATION ON SCHEMA::" + schema + " TO " + user); } } // ???? EntityDependencyParser parser = new EntityDependencyParser(); parser.parse(conn, url, schema); final List<String> tableList = parser.getTableList(); Collections.reverse(tableList); for (String table : tableList) { dropObject(conn, schema, "TABLE", table); } // ?? dropStmt = conn.prepareStatement("SELECT name, type_desc FROM sys.objects WHERE schema_id = SCHEMA_ID('" + schema + "') AND type IN ('U','V')"); ResultSet rs = dropStmt.executeQuery(); while (rs.next()) { if (!tableList.contains(rs.getString("name"))) { String objectType = getObjectType(rs.getString("type_desc")); if (objectType != null) { dropObject(conn, schema, objectType, rs.getString("name")); } } } } catch (SQLException e) { throw new MojoExecutionException("?", e); } finally { StatementUtil.close(stmt); ConnectionUtil.close(conn); } }
From source file:hydrograph.ui.expression.editor.datastructure.MethodDetails.java
private String formatType(String returnType) { if (StringUtils.equalsIgnoreCase(returnType, "V")) { returnType = "void"; } else if (StringUtils.equalsIgnoreCase(returnType, "Z")) { returnType = "boolean"; }// ww w.ja va 2s. co m return returnType; }
From source file:de.hybris.platform.secureportaladdon.cockpit.config.impl.TaskCellRenderer.java
/** * @return True if the user chose to reject the registration *//* ww w . j a v a 2s. c om*/ protected boolean isRejectedDecision(final WorkflowDecisionModel decision) { return StringUtils.equalsIgnoreCase(decision.getCode(), SecureportaladdonConstants.Workflows.Decisions.REGISTRATION_REJECTED); }
From source file:com.sammyun.controller.console.MemberController.java
/** * E-mail?//from w ww. ja va 2 s.c o m */ @RequestMapping(value = "/check_email", method = RequestMethod.GET) public @ResponseBody boolean checkEmail(String previousEmail, String email) { if (StringUtils.equalsIgnoreCase(previousEmail, email)) { return true; } if (memberService.emailExists(email)) { return false; } else { return true; } }
From source file:com.activecq.api.utils.TypeUtil.java
public static <T> T toObjectType(String data, Class<T> klass) { if (Double.class.equals(klass)) { try {//from ww w.j av a 2 s.co m return klass.cast(Double.parseDouble(data)); } catch (NumberFormatException ex) { return null; } } else if (Long.class.equals(klass)) { try { return klass.cast(Long.parseLong(data)); } catch (NumberFormatException ex) { return null; } } else if (StringUtils.equalsIgnoreCase("true", data)) { return klass.cast(Boolean.TRUE); } else if (StringUtils.equalsIgnoreCase("false", data)) { return klass.cast(Boolean.FALSE); } else if (JSON_DATE.matcher(data).matches()) { return klass.cast(ISODateTimeFormat.dateTimeParser().parseDateTime(data).toDate()); } else { return klass.cast(data); } }
From source file:com.edgenius.wiki.ext.todo.service.TodoServiceImpl.java
@Transactional(readOnly = true) public void fillTodosAndStatuses(Map<String, Object> map, Todo todo) { if (todo.getUid() == null) { //This todo is not persist yet, it shouldn't have todo items. So only fill in status list map.put("statuslist", todo.getStatuses()); return;//from www .ja va2s . c o m } //here doesn't use todo.getItems() for 2 reasons: //1. if todo is new one and just persisted, it won't refresh items - although this can be fix by adding items to todo.setItems() list //2. For a new item, it won't sort correctly as it won't get real createDate from database. List<TodoItem> todos = getTodoItems(todo.getPageUuid(), todo.getName()); //status from current macro - some status tag maybe not tag any TodoItem yet. so we need merge them - database and macro. List<TodoStatus> statuses = todo.getStatuses(); Map<String, Long> taggedStatuses = todoItemDAO.getStatusCount(todo.getPageUuid(), todo.getName()); //fill in TodoItem.statusObject for (TodoItem item : todos) { int idx = -1; for (int findIdx = 0; findIdx < statuses.size(); findIdx++) { if (StringUtils.equalsIgnoreCase(statuses.get(findIdx).getText(), item.getStatus())) { idx = findIdx; break; } } TodoStatus status; if (idx == -1) { //this TodoItem status not available in current macro status list(user have updated macro and remove some statuses) //then create a temporarily one. status = new TodoStatus(); status.setText(item.getStatus()); status.setSequence(statuses.size()); status.setPersisted(false); //fill it to current status list statuses.add(status); } else { status = statuses.get(idx); } //lower case - see todoItemDAO.getStatusCount() Long count = taggedStatuses.get(status.getText().toLowerCase()); if (count == null) status.setItemsCount(0); else status.setItemsCount(count.intValue()); //update status object item.setStatusObj(status); } map.put("todos", todos); map.put("statuslist", statuses); }
From source file:com.edgenius.wiki.render.handler.ImageHandler.java
public List<RenderPiece> handle(RenderContext renderContext, Map<String, String> values) throws RenderHandlerException { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Build ImageModel object, then render it String source = values.get(ImageFilter.SRC); values.remove(ImageFilter.SRC); ImageModel img = new ImageModel(); if (!source.toLowerCase().startsWith("http://") && !source.toLowerCase().startsWith("https://")) { //ok, this normal image render rather than draft preview etc(can see draft images), then remove all draft status attachments from list if (renderContext.getPageVisibleAttachments() == null && atts != null) { for (Iterator<FileNode> iter = atts.iterator(); iter.hasNext();) { FileNode node = iter.next(); if (node.getStatus() > 0) iter.remove();//from www . j av a2 s . c o m } } if (atts == null || atts.size() == 0) { throw new RenderHandlerException( "Image can not render because image repository can not find any attachment."); } img.filename = source; //try to find the image from repository for (FileNode node : atts) { if (StringUtils.equalsIgnoreCase(node.getFilename(), source)) { //found attachment img.url = renderContext.buildDownloadURL(node.getFilename(), node.getNodeUuid(), false); break; } } } else { img.url = source; } if (img.url == null) { log.info("Unable parse out external image url or unavailable image attachment from " + source); throw new RenderHandlerException( messageService.getMessage("render.image.not.found", new String[] { source })); } List<RenderPiece> pieces = new ArrayList<RenderPiece>(); //does not keep align as they are not standard <img> tag attributes img.align = values.remove(NameConstants.ALIGN); img.width = values.remove(NameConstants.WIDTH); img.height = values.remove(NameConstants.HEIGHT); img.title = values.remove(NameConstants.TITLE); img.attributes = values; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // render ImageModel String imgBuf = img.toRichAjaxTag(); pieces.add(new TextModel(imgBuf.toString())); return pieces; }
From source file:com.edgenius.wiki.render.RenderUtil.java
/** * @param subnode//from ww w . jav a 2 s . c o m * @return */ public static boolean isBlockTag(HTMLNode node) { for (String block : WikiConstants.ISBLOCK_TAGS) { if (StringUtils.equalsIgnoreCase(block, node.getTagName())) { //also need check if its CSS does not contain "display:inline" if (node.getStyle() == null || !NameConstants.INLINE.equalsIgnoreCase(node.getStyle().get(NameConstants.DISPLAY))) { return true; } } } return false; }
From source file:com.fengduo.bee.service.impl.message.MailServiceImpl.java
private boolean sendMail(String toMember, String subject, String text) { List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("appid", mailAppid)); params.add(new BasicNameValuePair("to", toMember)); params.add(new BasicNameValuePair("subject", subject)); params.add(new BasicNameValuePair("text", text)); params.add(new BasicNameValuePair("signature", signature)); params.add(new BasicNameValuePair("from", "system@fengduo.co")); try {//www . j ava2 s .c o m String result = HttpClientUtils.postRequest(mailUrl, params); logger.info("---send mail to get code result {},{},???", result, toMember); JSONObject jsonObject = JSONObject.parseObject(result); String status = jsonObject.getString("status"); if (StringUtils.equalsIgnoreCase(status, "success")) { return true; } } catch (Exception e) { logger.debug("http post error!{}", e.getMessage()); logger.info("{},??", toMember); } return false; }
From source file:com.adobe.acs.tools.csv.impl.Column.java
private <T> T toObjectType(String data, Class<T> klass) { data = StringUtils.trim(data);//from w ww . j a v a2s . c om if (Double.class.equals(klass)) { try { return klass.cast(Double.parseDouble(data)); } catch (NumberFormatException ex) { return null; } } else if (Long.class.equals(klass)) { try { return klass.cast(Long.parseLong(data)); } catch (NumberFormatException ex) { return null; } } else if (Integer.class.equals(klass)) { try { return klass.cast(Long.parseLong(data)); } catch (NumberFormatException ex) { return null; } } else if (StringUtils.equalsIgnoreCase("true", data)) { return klass.cast(Boolean.TRUE); } else if (StringUtils.equalsIgnoreCase("false", data)) { return klass.cast(Boolean.FALSE); } else if ((Date.class.equals(Date.class) || Calendar.class.equals(Calendar.class)) && ISO_DATE_PATTERN.matcher(data).matches()) { return klass.cast(ISODateTimeFormat.dateTimeParser().parseDateTime(data).toCalendar(Locale.US)); } else { return klass.cast(data); } }