org.apache.commons.lang3.BooleanUtils.isNotTrue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.apache.commons.lang3.BooleanUtils.isNotTrue()方法的一些代码示例,展示了BooleanUtils.isNotTrue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanUtils.isNotTrue()方法的具体详情如下:
包路径:org.apache.commons.lang3.BooleanUtils
类名称:BooleanUtils
方法名:isNotTrue

BooleanUtils.isNotTrue介绍

[英]Checks if a Boolean value is not true, handling null by returning true.

BooleanUtils.isNotTrue(Boolean.TRUE)  = false 
BooleanUtils.isNotTrue(Boolean.FALSE) = true 
BooleanUtils.isNotTrue(null)          = true

[中]检查布尔值是否为true,通过返回true处理null。

BooleanUtils.isNotTrue(Boolean.TRUE)  = false 
BooleanUtils.isNotTrue(Boolean.FALSE) = true 
BooleanUtils.isNotTrue(null)          = true

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void test_isNotTrue_Boolean() {
  assertFalse(BooleanUtils.isNotTrue(Boolean.TRUE));
  assertTrue(BooleanUtils.isNotTrue(Boolean.FALSE));
  assertTrue(BooleanUtils.isNotTrue(null));
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

protected void checkUser(AdminUser user, GenericResponse response) {
  if (user == null) {
    response.addErrorCode("invalidUser");
  } else if (StringUtils.isBlank(user.getEmail())) {
    response.addErrorCode("emailNotFound");
  } else if (BooleanUtils.isNotTrue(user.getActiveStatusFlag())) {
    response.addErrorCode("inactiveUser");
  }
}

代码示例来源:origin: daniellitoc/xultimate-toolkit

/**
 * <p>Checks if a {@code Boolean} value is <i>not</i> {@code true},
 * handling {@code null} by returning {@code true}.</p>
 *
 * <pre>
 *   BooleanUtils.isNotTrue(Boolean.TRUE)  = false
 *   BooleanUtils.isNotTrue(Boolean.FALSE) = true
 *   BooleanUtils.isNotTrue(null)          = true
 * </pre>
 *
 * @param bool  the boolean to check, null returns {@code true}
 * @return {@code true} if the input is null or false
 * @since 2.3
 */
public static boolean isNotTrue(Boolean bool) {
  return org.apache.commons.lang3.BooleanUtils.isNotTrue(bool);
}

代码示例来源:origin: metatron-app/metatron-discovery

/**
 * Used in Projection
 */
public List<Field> findUnloadedField() {
 if (CollectionUtils.isEmpty(this.fields)) {
  return Lists.newArrayList();
 }
 return fields.stream()
        .filter(field -> BooleanUtils.isNotTrue(field.getUnloaded()))
        .collect(Collectors.toList());
}

代码示例来源:origin: com.haulmont.reports/reports-gui

protected EnumSet<ReportImportOption> getImportOptions() {
  if (BooleanUtils.isNotTrue(importRoles.getValue())) {
    return EnumSet.of(ReportImportOption.DO_NOT_IMPORT_ROLES);
  }
  return null;
}

代码示例来源:origin: metatron-app/metatron-discovery

public void excludeUnloadedField() {
 if (CollectionUtils.isEmpty(this.fields)) {
  return;
 }
 fields = fields.stream()
         .filter(field -> BooleanUtils.isNotTrue(field.getUnloaded()))
         .collect(Collectors.toList());
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkSave
@PreAuthorize("hasAuthority('PERM_SYSTEM_MANAGE_DATASOURCE')")
public void handleBeforeLinkSave(DataSource dataSource, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // PATCH 일경우 linked 객체에 값이 주입되나 PUT 인경우 값이 주입되지 않아
 // linked 객체 체크를 수행하지 않음
 if (BooleanUtils.isNotTrue(dataSource.getPublished())) {
  dataSource.setLinkedWorkspaces(dataSource.getWorkspaces().size());
  LOGGER.debug("UPDATED: Set linked workspace in datasource({}) : {}", dataSource.getId(), dataSource.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeCreate
public void handleBeforeCreate(DataConnection dataConnection) {
 if(BooleanUtils.isNotTrue(dataConnection.getPublished()) && CollectionUtils.isNotEmpty(dataConnection.getWorkspaces())) {
  dataConnection.setLinkedWorkspaces(dataConnection.getWorkspaces().size());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@RequestMapping(value = "/datasources/query/candidate", method = RequestMethod.POST)
public ResponseEntity<?> metaDataQuery(@RequestBody CandidateQueryRequest queryRequest) {
 dataSourceValidator.validateQuery(queryRequest);
 // Link 타입의 데이터 소스일 경우, 별도 JDBC 처리
 if (queryRequest.getDataSource().getMetaDataSource().getConnType() == LINK &&
   BooleanUtils.isNotTrue(queryRequest.getDataSource().getTemporary())) {
  return ResponseEntity.ok(jdbcConnectionService.selectCandidateQuery(queryRequest));
 } else {
  return ResponseEntity.ok(engineQueryService.candidate(queryRequest));
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkSave
public void handleBeforeLinkSave(DataConnection dataConnection, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // PATCH 일경우 linked 객체에 값이 주입되나 PUT 인경우 값이 주입되지 않아
 // linked 객체 체크를 수행하지 않음
 if(BooleanUtils.isNotTrue(dataConnection.getPublished())) {
  dataConnection.setLinkedWorkspaces(dataConnection.getWorkspaces().size());
  LOGGER.debug("UPDATED: Set linked workspace in datasource({}) : {}", dataConnection.getId(), dataConnection.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkDelete
@PreAuthorize("hasAuthority('PERM_SYSTEM_MANAGE_DATASOURCE')")
public void handleBeforeLinkDelete(DataSource dataSource, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // 전체 공개 워크스페이스가 아니고 linked 내 Entity 타입이 Workspace 인 경우
 if (BooleanUtils.isNotTrue(dataSource.getPublished()) &&
   !CollectionUtils.sizeIsEmpty(linked) &&
   CollectionUtils.get(linked, 0) instanceof Workspace) {
  dataSource.setLinkedWorkspaces(dataSource.getWorkspaces().size());
  LOGGER.debug("DELETED: Set linked workspace in datasource({}) : {}", dataSource.getId(), dataSource.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

@HandleBeforeLinkDelete
@PreAuthorize("hasAuthority('PERM_SYSTEM_MANAGE_DATASOURCE')")
public void handleBeforeLinkDelete(DataConnection dataConnection, Object linked) {
 // 연결된 워크스페이스 개수 처리,
 // 전체 공개 워크스페이스가 아니고 linked 내 Entity 타입이 Workspace 인 경우
 if(BooleanUtils.isNotTrue(dataConnection.getPublished()) &&
   !CollectionUtils.sizeIsEmpty(linked) &&
   CollectionUtils.get(linked, 0) instanceof Workspace) {
  dataConnection.setLinkedWorkspaces(dataConnection.getWorkspaces().size());
  LOGGER.debug("DELETED: Set linked workspace in datasource({}) : {}", dataConnection.getId(), dataConnection.getLinkedWorkspaces());
 }
}

代码示例来源:origin: metatron-app/metatron-discovery

break;
case TIMESTAMP:
 if (BooleanUtils.isNotTrue(field.getDerived())) {
  resultFields.add(new TimestampField(fieldName, ref, field.getFormatObject()));

代码示例来源:origin: org.opensingular/singular-form-wicket

/**
 * Method for reload the configuration of Javascript for the Component.
 * This method will include a meta data for configure the Javascripts elements just one time.
 *
 * @param ctx   The context.
 * @param input The input.
 */
private void configureJSForComponent(WicketBuildContext ctx, Component input) {
  for (FormComponent<?> fc : findAjaxComponents(input)) {
    if (BooleanUtils.isNotTrue(fc.getMetaData(MDK_COMPONENT_CONFIGURED))) {
      ctx.configure(this, fc);
      fc.setMetaData(MDK_COMPONENT_CONFIGURED, Boolean.TRUE);
    }
  }
}

代码示例来源:origin: org.finra.herd/herd-service

/**
 * Validate the tag search request. This method also trims the request parameters.
 *
 * @param tagSearchRequest the tag search request
 */
private void validateTagSearchRequest(TagSearchRequest tagSearchRequest)
{
  Assert.notNull(tagSearchRequest, "A tag search request must be specified.");
  // Continue validation if the list of tag search filters is not empty.
  if (CollectionUtils.isNotEmpty(tagSearchRequest.getTagSearchFilters()) && tagSearchRequest.getTagSearchFilters().get(0) != null)
  {
    // Validate that there is only one tag search filter.
    Assert.isTrue(CollectionUtils.size(tagSearchRequest.getTagSearchFilters()) == 1, "At most one tag search filter must be specified.");
    // Get the tag search filter.
    TagSearchFilter tagSearchFilter = tagSearchRequest.getTagSearchFilters().get(0);
    // Validate that exactly one tag search key is specified.
    Assert.isTrue(CollectionUtils.size(tagSearchFilter.getTagSearchKeys()) == 1 && tagSearchFilter.getTagSearchKeys().get(0) != null,
      "Exactly one tag search key must be specified.");
    // Get the tag search key.
    TagSearchKey tagSearchKey = tagSearchFilter.getTagSearchKeys().get(0);
    tagSearchKey.setTagTypeCode(alternateKeyHelper.validateStringParameter("tag type code", tagSearchKey.getTagTypeCode()));
    if (tagSearchKey.getParentTagCode() != null)
    {
      tagSearchKey.setParentTagCode(tagSearchKey.getParentTagCode().trim());
    }
    // Fail validation when parent tag code is specified along with the isParentTagNull flag set to true.
    Assert.isTrue(StringUtils.isBlank(tagSearchKey.getParentTagCode()) || BooleanUtils.isNotTrue(tagSearchKey.isIsParentTagNull()),
      "A parent tag code can not be specified when isParentTagNull flag is set to true.");
  }
}

代码示例来源:origin: metatron-app/metatron-discovery

if(ds.getStatus() == FAILED && BooleanUtils.isNotTrue(ds.getFailOnEngine())) {
 continue;

代码示例来源:origin: FINRAOS/herd

/**
 * Validate the tag search request. This method also trims the request parameters.
 *
 * @param tagSearchRequest the tag search request
 */
private void validateTagSearchRequest(TagSearchRequest tagSearchRequest)
{
  Assert.notNull(tagSearchRequest, "A tag search request must be specified.");
  // Continue validation if the list of tag search filters is not empty.
  if (CollectionUtils.isNotEmpty(tagSearchRequest.getTagSearchFilters()) && tagSearchRequest.getTagSearchFilters().get(0) != null)
  {
    // Validate that there is only one tag search filter.
    Assert.isTrue(CollectionUtils.size(tagSearchRequest.getTagSearchFilters()) == 1, "At most one tag search filter must be specified.");
    // Get the tag search filter.
    TagSearchFilter tagSearchFilter = tagSearchRequest.getTagSearchFilters().get(0);
    // Validate that exactly one tag search key is specified.
    Assert.isTrue(CollectionUtils.size(tagSearchFilter.getTagSearchKeys()) == 1 && tagSearchFilter.getTagSearchKeys().get(0) != null,
      "Exactly one tag search key must be specified.");
    // Get the tag search key.
    TagSearchKey tagSearchKey = tagSearchFilter.getTagSearchKeys().get(0);
    tagSearchKey.setTagTypeCode(alternateKeyHelper.validateStringParameter("tag type code", tagSearchKey.getTagTypeCode()));
    if (tagSearchKey.getParentTagCode() != null)
    {
      tagSearchKey.setParentTagCode(tagSearchKey.getParentTagCode().trim());
    }
    // Fail validation when parent tag code is specified along with the isParentTagNull flag set to true.
    Assert.isTrue(StringUtils.isBlank(tagSearchKey.getParentTagCode()) || BooleanUtils.isNotTrue(tagSearchKey.isIsParentTagNull()),
      "A parent tag code can not be specified when isParentTagNull flag is set to true.");
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-core

protected Set<String> getAllAttributes(Entity entity) {
  if (entity == null) {
    return null;
  }
  Set<String> attributes = new HashSet<>();
  MetaClass metaClass = metadata.getClassNN(entity.getClass());
  for (MetaProperty metaProperty : metaClass.getProperties()) {
    Range range = metaProperty.getRange();
    if (range.isClass() && range.getCardinality().isMany()) {
      continue;
    }
    attributes.add(metaProperty.getName());
  }
  Collection<CategoryAttribute> categoryAttributes = dynamicAttributes.getAttributesForMetaClass(metaClass);
  if (categoryAttributes != null) {
    for (CategoryAttribute categoryAttribute : categoryAttributes) {
      if (BooleanUtils.isNotTrue(categoryAttribute.getIsCollection())) {
        attributes.add(
            DynamicAttributesUtils.getMetaPropertyPath(metaClass, categoryAttribute).getMetaProperty().getName());
      }
    }
  }
  return attributes;
}

代码示例来源:origin: metatron-app/metatron-discovery

/**
 * 데이터 소스 상세 조회 (임시 데이터 소스도 함께 조회 가능)
 */
@Transactional(readOnly = true)
public DataSource findDataSourceIncludeTemporary(String dataSourceId, Boolean includeUnloadedField) {
 DataSource dataSource;
 if (dataSourceId.indexOf(ID_PREFIX) == 0) {
  LOGGER.debug("Find temporary datasource : {}" + dataSourceId);
  DataSourceTemporary temporary = temporaryRepository.findOne(dataSourceId);
  if (temporary == null) {
   throw new ResourceNotFoundException(dataSourceId);
  }
  dataSource = dataSourceRepository.findOne(temporary.getDataSourceId());
  if (dataSource == null) {
   throw new DataSourceTemporaryException(DataSourceErrorCodes.VOLATILITY_NOT_FOUND_CODE,
                       "Not found related datasource :" + temporary.getDataSourceId());
  }
  dataSource.setEngineName(temporary.getName());
  dataSource.setTemporary(temporary);
 } else {
  dataSource = dataSourceRepository.findOne(dataSourceId);
  if (dataSource == null) {
   throw new ResourceNotFoundException(dataSourceId);
  }
 }
 if (BooleanUtils.isNotTrue(includeUnloadedField)) {
  dataSource.excludeUnloadedField();
 }
 return dataSource;
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

protected void finalizeExternalCall(Exchange exchange, ExternalCall externalCall, ExternalCallService service) {
  Boolean success = exchange.getProperty(ExtCallComponentParams.EXTERNAL_CALL_SUCCESS, Boolean.class);
  if (success == null) {
    // success is not defined forcefully -> determine success normally
    success = !exchange.isFailed()
        && isNotTrue(exchange.getProperty(Exchange.ROUTE_STOP, Boolean.class));
  }
  if (success) {
    service.complete(externalCall);
  } else {
    service.failed(externalCall);
  }
  // cleanup:
  exchange.removeProperty(ExtCallComponentParams.EXTERNAL_CALL_OPERATION);
  exchange.removeProperty(ExtCallComponentParams.EXTERNAL_CALL_KEY);
  exchange.removeProperty(ExtCallComponentParams.EXTERNAL_CALL_SUCCESS);
}

相关文章