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"); } }
/** * <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); }
/** * 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()); }
protected EnumSet<ReportImportOption> getImportOptions() { if (BooleanUtils.isNotTrue(importRoles.getValue())) { return EnumSet.of(ReportImportOption.DO_NOT_IMPORT_ROLES); } return null; }
public void excludeUnloadedField() { if (CollectionUtils.isEmpty(this.fields)) { return; } fields = fields.stream() .filter(field -> BooleanUtils.isNotTrue(field.getUnloaded())) .collect(Collectors.toList()); }
@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()); } }
@HandleBeforeCreate public void handleBeforeCreate(DataConnection dataConnection) { if(BooleanUtils.isNotTrue(dataConnection.getPublished()) && CollectionUtils.isNotEmpty(dataConnection.getWorkspaces())) { dataConnection.setLinkedWorkspaces(dataConnection.getWorkspaces().size()); } }
@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)); } }
@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()); } }
@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()); } }
@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()); } }
break; case TIMESTAMP: if (BooleanUtils.isNotTrue(field.getDerived())) { resultFields.add(new TimestampField(fieldName, ref, field.getFormatObject()));
/** * 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); } } }
/** * 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."); } }
if(ds.getStatus() == FAILED && BooleanUtils.isNotTrue(ds.getFailOnEngine())) { continue;
/** * 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."); } }
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; }
/** * 데이터 소스 상세 조회 (임시 데이터 소스도 함께 조회 가능) */ @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; }
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); }