Java Code Examples for org.apache.commons.collections.CollectionUtils#isNotEmpty()
The following examples show how to use
org.apache.commons.collections.CollectionUtils#isNotEmpty() .
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: AtlasStruct.java From atlas with Apache License 2.0 | 6 votes |
public static StringBuilder dumpModelObjects(Collection<? extends AtlasStruct> objList, StringBuilder sb) { if (sb == null) { sb = new StringBuilder(); } if (CollectionUtils.isNotEmpty(objList)) { int i = 0; for (AtlasStruct obj : objList) { if (i > 0) { sb.append(", "); } obj.toString(sb); i++; } } return sb; }
Example 2
Source File: ClusterServiceImpl.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Map<String, List<CacheInfoDTO>> getCacheInfo(final AsyncContext context) { final RspMessage message = new ContextRspMessageImpl( nodeService.getCurrentNodeId(), determineAllSfTargets(), "CacheDirector.getCacheInfo", null, context ); nodeService.broadcast(message); final Map<String, List<CacheInfoDTO>> info = new HashMap<>(); if (CollectionUtils.isNotEmpty(message.getResponses())) { for (final Message response : message.getResponses()) { if (response.getPayload() instanceof List) { info.put(response.getSource(), (List<CacheInfoDTO>) response.getPayload()); } } } final String admin = nodeService.getCurrentNodeId(); List<CacheInfoDTO> adminRez = localCacheDirector.getCacheInfo(); for (final CacheInfoDTO cacheInfoDTO : adminRez) { cacheInfoDTO.setNodeId(admin); } info.put(admin, adminRez); return info; }
Example 3
Source File: PaymentRequestInvoiceImageAttachmentValidation.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * * @param document * @param nodeName * @return */ protected boolean isDocumentStoppedInRouteNode(PaymentRequestDocument document, String nodeName) { WorkflowDocument workflowDoc = document.getDocumentHeader().getWorkflowDocument(); Set<String> currentRouteLevels = workflowDoc.getCurrentNodeNames(); if (CollectionUtils.isNotEmpty(currentRouteLevels) && currentRouteLevels.contains(nodeName) && workflowDoc.isApprovalRequested()) { return true; } return false; }
Example 4
Source File: TxStorageImpl.java From framework with Apache License 2.0 | 5 votes |
/** * Description: <br> * * @author 王伟<br> * @taskId <br> * @param clientInfo * @param retryTimes * @param pageIndex * @param pageSize * @return <br> */ @Override public PagerList<ClientInfo> queryTimeoutClientInfo(final String clientInfo, final int retryTimes, final int pageIndex, final int pageSize) { Query q = Query.query(Criteria.where("currentRetryTimes").is(retryTimes), Criteria.where("clientInfo").is(clientInfo), Criteria.where("nextRetryTime").lte(DateUtil.getCurrentDate())) .withAllowFiltering().limit(pageSize); if (pageIndex > 1) { String id = holder.get(); if (id != null) { q.and(Criteria.where("token(id)").gt("token('" + id + "')")); } } List<TxClientinfoEntity> entities = cassandraOperations.select(q, TxClientinfoEntity.class); if (CollectionUtils.isNotEmpty(entities)) { holder.set(entities.get(entities.size() - 1).getId()); PagerList<ClientInfo> pagerList = new PagerList<>(); pagerList.setPageIndex(pageIndex); pagerList.setPageSize(pageSize); pagerList.setTotalCount(100000); pagerList.addAll(entities.stream() .map(b -> new ClientInfo(b.getId(), b.getMark(), b.getContext(), b.getArgs() == null ? null : DataUtil.hexStr2Byte(b.getArgs()), 0, null, b.getClientInfo())) .collect(Collectors.toList())); return pagerList; } else { holder.remove(); } return null; }
Example 5
Source File: AdminWorkgroupJspBean.java From lutece-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Process to the confirmation of deleting a workgroup * * @param request * The Http Request * @return the HTML page * @throws AccessDeniedException * if the security token is invalid */ public String doRemoveWorkgroup( HttpServletRequest request ) throws AccessDeniedException { String strWorkgroupKey = request.getParameter( PARAMETER_WORKGROUP_KEY ); ArrayList<String> listErrors = new ArrayList<>( ); if ( CollectionUtils.isNotEmpty( AdminWorkgroupHome.getUserListForWorkgroup( strWorkgroupKey ) ) ) { return AdminMessageService.getMessageUrl( request, MESSAGE_WORKGROUP_ALREADY_USED, AdminMessage.TYPE_STOP ); } if ( !WorkgroupRemovalListenerService.getService( ).checkForRemoval( strWorkgroupKey, listErrors, getLocale( ) ) ) { String strCause = AdminMessageService.getFormattedList( listErrors, getLocale( ) ); Object [ ] args = { strCause }; return AdminMessageService.getMessageUrl( request, MESSAGE_CANNOT_REMOVE_WORKGROUP, args, AdminMessage.TYPE_STOP ); } if ( !SecurityTokenService.getInstance( ).validate( request, JSP_URL_REMOVE_WORKGROUP ) ) { throw new AccessDeniedException( ERROR_INVALID_TOKEN ); } AdminWorkgroupHome.remove( strWorkgroupKey ); return JSP_MANAGE_WORKGROUPS; }
Example 6
Source File: ActivityStreamComponent.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public void showFeeds(List<Integer> prjKeys) { this.removeAllComponents(); if (CollectionUtils.isNotEmpty(prjKeys)) { addComponent(activityStreamList); ActivityStreamSearchCriteria searchCriteria = new ActivityStreamSearchCriteria(); searchCriteria.setModuleSet(new SetSearchField<>(ModuleNameConstants.PRJ)); searchCriteria.setExtraTypeIds(new SetSearchField<>(prjKeys.toArray(new Integer[prjKeys.size()]))); searchCriteria.setSaccountid(new NumberSearchField(AppUI.getAccountId())); activityStreamList.setSearchCriteria(searchCriteria); } }
Example 7
Source File: ApiModelToSAMLSSOServiceProvider.java From identity-api-server with Apache License 2.0 | 5 votes |
private void updateSingleSignOnProfile(SAMLSSOServiceProviderDTO dto, SingleSignOnProfile ssoConfig) { if (ssoConfig != null) { List<SingleSignOnProfile.BindingsEnum> bindings = ssoConfig.getBindings(); // HTTP_POST and HTTP_REDIRECT bindings are not considered at the backend. They are always available by // default, therefore we only need to process the artifact binding. if (CollectionUtils.isNotEmpty(bindings) && bindings.contains(SingleSignOnProfile.BindingsEnum.ARTIFACT)) { dto.setEnableSAML2ArtifactBinding(true); } dto.setDoValidateSignatureInArtifactResolve(ssoConfig.getEnableSignatureValidationForArtifactBinding()); dto.setIdPInitSSOEnabled(ssoConfig.getEnableIdpInitiatedSingleSignOn()); SAMLAssertionConfiguration assertionConfig = ssoConfig.getAssertion(); if (assertionConfig != null) { dto.setNameIDFormat(assertionConfig.getNameIdFormat()); dto.setRequestedAudiences(toArray(assertionConfig.getAudiences())); dto.setRequestedRecipients(toArray(assertionConfig.getRecipients())); dto.setDigestAlgorithmURI(assertionConfig.getDigestAlgorithm()); AssertionEncryptionConfiguration encryption = assertionConfig.getEncryption(); if (encryption != null) { setIfNotNull(encryption.getEnabled(), dto::setDoEnableEncryptedAssertion); dto.setAssertionEncryptionAlgorithmURI(encryption.getAssertionEncryptionAlgorithm()); dto.setKeyEncryptionAlgorithmURI(encryption.getKeyEncryptionAlgorithm()); } } } }
Example 8
Source File: ProductServiceFacadeImpl.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public List<PriceModel> getSkuPrices(final ShoppingCart cart, final Long productId, final String skuCode, final String supplier) { if (!cart.getShoppingContext().isHidePrices()) { final Collection<SkuPrice> prices = resolvePrices(cart, productId, skuCode, supplier); if (CollectionUtils.isNotEmpty(prices)) { final List<PriceModel> models = new ArrayList<>(prices.size()); for (final SkuPrice price : prices) { final Pair<BigDecimal, BigDecimal> listAndSale = price.getSalePriceForCalculation(); models.add(getSkuPrice( cart, price.getSkuCode(), price.getQuantity(), price.isPriceUponRequest(), price.isPriceOnOffer(), listAndSale.getFirst(), listAndSale.getSecond(), supplier )); } return models; } } return Collections.emptyList(); }
Example 9
Source File: CreateImpalaProcess.java From atlas with Apache License 2.0 | 5 votes |
public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities)); } return ret; }
Example 10
Source File: QuickStartV2.java From incubator-atlas with Apache License 2.0 | 5 votes |
private List<AtlasClassification> toAtlasClassifications(String[] traitNames) { List<AtlasClassification> ret = new ArrayList<>(); ImmutableList<String> traits = ImmutableList.copyOf(traitNames); if (CollectionUtils.isNotEmpty(traits)) { for (String trait : traits) { ret.add(new AtlasClassification(trait)); } } return ret; }
Example 11
Source File: ClusterUtilsServiceImpl.java From yes-cart with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void reloadConfigurations() { if (CollectionUtils.isNotEmpty(this.configurationListeners)) { for (final ConfigurationListener listener : this.configurationListeners) { listener.reload(); } } }
Example 12
Source File: AbstractOutboundProvisioningConnector.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * @param attributeMap * @return */ protected String getPassword(Map<ClaimMapping, List<String>> attributeMap) { List<String> claimValue = ProvisioningUtil.getClaimValues(attributeMap, IdentityProvisioningConstants.PASSWORD_CLAIM_URI, null); if (CollectionUtils.isNotEmpty(claimValue) && claimValue.get(0) != null) { return claimValue.get(0); } return UUID.randomUUID().toString(); }
Example 13
Source File: ResourcesDisplayComponent.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
private void constructBody(Folder currentFolder) { this.removeAllComponents(); resources = resourceService.getResources(currentFolder.getPath()); if (CollectionUtils.isNotEmpty(resources)) { for (Resource res : resources) { ComponentContainer resContainer = buildResourceRowComp(res); if (resContainer != null) { this.addComponent(resContainer); } } } }
Example 14
Source File: UserUtil.java From sunbird-lms-service with MIT License | 5 votes |
public static void validateUserPhoneEmailAndWebPages(User user, String operationType) { checkPhoneUniqueness(user, operationType); checkEmailUniqueness(user, operationType); if (CollectionUtils.isNotEmpty(user.getWebPages())) { SocialMediaType.validateSocialMedia(user.getWebPages()); } }
Example 15
Source File: HotContentJob.java From feiqu-opensource with Apache License 2.0 | 4 votes |
@Scheduled(cron = "0 0/30 9-18 * * ? ")//从9点到18点 每半个小时更新一次 // @Scheduled(cron = "0 51 15 * * ? ") public void work(){ Stopwatch stopwatch = Stopwatch.createStarted(); PageHelper.startPage(1, 5 , false); ThoughtExample thoughtExample = new ThoughtExample(); thoughtExample.setOrderByClause("create_time desc"); thoughtExample.createCriteria().andDelFlagEqualTo(YesNoEnum.NO.getValue()); List<ThoughtWithUser> newThoughts = thoughtService.getThoughtWithUser(thoughtExample); if(CollectionUtil.isNotEmpty(newThoughts)){ newThoughts.forEach(t->{ if(StringUtils.isNotEmpty(t.getPicList())){ t.setPictures(Arrays.asList(t.getPicList().split(","))); } }); } CommonConstant.NEW_THOUGHT_LIST = newThoughts; PageHelper.startPage(1, 5 , false); thoughtExample.clear(); thoughtExample.setOrderByClause("comment_count desc "); thoughtExample.createCriteria().andDelFlagEqualTo(YesNoEnum.NO.getValue()); CommonConstant.HOT_THOUGHT_LIST = thoughtService.getThoughtWithUser(thoughtExample); ArticleExample example = new ArticleExample(); example.setOrderByClause("browse_count desc"); example.createCriteria().andCreateTimeGreaterThan(DateUtil.offsetDay(new Date(),-31)); PageHelper.startPage(0,10,false); List<Article> hotArticles = articleService.selectByExample(example); /*for(Article article : hotArticles){ if(article.getArticleTitle().length() > 20){ article.setArticleTitle(StringUtils.substring(article.getArticleTitle(),0,20) + "……"); } }*/ if(CollectionUtil.isNotEmpty(hotArticles)){ CommonConstant.HOT_ARTICLE_LIST = hotArticles; } FqNoticeExample fqNoticeExample = new FqNoticeExample(); fqNoticeExample.setOrderByClause("fq_order asc"); fqNoticeExample.createCriteria().andIsShowEqualTo(YesNoEnum.YES.getValue()); List<FqNotice> list = fqNoticeService.selectByExample(fqNoticeExample); if(CollectionUtil.isNotEmpty(list)){ CommonConstant.FQ_NOTICE_LIST = list; } PageHelper.startPage(0,5,false); SuperBeautyExample beautyExample = new SuperBeautyExample(); beautyExample.setOrderByClause("like_count desc"); List<BeautyUserResponse> beauties = superBeautyService.selectDetailByExample(beautyExample); if(CollectionUtil.isNotEmpty(beauties)){ CommonConstant.HOT_BEAUTY_LIST = beauties; } try { int month = DateUtil.thisMonth()+1; JedisCommands commands = JedisProviderFactory.getJedisCommands(null); Set<String> userIds =commands.zrevrange(CommonConstant.FQ_ACTIVE_USER_SORT+month,0,4); if(CollectionUtils.isNotEmpty(userIds)){ List<Integer> userIdList = Lists.newArrayList(); for(String userId : userIds){ userIdList.add(Integer.valueOf(userId)); } FqUserExample fqUserExample = new FqUserExample(); example.createCriteria().andIdIn(userIdList); List<FqUser> fqUsers = fqUserService.selectByExample(fqUserExample); Map<Integer,FqUser> userMap = Maps.newHashMap(); fqUsers.forEach(fqUser -> { userMap.put(fqUser.getId(),fqUser); }); List<UserActiveNumResponse> responses = Lists.newArrayList(); for(int i = 0;i<userIdList.size();i++){ double score = commands.zscore(CommonConstant.FQ_ACTIVE_USER_SORT+month,userIdList.get(i).toString()); if(userMap.get(userIdList.get(i)) == null){ continue; } UserActiveNumResponse userActiveNumResponse = new UserActiveNumResponse(userMap.get(userIdList.get(i)),score,i+1); responses.add(userActiveNumResponse); } CommonConstant.FQ_ACTIVE_USER_LIST = responses; } } catch (Exception e) { logger.error("",e); } Runtime runtime = Runtime.getRuntime(); String memoryInfo ="freeMemory:"+runtime.freeMemory()+",totalMemory:"+runtime.totalMemory(); stopwatch.stop(); long seconds = stopwatch.elapsed(TimeUnit.SECONDS); logger.info("热门文章以及通知以及热门图片更新完毕,耗时{}秒,内存信息:{}",seconds,memoryInfo); }
Example 16
Source File: XUserREST.java From ranger with Apache License 2.0 | 4 votes |
/** * Implements the traditional search functionalities for XUsers * * @param request * @return */ @GET @Path("/users") @Produces({ "application/xml", "application/json" }) @PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_X_USERS + "\")") public VXUserList searchXUsers(@Context HttpServletRequest request) { String UserRoleParamName = RangerConstants.ROLE_USER; SearchCriteria searchCriteria = searchUtil.extractCommonCriterias( request, xUserService.sortFields); String userName = null; if (request.getUserPrincipal() != null){ userName = request.getUserPrincipal().getName(); } searchUtil.extractString(request, searchCriteria, "name", "User name",null); searchUtil.extractString(request, searchCriteria, "emailAddress", "Email Address", null); searchUtil.extractInt(request, searchCriteria, "userSource", "User Source"); searchUtil.extractInt(request, searchCriteria, "isVisible", "User Visibility"); searchUtil.extractInt(request, searchCriteria, "status", "User Status"); List<String> userRolesList = searchUtil.extractStringList(request, searchCriteria, "userRoleList", "User Role List", "userRoleList", null, null); searchUtil.extractRoleString(request, searchCriteria, "userRole", "Role", null); if (CollectionUtils.isNotEmpty(userRolesList) && CollectionUtils.size(userRolesList) == 1 && userRolesList.get(0).equalsIgnoreCase(UserRoleParamName)) { if (!(searchCriteria.getParamList().containsKey("name"))) { searchCriteria.addParam("name", userName); } else if ((searchCriteria.getParamList().containsKey("name")) && userName!= null && userName.contains((String) searchCriteria.getParamList().get("name"))) { searchCriteria.addParam("name", userName); } } UserSessionBase userSession = ContextUtil.getCurrentUserSession(); if (userSession != null && userSession.getLoginId() != null) { VXUser loggedInVXUser = xUserService.getXUserByUserName(userSession .getLoginId()); if (loggedInVXUser != null) { if (loggedInVXUser.getUserRoleList().size() == 1 && loggedInVXUser.getUserRoleList().contains( RangerConstants.ROLE_USER)) { logger.info("Logged-In user having user role will be able to fetch his own user details."); if (!searchCriteria.getParamList().containsKey("name")) { searchCriteria.addParam("name", loggedInVXUser.getName()); }else if(searchCriteria.getParamList().containsKey("name") && !stringUtil.isEmpty(searchCriteria.getParamValue("name").toString()) && !searchCriteria.getParamValue("name").toString().equalsIgnoreCase(loggedInVXUser.getName())){ throw restErrorUtil.create403RESTException("Logged-In user is not allowed to access requested user data."); } } } } return xUserMgr.searchXUsers(searchCriteria); }
Example 17
Source File: UserP.java From directory-fortress-core with Apache License 2.0 | 4 votes |
/** * CreateSession * <p> * This method is called by AccessMgr and is not intended for use outside Fortress core. The successful * result is Session object that contains target user's RBAC and Admin role activations. In addition to checking * user password validity it will apply configured password policy checks. Method may also store parms passed in for * audit trail.. * <ul> * <li> authenticate user password * <li> password policy evaluation with OpenLDAP PwPolicy * <li> evaluate temporal constraints on User and UserRole entities. * <li> allow selective role activations into User RBAC Session. * <li> require valid password if trusted == false. * <li> will disallow any user who is locked out due to OpenLDAP pw policy, regardless of trusted flag being set as parm on API. * <li> return User's RBAC Session containing User and UserRole attributes. * <li> throw a SecurityException for authentication failures, other policy violations, data validation errors or system failure. * </ul> * <p> * <p> * The function is valid if and only if: * <ul> * <li> the user is a member of the USERS data set * <li> the password is supplied (unless trusted). * <li> the (optional) active role set is a subset of the roles authorized for that user. * </ul> * <p> * <p> * The User parm contains the following (* indicates required) * <ul> * <li> String userId* * <li> char[] password * <li> List<UserRole> userRoles contains a list of RBAC role names authorized for user and targeted for activation within this session. * <li> List<UserAdminRole> userAdminRoles contains a list of Admin role names authorized for user and targeted for activation. * <li> Properties logonProps collection of auditable name/value pairs to store. For example hostname:myservername or ip:192.168.1.99 * </ul> * <p> * <p> * Notes: * <ul> * <li> roles that violate Dynamic Separation of Duty Relationships will not be activated into session. * <li> role activations will proceed in same order as supplied to User entity setter. * </ul> * <p> * * @param user Contains userId, password (optional if "trusted"), optional User RBAC Roles: List<UserRole> rolesToBeActivated., optional User Admin Roles: List<UserAdminRole> adminRolesToBeActivated. * @param trusted if true password is not required. * @return Session object will contain authentication result code, RBAC and Admin role activations, OpenLDAP pw policy output and more. * @throws SecurityException in the event of data validation failure, security policy violation or DAO error. */ Session createSession( User user, boolean trusted ) throws SecurityException { Session session; if ( trusted ) { // Create the impl session without authentication of password. session = createSessionTrusted( user ); // Check user temporal constraints. This op usually performed during authentication. VUtil.getInstance().validateConstraints( session, VUtil.ConstraintType.USER, false ); } else { // Create the impl session if the user authentication succeeds: VUtil.assertNotNullOrEmpty( user.getPassword(), GlobalErrIds.USER_PW_NULL, CLS_NM + ".createSession" ); session = createSession( user ); } // Normally, the context (tenant) gets set in the mgr layer and passed into here, as in the User. // However, the Session was created down here and must be set here as well, for role constraint (validation) to be multitenant, in validateConstraints method: session.setContextId( user.getContextId() ); // Did the caller pass in a set of roles for selective activation? if ( CollectionUtils.isNotEmpty( user.getRoles() ) ) { // Process selective activation of user's RBAC roles into session: List<UserRole> rlsActual = session.getRoles(); List<UserRole> rlsFinal = new ArrayList<>(); session.setRoles( rlsFinal ); // Activate only the intersection between assigned and roles passed into this method: for ( UserRole role : user.getRoles() ) { int indx = rlsActual.indexOf( role ); if ( indx != -1 ) { UserRole candidateRole = rlsActual.get( indx ); rlsFinal.add( candidateRole ); } } } // Did the caller pass in a set of dynamic constraints as properties? // TODO: Guard with a property? i.e. user.session.props.enabled if ( user.getProps() != null ) { session.getUser().addProperties( user.getProperties() ); } // Check role temporal constraints + activate roles: VUtil.getInstance().validateConstraints( session, VUtil.ConstraintType.ROLE, true ); return session; }
Example 18
Source File: DelAccessMgrImpl.java From directory-fortress-core with Apache License 2.0 | 4 votes |
/** * This helper function processes "can do". * @param session * @param user * @return boolean * @throws SecurityException */ private boolean checkUser(Session session, User user, boolean isAdd) throws SecurityException { boolean result = false; List<UserAdminRole> uaRoles = session.getAdminRoles(); if(CollectionUtils.isNotEmpty( uaRoles )) { // validate user and retrieve user' ou: User ue; if(!isAdd) { ue = userP.read(user, false); } else { ue = user; } for(UserAdminRole uaRole : uaRoles) { if(uaRole.getName().equalsIgnoreCase(SUPER_ADMIN)) { result = true; break; } Set<String> osUs = uaRole.getOsUSet(); if(CollectionUtils.isNotEmpty( osUs )) { // create Set with case insensitive comparator: Set<String> osUsFinal = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); for(String osU : osUs) { // Add osU children to the set: osUsFinal.add(osU); Set<String> children = UsoUtil.getInstance().getDescendants( osU, this.contextId ); osUsFinal.addAll(children); } // does the admin role have authority over the user object? if(osUsFinal.contains(ue.getOu())) { result = true; break; } } } } return result; }
Example 19
Source File: AtlasTypeDefStoreInitializer.java From incubator-atlas with Apache License 2.0 | 4 votes |
public static AtlasTypesDef getTypesToUpdate(AtlasTypesDef typesDef, AtlasTypeRegistry typeRegistry) { AtlasTypesDef typesToUpdate = new AtlasTypesDef(); if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef newStructDef : typesDef.getStructDefs()) { AtlasStructDef oldStructDef = typeRegistry.getStructDefByName(newStructDef.getName()); if (oldStructDef == null) { continue; } if (updateTypeAttributes(oldStructDef, newStructDef)) { typesToUpdate.getStructDefs().add(newStructDef); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef newClassifDef : typesDef.getClassificationDefs()) { AtlasClassificationDef oldClassifDef = typeRegistry.getClassificationDefByName(newClassifDef.getName()); if (oldClassifDef == null) { continue; } if (updateTypeAttributes(oldClassifDef, newClassifDef)) { typesToUpdate.getClassificationDefs().add(newClassifDef); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef newEntityDef : typesDef.getEntityDefs()) { AtlasEntityDef oldEntityDef = typeRegistry.getEntityDefByName(newEntityDef.getName()); if (oldEntityDef == null) { continue; } if (updateTypeAttributes(oldEntityDef, newEntityDef)) { typesToUpdate.getEntityDefs().add(newEntityDef); } } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef newEnumDef : typesDef.getEnumDefs()) { AtlasEnumDef oldEnumDef = typeRegistry.getEnumDefByName(newEnumDef.getName()); if (oldEnumDef == null) { continue; } if (isTypeUpdateApplicable(oldEnumDef, newEnumDef)) { if (CollectionUtils.isNotEmpty(oldEnumDef.getElementDefs())) { for (AtlasEnumElementDef oldEnumElem : oldEnumDef.getElementDefs()) { if (!newEnumDef.hasElement(oldEnumElem.getValue())) { newEnumDef.addElement(oldEnumElem); } } } typesToUpdate.getEnumDefs().add(newEnumDef); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { AtlasRelationshipDef oldRelationshipDef = typeRegistry.getRelationshipDefByName(relationshipDef.getName()); if (oldRelationshipDef == null) { continue; } if (updateTypeAttributes(oldRelationshipDef, relationshipDef)) { typesToUpdate.getRelationshipDefs().add(relationshipDef); } } } return typesToUpdate; }
Example 20
Source File: FilterSearchUtils.java From yes-cart with Apache License 2.0 | 3 votes |
/** * Get single String value filter * * @param filterParam reduced filter parameter from search context * * @return trimmed string value or null (black also returns null) */ public static String getStringFilter(List filterParam) { if (CollectionUtils.isNotEmpty(filterParam) && filterParam.get(0) instanceof String && StringUtils.isNotBlank((String) filterParam.get(0))) { return ((String) filterParam.get(0)).trim(); } return null; }