Java Code Examples for java.util.List

The following are top voted examples for showing how to use java.util.List. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: dubbox-hystrix   File: ConsumerServiceImpl.java   View source code 58 votes vote down vote up
public List<String> findAddressesByApplication(String application) {
    List<String> ret = new ArrayList<String>();
    ConcurrentMap<String, Map<Long, URL>> consumerUrls = getRegistryCache().get(Constants.CONSUMERS_CATEGORY);
    if(consumerUrls == null) return ret;
    
    for(Map.Entry<String, Map<Long, URL>> e1 : consumerUrls.entrySet()) {
        Map<Long, URL> value = e1.getValue();
        for(Map.Entry<Long, URL> e2 : value.entrySet()) {
            URL u = e2.getValue();
            if(application.equals(u.getParameter(Constants.APPLICATION_KEY))) {
                String addr = u.getAddress();
                if(addr != null) ret.add(addr);
            }
        }
    }
    
    return ret;
}
 
Example 2
Project: Proyecto-DASI   File: InventoryCommandsImplementation.java   View source code 14 votes vote down vote up
private boolean getParameters(String parameter, List<Integer> parsedParams)
{
    String[] params = parameter.split(" ");
    if (params.length != 2)
    {
        System.out.println("Malformed parameter string (" + parameter + ") - expected <x> <y>");
        return false;   // Error - incorrect number of parameters.
    }
    Integer lhs, rhs;
    try
    {
        lhs = Integer.valueOf(params[0]);
        rhs = Integer.valueOf(params[1]);
    }
    catch (NumberFormatException e)
    {
        System.out.println("Malformed parameter string (" + parameter + ") - " + e.getMessage());
        return false;
    }
    if (lhs == null || rhs == null)
    {
        System.out.println("Malformed parameter string (" + parameter + ")");
        return false;   // Error - incorrect parameters.
    }
    InventoryPlayer inv = Minecraft.getMinecraft().thePlayer.inventory;
    if (lhs < 0 || lhs >= inv.getSizeInventory() || rhs < 0 || rhs >= inv.getSizeInventory())
    {
        System.out.println("Inventory swap parameters out of bounds - must be between 0 and " + (inv.getSizeInventory() - 1));
        return false;   // Out of bounds.
    }
    parsedParams.add(lhs);
    parsedParams.add(rhs);
    return true;
}
 
Example 3
Project: incubator-netbeans   File: MemoryFileManager.java   View source code 11 votes vote down vote up
public List<JavaFileObject> list(Location location, String packageName, Set<Kind> kinds, boolean recurse) throws IOException {
    if (recurse) {
        throw new UnsupportedEncodingException();
    }
    final List<JavaFileObject> result = new LinkedList<JavaFileObject> ();        
    if (location == StandardLocation.SOURCE_PATH) {
        final List<Integer> pkglst = packages.get(packageName);
        if (pkglst != null) {
            for (Integer foid : pkglst) {
                InferableJavaFileObject jfo = content.get(foid);
                assert jfo != null;
                if (kinds.contains(jfo.getKind())) {
                    result.add(jfo);
                }
            }
        }
    }
    return result;
}
 
Example 4
Project: DicomViewer   File: SortedListTools.java   View source code 6 votes vote down vote up
public static Integer idOfClosest(final List<DateTime> list, final DateTime key, final int low, final int high) {
    // Cas particuliers
    if (list == null || list.isEmpty() || key == null || low > high) {
        return null;
    }
    // Evacuation des cas où la valeur serait hors de l'intervalle -----------
    if (list.size() == 1) {
        return 0;
    }
    if (list.get(low).getMillis() >= key.getMillis()) {
        return low;
    }
    if (list.get(high).getMillis() <= key.getMillis()) {
        return high;
    }

    int idx = binarySearch(list, key, low, high);
    if (idx < 0) {
        idx = -(idx) - 1;
        if (idx != 0 && idx < list.size()) {
            return (key.getMillis()  - list.get(idx - 1).getMillis()  <= list.get(idx).getMillis() - key.getMillis() ) ? idx - 1 : idx;
        }
        return null;
    }
    return idx;
}
 
Example 5
Project: empiria.player   File: ExpressionToResponseConnectorJUnitTest.java   View source code 6 votes vote down vote up
@Test
public void shouldConnectOnlyResponsesRelatedToExpression() throws Exception {
    // given
    String template = "template";
    ExpressionBean expressionBean = new ExpressionBean();
    expressionBean.setTemplate(template);

    Response relatedResponse = Mockito.mock(Response.class);
    Response unrelatedResponse = Mockito.mock(Response.class);

    when(itemResponseManager.getVariable("relatedResponse")).thenReturn(relatedResponse);
    when(itemResponseManager.getVariable("unrelatedResponse")).thenReturn(unrelatedResponse);

    when(identifiersFromExpressionExtractor.extractResponseIdentifiersFromTemplate(template)).thenReturn(
            Lists.newArrayList("relatedResponse", "notExistingId"));

    // when
    expressionToResponseConnector.connectResponsesToExpression(expressionBean, itemResponseManager);

    // then
    verify(identifiersFromExpressionExtractor).extractResponseIdentifiersFromTemplate(template);
    verify(relatedResponse).setExpression(expressionBean);
    List<Response> connectedResponses = expressionBean.getResponses();
    assertEquals(1, connectedResponses.size());
    assertEquals(relatedResponse, connectedResponses.get(0));
}
 
Example 6
Project: Java-9-Cookbook   File: Chapter07Concurrency02.java   View source code 6 votes vote down vote up
private static void demoListIterRemove(List<String> list) {
    System.out.println("list: " + list);
    try {
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            String e = (String) iter.next();
            System.out.println(e);
            if ("Two".equals(e)) {
                System.out.println("Calling iter.remove()...");
                iter.remove();
            }
        }
    } catch (Exception ex) {
        System.out.println(ex.getClass().getName());
    }
    System.out.println("list: " + list);
}
 
Example 7
Project: Homework   File: HOMEWORK.java   View source code 6 votes vote down vote up
public List<Emp> getEmpList() throws SQLException
{
	
	List<Emp> empList = new ArrayList<>();
	DBHelper db = DBHelper.getInstance();
	Connection conn = db.getConnection();
	ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM emp");

	Emp emp = null;
	while(rs.next())
	{
		int empno = rs.getInt("empno");
		String name = rs.getString(2);
		String job = rs.getString(3);
		int mgr = rs.getInt(4);
		String hiredate = rs.getString(5);
		double sal = rs.getDouble(6);
		double comm = rs.getDouble(7);
		int deptno = rs.getInt("deptno");
		empList.add(new Emp(empno, name, job, mgr, hiredate, sal, comm, deptno));
	}	
	db.closeConnection(conn);
	return empList;
}
 
Example 8
Project: yadaframework   File: YadaConfiguration.java   View source code 6 votes vote down vote up
/**
 * Ritorna la lista di YadaClause trovate nella configurazione
 */
public List<YadaClause> getSetupClauses() {
	List<YadaClause> result = new ArrayList<YadaClause>();
	for (ImmutableHierarchicalConfiguration sub : configuration.immutableConfigurationsAt("config/setup/clauses")) {
		for (Iterator<String> names = sub.getKeys(); names.hasNext();) {
			String name = names.next();
			String content = sub.getString(name);
			YadaClause clause = new YadaClause();
			clause.setName(name);
			clause.setContent(content.trim().replaceAll("\\s+", " ")); // Collasso gli spazi multipli in spazio singolo
			clause.setClauseVersion(1);
			result.add(clause);
		}
	}
	return result;
}
 
Example 9
Project: QueryHighlighter   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
protected FilterResults performFiltering(CharSequence constraint) {
    final List<String> list;

    if (TextUtils.isEmpty(constraint)) {
        list = mItems;
    } else {
        list = new ArrayList<>();
        final String normalizedConstraint = Normalizer.forSearch(constraint);
        for (String item : mItems) {
            final String normalizedItem = Normalizer.forSearch(item);
            if (normalizedItem.startsWith(normalizedConstraint) || //
                    normalizedItem.contains(" " + normalizedConstraint)) {
                list.add(item);
            }
        }
    }

    final FilterResults results = new FilterResults();
    results.values = list;
    results.count = list.size();
    return results;
}
 
Example 10
Project: emufog   File: BriteFormatReader.java   View source code 6 votes vote down vote up
@Override
public Graph readGraph(List<Path> files) throws IOException, IllegalArgumentException {
    if (files == null || files.isEmpty()) {
        throw new IllegalArgumentException("No files given to read in.");
    }
    Graph graph = new Graph(settings);

    BufferedReader reader = new BufferedReader(new FileReader(files.get(0).toFile()));

    String currentLine = reader.readLine();
    while (currentLine != null) {
        // read in the nodes of the graph
        if (currentLine.startsWith("Nodes:")) {
            extractNodes(graph, reader);
        }

        // read in the edges of the graph
        if (currentLine.startsWith("Edges:")) {
            extractEdges(graph, reader);
        }

        currentLine = reader.readLine();
    }

    return graph;
}
 
Example 11
Project: kafka-0.11.0.0-src-with-comment   File: ConnectorsResourceTest.java   View source code 6 votes vote down vote up
@Test
public void testRestartConnectorLeaderRedirect() throws Throwable {
    final Capture<Callback<Void>> cb = Capture.newInstance();
    herder.restartConnector(EasyMock.eq(CONNECTOR_NAME), EasyMock.capture(cb));
    expectAndCallbackNotLeaderException(cb);

    EasyMock.expect(RestServer.httpRequest(EasyMock.eq("http://leader:8083/connectors/" + CONNECTOR_NAME + "/restart?forward=true"),
            EasyMock.eq("POST"), EasyMock.isNull(), EasyMock.<TypeReference>anyObject()))
            .andReturn(new RestServer.HttpResponse<>(202, new HashMap<String, List<String>>(), null));

    PowerMock.replayAll();

    connectorsResource.restartConnector(CONNECTOR_NAME, null);

    PowerMock.verifyAll();
}
 
Example 12
Project: metanome-algorithms   File: FDminimizerShadowedFDFixture.java   View source code 5 votes vote down vote up
public List<ColumnCombinationBitset> getUCCList() {
    List<ColumnCombinationBitset> uccList = new LinkedList<>();
    uccList.add(new ColumnCombinationBitset(0));
    uccList.add(new ColumnCombinationBitset(1));
    uccList.add(new ColumnCombinationBitset(2, 3, 5));
    uccList.add(new ColumnCombinationBitset(2, 4, 5));
    uccList.add(new ColumnCombinationBitset(5, 7));
    return uccList;
}
 
Example 13
Project: OperatieBRP   File: ExistentieleFunctieSignatuur.java   View source code 5 votes vote down vote up
@Override
public boolean test(final List<Expressie> argumenten, final Context context) {
    boolean match = false;
    if (argumenten != null && argumenten.size() == AANTAL_ARGUMENTEN) {
        match = argumenten.get(1).isVariabele();
    }
    return match;
}
 
Example 14
Project: buenojo   File: CourseLevelSessionResource.java   View source code 5 votes vote down vote up
/**
 * GET  /courseLevelSessions -> get all the courseLevelSessions.
 */
@RequestMapping(value = "/courseLevelSessions",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public List<CourseLevelSession> getAllCourseLevelSessions() {
    log.debug("REST request to get all CourseLevelSessions");
    return courseLevelSessionRepository.findAll();
}
 
Example 15
Project: live_master   File: DanmakuFilters.java   View source code 5 votes vote down vote up
@Override
public void setData(List<T> data) {
    reset();
    if (data != null) {
        for (T i : data) {
            addToBlackList(i);
        }
    }
}
 
Example 16
Project: Selenium-Foundation   File: TableComponent.java   View source code 5 votes vote down vote up
public int[] getBodyRefreshCounts() {
    List<TableRowComponent> tableRows = getTableRows();
    int[] counts = new int[tableRows.size()];
    for (int i = 0; i < tableRows.size(); i++) {
        counts[i] = tableRows.get(i).getRefreshCount();
    }
    return counts;
}
 
Example 17
Project: jaffa-framework   File: TransformationHandler.java   View source code 5 votes vote down vote up
/**
 * Adds a new handler to the end of the list of all handlers.
 */
public void appendTransformationHandlers(List<ITransformationHandler> handlers) {
    for (ITransformationHandler handler : handlers) {
        handler.setTargetBean(this);
        transformationHandlers.add(handler);
    }
}
 
Example 18
Project: batch-scheduler   File: DomainServiecImpl.java   View source code 5 votes vote down vote up
@Override
public DomainDto findAll(String domainId) {
    List<DomainEntity> list = domainDao.findAll();
    Set<String> set = shareDomainDaoo.findShareDomain(domainId);
    for (int i = 0; i < list.size(); i++) {
        if (!set.contains(list.get(i).getDomainId())) {
            list.remove(i);
            i--;
        }
    }
    DomainDto domainDto = new DomainDto();
    domainDto.setDomainId(domainId);
    domainDto.setOwnerList(list);
    return domainDto;
}
 
Example 19
Project: Nird2   File: BlogManagerImpl.java   View source code 5 votes vote down vote up
@Override
public Collection<Blog> getBlogs(LocalAuthor localAuthor)
		throws DbException {

	Collection<Blog> allBlogs = getBlogs();
	List<Blog> blogs = new ArrayList<Blog>();
	for (Blog b : allBlogs) {
		if (b.getAuthor().equals(localAuthor)) {
			blogs.add(b);
		}
	}
	return blogs;
}
 
Example 20
Project: avro-schema-editor   File: SchemaUtil.java   View source code 5 votes vote down vote up
public static boolean isMultiChoiceUnion(Schema unionSchema) {
	List<Schema> unionTypes = unionSchema.getTypes();
	int nbrOfNoNullChild = 0;
	for (Schema unionType : unionTypes) {
		if (unionType.getType() != Type.NULL) {
			nbrOfNoNullChild++;
		}
	}
	return nbrOfNoNullChild > 1;
}
 
Example 21
Project: alfresco-repository   File: AlfrescoEnviroment.java   View source code 5 votes vote down vote up
@Override
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern,
            QNamePattern qnamePattern, int maxResults, boolean preload) throws InvalidNodeRefException
{
    NodeService nodeService = apiFacet.getNodeService();
    return nodeService.getChildAssocs(nodeRef,
                                      typeQNamePattern,
                                      qnamePattern,
                                      maxResults,
                                      preload);
}
 
Example 22
Project: jmeter-bzm-plugins   File: BlazeMeterBackendListenerClient.java   View source code 5 votes vote down vote up
@Override
public void handleSampleResults(List<SampleResult> list, BackendListenerContext backendListenerContext) {
    if (isInterruptedThroughUI) {
        return;
    }

    accumulator.addAll(list);
    JSONObject data = JSONConverter.convertToJSON(accumulator, list);

    int counter = 0;
    while (!apiClient.isTestStarted() && counter < 3) {
        log.debug("Waiting for test starting");
        makeDelay();
        counter++;
    }

    try {
        apiClient.sendOnlineData(data);
    } catch (JMeterStopTestException ex) {
        isInterruptedThroughUI = true;
        StandardJMeterEngine.stopEngineNow();
    } catch (IOException e) {
        log.warn("Failed to send data: " + data, e);
    }

    makeDelay();
}
 
Example 23
Project: alipay-sdk   File: AlipaySignature.java   View source code 5 votes vote down vote up
/**
 * 
 * @param sortedParams
 * @return
 */
public static String getSignContent(Map<String, String> sortedParams) {
    StringBuffer content = new StringBuffer();
    List<String> keys = new ArrayList<String>(sortedParams.keySet());
    Collections.sort(keys);
    int index = 0;
    for (int i = 0; i < keys.size(); i++) {
        String key = keys.get(i);
        String value = sortedParams.get(key);
        if (StringUtils.areNotEmpty(key, value)) {
            content.append((index == 0 ? "" : "&") + key + "=" + value);
            index++;
        }
    }
    return content.toString();
}
 
Example 24
Project: weex-uikit   File: WXTextDomObject.java   View source code 5 votes vote down vote up
protected void updateSpannable(Spannable spannable, int spanFlag) {
  List<SetSpanOperation> ops = createSetSpanOperation(spannable.length(), spanFlag);
  if (mFontSize == UNSET) {
    ops.add(new SetSpanOperation(0, spannable.length(),
                                 new AbsoluteSizeSpan(WXText.sDEFAULT_SIZE), spanFlag));
  }
  Collections.reverse(ops);
  for (SetSpanOperation op : ops) {
    op.execute(spannable);
  }
}
 
Example 25
Project: otter-G   File: DatabaseExtractor.java   View source code 5 votes vote down vote up
private List<String> select(DbDialect dbDialect, String schemaName, String tableName, TableData keyTableData,
                            TableData columnTableData) throws InterruptedException {
    String selectSql = dbDialect.getSqlTemplate().getSelectSql(schemaName,
        tableName,
        keyTableData.columnNames,
        columnTableData.columnNames);
    Exception exception = null;
    for (int i = 0; i < retryTimes; i++) {
        if (Thread.currentThread().isInterrupted()) {
            throw new InterruptedException(); // 退出
        }

        try {
            List<List<String>> result = dbDialect.getJdbcTemplate().query(selectSql,
                keyTableData.columnValues,
                keyTableData.columnTypes,
                new RowDataMapper(columnTableData.columnTypes));
            if (CollectionUtils.isEmpty(result)) {
                logger.warn("the mediaName = {}.{} not has rowdate in db \n {}", new Object[] { schemaName,
                        tableName, dumpEventData(eventData, selectSql) });
                return null;
            } else {
                return result.get(0);
            }

        } catch (Exception e) {
            exception = e;
            logger.warn("retry [" + (i + 1) + "] failed", e);
        }
    }

    throw new RuntimeException("db extract failed , data:\n " + dumpEventData(eventData, selectSql), exception);
}
 
Example 26
Project: Mod-Tools   File: FileSystemParserTest.java   View source code 5 votes vote down vote up
/**
 * Test of handle method, of class FileSystemParser.
 */
@Test
public void testHandle() {
    System.out.println("handle");
    try {
        EntityManager manager = new PersistenceProvider().get();
        if(!manager.getTransaction().isActive()) {
            manager.getTransaction().begin();
        }
        manager.persist(new Modification("FileSystemParserTest.mod",32));
        manager.getTransaction().commit();
        new File(getAllowedFolder()+"/commons").mkdirs();
        IOUtils.copy(getClass().getResourceAsStream("/test.txt"), FileUtils.openOutputStream(new File(getAllowedFolder()+"/commons/test.txt")));
        List <ProcessTask> result = get().handle(manager);
        Assert.assertTrue(
            "result is not of correct type",
            result instanceof List<?>
        );
        Assert.assertEquals(
            "Unexpected follow-ups",
            0,
            result.size()
        );
    } catch(Exception ex) {
        Assert.fail(ex.getMessage());
    }
}
 
Example 27
Project: featurea   File: FontCreator.java   View source code 5 votes vote down vote up
public void createFont(final File fntFile, final String name, final int size, final boolean isBold, final boolean isItalic) {
    final JFrame frame = new JFrame() {{
        pack();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // IMPORTANT
    }};
    frame.getContentPane().add(new MyLwjglCanvas(new ApplicationAdapter() {
        private final UnicodeFont unicodeFont = new UnicodeFont(Font.decode(name), size, isBold, isItalic);

        @Override
        public void create() {
            unicodeFont.setMono(false);
            unicodeFont.setPaddingTop(PADDING);
            unicodeFont.setPaddingRight(PADDING);
            unicodeFont.setPaddingBottom(PADDING);
            unicodeFont.setPaddingLeft(PADDING);
            unicodeFont.setPaddingAdvanceX(-2 * PADDING);
            unicodeFont.setPaddingAdvanceY(-2 * PADDING);
            unicodeFont.setGlyphPageWidth(1024);
            unicodeFont.setGlyphPageHeight(512);
            unicodeFont.setRenderType(UnicodeFont.RenderType.Java);
            List effects = unicodeFont.getEffects();
            effects.add(new ColorEffect(Color.white));
            unicodeFont.addGlyphs(CHARACTERS);
            try {
                FileUtil.createNewFile(fntFile);
                new BMFontUtil(unicodeFont).save(fntFile);
            } catch (Throwable ex) {
                ex.printStackTrace();
            }
            if ("studio".equals(System.getProperty("featurea.launcher"))) {
                frame.dispose();
            } else {
                frame.setVisible(false);
            }
        }
    }).getCanvas());
}
 
Example 28
Project: BittrexJavaWrapper   File: PublicAPITests.java   View source code 5 votes vote down vote up
@Test
public void testGetOrderBookSellOnlyQuery() {
    String url = "https://bittrex.com/api/v1.1/public/getorderbook?market=BTC-ETH&type=sell";
    String response = Bittrex.getJSONFromBittrex(url);

    GetOrderBookSellOnlyContainer getOrderBookSellOnlyContainer = gson.fromJson(response, GetOrderBookSellOnlyContainer.class);
    Assert.assertNotNull(objNullMsg("GetOrderBookSellOnlyContainer"), getOrderBookSellOnlyContainer);
    Assert.assertTrue(falseFlagMsg("GetOrderBookSellOnlyContainer"), getOrderBookSellOnlyContainer.getSuccess());

    List<OrderBookEntry> sell = getOrderBookSellOnlyContainer.getSell();
    Assert.assertNotNull("List of Sell Orders", sell);
    Assert.assertTrue("Size of sell should be > 0", sell.size() > 0);
    Assert.assertTrue("Amount of quantity on a sell order should be > 0", sell.get(0).getQuantity() > 0);
}
 
Example 29
Project: Remindy   File: RemindyDAO.java   View source code 5 votes vote down vote up
/**
 * Inserts a List of Attachments associated to an Task, into the database.
 * @param taskId The id of the Task associated to the Attachments
 * @param attachments The List of Attachments to be inserted
 */
public long[] insertAttachmentsOfTask(int taskId, List<Attachment> attachments) throws CouldNotInsertDataException {
    SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
    long[] newRowIds = new long[attachments.size()];

    for (int i = 0; i < attachments.size(); i++) {

        Attachment attachment = attachments.get(i);
        attachment.setTaskId(taskId);
        ContentValues values = getValuesFromAttachment(attachment);

        newRowIds[i] = db.insert(RemindyContract.AttachmentTable.TABLE_NAME, null, values);

        if (newRowIds[i] == -1)
            throw new CouldNotInsertDataException("There was a problem inserting the Attachment: " + attachments.toString());
    }

    return newRowIds;
}
 
Example 30
Project: shareNote   File: ReadArticleActivity.java   View source code 5 votes vote down vote up
@Override
    protected void onListener() {
        super.onListener();
        rvComments.addOnItemTouchListener(new OnItemChildClickListener() {

            @Override
            public void SimpleOnItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
                switch (view.getId()) {
                    case R.id.btnReply:
                        List<MultiItemEntity> res = baseQuickAdapter.getData();
                        CommentFill commentFill = (CommentFill) res.get(i);
                        Comment comment = commentFill.getComment();
                        clickReply(comment.getUser(), comment);
                        break;
                    case R.id.imgHead:
//                        ToastUtil.getInstance().showLongT("点击头像,跳转用户信息界面");
                        break;
                    case R.id.tvReplyUser:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFill = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply reply = replyFill.getReply();
                        clickReply(reply.getSpeakUser(), reply.getComment());
                        break;
                    case R.id.tvReplyWho:
                        if (!(baseQuickAdapter.getData().get(i) instanceof ReplyFill)) {
                            break;
                        }
                        ReplyFill replyFillWho = (ReplyFill) baseQuickAdapter.getData().get(i);
                        Reply replyWho = replyFillWho.getReply();
                        clickReply(replyWho.getReplyUser(), replyWho.getComment());
                        break;
                }
            }
        });
    }
 
Example 31
Project: azure-libraries-for-java   File: CertificatesInner.java   View source code 5 votes vote down vote up
/**
 * Get all certificates in a resource group.
 * Get all certificates in a resource group.
 *
 * @param resourceGroupName Name of the resource group to which the resource belongs.
 * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the {@link ServiceFuture} object
 */
public ServiceFuture<List<CertificateInner>> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback<CertificateInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listByResourceGroupSinglePageAsync(resourceGroupName),
        new Func1<String, Observable<ServiceResponse<Page<CertificateInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<CertificateInner>>> call(String nextPageLink) {
                return listByResourceGroupNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example 32
Project: incubator-netbeans   File: LessPreferencesValidator.java   View source code 5 votes vote down vote up
@Override
public LessPreferencesValidator validateMappings(@NullAllowed FileObject root, boolean enabled, List<Pair<String, String>> mappings) {
    if (enabled) {
        result.merge(new CssPreprocessorUtils.MappingsValidator("less") // NOI18N
                .validate(root, mappings)
                .getResult());
    }
    return this;
}
 
Example 33
Project: c4sg-services   File: OrganizationServiceImpl.java   View source code 5 votes vote down vote up
@Override
public List<OrganizationDTO> findByUser(Integer userId) {
  User user = userDAO.findById(userId);
  requireNonNull(user, "Invalid User Id");
  List<UserOrganization> userOrganizations = userOrganizationDAO.findByUserId(userId);
  List<OrganizationDTO> organizationDtos = new ArrayList<OrganizationDTO>();
  for (UserOrganization userOrganization : userOrganizations) {
    organizationDtos.add(organizationMapper.getOrganizationDtoFromEntity(userOrganization));
  }
  return organizationDtos;
}
 
Example 34
Project: CXJPadProject   File: QuoteProcessOuterItem.java   View source code 5 votes vote down vote up
public QuoteProcessOuterItem(Activity activity, QuoteProcessFragment bFragment, List<InquiryInfo.AccectFlag> selectList,
                             QuoteProcessModel quoteProcessModel, QuoteProcessFragment.TmpSelectModel[] tmpSelectModel,
                             Map<String, String> carrierNameMap, OnPictureBtnClickListener onPictureBtnClickListener) {
    this.activity = activity;
    this.bFragment = bFragment;
    this.selectList = selectList;
    this.quoteProcessModel = quoteProcessModel;
    this.tmpSelectModel = tmpSelectModel;
    this.carrierNameMap = carrierNameMap;
    this.onPictureBtnClickListener = onPictureBtnClickListener;
}
 
Example 35
Project: Android-Code-Demos   File: Features2d.java   View source code 5 votes vote down vote up
public static void drawMatches2(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
{
    Mat keypoints1_mat = keypoints1;
    Mat keypoints2_mat = keypoints2;
    List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
    Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
    List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
    Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
    drawMatches2_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
    
    return;
}
 
Example 36
Project: Spring-5.0-Cookbook   File: DeptAsyncController.java   View source code 5 votes vote down vote up
@GetMapping(value="/webSyncDeptList.json", produces ="application/json", headers = {"Accept=text/xml, application/json"})
public WebAsyncTask<List<Department>> websyncDeptList(){
   
    Callable<List<Department>> callable = new Callable<List<Department>>() {
        public List<Department> call() throws Exception {
             return departmentServiceImpl.readDepartments().get(500, TimeUnit.MILLISECONDS);
        }
    };
    return new WebAsyncTask<List<Department>>(500, callable);
}
 
Example 37
Project: alfresco-remote-api   File: CustomModelsImpl.java   View source code 5 votes vote down vote up
@Override
public CollectionWithPagingInfo<CustomType> getCustomTypes(String modelName, Parameters parameters)
{
    CustomModelDefinition modelDef = getCustomModelImpl(modelName);
    Collection<TypeDefinition> typeDefinitions = modelDef.getTypeDefinitions();
    // TODO Should we support paging?
    Paging paging = Paging.DEFAULT;

    List<CustomType> customTypes = convertToCustomTypes(typeDefinitions, false);

    return CollectionWithPagingInfo.asPaged(paging, customTypes, false, typeDefinitions.size());

}
 
Example 38
Project: springboot-shiro-cas-mybatis   File: TbUserExample.java   View source code 5 votes vote down vote up
protected Criterion(String condition, Object value, String typeHandler) {
    super();
    this.condition = condition;
    this.value = value;
    this.typeHandler = typeHandler;
    if (value instanceof List<?>) {
        this.listValue = true;
    } else {
        this.singleValue = true;
    }
}
 
Example 39
Project: GitHub   File: JavaApiConverterTest.java   View source code 5 votes vote down vote up
@Test public void createOkRequest_nullRequestHeaderKey() throws Exception {
  URI uri = new URI("https://foo/bar");

  Map<String, List<String>> javaRequestHeaders = new LinkedHashMap<>();
  javaRequestHeaders.put(null, Arrays.asList("GET / HTTP 1.1"));
  javaRequestHeaders.put("Foo", Arrays.asList("Bar"));
  Request request = JavaApiConverter.createOkRequest(uri, "POST", javaRequestHeaders);
  assertTrue(request.isHttps());
  assertEquals(uri, request.url().uri());
  Headers okRequestHeaders = request.headers();
  assertEquals(1, okRequestHeaders.size());
  assertEquals("Bar", okRequestHeaders.get("Foo"));
  assertEquals("POST", request.method());
}
 
Example 40
Project: azure-libraries-for-java   File: DeploymentOperationsInner.java   View source code 5 votes vote down vote up
/**
 * Gets all deployments operations for a deployment.
 *
 * @param resourceGroupName The name of the resource group. The name is case insensitive.
 * @param deploymentName The name of the deployment with the operation to get.
 * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the {@link ServiceFuture} object
 */
public ServiceFuture<List<DeploymentOperationInner>> listByResourceGroupAsync(final String resourceGroupName, final String deploymentName, final ListOperationCallback<DeploymentOperationInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listByResourceGroupSinglePageAsync(resourceGroupName, deploymentName),
        new Func1<String, Observable<ServiceResponse<Page<DeploymentOperationInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<DeploymentOperationInner>>> call(String nextPageLink) {
                return listByResourceGroupNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}