• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Document类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.abdera.model.Document的典型用法代码示例。如果您正苦于以下问题:Java Document类的具体用法?Java Document怎么用?Java Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Document类属于org.apache.abdera.model包,在下文中一共展示了Document类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getDocument

import org.apache.abdera.model.Document; //导入依赖的package包/类
private Document<Feed> getDocument() throws IOException, ParseException {
    if (document == null) {
        if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) {
            document = AtomUtils.parseDocument(endpoint.getFeedUri());
        } else {
            document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword());
        }
        Feed root = document.getRoot();
        if (endpoint.isSortEntries()) {
            sortEntries(root);
        }
        list = root.getEntries();
        entryIndex = list.size() - 1;
    }
    return document;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:17,代码来源:AtomEntryPollingConsumer.java


示例2: testFilter

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Test
public void testFilter() throws Exception {
    Document<Feed> doc = AtomUtils.parseDocument("file:src/test/data/feed.atom");
    assertNotNull(doc);

    // timestamp from the feed to use as base
    // 2007-11-13T13:35:25.014Z
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+1:00"));
    cal.set(2007, Calendar.NOVEMBER, 13, 14, 35, 0);
    EntryFilter filter = new UpdatedDateFilter(cal.getTime());

    List<Entry> entries = doc.getRoot().getEntries();

    // must reverse backwards
    for (int i = entries.size() - 1; i > 0; i--) {
        Entry entry = entries.get(i);
        boolean valid = filter.isValidEntry(null, doc, entry);
        // only the 3 last should be true
        if (i > 3) {
            assertEquals("not valid", false, valid);
        } else {
            assertEquals("valid", true, valid);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:UpdatedDateFilterTest.java


示例3: fetchData

import org.apache.abdera.model.Document; //导入依赖的package包/类
/**
 * Executes the command
 * @return the feed received from the VLER DAS system
 * @throws VlerDasException if an unsuccessful response is received from the VLER DAS webservice call
 */
public Document<Feed> fetchData() throws VlerDasException {
    String pid = getPid(query.getPatientIds());
    String url = constructUrl(pid);

    ClientResponse response = doAbderaRequest(url);
    Document<Feed> vlerData = null;

    if (response.getType() == ResponseType.SUCCESS) {
        vlerData = response.getDocument();
    } else {
        LOGGER.warn("Received failed response from VLER DAS service: " + response.getStatus() + "/"
                + response.getStatusText() + ", URI=\"" + response.getUri() + "\"");
        throw new VlerDasException("Unable to fetch patient data from VLER DAS for ICN: " + pid);
    }

    return vlerData;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:23,代码来源:VlerDasDataFetchCommand.java


示例4: getVistaDataChunks

import org.apache.abdera.model.Document; //导入依赖的package包/类
/**
 * Retrieve DoD vital data and format it into a VistaChunk to be included into the set of data returned to the system.
 *
 * @param document the document
 * @param patientIds Patient identifier bean.
 * @return The VistaDataChunk list that contains the vital data.
 */
public static List<VistaDataChunk> getVistaDataChunks(Document<Feed> document, PatientIds patientIds) {
    LOG.debug("started VlerDasVitalsMapper.getVistaDataChunks");

    List<VistaDataChunk> oaVitalChunk = new ArrayList<VistaDataChunk>();

    List<VitalSign> oaVital = transformFeed(document, patientIds);

    if ((oaVital != null) && (oaVital.size() > 0)) {

        int iNumVitals = oaVital.size();
        int iCurVitalIdx = 1;       // One based index
        for (VitalSign oVital : oaVital) {
            VistaDataChunk oVitalChunk = transformVitalChunk(oVital, patientIds, iNumVitals, iCurVitalIdx);
            if (oVitalChunk != null) {
                oaVitalChunk.add(oVitalChunk);
                iCurVitalIdx++;
            }
        }
    }

    LOG.debug("finished VlerDasVitalsMapper.getVistaDataChunks");
    return oaVitalChunk;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:31,代码来源:VlerDasVitalsMapper.java


示例5: testFetchDataSuccessResponse

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Test
public void testFetchDataSuccessResponse() {
    Document mockResults = Mockito.mock(Document.class);

    // create mock successful response
    AbderaClient successfulClient = Mockito.mock(AbderaClient.class);
    ClientResponse successResponse = Mockito.mock(ClientResponse.class);
    Mockito.when(successResponse.getType()).thenReturn(Response.ResponseType.SUCCESS);
    Mockito.when(successResponse.getDocument()).thenReturn(mockResults);
    Mockito.when(successfulClient.get(Mockito.anyString())).thenReturn(successResponse);

    // test successful fetch
    try {
        command.setWsClient(successfulClient);
        Assert.assertNotNull(command.fetchData());

    } catch (Throwable t) {
        t.printStackTrace();
        Assert.fail("fetchData should not have thrown an exception");
    }
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:22,代码来源:VlerDasDataFetchCommandTest.java


示例6: testFetchDataFailureResponse

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Test
public void testFetchDataFailureResponse() {
    Document mockResults = Mockito.mock(Document.class);

    // create mock failed response
    AbderaClient failedClient = Mockito.mock(AbderaClient.class);
    ClientResponse failureResponse = Mockito.mock(ClientResponse.class);
    Mockito.when(failureResponse.getType()).thenReturn(Response.ResponseType.SERVER_ERROR);
    Mockito.when(failureResponse.getDocument()).thenReturn(mockResults);
    Mockito.when(failedClient.get(Mockito.anyString())).thenReturn(failureResponse);

    // test failed fetch
    try {
        command.setWsClient(failedClient);
        command.fetchData();

        Assert.fail("fetchData should have thrown an exception");

    } catch (VlerDasException vde) {
        // this was expected
    }
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:23,代码来源:VlerDasDataFetchCommandTest.java


示例7: createFeed

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Override
protected Object createFeed() throws IOException {
    Document<Feed> document;
    if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) {
        document = AtomUtils.parseDocument(endpoint.getFeedUri());
    } else {
        document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword());
    }
    return document.getRoot();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:AtomPollingConsumer.java


示例8: parseDocument

import org.apache.abdera.model.Document; //导入依赖的package包/类
public static Document<Feed> parseDocument(String uri, String username, String password) throws IOException {
    URL feedUrl = new URL(uri);
    HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection();
    String encoding = Base64.encodeBase64String(username.concat(":").concat(password).getBytes());
    httpcon.setRequestProperty("Authorization", "Basic " + encoding);
    InputStream in = httpcon.getInputStream();
    return parseInputStream(in);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:AtomUtils.java


示例9: parseInputStream

import org.apache.abdera.model.Document; //导入依赖的package包/类
private static Document<Feed> parseInputStream(InputStream in) throws ParseException {
    Parser parser = getAtomParser();
    // set the thread context loader with the ParserClassLoader
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    try {
        Thread.currentThread().setContextClassLoader(parser.getClass().getClassLoader());
        return parser.parse(in);
    } finally {
        Thread.currentThread().setContextClassLoader(old);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:AtomUtils.java


示例10: getEntryFromFile

import org.apache.abdera.model.Document; //导入依赖的package包/类
private Entry getEntryFromFile(File f) throws FilesystemAccessException {
	long size = f.getSize();
	if (size > MAX_ENTRY_SIZE)
		throw new FilesystemAccessException("entry larger than 50kB");
	byte[] contents = f.getContents(0, (int) size);
	Document<Entry> doc = parser.parse(new ByteArrayInputStream(contents));
	return doc.getRoot();
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:9,代码来源:InteractionFeedSupport.java


示例11: transformFeed

import org.apache.abdera.model.Document; //导入依赖的package包/类
/**
 * Transform feed.
 *
 * @param document the document
 * @param patientIds the patient ids
 * @return the list
 */
@SuppressWarnings("unchecked")
private static List<VitalSign> transformFeed(Document<Feed> document, PatientIds patientIds) {
    List<VitalSign> list = new ArrayList<VitalSign>();

    Feed feed = document.getRoot();
    //should only have 1 entry
    if (feed.getEntries().iterator().hasNext()) {
        Entry entry = feed.getEntries().iterator().next();
        FOMContent content = (FOMContent) entry.getContentElement();
        Iterator<OMElement> vitalsIter = content.getChildrenWithName(QNAME_VITALS);
        while (vitalsIter.hasNext()) {
            OMElement vitalsElement = vitalsIter.next();
            VitalSign vitalSign = new VitalSign();
            transformCode(vitalSign, vitalsElement);
            transformUid(vitalSign, vitalsElement, patientIds);
            transformObserved(vitalSign, vitalsElement);
            transformResult(vitalSign, vitalsElement);
            transformUnits(vitalSign, vitalsElement);
            transformTypeName(vitalSign, vitalsElement);
            mapPatientGeneratedData(vitalSign);
            list.add(vitalSign);
        }
    }


    return list;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:35,代码来源:VlerDasVitalsMapper.java


示例12: sendResponseWithEditLink

import org.apache.abdera.model.Document; //导入依赖的package包/类
private ResponseContext sendResponseWithEditLink(RequestContext request, Entry newEntry,
    int responseCode) {
  if (newEntry != null) {
    Document<Entry> newEntryDoc = newEntry.getDocument();
    String loc = newEntry.getEditLinkResolvedHref().toString();
    return sendResponse(request, newEntryDoc, responseCode).setLocation(loc);
  } else {
    return sendNotFoundResponse(request);
  }
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:11,代码来源:AbstractManagedCollectionAdapter.java


示例13: retrieveEntry

import org.apache.abdera.model.Document; //导入依赖的package包/类
protected Entry retrieveEntry(String entryId) {
  // Deserialize from a byte array
  byte[] bytes = entries.get(entryId);
  if (bytes == null) {
    // entry not found
    return null;
  }
  ByteArrayInputStream in = new ByteArrayInputStream(bytes);
  Document<Entry> entryDoc = abdera.getParser().parse(in);
  Entry entry = entryDoc.getRoot();
  return entry;
}
 
开发者ID:jyang,项目名称:google-feedserver,代码行数:13,代码来源:SampleBasicAdapter.java


示例14: getEntry

import org.apache.abdera.model.Document; //导入依赖的package包/类
private Entry getEntry(final File entryFile) {
	if (!entryFile.exists() || !entryFile.isFile()) {
		throw new RuntimeException();
	}
	try {
		final FileInputStream fis = new FileInputStream(entryFile);
		final Document<Entry> doc = this.abdera.getParser().parse(fis);
		final Entry entry = doc.getRoot();
		return entry;
	} catch (final Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-common-activities,代码行数:14,代码来源:HackedFilesystemAdapter.java


示例15: CodePackageFeed

import org.apache.abdera.model.Document; //导入依赖的package包/类
/**
 * Construct a {@link CodePackageFeed} from an atom XML stream
 * 
 * @param atomStream {@link InputStream}
 */
public CodePackageFeed(InputStream atomStream) {
	LOGGER.debug("Loading Feed from " + atomStream);

	Parser parser = Abdera.getInstance().getParser();
	Document<Feed> doc = parser.parse(atomStream);
	feed = doc.getRoot();

	LOGGER.info("New Feed: " + feed.getTitle());
}
 
开发者ID:52North,项目名称:movingcode,代码行数:15,代码来源:CodePackageFeed.java


示例16: getMessagesAtom

import org.apache.abdera.model.Document; //导入依赖的package包/类
private List<FeedMessageContainer> getMessagesAtom() {
    List<FeedMessageContainer> messages = new ArrayList<>();
    Parser parser = abdera.getParser();
    Document<Feed> doc = null;
    try {
        doc = parser.parse(url.openStream(),url.toString());
    } catch (IOException exception) {
        exception.printStackTrace();
    }
    Feed feed = doc.getRoot();
    for (Entry entry : feed.getEntries()) {
        messages.add(new FeedMessageContainer(entry));
    }
    return messages;
}
 
开发者ID:CubeCraft,项目名称:KellyBot,代码行数:16,代码来源:FeedContainer.java


示例17: readFrom

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Override
public Object readFrom(Class<Object> feedOrEntry, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap<String, String> arg4,
        InputStream inputStream) throws IOException, WebApplicationException {
    Document<Element> doc = getAbdera().getParser().parse(inputStream);
    Element el = doc.getRoot();
    if (feedOrEntry.isAssignableFrom(el.getClass())) {
        return el;
    } else {
        throw new IOException("Unexpected payload, expected " + feedOrEntry.getName() + ", received " + el.getClass().getName());
    }
}
 
开发者ID:fraunhoferfokus,项目名称:odp-rss-servlet,代码行数:12,代码来源:AbderaSupport.java


示例18: from

import org.apache.abdera.model.Document; //导入依赖的package包/类
public static String from(Reader reader, ProgressDialogJFrame progressDialogJFrame) {
    try {
        Abdera abdera = new Abdera();
        Parser parser = abdera.getParser();
        Document<Feed> doc = parser.parse(reader);
        
        Feed feed = doc.getRoot();
        
        HashMap<String, Entry> entryByUri=new HashMap<String, Entry>();
        
        logger.debug(feed.getTitle());
        for (Entry entry : feed.getEntries()) {
            logger.debug("\t"+entry.getTitle());
            entryByUri.put(entry.getId().toString(), entry);
        }
        
        String outlineUri = null;
        String outlineLabel;
        String labelUri = MindRaider.labelCustodian.LABEL_TWIKI_IMPORT_URI;
        MindRaider.labelCustodian.create("Atom Import", MindRaider.labelCustodian.LABEL_ATOM_IMPORT_URI);
        outlineLabel = feed.getTitle()+" ("+Utils.getCurrentDataTimeAsPrettyString()+")";
        logger.debug("Outline label: '"+outlineLabel+"'");

        outlineUri = MindRaiderVocabulary.getNotebookUri(Utils.toNcName(outlineLabel));
        String createdUri;
        while (MindRaiderConstants.EXISTS.equals(createdUri = MindRaider.outlineCustodian.create(
                outlineLabel,
                outlineUri,
                feed.getSubtitle(),
                false))) {
            outlineUri += "_";
        }
        outlineUri = createdUri;
        MindRaider.labelCustodian.addOutline(labelUri, outlineUri);
        OutlineResource activeOutlineResource = MindRaider.outlineCustodian.getActiveOutlineResource();
        // fill in notebook resource
        activeOutlineResource.save();
        logger.debug("Outline created: " + outlineUri);
        
        String parentNoteUri=activeOutlineResource.getUri();            
        List<Link> childrenLinks = feed.getLinks(Atomizer.ATOM_REL_CHILD_NOTE);
        fromOneLevel(progressDialogJFrame, entryByUri, outlineUri, parentNoteUri, childrenLinks, activeOutlineResource);
        
        return outlineUri;
    } catch(Exception e) {
        logger.debug("Unable to import Outline from Atom",e);
        return null;
    } finally {
        // now refresh notebook outline
        ExplorerJPanel.getInstance().refresh();
        OutlineJPanel.getInstance().refresh();
        MindRaider.spidersGraph.renderModel();            
    }
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:55,代码来源:Atomizer.java


示例19: transform

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Override
protected List<VistaDataChunk> transform(Document<Feed> vlerData, PatientIds patientIds) {
    return VlerDasVitalsMapper.getVistaDataChunks(vlerData, patientIds);
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:5,代码来源:VlerDasVitalsService.java


示例20: fetchData

import org.apache.abdera.model.Document; //导入依赖的package包/类
@Override
public List<VistaDataChunk> fetchData(VlerDasQuery query) throws VlerDasException {
    Document<Feed> vlerData = new VlerDasDataFetchCommand(configuration, query).fetchData();
    return transform(vlerData, query.getPatientIds());
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:6,代码来源:BaseVlerDasService.java



注:本文中的org.apache.abdera.model.Document类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InterfaceState类代码示例发布时间:2022-05-22
下一篇:
Java DirectedOrderedSparseMultigraph类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap