List of usage examples for org.apache.commons.lang StringUtils endsWith
public static boolean endsWith(String str, String suffix)
Check if a String ends with a specified suffix.
From source file:com.microsoft.alm.plugin.external.utils.WorkspaceHelper.java
/** * This method returns true if the serverPath ends with /* *//*from w w w . j a v a2 s. c o m*/ public static boolean isOneLevelMapping(final String serverPath) { return StringUtils.endsWith(serverPath, ONE_LEVEL_MAPPING_SUFFIX); }
From source file:com.hangum.tadpole.engine.sql.util.sqlscripts.DDLScriptManager.java
/** * /*from w w w . j a v a 2s . c o m*/ * @param obj * @return */ public String getScript(Object obj) throws Exception { String retStr = ""; // find DDL Object if (PublicTadpoleDefine.OBJECT_TYPE.TABLES == actionType) { TableDAO tbl = (TableDAO) obj; setObjectName(tbl.getName()); retStr = rdbScript.getTableScript(tbl); } else if (PublicTadpoleDefine.OBJECT_TYPE.VIEWS == actionType) { TableDAO tbl = (TableDAO) obj; setObjectName(tbl.getName()); retStr = rdbScript.getViewScript(tbl.getName()); } else if (PublicTadpoleDefine.OBJECT_TYPE.INDEXES == actionType) { InformationSchemaDAO index = (InformationSchemaDAO) obj; setObjectName(index.getINDEX_NAME()); retStr = rdbScript.getIndexScript(index); } else if (PublicTadpoleDefine.OBJECT_TYPE.FUNCTIONS == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getFunctionScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.PROCEDURES == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getProcedureScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.PACKAGES == actionType) { ProcedureFunctionDAO procedure = (ProcedureFunctionDAO) obj; setObjectName(procedure.getName()); retStr = rdbScript.getProcedureScript(procedure); } else if (PublicTadpoleDefine.OBJECT_TYPE.TRIGGERS == actionType) { TriggerDAO trigger = (TriggerDAO) obj; setObjectName(trigger.getName()); retStr = rdbScript.getTriggerScript(trigger); } else { throw new Exception(Messages.get().ProcedureExecuterManager_0); } // ; ? ??? . if (StringUtils.endsWith(StringUtils.trimToEmpty(retStr), PublicTadpoleDefine.SQL_DELIMITER)) { return retStr; } else { return retStr + PublicTadpoleDefine.SQL_DELIMITER; } }
From source file:com.mobileman.kuravis.core.ws.BaseControllerTest.java
protected MvcResult doDelete(String id, String url) throws Exception { if (StringUtils.isEmpty(id)) { return null; }/*from w ww .ja v a 2s . c o m*/ url = StringUtils.endsWith(url, "/") ? url : url + "/"; url += id; RequestBuilder rb = MockMvcRequestBuilders.delete(url).contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON); MvcResult result = this.mockMvc.perform(rb).andReturn(); assertNull(result.getResolvedException()); Assert.assertEquals(HttpStatus.OK, HttpStatus.valueOf(result.getResponse().getStatus())); return result; }
From source file:eionet.meta.dao.domain.VocabularyFolder.java
/** * @param baseUri//from ww w . j a va 2s. c o m * the baseUri to set */ public void setBaseUri(String baseUri) { this.baseUri = StringUtils.trimToNull(baseUri); if (StringUtils.isNotBlank(this.baseUri) && !StringUtils.endsWith(this.baseUri, "/") && !StringUtils.endsWith(this.baseUri, ":") && !StringUtils.endsWith(this.baseUri, "#")) { this.baseUri = this.baseUri + "/"; } }
From source file:com.hangum.tadpole.rdb.core.editors.main.utils.RequestQuery.java
/** * sql of query type/*from ww w .ja v a2 s .co m*/ * * @param sql * @return query type */ public void parseSQL(String sql) { BasicTDBSQLParser parser = new BasicTDBSQLParser(); QueryInfoDTO queryInfoDto = parser.parser(sql); setStatement(queryInfoDto.isStatement()); try { Statement statement = CCJSqlParserUtil.parse(sql); setSqlType(SQL_TYPE.DML); if (statement instanceof Select) { sqlDMLType = QUERY_DML_TYPE.SELECT; } else if (statement instanceof Insert) { sqlDMLType = QUERY_DML_TYPE.INSERT; } else if (statement instanceof Update) { sqlDMLType = QUERY_DML_TYPE.UPDATE; } else if (statement instanceof Delete) { sqlDMLType = QUERY_DML_TYPE.DELETE; } } catch (Throwable e) { logger.error(String.format("sql parse exception. [ %s ]", sql)); } if (sqlDMLType.equals(QUERY_DML_TYPE.UNKNOWN)) { if (queryInfoDto.isStatement()) { setSqlType(SQL_TYPE.DML); sqlDMLType = QUERY_DML_TYPE.UNKNOWN; } else { setSqlType(SQL_TYPE.DDL); sqlDDLType = queryInfoDto.getQueryDDLType(); queryStatus = queryInfoDto.getQueryStatus(); sqlObjectName = queryInfoDto.getObjectName(); // // CREATE, ALTER , // , , , , ? ?? ; ? ? ?. - ? ? hangum // if (queryStatus == QUERY_DDL_STATUS.CREATE | queryStatus == QUERY_DDL_STATUS.ALTER) if (sqlDDLType == QUERY_DDL_TYPE.PROCEDURE | sqlDDLType == QUERY_DDL_TYPE.FUNCTION | sqlDDLType == QUERY_DDL_TYPE.TRIGGER | sqlDDLType == QUERY_DDL_TYPE.PACKAGE | sqlDDLType == QUERY_DDL_TYPE.SYNONYM) { if (!StringUtils.endsWith(this.sql, PublicTadpoleDefine.SQL_DELIMITER)) { this.sql += PublicTadpoleDefine.SQL_DELIMITER; } } } } }
From source file:com.gst.infrastructure.documentmanagement.api.ImagesApiResource.java
/** * Returns a base 64 encoded client image Data URI *///from www. j av a 2 s .com @GET @Consumes({ MediaType.TEXT_PLAIN, MediaType.TEXT_HTML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.TEXT_PLAIN }) public Response retrieveImage(@PathParam("entity") final String entityName, @PathParam("entityId") final Long entityId, @QueryParam("maxWidth") final Integer maxWidth, @QueryParam("maxHeight") final Integer maxHeight, @QueryParam("output") final String output) { validateEntityTypeforImage(entityName); if (ENTITY_TYPE_FOR_IMAGES.CLIENTS.toString().equalsIgnoreCase(entityName)) { this.context.authenticatedUser().validateHasReadPermission("CLIENTIMAGE"); } else if (ENTITY_TYPE_FOR_IMAGES.STAFF.toString().equalsIgnoreCase(entityName)) { this.context.authenticatedUser().validateHasReadPermission("STAFFIMAGE"); } if (output != null && (output.equals("octet") || output.equals("inline_octet"))) { return downloadClientImage(entityName, entityId, maxWidth, maxHeight, output); } final ImageData imageData = this.imageReadPlatformService.retrieveImage(entityName, entityId); // TODO: Need a better way of determining image type String imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.JPEG.getValue(); if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.IMAGE_FILE_EXTENSION.GIF.getValue())) { imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.GIF.getValue(); } else if (StringUtils.endsWith(imageData.location(), ContentRepositoryUtils.IMAGE_FILE_EXTENSION.PNG.getValue())) { imageDataURISuffix = ContentRepositoryUtils.IMAGE_DATA_URI_SUFFIX.PNG.getValue(); } final String clientImageAsBase64Text = imageDataURISuffix + Base64.encodeBytes(imageData.getContentOfSize(maxWidth, maxHeight)); return Response.ok(clientImageAsBase64Text).build(); }
From source file:de.hybris.platform.accountsummaryaddon.document.dao.impl.DefaultPagedB2BDocumentDao.java
protected String getFiedName(final String fieldName) { if (StringUtils.endsWith(fieldName, "_max") || StringUtils.endsWith(fieldName, "_min")) { return StringUtils.substringBefore(fieldName, "_"); }// w ww .j a v a 2 s . c om return fieldName; }
From source file:edu.monash.merc.util.DMUtil.java
public static String normalizePath(String path) { if (StringUtils.isNotBlank(path)) { if (StringUtils.endsWith(path, "/")) { return StringUtils.removeEnd(path, "/"); } else {/*ww w . j av a2s. c o m*/ return path; } } return path; }
From source file:com.razorfish.controllers.misc.StoreSessionController.java
protected String getReturnRedirectUrlForUrlEncoding(final HttpServletRequest request, final String old, final String current) { String referer = StringUtils.remove(request.getRequestURL().toString(), request.getServletPath()); if (!StringUtils.endsWith(referer, "/")) { referer = referer + "/"; }//from w w w . j av a 2s .co m if (referer != null && !referer.isEmpty() && StringUtils.contains(referer, "/" + old + "/")) { return REDIRECT_PREFIX + StringUtils.replace(referer, "/" + old + "/", "/" + current + "/"); } return REDIRECT_PREFIX + referer; }
From source file:it.av.eatt.service.impl.JcrApplicationServiceJackrabbit.java
public void setBasePath(String basePath) { if (StringUtils.isBlank(basePath)) { this.basePath = ""; } else {/*from w w w. ja va 2s . c o m*/ this.basePath = StringUtils.trimToEmpty(basePath); if ((StringUtils.endsWith(this.basePath, "/"))) { this.basePath = StringUtils.removeEnd(this.basePath, "/"); } } }