當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeIterator.next方法代碼示例

本文整理匯總了Java中javax.jcr.NodeIterator.next方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeIterator.next方法的具體用法?Java NodeIterator.next怎麽用?Java NodeIterator.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jcr.NodeIterator的用法示例。


在下文中一共展示了NodeIterator.next方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getForumByName

import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private Forum getForumByName(String forumName) throws Exception {
  StringBuffer sb = new StringBuffer(Utils.JCR_ROOT);
  sb.append("/").append(locator_.getForumCategoriesLocation()).append("//element(*,");
  sb.append(Utils.EXO_FORUM).append(")[jcr:like(exo:name, '%").append(forumName).append("%')]");

  NodeIterator iter =  forumService_.search(sb.toString());
  if (iter.hasNext()) {
    Node forumNode = (Node)iter.next();

    Forum forum = new Forum();
    PropertyReader reader = new PropertyReader(forumNode);
    forum.setId(forumNode.getName());
    forum.setPath(forumNode.getPath());
    forum.setOwner(reader.string(Utils.EXO_OWNER));
    forum.setForumName(reader.string(Utils.EXO_NAME));
    forum.setViewer(reader.strings(Utils.EXO_VIEWER));

    return forum;
  }


  return null;
}
 
開發者ID:exo-addons,項目名稱:portlet-pack,代碼行數:24,代碼來源:QuicklookData.java

示例2: getCategoryByForumName

import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private Category getCategoryByForumName(String forumName) throws Exception {
  StringBuffer sb = new StringBuffer(Utils.JCR_ROOT);
  sb.append("/").append(locator_.getForumCategoriesLocation()).append("//element(*,");
  sb.append(Utils.EXO_FORUM).append(")[jcr:like(exo:name, '%").append(forumName).append("%')]");

  NodeIterator iter =  forumService_.search(sb.toString());
  if (iter.hasNext()) {
    Node forumNode = (Node)iter.next();
    if (forumNode.getParent() != null) {
      Node cateNode =  forumNode.getParent();
      Category cat = new Category(cateNode.getName());
      cat.setPath(cateNode.getPath());
      PropertyReader reader = new PropertyReader(cateNode);
      cat.setOwner(reader.string(Utils.EXO_OWNER));
      cat.setCategoryName(reader.string(Utils.EXO_NAME));
      return cat;
    }
  }

  return null;
}
 
開發者ID:exo-addons,項目名稱:portlet-pack,代碼行數:22,代碼來源:QuicklookData.java

示例3: retrievePlanList

import javax.jcr.NodeIterator; //導入方法依賴的package包/類
/**
 * Retrieve a {@link PlanList} from Fedora
 * @param limit the maximum number of entries in the list
 * @param offset the offset of the list
 * @return a {@link Response} which maps to a corresponding HTTP response, containing a {@link PlanList}'s XML representation
 * @throws RepositoryException
 */
@GET
@Path("{limit}/{offset}")
public Response retrievePlanList(@PathParam("limit")
final long limit, @PathParam("offset")
final long offset) throws RepositoryException {
    final List<PlanData> plans = new ArrayList<>();
    NodeIterator nodes = this.retrievePlanNodes(limit, offset);
    while (nodes.hasNext()) {
        Node plan = (Node) nodes.next();
        PropertyIterator props = plan.getProperties("scape:*");
        PlanData.Builder data = new PlanData.Builder();
        data.identifier(new Identifier(plan.getPath().substring(plan.getPath().lastIndexOf('/') + 1)));
        while (props.hasNext()) {
            Property prop = (Property) props.next();
            for (Value val : prop.getValues()) {
                if (prop.getName().equals("scape:hasTitle")) {
                    data.title(val.getString());
                }
                if (prop.getName().equals("scape:hasDescription")) {
                    data.description(val.getString());
                }
                if (prop.getName().equals("scape:hasLifecycleState")) {
                    String state = val.getString();
                    int pos;
                    if ((pos = state.indexOf(':')) != -1) {
                        data.lifecycleState(new PlanLifecycleState(PlanState.valueOf(state.substring(0, pos)), state.substring(pos + 1)));
                    } else {
                        data.lifecycleState(new PlanLifecycleState(PlanState.valueOf(state), ""));
                    }
                }
            }
        }
        plans.add(data.build());
    }
    return Response.ok(new StreamingOutput() {

        @Override
        public void write(OutputStream sink) throws IOException, WebApplicationException {
            try {
                marshaller.serialize(new PlanDataCollection(plans), sink);
            } catch (JAXBException e) {
                throw new IOException(e);
            }
        }
    }).build();
}
 
開發者ID:openpreserve,項目名稱:scape-fcrepo4-planmanagement,代碼行數:54,代碼來源:PlanList.java


注:本文中的javax.jcr.NodeIterator.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。