Java Code Examples for org.apache.commons.lang3.StringUtils.EMPTY

The following are Jave code examples for showing how to use EMPTY of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SECP   File: AdminController.java   View Source Code Vote up 6 votes
private String validateCreateRolesRequest(AppCreateDTO request) {
    if (request == null || Util.isCollectionEmpty(request.getRoles())) {
        return  AdminErrorMessage.REGISTER_ROLES_FAIL_EMPTY_REQUEST;
    }

    else if(StringUtils.isEmpty(request.getColor())){
        return  AdminErrorMessage.REGISTER_ROLES_FAIL_INVALID_COLOR;
    }

    for (String role : request.getRoles()) {
        if (rolesDAO.findByName(role) != null) {
            return String.format(AdminErrorMessage.REGISTER_ROLES_FAIL_NAME_EXISTS, role);
        }
    }

    return StringUtils.EMPTY;
}
 
Example 2
Project: axway-b2b-plugins   File: AzureTransportUtility.java   View Source Code Vote up 6 votes
public static String getSanitizedDownloadPath(String downloadObjectKey) {
	if (downloadObjectKey == null) {
		log.info(LOGGER_KEY + "Download object key set to the root of the container. Null value specified");
		downloadObjectKey = StringUtils.EMPTY;
	}

	if (downloadObjectKey.equalsIgnoreCase(PluginConstants.AZURE_FOLDER_SEPARATOR)) {
		log.info(LOGGER_KEY + "Download object key set to the root of the container");
		downloadObjectKey = StringUtils.EMPTY;
	}

	if (downloadObjectKey.startsWith(PluginConstants.AZURE_FOLDER_SEPARATOR)) {
		log.info(LOGGER_KEY + "Removing leading forward-slashes from download object key");
		downloadObjectKey = downloadObjectKey.substring(1, downloadObjectKey.length());
	}

	log.debug(LOGGER_KEY + "Formatting the Input to match Azure specification - " + downloadObjectKey);
	return downloadObjectKey;
}
 
Example 3
Project: jwala   File: AbstractGroupPersistenceServiceIntegrationTest.java   View Source Code Vote up 6 votes
@Test
public void testPopulateGroupJvmTemplates() throws FileNotFoundException {
    List<UploadJvmTemplateRequest> uploadCommands = new ArrayList<UploadJvmTemplateRequest>();
    InputStream data = new FileInputStream(new File("./src/test/resources/ServerXMLTemplate.tpl"));
    Scanner scanner = new Scanner(data).useDelimiter("\\A");
    String templateContent = scanner.hasNext() ? scanner.next() : "";

    UploadJvmTemplateRequest request = new UploadJvmTemplateRequest(preCreatedJvm, "ServerXMLTemplate.tpl", templateContent, StringUtils.EMPTY) {
        @Override
        public String getConfFileName() {
            return "server.xml";
        }
    };
    uploadCommands.add(request);
    groupPersistenceService.populateGroupJvmTemplates(preCreatedGroup.getName(), uploadCommands);
}
 
Example 4
Project: Thrush   File: HttpRequest.java   View Source Code Vote up 6 votes
public static String authClient() {
    CloseableHttpClient httpClient = buildHttpClient();
    HttpPost httpPost = new HttpPost(UrlConfig.authClient);

    httpPost.addHeader(CookieManager.cookieHeader());
    String param = Optional.ofNullable(ResultManager.get("tk")).map(r -> null == r.getValue() ? StringUtils.EMPTY : r.getValue().toString()).orElse(StringUtils.EMPTY);
    httpPost.setEntity(new StringEntity("tk=" + param, ContentType.create("application/x-www-form-urlencoded", Consts.UTF_8)));

    String result = StringUtils.EMPTY;
    try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
        result = EntityUtils.toString(response.getEntity());
        CookieManager.touch(response);
    } catch (IOException e) {
        logger.error("authClient error", e);
    }

    return result;
}
 
Example 5
Project: Thrush   File: HttpRequest.java   View Source Code Vote up 6 votes
public static String getPassengers() {
    CloseableHttpClient httpClient = buildHttpClient();
    HttpPost httpPost = new HttpPost(UrlConfig.passenger);

    httpPost.addHeader(CookieManager.cookieHeader());

    String result = StringUtils.EMPTY;
    try(CloseableHttpResponse response = httpClient.execute(httpPost)) {
        result = EntityUtils.toString(response.getEntity());
        List<Passenger> passengers = PassengerUtil.parsePassenger(result);
        ResultManager.touch(passengers, "passengers");
    } catch (IOException e) {
        logger.error("getPassengers error", e);
    }

    return result;
}
 
Example 6
Project: Thrush   File: HttpRequest.java   View Source Code Vote up 6 votes
public static String checkOrderInfo(TrainQuery query) {
    CloseableHttpClient httpClient = buildHttpClient();
    HttpPost httpPost = new HttpPost(UrlConfig.checkOrderInfo);

    httpPost.addHeader(CookieManager.cookieHeader());

    httpPost.setEntity(new StringEntity(genCheckOrderInfoParam(query), ContentType.create("application/x-www-form-urlencoded", Consts.UTF_8)));

    String result = StringUtils.EMPTY;
    try(CloseableHttpResponse response = httpClient.execute(httpPost)) {
        CookieManager.touch(response);
        result = EntityUtils.toString(response.getEntity());
    } catch (IOException e) {
        logger.error("checkUser error", e);
    }

    return result;
}
 
Example 7
Project: Thrush   File: HttpRequest.java   View Source Code Vote up 6 votes
public static String checkUser() {
    CloseableHttpClient httpClient = buildHttpClient();
    HttpPost httpPost = new HttpPost(UrlConfig.checkUser);

    httpPost.addHeader(CookieManager.cookieHeader());

    String result = StringUtils.EMPTY;
    try(CloseableHttpResponse response = httpClient.execute(httpPost)) {
        CookieManager.touch(response);
        result = EntityUtils.toString(response.getEntity());
    } catch (IOException e) {
        logger.error("checkUser error", e);
    }

    return result;
}
 
Example 8
Project: MMall_JAVA   File: DateTimeUtil.java   View Source Code Vote up 5 votes
public static String dateToStr(Date date){
    if(date == null){
        return StringUtils.EMPTY;
    }
    DateTime dateTime = new DateTime(date);
    return dateTime.toString(STANDARD_FORMAT);
}
 
Example 9
Project: jwala   File: JvmCrudServiceImplTest.java   View Source Code Vote up 5 votes
@Test
public void testUpdateErrorStatus() {
    final CreateJvmRequest createJvmRequest = new CreateJvmRequest("jvmName", "hostName", 0, 0, 0, 0, 0,
            new Path("./jwala.png"), StringUtils.EMPTY, null, null, null, null);
    final JpaJvm newJpaJvm = jvmCrudService.createJvm(createJvmRequest, jpaMedia, jpaMedia);
    final Identifier<Jvm> jpaJvmId = new Identifier<>(newJpaJvm.getId());
    assertEquals(1, jvmCrudService.updateErrorStatus(jpaJvmId, "error!"));
}
 
Example 10
Project: diorite-configs-java8   File: DocumentCommentsImpl.java   View Source Code Vote up 5 votes
@Override
public void setHeader(@Nullable String header)
{
    if ((header == null) || header.trim().isEmpty())
    {
        header = StringUtils.EMPTY;
    }
    this.header = header;
}
 
Example 11
Project: cas-5.1.0   File: CasApplicationContextConfiguration.java   View Source Code Vote up 5 votes
@Bean
protected Controller rootController() {
    return new ParameterizableViewController() {
        @Override
        protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) 
                throws Exception {
            final String queryString = request.getQueryString();
            final String url = request.getContextPath() + "/login" + (queryString != null ? '?' + queryString : StringUtils.EMPTY);
            return new ModelAndView(new RedirectView(response.encodeURL(url)));
        }
    };
}
 
Example 12
Project: session-cloud   File: CustomTokenStore.java   View Source Code Vote up 5 votes
public String readCallBackUrl(final String clientId) {
	try {
		return jdbcTemplate.queryForObject(CALLBACK_URL_SELECT_STATEMENT, new Object[]{clientId},String.class);
	} catch (DataAccessException e) {
		e.printStackTrace();
	}
	
	return StringUtils.EMPTY;
}
 
Example 13
Project: SECP   File: GroupController.java   View Source Code Vote up 5 votes
private String validatePermissions(Set<Long> permissions) {
    for (long permissionID : permissions) {
        if (!isPermissionValid(permissionID)) {
            return String.format(GroupErrorMessages.PERMISSION_ID_INVALID, permissionID);
        }
    }

    return StringUtils.EMPTY;
}
 
Example 14
Project: spring-boot-start-current   File: ReflectionProUtils.java   View Source Code Vote up 5 votes
/**
 * 反射调用对象字段的Getters方法,结果定制输出成字符串
 * <p>
 * 只适用于个别业务场景
 *
 * @param object
 * @param fieldName
 * @return 结果定制化
 */
public static String invokeFieldGettersMethodToCustomizeString ( Object object , String fieldName ) {
	final Object methodResult = invokeFieldGettersMethod( object , fieldName );
	if ( Objects.isNull( methodResult ) ) {
		return StringUtils.EMPTY;
	}
	if ( methodResult.getClass().isEnum() ) {
		return invokeFieldGettersMethod( methodResult , "comment" ).toString();
	} else if ( methodResult instanceof Date ) {
		return DateUtils.formatDateByStyle( ( Date ) methodResult );
	}
	return methodResult.toString();
}
 
Example 15
Project: Thrush   File: SeatConfig.java   View Source Code Vote up 5 votes
public static String getSeatType(String seat) {
    for (String st : type) {
        String[] arr = st.split(":");
        if (StringUtils.equals(arr[0], seat)) {
            return arr[1];
        }
    }
    return StringUtils.EMPTY;
}
 
Example 16
Project: cas-5.1.0   File: X509CredentialsAuthenticationHandler.java   View Source Code Vote up 5 votes
public X509CredentialsAuthenticationHandler(final Pattern regExTrustedIssuerDnPattern,
                                            final boolean maxPathLengthAllowUnspecified,
                                            final boolean checkKeyUsage,
                                            final boolean requireKeyUsage) {
    this(StringUtils.EMPTY, null, null, regExTrustedIssuerDnPattern,
            Integer.MAX_VALUE, maxPathLengthAllowUnspecified,
            checkKeyUsage, requireKeyUsage, null,
            new NoOpRevocationChecker());
}
 
Example 17
Project: cas-5.1.0   File: X509CredentialsAuthenticationHandler.java   View Source Code Vote up 4 votes
public X509CredentialsAuthenticationHandler(final Pattern regExTrustedIssuerDnPattern, final RevocationChecker revocationChecker) {
    this(StringUtils.EMPTY, null, null, regExTrustedIssuerDnPattern, Integer.MAX_VALUE, false,
            false, false, null,
            revocationChecker);
}
 
Example 18
Project: cyberduck   File: IRODSSession.java   View Source Code Vote up 4 votes
public URIEncodingIRODSAccount(final String user, final String password, final String home, final String region, final String resource) {
    super(host.getHostname(), host.getPort(), StringUtils.isBlank(user) ? StringUtils.EMPTY : user, password, home, region, resource);
    this.setUserName(user);
}
 
Example 19
Project: cas-5.1.0   File: UnauthorizedServiceForPrincipalException.java   View Source Code Vote up 4 votes
/**
 * Instantiates a new unauthorized sso service exception.
 */
public UnauthorizedServiceForPrincipalException() {
    super(CODE, StringUtils.EMPTY);
}
 
Example 20
Project: IPPR2016   File: CacheUser.java   View Source Code Vote up 4 votes
public CacheUser(final String systemId, final String firstname, final String lastname,
    final String username, final List<CacheRole> groups) {
  this(systemId, firstname, lastname, username, groups, StringUtils.EMPTY);
}