List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:edu.cornell.mannlib.vitro.webapp.utils.ApplicationConfigurationOntologyUtils.java
public static List<ObjectProperty> getAdditionalFauxSubpropertiesForList(List<ObjectProperty> propList, Individual subject, Model displayModel, Model tboxModel) { List<ObjectProperty> additionalProps = new ArrayList<ObjectProperty>(); Model union = ModelFactory.createUnion(displayModel, tboxModel); for (ObjectProperty op : propList) { additionalProps.addAll(getAdditionalFauxSubproperties(op, subject, tboxModel, union)); }//from w w w . j a v a2 s .co m return additionalProps; }
From source file:Main.java
/** * Recursively fetches all nodes of specified ns. For multi ns documents * * @param node the starting node./*from www. jav a 2 s.c o m*/ * @param namespace desired ns */ private static List<Node> getAllNodesByNamespaceRecursive(Node node, String namespace) { List nsNodeList = new ArrayList(); if (node.getNamespaceURI() != null && node.getNamespaceURI().equals(namespace)) { nsNodeList.add(node); } NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); ++i) { nsNodeList.addAll(getAllNodesByNamespaceRecursive(list.item(i), namespace)); } return nsNodeList; }
From source file:com.omertron.slackbot.functions.Meetup.java
/** * Retrieve and process the MeetUps from the site. * * @param pageSize/*from w w w . j av a2s .com*/ * @throws ApiException */ public static void readMeetUp(int pageSize) throws ApiException { MEETUPS.clear(); if (StringUtils.isBlank(BASE_URL)) { throw new ApiException(ApiExceptionType.INVALID_URL, "Meetup URL is not set in the properties file! Use the property " + Constants.MEETUP_URL); } try { URL url = HttpTools.createUrl(BASE_URL + pageSize); List<MeetupDetails> meetups = MAPPER.readValue(url, new TypeReference<List<MeetupDetails>>() { }); MEETUPS.addAll(meetups); } catch (IOException ex) { LOG.warn("Failed to read MeetUp data: {}", ex.getMessage(), ex); return; } catch (ApiException ex) { LOG.warn("Failed to convert URL: {}", ex.getMessage(), ex); return; } LOG.info("Processed {} MeetUp events", MEETUPS.size()); }
From source file:cn.guoyukun.spring.jpa.entity.search.utils.SearchableConvertUtils.java
private static void convert(BeanWrapperImpl beanWrapper, Condition condition) { String searchProperty = condition.getSearchProperty(); //??//from www .j a va2 s .co m if (condition.getOperator() == SearchOperator.custom) { return; } //??? if (condition.isUnaryFilter()) { return; } String entityProperty = condition.getEntityProperty(); Object value = condition.getValue(); Object newValue = null; boolean isCollection = value instanceof Collection; boolean isArray = value != null && value.getClass().isArray(); if (isCollection || isArray) { List<Object> list = Lists.newArrayList(); if (isCollection) { list.addAll((Collection) value); } else { list = Lists.newArrayList(CollectionUtils.arrayToList(value)); } int length = list.size(); for (int i = 0; i < length; i++) { list.set(i, getConvertedValue(beanWrapper, searchProperty, entityProperty, list.get(i))); } newValue = list; } else { newValue = getConvertedValue(beanWrapper, searchProperty, entityProperty, value); } condition.setValue(newValue); }
From source file:com.cuubez.visualizer.util.CuubezUtil.java
public static List<HttpCodeMetaData> getHttpCodes(List<HttpCodeMetaData> rootHttpCodes, List<HttpCodeMetaData> subResourceHttpCodes) { if ((subResourceHttpCodes != null && subResourceHttpCodes.size() > 0) && (rootHttpCodes != null && rootHttpCodes.size() > 0)) { List<HttpCodeMetaData> httReasonCodeList = new ArrayList<HttpCodeMetaData>(); httReasonCodeList.addAll(rootHttpCodes); httReasonCodeList.addAll(subResourceHttpCodes); return httReasonCodeList; }/*from w ww . j a v a 2 s . c o m*/ if (subResourceHttpCodes != null && subResourceHttpCodes.size() > 0) { return subResourceHttpCodes; } if ((subResourceHttpCodes == null || subResourceHttpCodes.size() == 0) && (rootHttpCodes != null && rootHttpCodes.size() > 0)) { return rootHttpCodes; } return null; }
From source file:com.citytechinc.cq.component.touchuidialog.util.TouchUIDialogUtil.java
public static List<TouchUIWidgetMakerParameters> getWidgetMakerParametersForComponentClass( CtClass componentClass, ClassLoader classLoader, ClassPool classPool, TouchUIWidgetRegistry widgetRegistry) throws NotFoundException, ClassNotFoundException, InvalidComponentClassException { List<TouchUIWidgetMakerParameters> widgetMakerParametersList = new ArrayList<TouchUIWidgetMakerParameters>(); List<CtMember> fieldsAndMethods = new ArrayList<CtMember>(); fieldsAndMethods.addAll(ComponentMojoUtil.collectFields(componentClass)); fieldsAndMethods.addAll(ComponentMojoUtil.collectMethods(componentClass)); // Load the true class Class<?> trueComponentClass = classLoader.loadClass(componentClass.getName()); // Iterate through all the fields creating configs for each and // preparing the necessary widget maker parameters for (CtMember member : fieldsAndMethods) { if (!member.hasAnnotation(IgnoreDialogField.class)) { DialogFieldConfig dialogFieldConfig = null; if (member instanceof CtMethod) { dialogFieldConfig = DialogUtil.getDialogFieldFromSuperClasses((CtMethod) member); } else { if (member.hasAnnotation(DialogField.class)) { dialogFieldConfig = new DialogFieldConfig( (DialogField) member.getAnnotation(DialogField.class), member); }/*from w ww. j a v a 2 s . com*/ } if (dialogFieldConfig != null && !dialogFieldConfig.isSuppressTouchUI()) { TouchUIWidgetMakerParameters touchUIWidgetMakerParameters = new TouchUIWidgetMakerParameters(); touchUIWidgetMakerParameters.setClassLoader(classLoader); touchUIWidgetMakerParameters.setContainingClass(trueComponentClass); touchUIWidgetMakerParameters.setDialogFieldConfig(dialogFieldConfig); touchUIWidgetMakerParameters.setClassPool(classPool); touchUIWidgetMakerParameters.setUseDotSlashInName(true); touchUIWidgetMakerParameters.setWidgetRegistry(widgetRegistry); widgetMakerParametersList.add(touchUIWidgetMakerParameters); } } } return widgetMakerParametersList; }
From source file:com.qmetry.qaf.automation.step.JavaStepFinder.java
public static Map<String, TestStep> getAllJavaSteps() { Map<String, TestStep> stepMapping = new HashMap<String, TestStep>(); Set<Method> steps = new LinkedHashSet<Method>(); List<String> pkgs = new ArrayList<String>(); pkgs.add(STEPS_PACKAGE);/*from w w w . j a v a2s . c o m*/ if (getBundle().containsKey(STEP_PROVIDER_PKG.key)) { pkgs.addAll(Arrays.asList(getBundle().getStringArray(STEP_PROVIDER_PKG.key))); } for (String pkg : pkgs) { logger.info("pkg: " + pkg); try { List<Class<?>> classes = CLASS_FINDER.getClasses(pkg); steps.addAll(getAllMethodsWithAnnotation(classes, QAFTestStep.class)); } catch (Exception e) { System.err.println("Unable to load steps for package: " + pkg); } } for (Method step : steps) { if (!Modifier.isPrivate(step.getModifiers())) { // exclude private methods. // Case: step provided using QAFTestStepProvider at class level add(stepMapping, new JavaStep(step)); } } return stepMapping; }
From source file:cz.lbenda.common.ClassLoaderHelper.java
private static List<File> subClasses(File file) { if (file != null) { if (file.isDirectory()) { List<File> result = new ArrayList<>(); //noinspection ConstantConditions for (File f : file.listFiles()) { result.addAll(subClasses(f)); }//from ww w.ja va 2 s .c o m return result; } else { if (file.getName().endsWith(".class")) { //noinspection ArraysAsListWithZeroOrOneArgument return Arrays.asList(file); } } } return Collections.emptyList(); }
From source file:Main.java
/** * Returns all fields declared in the class passed as argument or in its super classes. *//*from w ww .j a v a 2 s .c om*/ public static List<Field> getAllDeclaredField(Class<?> clazz, boolean includeSuperClass) { final List<Field> result = new LinkedList<Field>(); for (final Field field : clazz.getDeclaredFields()) { result.add(field); } final Class<?> superClass = clazz.getSuperclass(); if (superClass != null && includeSuperClass) { result.addAll(getAllDeclaredField(superClass, true)); } return result; }
From source file:com.aurel.track.exchange.docx.exporter.DocxExportBL.java
public static ReportBeans getReportBeansForDocument(TWorkItemBean workItemBean, TPersonBean personBean, Locale locale, boolean includeSections) { if (workItemBean == null) { LOGGER.warn("Item not found"); return new ReportBeans(new LinkedList<ReportBean>(), locale); }/* w w w . j a v a 2 s.c om*/ Integer workItemID = workItemBean.getObjectID(); FilterUpperTO filterUpperTO = new FilterUpperTO(); if (workItemBean != null) { filterUpperTO.setSelectedProjects(new Integer[] { workItemBean.getProjectID() }); } filterUpperTO.setLinkTypeFilterSuperset( MergeUtil.mergeKey(ILinkType.PARENT_CHILD, PARENT_CHILD_EXPRESSION.ALL_NOT_CLOSED_CHILDREN)); List<FieldExpressionSimpleTO> fieldExpressionSimpleList = new ArrayList<FieldExpressionSimpleTO>(1); FieldExpressionSimpleTO fieldExpressionSimpleTO = new FieldExpressionSimpleTO(); fieldExpressionSimpleTO.setField(SystemFields.INTEGER_SUPERIORWORKITEM); fieldExpressionSimpleTO.setSelectedMatcher(MatchRelations.EQUAL); fieldExpressionSimpleTO.setValue(workItemID); fieldExpressionSimpleList.add(fieldExpressionSimpleTO); filterUpperTO.setFieldExpressionSimpleList(fieldExpressionSimpleList); List<TListTypeBean> documentIssueTypes = IssueTypeBL.loadByTypeFlag(TListTypeBean.TYPEFLAGS.DOCUMENT); List<TListTypeBean> issueTypes = new ArrayList<TListTypeBean>(); issueTypes.addAll(documentIssueTypes); if (includeSections) { List<TListTypeBean> documentSectionsIssueTypes = IssueTypeBL .loadByTypeFlag(TListTypeBean.TYPEFLAGS.DOCUMENT_SECTION); issueTypes.addAll(documentSectionsIssueTypes); } else { List<TListTypeBean> folderIssueTypes = IssueTypeBL .loadByTypeFlag(TListTypeBean.TYPEFLAGS.DOCUMENT_FOLDER); issueTypes.addAll(folderIssueTypes); filterUpperTO.setItemTypeIDsForLinkType(GeneralUtils.createIntegerListFromBeanList(issueTypes)); } filterUpperTO.setSelectedIssueTypes(GeneralUtils .createIntegerArrFromCollection(GeneralUtils.createIntegerListFromBeanList(issueTypes))); List<ReportBean> reportBeanList = null; try { reportBeanList = LoadTreeFilterItems.getTreeFilterReportBeans(filterUpperTO, null, null, false, personBean, locale, true, true, false, false, false, false, false, true, false); } catch (TooManyItemsToLoadException e) { LOGGER.info("Number of items to load " + e.getItemCount()); } return new ReportBeans(reportBeanList, locale); }