下面列出了javax.persistence.criteria.Order#org.apache.commons.collections4.CollectionUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private List<ClusterComponent> determineCdhRepoConfig(Cluster cluster, List<Component> stackCdhRepoConfig,
String osType, String blueprintCdhVersion) {
if (Objects.isNull(stackCdhRepoConfig) || stackCdhRepoConfig.isEmpty()) {
DefaultCDHInfo defaultCDHInfo = getDefaultCDHInfo(blueprintCdhVersion, osType);
Map<String, String> stack = defaultCDHInfo.getRepo().getStack();
ClouderaManagerProduct cmProduct = new ClouderaManagerProduct()
.withVersion(defaultCDHInfo.getVersion())
.withName(stack.get("repoid").split("-")[0])
.withParcel(stack.get(osType));
List<ClouderaManagerProduct> products = CollectionUtils.isNotEmpty(defaultCDHInfo.getParcels())
? defaultCDHInfo.getParcels() : new ArrayList<>();
products.add(cmProduct);
return products.stream().map(product -> new ClusterComponent(CDH_PRODUCT_DETAILS, product.getName(), new Json(product), cluster))
.collect(Collectors.toList());
} else {
return stackCdhRepoConfig.stream()
.map(Component::getAttributes)
.map(json -> new ClusterComponent(CDH_PRODUCT_DETAILS,
json.getSilent(ClouderaManagerProduct.class).getName(), json, cluster))
.collect(Collectors.toList());
}
}
@Override
protected StepPhase executeStep(ProcessContext context) {
CloudApplicationExtended app = context.getVariable(Variables.APP_TO_PROCESS);
getStepLogger().debug(MessageFormat.format(Messages.PUBLISHING_PUBLIC_PROVIDED_DEPENDENCIES, app.getName()));
List<ConfigurationEntry> entriesToPublish = context.getVariable(Variables.CONFIGURATION_ENTRIES_TO_PUBLISH);
if (CollectionUtils.isEmpty(entriesToPublish)) {
context.setVariable(Variables.PUBLISHED_ENTRIES, Collections.emptyList());
getStepLogger().debug(Messages.NO_PUBLIC_PROVIDED_DEPENDENCIES_FOR_PUBLISHING);
return StepPhase.DONE;
}
List<ConfigurationEntry> publishedEntries = publish(entriesToPublish);
getStepLogger().debug(Messages.PUBLISHED_ENTRIES, SecureSerialization.toJson(publishedEntries));
context.setVariable(Variables.PUBLISHED_ENTRIES, publishedEntries);
getStepLogger().debug(Messages.PUBLIC_PROVIDED_DEPENDENCIES_PUBLISHED);
return StepPhase.DONE;
}
public VideoResponse toVideoResponse(BidRequest bidRequest, BidResponse bidResponse, List<PodError> podErrors) {
final List<Bid> bids = bidsFrom(bidResponse);
final boolean anyBidsReturned = CollectionUtils.isNotEmpty(bids);
final List<ExtAdPod> adPods = adPodsWithTargetingFrom(bids);
if (anyBidsReturned && CollectionUtils.isEmpty(adPods)) {
throw new PreBidException("caching failed for all bids");
}
adPods.addAll(adPodsWithErrors(podErrors));
final ExtResponseDebug extResponseDebug;
final Map<String, List<ExtBidderError>> errors;
// Fetch debug and errors information from response if requested
if (isDebugEnabled(bidRequest)) {
final ExtBidResponse extBidResponse = extResponseFrom(bidResponse);
extResponseDebug = extResponseDebugFrom(extBidResponse);
errors = errorsFrom(extBidResponse);
} else {
extResponseDebug = null;
errors = null;
}
return VideoResponse.of(adPods, extResponseDebug, errors, null);
}
private static void assembleApplication(RegistryExecutor registryExecutor, ProtocolType protocolType, ElementNode root) throws Exception {
ElementNode protocolNode = new ElementNode(protocolType.toString(), protocolType.toString(), null, protocolType.toString());
root.add(protocolNode);
List<String> groups = null;
try {
groups = registryExecutor.getGroupList();
} catch (Exception e) {
LOG.warn("Get group list failed, protocol={}", protocolType);
}
if (CollectionUtils.isNotEmpty(groups)) {
for (String group : groups) {
ElementNode groupNode = new ElementNode(protocolType.toString(), group, null, group);
protocolNode.add(groupNode);
List<String> applications = registryExecutor.getApplicationList(group);
for (String application : applications) {
ElementNode applicationNode = new ElementNode(protocolType.toString(), application, null, application);
groupNode.add(applicationNode);
}
}
}
}
/**
* 根据父节点获取所有下级节点集合
*
* @param t 父节点对象
* @param justLeaf 是否只采集叶子节点
* @param <T> 树节点泛型
* @return 子节点集合
*/
public static <T extends TreeNode> Set<T> getChildSet(T t, boolean justLeaf) {
List<T> children = t.fetchChildren();
if (CollectionUtils.isEmpty(children)) {
return null;
}
Set<T> childSet = new HashSet<>();
for (T child : children) {
TreeUtil.recurTreeNode(child, (t1, isLeaf) -> {
//仅采集叶子的情况判断
if (justLeaf && !isLeaf) {
return;
}
childSet.add(t1);
});
}
return childSet;
}
@Override
public boolean validate() throws ConfigException {
if (CollectionUtils.isEmpty(retryDelays)) {
throw new ConfigException("[CarreraConfiguration] retryDelays empty");
} else if (thriftServer == null || !thriftServer.validate()) {
throw new ConfigException("[CarreraConfiguration] thriftServer error");
} else if (useKafka && (kafkaProducers <= 0 || MapUtils.isEmpty(kafkaConfigurationMap) || !kafkaConfigurationMap.values().stream().allMatch(KafkaConfiguration::validate))) {
throw new ConfigException("[CarreraConfiguration] kafka config error");
} else if (useRocketmq && (rocketmqProducers <= 0 || MapUtils.isEmpty(rocketmqConfigurationMap) || !rocketmqConfigurationMap.values().stream().allMatch(RocketmqConfiguration::validate))) {
throw new ConfigException("[CarreraConfiguration] rocketmq config error");
} else if (useAutoBatch && (autoBatch == null || !autoBatch.validate())) {
throw new ConfigException("[CarreraConfiguration] autoBatch error");
} else if (maxTps <= 0) {
throw new ConfigException("[CarreraConfiguration] maxTps <= 0");
} else if (tpsWarningRatio <= 0) {
throw new ConfigException("[CarreraConfiguration] tpsWarningRatio <= 0");
} else if (defaultTopicInfoConf == null) {
throw new ConfigException("[CarreraConfiguration] defaultTopicInfoConf is null");
}
return true;
}
protected List<MenuItem> collectPermittedScreens(List<MenuItem> menuItems) {
List<MenuItem> collectedItems = new ArrayList<>();
for (MenuItem item : menuItems) {
if (!item.isPermitted(userSession))
continue;
if (StringUtils.isNotEmpty(item.getScreen())) {
collectedItems.add(item);
}
if (CollectionUtils.isNotEmpty(item.getChildren())) {
collectedItems.addAll(collectPermittedScreens(item.getChildren()));
}
}
return collectedItems;
}
/**
* Find the non-tabu {@link Solution} with the lowest value.<br>
* This method doesn't use any Aspiration Criteria.
*/
@Override
public Solution findBestNeighbor(List<Solution> neighborsSolutions, final List<Solution> solutionsInTabu) {
//remove any neighbor that is in tabu list
CollectionUtils.filterInverse(neighborsSolutions, new Predicate<Solution>() {
@Override
public boolean evaluate(Solution neighbor) {
return solutionsInTabu.contains(neighbor);
}
});
//sort the neighbors
Collections.sort(neighborsSolutions, new Comparator<Solution>() {
@Override
public int compare(Solution a, Solution b) {
return a.getValue().compareTo(b.getValue());
}
});
//get the neighbor with lowest value
return neighborsSolutions.get(0);
}
private static void testContainsAll() {
Collection<String> collection1 = Lists.newArrayList("a1", "a2", "a3", "a1");
Collection<String> collection2 = Lists.newArrayList("a1", "a2", "a3", "a1");
Iterable<String> iterable1 = collection1;
Iterable<String> iterable2 = collection2;
MutableCollection<String> mutableCollection1 = FastList.newListWith("a1", "a2", "a3", "a1");
MutableCollection<String> mutableCollection2 = FastList.newListWith("a1", "a2", "a3", "a1");
// Check full equals with two collections
boolean jdk = collection1.containsAll(collection2); // using JDK
boolean guava = Iterables.elementsEqual(iterable1, iterable2); // using guava
boolean apache = CollectionUtils.containsAll(collection1, collection2); // using Apache
boolean gs = mutableCollection1.containsAll(mutableCollection2); // using GS
System.out.println("containsAll = " + jdk + ":" + guava + ":" + apache + ":" + gs); // print containsAll = true:true:true:true
}
private static String makeKeywords(List<AppnexusKeyVal> keywords) {
if (CollectionUtils.isEmpty(keywords)) {
return null;
}
final List<String> kvs = new ArrayList<>();
for (AppnexusKeyVal keyVal : keywords) {
final String key = keyVal.getKey();
final List<String> values = keyVal.getValue();
if (values == null || values.isEmpty()) {
kvs.add(key);
} else {
for (String value : values) {
kvs.add(String.format("%s=%s", key, value));
}
}
}
return String.join(",", kvs);
}
@Override
public List<ExportPredef> getAllByCompany(@VelocityCheck int companyId, Collection<Integer> disabledMailingListIds) {
if (CollectionUtils.isEmpty(disabledMailingListIds)) {
return getAllByCompany(companyId);
}
String sqlGetAll = "SELECT * FROM export_predef_tbl " +
"WHERE deleted = 0 AND company_id = ? " +
"AND mailinglist_id NOT IN (" + StringUtils.join(disabledMailingListIds, ',') + ")";
List<ExportPredef> profiles = new ArrayList<>();
RowMapper<ExportPredef> rowMapper = new ExportPredefRowMapper(isOracleDB());
query(logger, sqlGetAll, rs -> {
if (validateMailingListIds(rs.getString("mailinglists"), disabledMailingListIds)) {
profiles.add(rowMapper.mapRow(rs, 0));
}
}, companyId);
return profiles;
}
/**
* 转换对象
*
* @param subjectDtoList subjectDtoList
* @return List
*/
public static List<SubjectExcelModel> convertToExcelModel(List<SubjectDto> subjectDtoList) {
List<SubjectExcelModel> subjectExcelModels = new ArrayList<>(subjectDtoList.size());
subjectDtoList.forEach(subject -> {
SubjectExcelModel subjectExcelModel = new SubjectExcelModel();
BeanUtils.copyProperties(subject, subjectExcelModel);
if (CollectionUtils.isNotEmpty(subject.getOptions())) {
List<String> optionString = subject.getOptions().stream()
.map(option -> "$$" + option.getOptionName() + "# " + option.getOptionContent()).collect(Collectors.toList());
subjectExcelModel.setOptions(StringUtils.join(optionString, "\n"));
}
subjectExcelModel.setAnswer(subject.getAnswer().getAnswer());
subjectExcelModels.add(subjectExcelModel);
});
return subjectExcelModels;
}
private Map<Long, TopicOrderVo> getTopicVoMap(List<Topic> list, List<CustomTopicConf> confList, Boolean needExtraParams) {
Map<Long/*topicID*/, TopicOrderVo> topicVoMap = Maps.newLinkedHashMap();
list.forEach((topic -> {
TopicOrderVo vo = TopicOrderVo.buildTopicVo(topic);
topicVoMap.put(topic.getId(), vo);
}));
if (CollectionUtils.isNotEmpty(confList)) {
Map<Long, Cluster> clusterMap = clusterService.findMap();
confList.forEach(conf -> {
if (topicVoMap.containsKey(conf.getTopicId())) {
try {
TopicConfVo confVo = TopicConfVo.buildTopicConfVo(conf);
confVo.setClusterDesc(clusterMap.get(conf.getClusterId()).getDescription());
topicVoMap.get(conf.getTopicId()).addConf(confVo);
} catch (Exception e) {
LOGGER.error("getTopicVoMap exception", e);
}
}
});
}
return topicVoMap;
}
/**
* 合并默认租户和租户的菜单,租户菜单优先
*
* @param defaultMenus defaultMenus
* @param tenantMenus tenantMenus
* @return List
* @author tangyi
* @date 2019-09-14 14:45
*/
private List<Menu> mergeMenu(List<Menu> defaultMenus, List<Menu> tenantMenus) {
if (CollectionUtils.isEmpty(tenantMenus))
return defaultMenus;
List<Menu> userMenus = new ArrayList<>();
// 默认菜单
defaultMenus.forEach(defaultMenu -> {
Optional<Menu> menu = tenantMenus.stream()
.filter(tenantMenu -> tenantMenu.getName().equals(defaultMenu.getName())).findFirst();
if (menu.isPresent()) {
userMenus.add(menu.get());
} else {
userMenus.add(defaultMenu);
}
});
// 租户菜单
tenantMenus.forEach(tenantMenu -> {
Optional<Menu> exist = userMenus.stream()
.filter(userMenu -> userMenu.getName().equals(tenantMenu.getName()) && userMenu.getParentId()
.equals(tenantMenu.getParentId())).findFirst();
if (!exist.isPresent()) {
userMenus.add(tenantMenu);
}
});
return userMenus;
}
@Override
public List<AgentBaseInfoVo> listAllAgentsByDailyAchievements() {
List<AgentVo> agentVos = listAllProcessedAgents();
List<AgentBaseInfoVo> collect =Lists.newArrayList();
if (CollectionUtils.isEmpty(agentVos)){
return null;
}
agentVos.stream()
.filter(agentVo -> agentVo.getStatus().equals(AgentStatus.EXAMINED.getCode()))
.sorted(Comparator.comparing(AgentVo::getDailyAchieve).reversed())
.forEach(agentVo -> {
AgentBaseInfoVo agentBaseInfoVo=new AgentBaseInfoVo();
BeanUtils.copyProperties(agentVo,agentBaseInfoVo);
collect.add(agentBaseInfoVo);
});
return collect;
}
/**
* 添加数据记录并检查是否换行
* @param row 实际当前行号
* @param col 实际记录当前列
* @param value 当前cell的值
*/
public void addDataAndrChangeRow(int row,int col,Object value){
//当前行如果大于实际行表示改行忽略,不记录
if(curRowNum!=row){
if(CollectionUtils.isEmpty(currentSheetDataMap)){
currentSheetDataMap=new ArrayList<Map<String,Object>>();
}
currentSheetDataMap.add(currentSheetRowDataMap);
//logger.debug( "行号:"+curRowNum +" 行内容:"+currentSheetRowDataMap.toString());
//logger.debug( "\n" );
currentSheetRowDataMap=new HashMap<String,Object>();
currentSheetRowDataMap.put(trianListheadTitle[col], value);
logger.debug(row+":"+col+" "+value+"\r" );
curRowNum=row;
}else{
currentSheetRowDataMap.put(trianListheadTitle[col], value);
//logger.debug(row+":"+col+" "+value+"\r" );
}
}
@Override
protected List<EnhanceModel> getEnhanceModels() {
if (config == null || CollectionUtils.isEmpty(config.getJavaEntranceBehaviors())) { return null;}
List<EnhanceModel> ems = Lists.newArrayList();
for (Behavior behavior : config.getJavaEntranceBehaviors()) {
ems.add(EnhanceModel.convert(behavior));
}
return ems;
}
@Override
public boolean offLineCluster(int clusterId) {
List<InstanceInfo> instanceInfoList = instanceService.getInstancesByClusterId(clusterId);
if (CollectionUtils.isEmpty(instanceInfoList)) {
return false;
}
for (InstanceInfo instanceInfo : instanceInfoList) {
stopZKInstance(instanceInfo.getId());
}
// 下线集群操作,直接更改集群状态
return clusterService.updateClusterStatus(clusterId, ClusterStatusEnum.OFFLINE.getStatus());
}
private synchronized void onDataChange(PProxyConfig newPProxyConfig) throws Exception {
LogUtils.getMainLogger().info("proxyConfig change, old:{}, new:{}", proxyConfig, newPProxyConfig);
if (!checkProxyConfig(newPProxyConfig)) {
return;
}
//swap
PProxyConfig oldProxyConfig = proxyConfig.clone();
proxyConfig = newPProxyConfig;
//add new and delete not in management
if (!CollectionUtils.isEqualCollection(oldProxyConfig.getTopics(), proxyConfig.getTopics())) {
Set<String> topics = getTopicsInProxyConfigAndLocal(proxyConfig);
updateTopics(topics);
}
//rocketmq client update
checkAndUpdateRmqConfig(oldProxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap(),
proxyConfig.getCarreraConfiguration().getRocketmqConfigurationMap());
//kafka client update
checkAndUpdateKafkaConfig(oldProxyConfig.getCarreraConfiguration().getKafkaConfigurationMap(),
proxyConfig.getCarreraConfiguration().getKafkaConfigurationMap());
//cluster change, update all topics
if (!CollectionUtils.isEqualCollection(oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters())) {
updateAllTopicConfig();
LogUtils.getMainLogger().info("cluster change, old:{}, new:{}", oldProxyConfig.getBrokerClusters(), proxyConfig.getBrokerClusters());
}
//node rate limiter update
if (oldProxyConfig.getCarreraConfiguration().getMaxTps() != proxyConfig.getCarreraConfiguration().getMaxTps()
|| oldProxyConfig.getCarreraConfiguration().getTpsWarningRatio() != proxyConfig.getCarreraConfiguration().getTpsWarningRatio()) {
requestLimiter.updateNodeConfig(proxyConfig.getCarreraConfiguration().getTpsWarningRatio(),
proxyConfig.getCarreraConfiguration().getMaxTps());
}
proxyConfigService.getAndWatchIndex(proxyConfig.getTopics(), new TopicConfigCallback());
LogUtils.getMainLogger().info("proxyConfig change completely");
}
protected List<OffsetTrackSnapshot> removeUnsubscriptedQids(List<OffsetTrackSnapshot> snapshots) {
Map<String, Set<String>> subscribedQids = getCurrentQids();
snapshots = snapshots.stream().filter(snapshot -> {
Set<String> qids = subscribedQids.get(snapshot.getTopic());
return CollectionUtils.isNotEmpty(qids) && qids.contains(snapshot.getQid());
}).collect(Collectors.toList());
return snapshots;
}
/** {@inheritDoc} */
public String getAnonId(final String siteId, final String userId)
{
// Query for a single user in the site
List<AnonymousMapping> results = findMappingsBySiteAndUsers(siteId, Collections.singletonList(userId));
if (CollectionUtils.isEmpty(results))
{
return null;
}
return results.get(0).getAnonId();
}
@Test
public void testBigBoomAtClassicWalls3() {
List<Wall> barriers = new LinkedList<Wall>();
CollectionUtils.addAll(barriers, new OriginalWalls(v(SIZE)).iterator());
Point source = pt(11, 12);
int radius = 3;
int countBlasts = 2*radius + 1;
assertBoom(barriers, source, radius, countBlasts,
"☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼\n" +
"☼ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ҉ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼҉☼ ☼ ☼ ☼ ☼\n" +
"☼ ҉ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼☻☼ ☼ ☼ ☼ ☼\n" +
"☼ ҉ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼҉☼ ☼ ☼ ☼ ☼\n" +
"☼ ҉ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ☼\n" +
"☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼ ☼\n" +
"☼ ☼\n" +
"☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼☼\n");
}
private void deleteRule(BrokerEntity brokerEntity, HttpServletRequest request) throws GovernanceException {
try {
List<RuleEngineEntity> ruleEngines = ruleEngineRepository.findAllByBrokerIdAndDeleteAt(brokerEntity.getId(), IsDeleteEnum.NOT_DELETED.getCode());
if (CollectionUtils.isNotEmpty(ruleEngines)) {
for (RuleEngineEntity ruleEngine : ruleEngines) {
ruleEngineService.deleteProcessRule(request, ruleEngine);
}
}
} catch (Exception e) {
log.error("delete rule fail", e);
throw new GovernanceException("delete rule fail", e);
}
}
@Override
public void apply(Element element, boolean sortable) {
String horizontalScroll = element.attributeValue("horizontalScroll");
if (!StringUtils.isBlank(horizontalScroll)) {
table.setHorizontalScrollEnabled(Boolean.valueOf(horizontalScroll));
}
loadFontPreferences(element);
final Element columnsElem = element.element("columns");
if (columnsElem == null) {
return;
}
Collection<String> modelIds = new LinkedList<>();
for (TableColumn modelColumn : table.getColumns(true)) {
modelIds.add(String.valueOf(modelColumn.getIdentifier()));
}
Collection<String> loadedIds = new LinkedList<>();
for (Element colElem : Dom4j.elements(columnsElem, "column")) {
String id = colElem.attributeValue("id");
loadedIds.add(id);
}
Configuration configuration = AppBeans.get(Configuration.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
if (clientConfig.getLoadObsoleteSettingsForTable()
|| CollectionUtils.isEqualCollection(modelIds, loadedIds)) {
applyColumnSettings(element, sortable);
}
}
public List<AclLevelRes> dynamicMenuTree(DynamicMenuAuthorReq loginAuthReq, RedisUser redisUser) {
List<AclDO> userAclList = commonSysCoreServiceCache.getUserAclList(loginAuthReq, redisUser);
//获取第三方管理员权限id列表
String redisAdminKey = RedisKeyEnum.REDIS_ADMIN_ROLE_STR.getKey() + redisUser.getTenantId();
Object roleDoObj = redisUtil.get(redisAdminKey);
if (null == roleDoObj) {
return Lists.newArrayList();
}
RoleDO roleDO = JSON.parseObject(String.valueOf(roleDoObj), new TypeReference<RoleDO>() {
});
if (roleDO.getDisabledFlag().equals(1) || roleDO.getDelFlag().equals(1)) {
return Lists.newArrayList();
}
Object aclIdsObj = redisUtil.hget(RedisKeyEnum.REDIS_ROLE_ACLS_MAP.getKey() + roleDO.getId(), loginAuthReq.getAclPermissionCode());
if (null == aclIdsObj) {
return Lists.newArrayList();
}
List<Long> adminAclIds = JSON.parseObject(String.valueOf(aclIdsObj), new TypeReference<List<Long>>() {
});
if (CollectionUtils.isEmpty(adminAclIds)) {
return Lists.newArrayList();
}
List<AclLevelRes> aclDtoList = Lists.newArrayList();
for (AclDO acl : userAclList) {
//权限继承
//企业员工权限列表不能大于该企业下管理员(老板)权限列表
if (acl.getDisabledFlag().equals(0) && acl.getDelFlag().equals(0)) {
if (adminAclIds.contains(acl.getId())) {
AclLevelRes dto = AclLevelRes.adapt(acl);
dto.setHasAcl(true);
dto.setDisabled(false);
dto.setChecked(true);
aclDtoList.add(dto);
}
}
}
return aclListToTree(aclDtoList);
}
/**
* Analyzes a list of Components.
* @param components a list of Components
*/
public void analyze(final List<Component> components) {
final Pageable<Component> paginatedComponents = new Pageable<>(100, components);
while (!paginatedComponents.isPaginationComplete()) {
final List<String> coordinates = new ArrayList<>();
final List<Component> paginatedList = paginatedComponents.getPaginatedList();
for (final Component component: paginatedList) {
if (!component.isInternal() && shouldAnalyze(component.getPurl())) {
//coordinates.add(component.getPurl().canonicalize()); // todo: put this back when minimizePurl() is removed
coordinates.add(minimizePurl(component.getPurl()));
}
}
if (CollectionUtils.isEmpty(coordinates)) {
return;
}
final JSONObject json = new JSONObject();
json.put("coordinates", coordinates);
try {
final List<ComponentReport> report = submit(json);
processResults(report, paginatedList);
} catch (UnirestException e) {
handleRequestException(LOGGER, e);
}
LOGGER.info("Analyzing " + coordinates.size() + " component(s)");
doThrottleDelay();
paginatedComponents.nextPage();
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ValueProviderImpl that = (ValueProviderImpl) o;
return Objects.equals(name, that.name) &&
Objects.equals(type, that.type) &&
CollectionUtils.isEqualCollection(parameters, that.parameters);
}
@Override
@Transactional
@Validate("deleteSubscriber") // TODO Check, why use "deleteSubscriber" validation rule here???
public Map<String, Object> getSubscriber(RecipientModel model) {
Set<String> columns = model.getColumns();
if (CollectionUtils.isEmpty(columns)) {
return recipientDao.getCustomerDataFromDb(model.getCompanyId(), model.getCustomerId());
} else {
return recipientDao.getCustomerDataFromDb(model.getCompanyId(), model.getCustomerId(), columns);
}
}
@Override
public void startService() {
if (CollectionUtils.isEmpty(priorityDirectories)) {
LOG.error("No input root or priority directories specified");
throw new ParameterException("Missing required parameter '-i' for input root or priority directories");
}
LOG.info("Starting feeder using {} as the workspace class", workspaceClass);
try {
WorkSpace ws = (WorkSpace) Class.forName(workspaceClass).getConstructor(FeedCommand.class).newInstance(this);
ws.run();
} catch (Exception e) {
LOG.error("Error running WorkSpace class: {} ", workspaceClass, e);
}
}
@Override
public List<ClusterEntity> selectListAll() {
List<ClusterH2Entity> envH2Entities = clusterJpaRepository.findAll();
if (CollectionUtils.isEmpty(envH2Entities)) {
return new ArrayList<>();
}
return envH2Entities.stream().map(this::transferEntity).collect(Collectors.toList());
}