本文整理汇总了Java中org.apache.abdera.model.Document.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java Document.getRoot方法的具体用法?Java Document.getRoot怎么用?Java Document.getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.abdera.model.Document
的用法示例。
在下文中一共展示了Document.getRoot方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
}
示例6: 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());
}
示例7: 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;
}
示例8: 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());
}
}
示例9: 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();
}
}
示例10: serviceDocumentFromStream
import org.apache.abdera.model.Document; //导入方法依赖的package包/类
protected Service serviceDocumentFromStream(final InputStream content) {
final Abdera abdera = new Abdera();
final Document<Service> serviceDocument = abdera.getParser().parse(content);
return serviceDocument.getRoot();
}