List of usage examples for org.apache.commons.lang StringUtils substringBeforeLast
public static String substringBeforeLast(String str, String separator)
Gets the substring before the last occurrence of a separator.
From source file:com.capgemini.b2bassets.core.batch.task.BatchIntegrationTest.java
@Before public void setUp() throws Exception { random = new Random(); mediaHeader = batchMediaConverter.getHeader(); productId = Long.valueOf(Math.abs((long) random.nextInt())); sequenceId = Long.valueOf(Math.abs((long) random.nextInt())); importCsv("/b2bassetscore/test/testBatch.impex", "utf-8"); // don't import binary data -> temporarily remove MediaTranslator ((DefaultImpexConverter) batchMediaConverter).setHeader(StringUtils.substringBeforeLast(mediaHeader, ";")); }
From source file:com.sap.sapbasket.core.batch.task.BatchIntegrationTest.java
@Before public void setUp() throws Exception { random = new Random(); mediaHeader = batchMediaConverter.getHeader(); productId = Long.valueOf(Math.abs((long) random.nextInt())); sequenceId = Long.valueOf(Math.abs((long) random.nextInt())); importCsv("/sapbasketcore/test/testBatch.impex", "utf-8"); // don't import binary data -> temporarily remove MediaTranslator ((DefaultImpexConverter) batchMediaConverter).setHeader(StringUtils.substringBeforeLast(mediaHeader, ";")); }
From source file:de.hybris.merchandise.core.batch.task.BatchIntegrationTest.java
@Before public void setUp() throws Exception { random = new Random(); mediaHeader = batchMediaConverter.getHeader(); productId = Long.valueOf(Math.abs((long) random.nextInt())); sequenceId = Long.valueOf(Math.abs((long) random.nextInt())); importCsv("/merchandisecore/test/testBatch.impex", "utf-8"); // don't import binary data -> temporarily remove MediaTranslator ((DefaultImpexConverter) batchMediaConverter).setHeader(StringUtils.substringBeforeLast(mediaHeader, ";")); }
From source file:com.googlecode.gmaps4jsf.jsfplugin.digester.Component.java
/** * Returns the parent package folder//from ww w. j a v a 2s . com * e.g. com.googlecode.gmaps4jsf.component.tabview.Tab will return "com.googlecode.gmaps4jsf.component.tabview" */ public String getPackage() { return StringUtils.substringBeforeLast(getTagClass(), "."); }
From source file:com.amalto.core.server.DefaultXmlServer.java
public boolean existCluster(String cluster) throws XtentisException { try {/* w w w. j av a 2 s .c o m*/ if (cluster.endsWith(StorageAdmin.STAGING_SUFFIX)) { cluster = StringUtils.substringBeforeLast(cluster, "#"); //$NON-NLS-1$ } return server.existCluster(cluster); } catch (XmlServerException e) { throw new XtentisException(e); } }
From source file:de.hybris.platform.yacceleratorcore.batch.task.BatchIntegrationTest.java
@Before public void setUp() throws Exception { random = new Random(); mediaHeader = batchMediaConverter.getHeader(); productId = Long.valueOf(Math.abs((long) random.nextInt())); sequenceId = Long.valueOf(Math.abs((long) random.nextInt())); importCsv("/yacceleratorcore/test/testBatch.impex", "utf-8"); // don't import binary data -> temporarily remove MediaTranslator ((DefaultImpexConverter) batchMediaConverter).setHeader(StringUtils.substringBeforeLast(mediaHeader, ";")); }
From source file:com.tieto.tre.tietomerchendise.core.batch.task.BatchIntegrationTest.java
@Before public void setUp() throws Exception { random = new Random(); mediaHeader = batchMediaConverter.getHeader(); productId = Long.valueOf(Math.abs((long) random.nextInt())); sequenceId = Long.valueOf(Math.abs((long) random.nextInt())); importCsv("/tietomerchendisecore/test/testBatch.impex", "utf-8"); // don't import binary data -> temporarily remove MediaTranslator ((DefaultImpexConverter) batchMediaConverter).setHeader(StringUtils.substringBeforeLast(mediaHeader, ";")); }
From source file:info.magnolia.cms.security.auth.callback.RedirectClientCallback.java
@Override public void handle(HttpServletRequest request, HttpServletResponse response) { String target;//from ww w . j av a2 s .c o m if (location.startsWith("/")) { target = request.getContextPath() + location; } else { target = location; } if (request.getRequestURI().equals(target)) { log.debug("Unauthorized, can't redirect further, we're already at {}", target); return; } log.debug("Unauthorized, will redirect to {}", target); try { // formats the target location with the request url, to allow passing it has a parameter, for instance. String url = request.getRequestURL().toString(); if (MgnlContext.getParameters() != null && !MgnlContext.getParameters().isEmpty()) { Set<String> keys = MgnlContext.getParameters().keySet(); String parameterString = ""; String[] values; for (String key : keys) { // we don't want to pass along the mgnlLogut parameter on a // login action if (!key.equals("mgnlLogout")) { values = MgnlContext.getParameterValues(key); for (int i = 0; i < values.length; i++) { parameterString += key + "=" + values[i] + "&"; } } } if (StringUtils.isNotBlank(parameterString)) { // cut off trailing "&" url += "?" + StringUtils.substringBeforeLast(parameterString, "&"); target += "?" + StringUtils.substringBeforeLast(parameterString, "&"); } } final String encodedUrl = URLEncoder.encode(url, "UTF-8"); final String formattedTarget = MessageFormat.format(target, encodedUrl); response.sendRedirect(formattedTarget); } catch (IOException e) { throw new RuntimeException("Can't redirect to " + target + " : " + e.getMessage(), e); } }
From source file:com.thistech.spotlink.engine.AbstractPlacementDecisionEngine.java
/** * Build a Content from an Ad (for the PlacementResponse) * @param placementRequest The original PlacementRequest * @param ad The Ad//from w w w . ja v a2s . c om * @return A Content */ protected ContentType buildContent(PlacementRequestType placementRequest, Ad ad) { if (ad == null || ad.getMediaFiles().isEmpty()) { return null; } MediaFile mediaFile = ad.getMediaFiles().get(0); String providerId = StringUtils.substringBeforeLast(mediaFile.getUrl(), "/"); String assetId = StringUtils.substringAfterLast(mediaFile.getUrl(), "/"); return new ContentBuilder().withTracking(ad.getTrackingEvents().getId()).withAssetRef(providerId, assetId) .build(); }
From source file:com.amalto.core.server.DefaultDataCluster.java
/** * Get datacluster/* w w w.j a va2 s. co m*/ */ @Override public DataClusterPOJO getDataCluster(DataClusterPOJOPK pk) throws XtentisException { try { if (pk.getUniqueId() == null) { throw new XtentisException("The Data Cluster should not be null!"); } if (pk.getUniqueId().endsWith(StorageAdmin.STAGING_SUFFIX)) { pk = new DataClusterPOJOPK(StringUtils.substringBeforeLast(pk.getUniqueId(), "#")); } DataClusterPOJO value = MDMEhCacheUtil.getCache(DATA_CLUSTER_CACHE_NAME, pk.getUniqueId()); if (value != null) { return value; } DataClusterPOJO dataCluster = ObjectPOJO.load(DataClusterPOJO.class, pk); if (dataCluster == null) { String err = "The Data Cluster " + pk.getUniqueId() + " does not exist."; LOGGER.error(err); throw new XtentisException(err); } MDMEhCacheUtil.addCache(DATA_CLUSTER_CACHE_NAME, pk.getUniqueId(), dataCluster); return dataCluster; } catch (XtentisException e) { throw (e); } catch (Exception e) { String err = "Unable to get the Data Cluster " + pk.toString() + ": " + e.getClass().getName() + ": " + e.getLocalizedMessage(); LOGGER.error(err, e); throw new XtentisException(err); } }