Java Code Examples for org.datanucleus.util.StringUtils#isEmpty()

The following examples show how to use org.datanucleus.util.StringUtils#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopologyTestRunResource.java    From streamline with Apache License 2.0 6 votes vote down vote up
private Response getEventsOfTestRunTopologyHistory(Long topologyId, Long historyId, String componentName,
                                                   SecurityContext securityContext) throws IOException {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER,
            Topology.NAMESPACE, topologyId, READ);

    File eventLogFile = getEventLogFile(topologyId, historyId);
    Stream<EventInformation> eventsStream = eventLogFileReader.loadEventLogFileAsStream(eventLogFile);

    if (!StringUtils.isEmpty(componentName)) {
        eventsStream = eventsStream.filter(event -> {
            String eventComponentName = event.getComponentName();
            return eventComponentName != null && eventComponentName.equals(componentName);
        });
    }

    return WSUtils.respondEntities(eventsStream.collect(toList()), OK);
}
 
Example 2
Source File: CommandUtil.java    From incubator-sentry with Apache License 2.0 6 votes vote down vote up
private static String createCmdForRoleAddOrDeleteGroup(String roleName,
String groups,
     boolean isAddGroup) {
   StringBuilder sb = new StringBuilder();
   if (isAddGroup) {
     sb.append("GRANT ROLE ");
   } else {
     sb.append("REVOKE ROLE ");
   }
   sb.append(roleName);
   if (isAddGroup) {
     sb.append(" TO ");
   } else {
     sb.append(" FROM ");
   }

   if (!StringUtils.isEmpty(groups)) {
     sb.append("GROUP ").append(groups);
   } else {
     sb = new StringBuilder("Missing group information.");
   }

   return sb.toString();
 }