本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isNoneEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isNoneEmpty方法的具体用法?Java StringUtils.isNoneEmpty怎么用?Java StringUtils.isNoneEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isNoneEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEndpoint
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public void addEndpoint(Endpoint e) {
LOGGER.debug("Añadiendo endpoint: {}", e);
String[] relatives = e.getUrl().trim().split("/");
int i = 0;
String path = "";
boolean isPathVariable = false;
while (i < relatives.length && !isPathVariable) {
String relative = relatives[i++];
isPathVariable = relative.contains("{");
if (StringUtils.isNoneEmpty(relative) && !isPathVariable) {
path = path + "/" + relative;
if (!path.matches("/public|/private|/private/v1|/public/v1")) {
Resource resource = this.resources.get(path);
if (resource == null) {
resource = new Resource();
}
resource.addEndpoint(e);
this.resources.put(path, resource);
}
}
}
}
示例2: getUserData
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Map<String, String> getUserData(String instanceId) throws Exception {
Preconditions.checkNotNull(instanceId);
awsRateLimiter.acquire();
OperationStats op = new OperationStats("ec2InstanceStore", "getUserData");
try {
InstanceAttribute
attribute =
this.getInstanceAttribute(instanceId, "userData");
if (attribute != null) {
String base64EncodedString = attribute.getUserData();
if (StringUtils.isNoneEmpty(base64EncodedString)) {
Map<String, String> userData = Ec2InstanceStore.parseEc2UserData(base64EncodedString);
op.succeed();
return userData;
}
}
} catch (Exception ex) {
op.failed();
throw ex;
}
op.succeed();
return new HashMap<>();
}
示例3: modifyGroup
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response modifyGroup(GroupDTO request) {
Set<Long> permissions = request.getPermissions().stream().
map(permission -> permission.getId()).collect(Collectors.toSet());
Set<Long> roles = request.getRoles().stream().
map(role -> role.getId()).collect(Collectors.toSet());
String error = validateRolesAndPermissions(permissions, roles);
if (StringUtils.isNoneEmpty(error)) {
throw new WebApplicationException(
error,
Response.Status.BAD_REQUEST);
}
Group group = getGroup(request.getGroupID());
if(group.getGroupType() == GroupType.PRIVATE)
{
throw new WebApplicationException(
GroupErrorMessages.MODIFY_PRIVATE_GROUP,
Response.Status.BAD_REQUEST);
}
group.setIsActive(request.isActive());
return updateOrCreateGroup(group, permissions, roles);
}
示例4: getSeesion
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public String getSeesion(final String sessionId) {
try {
String session = (String) this.redisConfig.execute(new RedisCallback<String>() {
@Override
public String call(Jedis jedis) {
return jedis.get(sessionId);
}
});
if (StringUtils.isNoneEmpty(new CharSequence[]{session})) {
this.updateExpiredTime(sessionId);
}
return session;
} catch (Exception var3) {
LOGGER.error("getSeesion failed, sessionId[" + sessionId + "]", var3);
return null;
}
}
示例5: updateOrCreateFilter
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response updateOrCreateFilter(FilterCreateRequest request)
{
Set<Long> permissions = request.permissions.stream().
map(permission -> permission.getId()).collect(Collectors.toSet());
Set<Long> roles = request.roles.stream().
map(role -> role.getId()).collect(Collectors.toSet());
String error = validateCreateRequest(request.name,permissions,roles);
if(StringUtils.isNoneEmpty(error))
{
throw new WebApplicationException(
error,
Response.Status.BAD_REQUEST);
}
Filter filter = new Filter(request.name);
return updateOrCreateFilter(filter,permissions,roles);
}
示例6: toHttpUriRequest
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public HttpUriRequest toHttpUriRequest() {
LOGGER.debug("in createRequestBuilder");
RequestBuilder requestBuilder = createRequestBuilder();
int timeout = httpServiceInfo.getTimeout();
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom()
.setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout)
.setConnectTimeout(timeout)
.setCookieSpec(CookieSpecs.IGNORE_COOKIES);
requestBuilder.setConfig(requestConfigBuilder.build());
if (StringUtils.isNoneEmpty(httpServiceInfo.getContentType())) {
requestBuilder.addHeader("Content-Type", httpServiceInfo.getContentType());
} else {
requestBuilder.addHeader("Content-Type", httpServletRequest.getContentType());
}
return requestBuilder.build();
}
示例7: getNodeAddress
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String getNodeAddress(ClusterNodeAddress ownAddress) {
if (StringUtils.isNoneEmpty(configuration.getNodeAddress())) {
return configuration.getNodeAddress();
} else {
return ownAddress.getHost();
}
}
示例8: createPublicGroup
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response createPublicGroup(GroupCreateRequest request) {
Set<Long> permissions = request.permissions.stream().
map(permission -> permission.getId()).collect(Collectors.toSet());
Set<Long> roles = request.roles.stream().
map(role -> role.getId()).collect(Collectors.toSet());
String error = validateCreateRequest(request.name, permissions, roles);
if (StringUtils.isNoneEmpty(error)) {
throw new WebApplicationException(
error,
Response.Status.BAD_REQUEST);
}
Group group = new Group(request.name);
return updateOrCreateGroup(group, permissions, roles);
}
示例9: validateRolesAndPermissions
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private String validateRolesAndPermissions(Set<Long> permissions, Set<Long> roles) {
String roleError = validateRoles(roles);
if (StringUtils.isNoneEmpty(roleError))
return roleError;
String permissionError = validatePermissions(permissions);
if (StringUtils.isNoneEmpty(permissionError))
return permissionError;
return StringUtils.EMPTY;
}
示例10: registerRoles
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response registerRoles(AppCreateDTO request) {
String error = validateCreateRolesRequest(request);
if(StringUtils.isNoneEmpty(error))
{
throw new WebApplicationException(error, Response.Status.BAD_REQUEST);
}
Set<RolesOrPermissionDTO> response = new HashSet<>();
for (String name : request.getRoles()) {
Role role = rolesDAO.save(new Role(name, request.getColor()));
response.add(new RolesOrPermissionDTO(role.getId(), role.getRole(), role.getColor()));
}
return Response.status(Response.Status.CREATED).entity(response).build();
}
示例11: registerPermissions
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public Response registerPermissions(AppCreateDTO request) {
String error = validateCreatePermissionsRequest(request);
if(StringUtils.isNoneEmpty(error))
{
throw new WebApplicationException(error, Response.Status.BAD_REQUEST);
}
Set<RolesOrPermissionDTO> response = new HashSet<>();
for (String name : request.getPermissions()) {
Permission permission = permissionDAO.save(new Permission(name, request.getColor()));
response.add(new RolesOrPermissionDTO(permission.getId(), permission.getLevel(), permission.getColor()));
}
return Response.status(Response.Status.CREATED).entity(response).build();
}
示例12: setDisplayName
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
/**
* set displayName
* <p>
* validate display length before set the value
*
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
if (StringUtils.isNoneEmpty(displayName)) {
if (ValidationUtil.validateDisplayName(displayName)) {
this.displayName = displayName;
} else {
throw new RuntimeException("Display name is oversized.");
}
} else {
this.displayName = displayName;
}
}
示例13: checkFileExists
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public Map<String, String> checkFileExists(final String groupName, final String jvmName, final String webappName, final String webserverName, final String fileName) {
boolean resultBoolean = false;
if (StringUtils.isNotEmpty(groupName) && StringUtils.isNoneEmpty(fileName)) {
if (jvmName != null && !jvmName.isEmpty()) {
// Search for file in jvms
LOGGER.debug("Searching for resource {} in group {} and jvm {}", fileName, groupName, jvmName);
resultBoolean = groupPersistenceService.checkGroupJvmResourceFileName(groupName, fileName) ||
jvmPersistenceService.checkJvmResourceFileName(groupName, jvmName, fileName);
} else if (webappName != null && !webappName.isEmpty()) {
// Search for file in webapps
LOGGER.debug("Searching for resource {} in group {} and webapp {}", fileName, groupName, webappName);
resultBoolean = groupPersistenceService.checkGroupAppResourceFileName(groupName, fileName) ||
applicationPersistenceService.checkAppResourceFileName(groupName, webappName, fileName);
} else if (webserverName != null && !webserverName.isEmpty()) {
// Search for file in webservers
LOGGER.debug("Searching for resource {} in group {} and webserver {}", fileName, groupName, webserverName);
resultBoolean = groupPersistenceService.checkGroupWebServerResourceFileName(groupName, fileName) ||
webServerPersistenceService.checkWebServerResourceFileName(groupName, webserverName, fileName);
}
}
Map<String, String> result = new HashMap<>();
result.put("fileName", fileName);
result.put("exists", Boolean.toString(resultBoolean));
LOGGER.debug("result: {}", result.toString());
return result;
}
示例14: Plain
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@SuppressWarnings("WeakerAccess")
public Plain(String json) {
List<JsonTable> list = new ArrayList<>();
if (StringUtils.isNoneEmpty(json)) {
final JsonParser parser = new JsonParser();
final JsonObject jsonObject = parser.parse(json).getAsJsonObject();
for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
if (e.getValue().isJsonArray()) {
list.add(new JsonTable(e.getKey(), e.getValue().getAsJsonArray()));
}
}
}
jsonLength = json.length();
iterator = list.iterator();
}
示例15: showCart
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@RequestMapping("/cart")
public String showCart( HttpServletRequest request, HttpServletResponse response,Model model) {
String cookieUUID = CookieUtils.getCookieValue(request, Const.CART_KEY);
String tokenLogin = CookieUtils.getCookieValue(request, Const.TOKEN_LOGIN);
TbUser user = null;
String userJson = null;
if (StringUtils.isNoneEmpty(tokenLogin)) {
try {
userJson = jedisClient.get(USER_SESSION + tokenLogin);
} catch (Exception e) {
logger.error("Redis 错误", e);
}
if (StringUtils.isNoneEmpty(userJson)) {
user = FastJsonConvert.convertJSONToObject(userJson, TbUser.class);
}
model.addAttribute("user", user);
} else {
model.addAttribute("user", user);
}
List<CartInfo> cartInfos = new ArrayList<>();
if (StringUtils.isNoneEmpty(cookieUUID)) {
cartInfos= cartService.getCartInfoListByCookiesId(cookieUUID);
}
if (cartInfos.size() == 0) {
model.addAttribute("cartInfos", null);
return "cart";
}
int totalPrice = 0;
for (int i = 0; i < cartInfos.size(); i++) {
CartInfo cartInfo = cartInfos.get(i);
totalPrice += cartInfo.getSum();
}
model.addAttribute("cartInfos", cartInfos);
model.addAttribute("totalPrice", totalPrice);
return "cart";
}