org.apache.commons.collections.CollectionUtils Java Examples
The following examples show how to use
org.apache.commons.collections.CollectionUtils.
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: CurricularCourse.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") public boolean hasActiveScopeInGivenSemesterForCommonAndGivenBranch(final Integer semester, final Branch branch) { Collection<CurricularCourseScope> scopes = getScopesSet(); List<CurricularCourseScope> result = (List<CurricularCourseScope>) CollectionUtils.select(scopes, new Predicate() { @Override public boolean evaluate(Object obj) { CurricularCourseScope curricularCourseScope = (CurricularCourseScope) obj; return ((curricularCourseScope.getBranch().getBranchType().equals(BranchType.COMNBR) || curricularCourseScope .getBranch().equals(branch)) && curricularCourseScope.getCurricularSemester().getSemester().equals(semester) && curricularCourseScope .isActive().booleanValue()); } }); return !result.isEmpty(); }
Example #2
Source File: ElasticsearchClient.java From ranger with Apache License 2.0 | 6 votes |
private static List<String> filterResourceFromResponse(String resourceMatching, List<String> existingResources, List<String> resourceResponses) { List<String> resources = new ArrayList<String>(); for (String resourceResponse : resourceResponses) { if (CollectionUtils.isNotEmpty(existingResources) && existingResources.contains(resourceResponse)) { continue; } if (StringUtils.isEmpty(resourceMatching) || resourceMatching.startsWith("*") || resourceResponse.toLowerCase().startsWith(resourceMatching.toLowerCase())) { if (LOG.isDebugEnabled()) { LOG.debug("filterResourceFromResponse(): Adding elasticsearch resource " + resourceResponse); } resources.add(resourceResponse); } } return resources; }
Example #3
Source File: RegistryDataManager.java From product-ei with Apache License 2.0 | 6 votes |
/** * Encrypt the registry properties by new algorithm and update * * @param registry * @param resource * @param properties * @throws RegistryException * @throws CryptoException */ private void updateRegistryProperties(Registry registry, String resource, List<String> properties) throws RegistryException, CryptoException { if (registry == null || StringUtils.isEmpty(resource) || CollectionUtils.isEmpty(properties)) { return; } if (registry.resourceExists(resource)) { try { registry.beginTransaction(); Resource resourceObj = registry.get(resource); for (String encryptedPropertyName : properties) { String oldValue = resourceObj.getProperty(encryptedPropertyName); String newValue = Utility.getNewEncryptedValue(oldValue); if (StringUtils.isNotEmpty(newValue)) { resourceObj.setProperty(encryptedPropertyName, newValue); } } registry.put(resource, resourceObj); registry.commitTransaction(); } catch (RegistryException e) { registry.rollbackTransaction(); log.error("Unable to update the registry resource", e); throw e; } } }
Example #4
Source File: EingangsrechnungDao.java From projectforge-webapp with GNU General Public License v3.0 | 6 votes |
/** * Sets the scales of percentage and currency amounts. <br/> * Gutschriftsanzeigen dürfen keine Rechnungsnummer haben. Wenn eine Rechnungsnummer für neue Rechnungen gegeben wurde, so muss sie * fortlaufend sein. Berechnet das Zahlungsziel in Tagen, wenn nicht gesetzt, damit es indiziert wird. * @see org.projectforge.core.BaseDao#onSaveOrModify(org.projectforge.core.ExtendedBaseDO) */ @Override protected void onSaveOrModify(final EingangsrechnungDO obj) { if (obj.getZahlBetrag() != null) { obj.setZahlBetrag(obj.getZahlBetrag().setScale(2, RoundingMode.HALF_UP)); } obj.recalculate(); if (CollectionUtils.isEmpty(obj.getPositionen()) == true) { throw new UserException("fibu.rechnung.error.rechnungHatKeinePositionen"); } final int size = obj.getPositionen().size(); for (int i = size - 1; i > 0; i--) { // Don't remove first position, remove only the last empty positions. final EingangsrechnungsPositionDO position = obj.getPositionen().get(i); if (position.getId() == null && position.isEmpty() == true) { obj.getPositionen().remove(i); } else { break; } } RechnungDao.writeUiStatusToXml(obj); }
Example #5
Source File: TxManagerServiceImpl.java From Raincat with GNU Lesser General Public License v3.0 | 6 votes |
@Override public Boolean saveTxTransactionGroup(final TxTransactionGroup txTransactionGroup) { try { final String groupId = txTransactionGroup.getId(); //保存数据 到sortSet redisTemplate.opsForZSet().add(CommonConstant.REDIS_KEY_SET, groupId, CommonConstant.REDIS_SCOPE); final List<TxTransactionItem> itemList = txTransactionGroup.getItemList(); if (CollectionUtils.isNotEmpty(itemList)) { for (TxTransactionItem item : itemList) { redisTemplate.opsForHash().put(cacheKey(groupId), item.getTaskKey(), item); } } } catch (Exception e) { return false; } return true; }
Example #6
Source File: CommonBeans.java From circus-train with Apache License 2.0 | 6 votes |
private HiveConf newHiveConf(TunnelMetastoreCatalog hiveCatalog, Configuration baseConf) { List<String> siteXml = hiveCatalog.getSiteXml(); if (CollectionUtils.isEmpty(siteXml)) { LOG.info("No Hadoop site XML is defined for catalog {}.", hiveCatalog.getName()); } Map<String, String> properties = new HashMap<>(); for (Entry<String, String> entry : baseConf) { properties.put(entry.getKey(), entry.getValue()); } if (hiveCatalog.getHiveMetastoreUris() != null) { properties.put(ConfVars.METASTOREURIS.varname, hiveCatalog.getHiveMetastoreUris()); } putConfigurationProperties(hiveCatalog.getConfigurationProperties(), properties); HiveConf hiveConf = new HiveConfFactory(siteXml, properties).newInstance(); return hiveConf; }
Example #7
Source File: ClientVersionServiceImpl.java From cachecloud with Apache License 2.0 | 6 votes |
@Override public List<AppClientVersion> getAppAllServerClientVersion(long appId) { List<AppClientVersion> appClientVersionList = getAppAllClientVersion(appId); if (CollectionUtils.isEmpty(appClientVersionList)) { return Collections.emptyList(); } List<AppClientVersion> appClientVersionServerList = new ArrayList<AppClientVersion>(); for (AppClientVersion appClientVersion : appClientVersionList) { String clientIp = appClientVersion.getClientIp(); String[] items = clientIp.split("."); //过滤办公网段ip if (!OFFICE_IP.contains(items[0] + "." + items[1])) { appClientVersionServerList.add(appClientVersion); } } return appClientVersionServerList; }
Example #8
Source File: HiveHook.java From atlas with Apache License 2.0 | 6 votes |
public PreprocessAction getPreprocessActionForHiveTable(String qualifiedName) { PreprocessAction ret = PreprocessAction.NONE; if (qualifiedName != null && (CollectionUtils.isNotEmpty(hiveTablesToIgnore) || CollectionUtils.isNotEmpty(hiveTablesToPrune))) { ret = hiveTablesCache.get(qualifiedName); if (ret == null) { if (isMatch(qualifiedName, hiveTablesToIgnore)) { ret = PreprocessAction.IGNORE; } else if (isMatch(qualifiedName, hiveTablesToPrune)) { ret = PreprocessAction.PRUNE; } else { ret = PreprocessAction.NONE; } hiveTablesCache.put(qualifiedName, ret); } } return ret; }
Example #9
Source File: ZKV4ConfigServiceImpl.java From DDMQ with Apache License 2.0 | 6 votes |
@Override @Transactional(isolation = Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public ConsoleBaseResponse<?> pushCProxyByCluster(String clusterName) throws Exception { Cluster cluster = clusterService.findByClusterName(clusterName); if (cluster == null) { return ConsoleBaseResponse.error(ConsoleBaseResponse.Status.INVALID_PARAM, "集群不存在"); } List<Node> list = nodeService.findByClusterIdNodeType(cluster.getId(), NodeType.CONSUMER_PROXY); if (CollectionUtils.isEmpty(list)) { return ConsoleBaseResponse.error(ConsoleBaseResponse.Status.INVALID_PARAM, "集群暂无CProxy"); } for (Node node : list) { updateCProxyConfig(node.getId()); } return ConsoleBaseResponse.success(); }
Example #10
Source File: ScheduledService.java From myth with Apache License 2.0 | 6 votes |
/** * Scheduled auto recover. */ private void scheduledAutoRecover() { new ScheduledThreadPoolExecutor(1, MythTransactionThreadFactory.create("MythAutoRecoverService", true)) .scheduleWithFixedDelay(() -> { LogUtil.debug(LOGGER, "auto recover execute delayTime:{}", mythConfig::getScheduledDelay); try { final List<MythTransaction> mythTransactionList = mythCoordinatorService.listAllByDelay(acquireData(mythConfig)); if (CollectionUtils.isNotEmpty(mythTransactionList)) { mythTransactionList.forEach(mythTransaction -> { final Boolean success = mythSendMessageService.sendMessage(mythTransaction); //发送成功 ,更改状态 if (success) { mythTransaction.setStatus(MythStatusEnum.COMMIT.getCode()); publisher.publishEvent(mythTransaction, EventTypeEnum.UPDATE_STATUS.getCode()); } }); } } catch (Exception e) { e.printStackTrace(); } }, 30, mythConfig.getScheduledDelay(), TimeUnit.SECONDS); }
Example #11
Source File: AtlasNotificationMapper.java From ranger with Apache License 2.0 | 6 votes |
static private List<RangerTagDef> getTagDefs(RangerAtlasEntityWithTags entityWithTags) { List<RangerTagDef> ret = new ArrayList<>(); if (entityWithTags != null && CollectionUtils.isNotEmpty(entityWithTags.getTags())) { Map<String, String> tagNames = new HashMap<>(); for (EntityNotificationWrapper.RangerAtlasClassification tag : entityWithTags.getTags()) { if (!tagNames.containsKey(tag.getName())) { tagNames.put(tag.getName(), tag.getName()); RangerTagDef tagDef = new RangerTagDef(tag.getName(), "Atlas"); if (MapUtils.isNotEmpty(tag.getAttributes())) { for (String attributeName : tag.getAttributes().keySet()) { tagDef.getAttributeDefs().add(new RangerTagAttributeDef(attributeName, entityWithTags.getTagAttributeType(tag.getName(), attributeName))); } } ret.add(tagDef); } } } return ret; }
Example #12
Source File: RangerServiceDefHelper.java From ranger with Apache License 2.0 | 6 votes |
/** * Builds a directed graph where each resource is node and arc goes from parent level to child level * * @param resourceDefs * @return */ DirectedGraph createGraph(List<RangerResourceDef> resourceDefs) { DirectedGraph graph = null; if(CollectionUtils.isNotEmpty(resourceDefs)) { graph = new DirectedGraph(); for (RangerResourceDef resourceDef : resourceDefs) { String name = resourceDef.getName(); graph.add(name); String parent = resourceDef.getParent(); if (StringUtils.isNotEmpty(parent)) { graph.addArc(parent, name); } } } if (LOG.isDebugEnabled()) { LOG.debug("Created graph for resources: " + graph); } return graph; }
Example #13
Source File: DeleteHandlerV1.java From atlas with Apache License 2.0 | 6 votes |
public List<AtlasVertex> removeTagPropagation(AtlasVertex classificationVertex) throws AtlasBaseException { List<AtlasVertex> ret = new ArrayList<>(); if (classificationVertex != null) { List<AtlasEdge> propagatedEdges = getPropagatedEdges(classificationVertex); if (CollectionUtils.isNotEmpty(propagatedEdges)) { AtlasClassification classification = entityRetriever.toAtlasClassification(classificationVertex); for (AtlasEdge propagatedEdge : propagatedEdges) { AtlasVertex entityVertex = propagatedEdge.getOutVertex(); ret.add(entityVertex); // record remove propagation details to send notifications at the end RequestContext.get().recordRemovedPropagation(getGuid(entityVertex), classification); deletePropagatedEdge(propagatedEdge); } } } return ret; }
Example #14
Source File: EntityLineageService.java From atlas with Apache License 2.0 | 6 votes |
private boolean lineageContainsEdge(AtlasLineageInfo lineageInfo, AtlasEdge edge) { boolean ret = false; if (lineageInfo != null && CollectionUtils.isNotEmpty(lineageInfo.getRelations()) && edge != null) { String relationGuid = AtlasGraphUtilsV2.getEncodedProperty(edge, RELATIONSHIP_GUID_PROPERTY_KEY, String.class); Set<LineageRelation> relations = lineageInfo.getRelations(); for (LineageRelation relation : relations) { if (relation.getRelationshipId().equals(relationGuid)) { ret = true; break; } } } return ret; }
Example #15
Source File: AtlasStructDefStoreV2.java From atlas with Apache License 2.0 | 6 votes |
@Override public AtlasStructDef create(AtlasStructDef structDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasStructDefStoreV1.create({}, {})", structDef, preCreateResult); } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, structDef), "create struct-def ", structDef.getName()); if (CollectionUtils.isEmpty(structDef.getAttributeDefs())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Missing attributes for structdef"); } AtlasVertex vertex = (preCreateResult == null) ? preCreate(structDef) : preCreateResult; AtlasStructDefStoreV2.updateVertexAddReferences(structDef, vertex, typeDefStore); AtlasStructDef ret = toStructDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasStructDefStoreV1.create({}, {}): {}", structDef, preCreateResult, ret); } return ret; }
Example #16
Source File: ApprovedLearningAgreementDocumentFile.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
protected List<ApprovedLearningAgreementExecutedAction> getSentLearningAgreementActions() { List<ApprovedLearningAgreementExecutedAction> executedActionList = new ArrayList<ApprovedLearningAgreementExecutedAction>(); CollectionUtils.select(getExecutedActionsSet(), new Predicate() { @Override public boolean evaluate(Object arg0) { return ((ApprovedLearningAgreementExecutedAction) arg0).isSentLearningAgreementAction(); }; }, executedActionList); Collections.sort(executedActionList, Collections.reverseOrder(ExecutedAction.WHEN_OCCURED_COMPARATOR)); return executedActionList; }
Example #17
Source File: DiffFilter.java From diff-check with GNU Lesser General Public License v2.1 | 6 votes |
public DiffFilter(MavenProject project, File gitDir, List<DiffEntryWrapper> entries) { File baseDir = project.getBasedir(); String baseDirPath = baseDir.getAbsolutePath(); @SuppressWarnings("unchecked") List<String> modules = project.getModules(); for (DiffEntryWrapper entry : entries) { if (!entry.getAbsoluteNewPath().startsWith(baseDirPath)) { continue; } String name = StringUtils.replaceOnce(entry.getAbsoluteNewPath(), baseDirPath, ""); if (CollectionUtils.isNotEmpty(modules)) { for (String module : modules) { if (name.startsWith("/" + module)) { name = StringUtils.replaceOnce(name, "/" + module, ""); break; } } } if (!name.startsWith(SOURCE_PATH_PREFIX)) { continue; } name = StringUtils.replaceOnce(name, SOURCE_PATH_PREFIX, ""); classPathDiffEntryMap.put(name, entry); } }
Example #18
Source File: RESTUtil.java From rest-client with Apache License 2.0 | 6 votes |
/** * * @Title : diff * @Description: Differ JSON nodes * @Param : @param json1 * @Param : @param json2 * @Param : @param excludedNodes * @Param : @return * @Return : boolean * @Throws : */ public static boolean diff(String json1, String json2, List<String> exclNodes) { if (CollectionUtils.isEmpty(exclNodes)) { return json1.equals(json2); } JsonParser p = new JsonParser(); JsonElement e1 = p.parse(json1); JsonElement e2 = p.parse(json2); jsonTree(e1, "", exclNodes); jsonTree(e2, "", exclNodes); return e1.equals(e2); }
Example #19
Source File: ActivityRuleService.java From dubbox with Apache License 2.0 | 6 votes |
@Override public List<ActivityRuleEntity> getActivityRule(ActivityRuleEntity activityRuleEntity) throws DTSAdminException { ActivityRuleDO activityRuleDO = ActivityRuleHelper.toActivityRuleDO(activityRuleEntity); ActivityRuleDOExample example = new ActivityRuleDOExample(); Criteria criteria = example.createCriteria(); criteria.andIsDeletedIsNotNull(); if (StringUtils.isNotEmpty(activityRuleDO.getBizType())) { criteria.andBizTypeLike(activityRuleDO.getBizType()); } if (StringUtils.isNotEmpty(activityRuleDO.getApp())) { criteria.andAppLike(activityRuleDO.getApp()); } if (StringUtils.isNotEmpty(activityRuleDO.getAppCname())) { criteria.andAppCnameLike(activityRuleDO.getAppCname()); } example.setOrderByClause("app,biz_type"); List<ActivityRuleDO> lists = activityRuleDOMapper.selectByExample(example); if (CollectionUtils.isEmpty(lists)) { return Lists.newArrayList(); } List<ActivityRuleEntity> entities = Lists.newArrayList(); for (ActivityRuleDO an : lists) { entities.add(ActivityRuleHelper.toActivityRuleEntity(an)); } return entities; }
Example #20
Source File: ReviewMgrConsole.java From directory-fortress-core with Apache License 2.0 | 6 votes |
private static void printAddress( Address address, String label ) { if ( address != null ) { System.out.println( label ); if ( CollectionUtils.isNotEmpty( address.getAddresses() ) ) { for ( String addr : address.getAddresses() ) { System.out.println( " line [" + addr + "]" ); } } System.out.println( " city [" + address.getCity() + "]" ); System.out.println( " state [" + address.getState() + "]" ); System.out.println( " zip [" + address.getPostalCode() + "]" ); } }
Example #21
Source File: PortfolioCollector.java From ExecDashboard with Apache License 2.0 | 6 votes |
private Iterable<Lob> createLobs() { List<Lob> lobList = new ArrayList<>(); if (CollectionUtils.isEmpty(lobRowsList)){ return lobList; } for (Row productRow : lobRowsList) { String lobName = productRow.getAs("ownerDept"); String pName = productRow.getAs("businessOwner"); Lob lob = lobList.stream() .filter(l -> l.getName().equalsIgnoreCase(lobName)) .findFirst().orElse(null); if (lob == null) { lob = new Lob(); lob.setName(lobName); lobList.add(lob); } LOGGER.debug("Lob Name = " + lobName); addProductToLob(lob, productRow); lob.addOwner(new PeopleRoleRelation(getPeople(pName, "businessOwner"), RoleRelationShipType.BusinessOwner)); } lobRepository.deleteAll(); return lobRepository.save(lobList); }
Example #22
Source File: ReflectionUtils.java From base-framework with Apache License 2.0 | 5 votes |
/** * * 获取对象中的所有annotationClass注解 * * @param targetClass * 目标对象Class * @param annotationClass * 注解类型Class * * @return List */ public static <T extends Annotation> List<T> getAnnotations( Class targetClass, Class annotationClass) { Assert.notNull(targetClass, "targetClass不能为空"); Assert.notNull(annotationClass, "annotationClass不能为空"); List<T> result = new ArrayList<T>(); Annotation annotation = targetClass.getAnnotation(annotationClass); if (annotation != null) { result.add((T) annotation); } Constructor[] constructors = targetClass.getDeclaredConstructors(); // 获取构造方法里的注解 CollectionUtils.addAll(result, getAnnotations(constructors, annotationClass).iterator()); Field[] fields = targetClass.getDeclaredFields(); // 获取字段中的注解 CollectionUtils.addAll(result, getAnnotations(fields, annotationClass) .iterator()); Method[] methods = targetClass.getDeclaredMethods(); // 获取方法中的注解 CollectionUtils.addAll(result, getAnnotations(methods, annotationClass) .iterator()); for (Class<?> superClass = targetClass.getSuperclass(); superClass == null || superClass == Object.class; superClass = superClass .getSuperclass()) { List<T> temp = getAnnotations(superClass, annotationClass); if (CollectionUtils.isNotEmpty(temp)) { CollectionUtils.addAll(result, temp.iterator()); } } return result; }
Example #23
Source File: Spider.java From zongtui-webcrawler with GNU General Public License v2.0 | 5 votes |
protected void onSuccess(Request request) { if (CollectionUtils.isNotEmpty(spiderListeners)) { for (SpiderListener spiderListener : spiderListeners) { spiderListener.onSuccess(request); } } }
Example #24
Source File: ProjectService.java From das with Apache License 2.0 | 5 votes |
private List<ProjectDbsetRelation> toProjectDbsetRelations(Project project, Set<Long> addDbsetIds) { List<ProjectDbsetRelation> list = new ArrayList<>(); if (CollectionUtils.isNotEmpty(addDbsetIds)) { for (Long dbsetId : addDbsetIds) { list.add(ProjectDbsetRelation.builder().dbsetId(dbsetId).projectId(project.getId()).updateUserNo(project.getUpdate_user_no()).build()); } } return list; }
Example #25
Source File: DelAdminMgrImpl.java From directory-fortress-core with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override @AdminPermissionOperation public AdminRole updateRole(AdminRole role) throws SecurityException { String methodName = "updateRole"; assertContext(CLS_NM, methodName, role, GlobalErrIds.ARLE_NULL); setEntitySession(CLS_NM, methodName, role); AdminRole re = admRP.update(role); // search for all users assigned this role and update: List<User> users = userP.getAssignedUsers(role); if(CollectionUtils.isNotEmpty( users )) { final AdminMgr aMgr = AdminMgrFactory.createInstance(this.contextId); for (User ue : users) { User upUe = new User(ue.getUserId()); setAdminData(CLS_NM, methodName, upUe); List<UserAdminRole> uaRoles = ue.getAdminRoles(); UserAdminRole chgRole = new UserAdminRole(); chgRole.setName(role.getName()); chgRole.setUserId(ue.getUserId()); chgRole.setOsPSet( role.getOsPSet() ); chgRole.setOsUSet( role.getOsUSet() ); uaRoles.remove(chgRole); ConstraintUtil.copy( re, chgRole ); uaRoles.add(chgRole); upUe.setUserId(ue.getUserId()); upUe.setAdminRole(chgRole); aMgr.updateUser(upUe); } } return re; }
Example #26
Source File: NodeServiceImpl.java From DDMQ with Apache License 2.0 | 5 votes |
private Long create(Node node) throws Exception { Cluster cluster = clusterService.findById(node.getClusterId()); if (cluster == null) { throw new RuntimeException("cluster not found"); } if (CollectionUtils.isNotEmpty(findByCondition(node))) { throw new RuntimeException("node existed"); } nodeMapper.insertSelective(node); updateV4Zk(node, cluster); return node.getId(); }
Example #27
Source File: SqoopClient.java From ranger with Apache License 2.0 | 5 votes |
public List<String> getConnectorList(final String connectorMatching, final List<String> existingConnectors) { if (LOG.isDebugEnabled()) { LOG.debug("Get sqoop connector list for connectorMatching: " + connectorMatching + ", existingConnectors: " + existingConnectors); } Subject subj = getLoginSubject(); if (subj == null) { return Collections.emptyList(); } List<String> ret = Subject.doAs(subj, new PrivilegedAction<List<String>>() { @Override public List<String> run() { ClientResponse response = getClientResponse(sqoopUrl, SQOOP_CONNECTOR_API_ENDPOINT, userName); SqoopConnectorsResponse sqoopConnectorsResponse = getSqoopResourceResponse(response, SqoopConnectorsResponse.class); if (sqoopConnectorsResponse == null || CollectionUtils.isEmpty(sqoopConnectorsResponse.getConnectors())) { return Collections.emptyList(); } List<String> connectorResponses = new ArrayList<>(); for (SqoopConnectorResponse sqoopConnectorResponse : sqoopConnectorsResponse.getConnectors()) { connectorResponses.add(sqoopConnectorResponse.getName()); } List<String> connectors = null; if (CollectionUtils.isNotEmpty(connectorResponses)) { connectors = filterResourceFromResponse(connectorMatching, existingConnectors, connectorResponses); } return connectors; } }); if (LOG.isDebugEnabled()) { LOG.debug("Get sqoop connector list result: " + ret); } return ret; }
Example #28
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 #29
Source File: HbaseApplicationIndexDao.java From pinpoint with Apache License 2.0 | 5 votes |
@Override public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) { if (MapUtils.isEmpty(applicationAgentIdMap)) { return; } List<Delete> deletes = new ArrayList<>(applicationAgentIdMap.size()); for (Map.Entry<String, List<String>> entry : applicationAgentIdMap.entrySet()) { String applicationName = entry.getKey(); List<String> agentIds = entry.getValue(); if (StringUtils.isEmpty(applicationName) || CollectionUtils.isEmpty(agentIds)) { continue; } Delete delete = new Delete(Bytes.toBytes(applicationName)); for (String agentId : agentIds) { if (!StringUtils.isEmpty(agentId)) { delete.addColumns(descriptor.getColumnFamilyName(), Bytes.toBytes(agentId)); } } // don't delete if nothing has been specified except row if (!delete.getFamilyCellMap().isEmpty()) { deletes.add(delete); } } TableName applicationIndexTableName = descriptor.getTableName(); hbaseOperations2.delete(applicationIndexTableName, deletes); }
Example #30
Source File: AbstractCsvReader.java From the-app with Apache License 2.0 | 5 votes |
protected CsvToBean<T> getParser() { return new CsvToBean<T>() { @Override protected PropertyEditor getPropertyEditor(final PropertyDescriptor desc) throws InstantiationException, IllegalAccessException { if (getDestinationClass().isAssignableFrom(User.class) && "categories".equalsIgnoreCase( desc.getDisplayName())) { return new DummyPropertyEditor() { @Override public Object getValue() { if (StringUtils.isBlank(getAsText())) { return null; } Set<String> result = new HashSet<>(); CollectionUtils.addAll(result, StringUtils.split(getAsText(), ",")); return result; } }; } final Class<?> enumCandidate = desc.getWriteMethod().getParameterTypes()[0]; if (enumCandidate.isEnum()) { return new DummyPropertyEditor() { @Override public Object getValue() { try { Method valueOfMethod = enumCandidate.getMethod("valueOf", String.class); return valueOfMethod.invoke(null, getAsText()); } catch (Exception e) { throw new RuntimeException("Unable to parse enum " + enumCandidate + " from csv value " + getAsText()); } } }; } return super.getPropertyEditor(desc); } }; }