List of usage examples for org.apache.commons.lang3 StringUtils substringAfterLast
public static String substringAfterLast(final String str, final String separator)
Gets the substring after the last occurrence of a separator.
From source file:jodtemplate.template.expression.DefaultExpressionHandler.java
private static String getInlineListName(final String text) { if (text.contains(POINT)) { return StringUtils.substringAfterLast(text, POINT); }//from w w w . j ava 2 s . c om return text; }
From source file:com.zht.common.codegen.service.impl.GenEntityServiceImpl.java
@Override public List<Map<String, String>> loadPropertyTypeData() { List<Map<String, String>> resList = new ArrayList<Map<String, String>>(); Map<String, String> poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.String"); poMap.put("displayz", "String"); resList.add(poMap);//from www . j av a 2 s .c om poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Long"); poMap.put("displayz", "Long"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.util.Date"); poMap.put("displayz", "Date"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Boolean"); poMap.put("displayz", "Boolean"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Integer"); poMap.put("displayz", "Integer"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Double"); poMap.put("displayz", "Double"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Float"); poMap.put("displayz", "Float"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Short"); poMap.put("displayz", "Short"); resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Byte"); poMap.put("displayz", "Byte"); resList.add(poMap); // poMap=new LinkedHashMap<>(); // poMap.put("valuez", "java.lang.Character"); // poMap.put("displayz", "Character"); // resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.lang.Byte[]"); poMap.put("displayz", "Byte[]"); resList.add(poMap); // poMap=new LinkedHashMap<>(); // poMap.put("valuez", "java.sql.Time"); // poMap.put("displayz", "Time"); // resList.add(poMap); // poMap=new LinkedHashMap<>(); // poMap.put("valuez", "java.sql.Timestamp"); // poMap.put("displayz", "Timestamp"); // resList.add(poMap); poMap = new LinkedHashMap<>(); poMap.put("valuez", "java.math.BigDecimal"); poMap.put("displayz", "BigDecimal"); resList.add(poMap); String hql = "select name from GenEntity "; Query query = baseDaoImpl.getCurrentSession().createQuery(hql); @SuppressWarnings("unchecked") List<String> list = query.list(); if (list != null && list.size() > 0) { for (String str : list) { Map<String, String> map = new HashMap<>(); map.put("valuez", str); map.put("displayz", StringUtils.substringAfterLast(str, ".")); resList.add(map); } } return resList; }
From source file:cc.recommenders.names.VmMethodName.java
@Override public ITypeName getReturnType() { String returnType = StringUtils.substringAfterLast(identifier, ")"); // strip off throws type from method return returnType = StringUtils.substringBefore(returnType, "|"); if (!returnType.endsWith(";")) { // be sure that if it does not end with a ';' is MUST be a primitive // or an array of primitives: final ITypeName res = VmTypeName.get(returnType); ensureIsTrue(res.isPrimitiveType() || res.isArrayType() && res.getArrayBaseType().isPrimitiveType()); return res; } else {/*from w w w. j a v a 2 s . c o m*/ returnType = StringUtils.substring(returnType, 0, -1); return VmTypeName.get(returnType); } }
From source file:cc.recommenders.names.CoReMethodName.java
@Override public ICoReTypeName getReturnType() { String returnType = StringUtils.substringAfterLast(identifier, ")"); // strip off throws type from method return returnType = StringUtils.substringBefore(returnType, "|"); if (!returnType.endsWith(";")) { // be sure that if it does not end with a ';' is MUST be a primitive // or an array of primitives: final ICoReTypeName res = CoReTypeName.get(returnType); ensureIsTrue(res.isPrimitiveType() || res.isArrayType() && res.getArrayBaseType().isPrimitiveType()); return res; } else {// w w w .java 2 s. com returnType = StringUtils.substring(returnType, 0, -1); return CoReTypeName.get(returnType); } }
From source file:de.micromata.tpsb.doc.parser.FileInfo.java
public String getShortClassName() { if (className.indexOf('.') == -1) { return className; }//from w w w . j a v a 2s. c om return StringUtils.substringAfterLast(className, "."); }
From source file:com.denimgroup.threadfix.importer.impl.upload.ClangChannelImporter.java
private String getNativeIdFromReport(String input) { String id;/* w ww . ja va 2 s.c o m*/ id = StringUtils.substringBetween(input, "report-", ".html"); if (id == null) id = StringUtils.substringAfterLast(input, "/"); if (id == null) id = input; if (id.length() > 50) id = id.substring(id.length() - 50); return id; }
From source file:io.wcm.handler.mediasource.inline.InlineMediaSource.java
/** * Make sure filename contains no invalid characters or path parts * @param fileName File name/*w ww .j av a 2 s. c o m*/ * @return Cleaned up file name */ private String cleanupFileName(String fileName) { String processedFileName = fileName; // strip off path parts if (StringUtils.contains(processedFileName, "/")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "/"); } if (StringUtils.contains(processedFileName, "\\")) { processedFileName = StringUtils.substringAfterLast(processedFileName, "\\"); } // make sure filename does not contain any invalid characters processedFileName = Escape.validFilename(processedFileName); return processedFileName; }
From source file:com.github.cherimojava.orchidae.controller.PictureController.java
/** * uploads multiple files into the system for the current user * //from w w w.j a v a 2 s. com * @param request * request with pictures to store * @return {@link org.springframework.http.HttpStatus#CREATED} if the upload was successful or * {@link org.springframework.http.HttpStatus#OK} if some of the pictures couldn't be uploaded together with * information which pictures couldn't be uploaded * @since 1.0.0 */ @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ResponseEntity<String> handleFileUpload(MultipartHttpServletRequest request) { List<String> badFiles = Lists.newArrayList(); User user = userUtil .getUser((String) SecurityContextHolder.getContext().getAuthentication().getPrincipal()); for (Iterator<String> it = request.getFileNames(); it.hasNext();) { MultipartFile file = request.getFile(it.next()); // Create uuid and Picture entity Picture picture = factory.create(Picture.class); picture.setUser(user); picture.setTitle(StringUtils.split(file.getOriginalFilename(), ".")[0]); picture.setId(generateId()); picture.setOriginalName(file.getOriginalFilename()); picture.setUploadDate(DateTime.now()); String type = StringUtils.substringAfterLast(file.getOriginalFilename(), "."); try { File storedPicture = fileUtil.getFileHandle(picture.getId()); // save picture file.transferTo(storedPicture); // read some some properties from it BufferedImage image = ImageIO.read(storedPicture); picture.setHeight(image.getHeight()); picture.setWidth(image.getWidth()); picture.setAccess(Access.PRIVATE);// TODO for now only private access createSmall(picture.getId(), image, type); LOG.info("Uploaded {} and assigned id {}", file.getOriginalFilename(), picture.getId()); checkBatch(picture, request); picture.save(); } catch (Exception e) { LOG.warn("failed to store picture", e); badFiles.add(file.getOriginalFilename()); } } if (badFiles.isEmpty()) { return new ResponseEntity<>("You successfully uploaded!", HttpStatus.CREATED); } else { return new ResponseEntity<>( "Could not upload all files. Failed to upload: " + Joiner.on(",").join(badFiles), HttpStatus.OK); } }
From source file:com.cognifide.qa.bb.aem.ui.AemContentFinder.java
/** * @return Name of the currently selected tab, e.g. Images, Documents *///from w w w .j a v a 2s.c o m public String getCurrentTabName() { WebElement findElement = iconBar.findElement(By.xpath(".//li[contains(@class,'x-tab-strip-active')]")); String id = findElement.getAttribute("id"); return StringUtils.substringAfterLast(id, "-"); }
From source file:com.utdallas.s3lab.smvhunter.monkey.MonkeyMe.java
/** * Read static analysis output/*from ww w . j a va 2 s .co m*/ * @throws IOException * */ private static void readFromStaticAnalysisText() throws IOException { Iterator<String> lineIter = FileUtils.lineIterator(new File(dbLocation)); while (lineIter.hasNext()) { String line = lineIter.next(); String[] info = line.split("[\\s]"); String apkName = StringUtils.substringAfterLast(info[0], "/"); String seedName = info[2]; String seedType = info[3]; if (resultFromStaticAnalysis.containsKey(apkName)) { List<StaticResultBean> list = resultFromStaticAnalysis.get(apkName); list.add(new StaticResultBean(seedName, seedType)); } else { List<StaticResultBean> list = new ArrayList<StaticResultBean>(); list.add(new StaticResultBean(seedName, seedType)); resultFromStaticAnalysis.put(apkName, list); } } }