本文整理匯總了Java中javax.jcr.NodeIterator.nextNode方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeIterator.nextNode方法的具體用法?Java NodeIterator.nextNode怎麽用?Java NodeIterator.nextNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.jcr.NodeIterator
的用法示例。
在下文中一共展示了NodeIterator.nextNode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildPath
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void buildPath(List<String> list, Node parentNode) throws RepositoryException {
NodeIterator nodeIterator=parentNode.getNodes();
while(nodeIterator.hasNext()){
Node node=nodeIterator.nextNode();
String nodePath=node.getPath();
if(nodePath.endsWith(FileType.Ruleset.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.UL.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.DecisionTable.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.ScriptDecisionTable.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.DecisionTree.toString())){
list.add(nodePath);
}else if(nodePath.endsWith(FileType.RuleFlow.toString())){
list.add(nodePath);
}
buildPath(list,node);
}
}
示例2: queryJcrContent
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
String queryJcrContent(Session session) throws RepositoryException {
// get query manager
QueryManager queryManager = session.getWorkspace().getQueryManager();
// query for all nodes with tag "JCR"
Query query = queryManager.createQuery("/jcr:root/content/adaptto//*[tags='JCR']", Query.XPATH);
// iterate over results
QueryResult result = query.execute();
NodeIterator nodes = result.getNodes();
StringBuilder output = new StringBuilder();
while (nodes.hasNext()) {
Node node = nodes.nextNode();
output.append("path=" + node.getPath() + "\n");
}
return output.toString();
}
示例3: buildDirectories
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void buildDirectories(Node node, List<RepositoryFile> fileList, String projectPath) throws Exception {
NodeIterator nodeIterator = node.getNodes();
while (nodeIterator.hasNext()) {
Node dirNode = nodeIterator.nextNode();
if (!dirNode.hasProperty(FILE)) {
continue;
}
if (!dirNode.hasProperty(DIR_TAG)) {
continue;
}
RepositoryFile file = new RepositoryFile();
file.setName(dirNode.getPath().substring(projectPath.length()));
file.setFullPath(dirNode.getPath());
buildDirectories(dirNode, fileList, projectPath);
fileList.add(file);
}
}
示例4: unlockAllChildNodes
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void unlockAllChildNodes(Node node,User user,List<Node> nodeList,String rootPath) throws Exception{
NodeIterator iter=node.getNodes();
while(iter.hasNext()){
Node nextNode=iter.nextNode();
String absPath=nextNode.getPath();
if(!lockManager.isLocked(absPath)){
continue;
}
Lock lock=lockManager.getLock(absPath);
String owner=lock.getLockOwner();
if(!user.getUsername().equals(owner)){
throw new NodeLockException("當前目錄下有子目錄被其它人鎖定,您不能執行鎖定"+rootPath+"目錄");
}
nodeList.add(nextNode);
unlockAllChildNodes(nextNode, user, nodeList, rootPath);
}
}
示例5: purge
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void purge(final Context context, final ActionResult actionResult)
throws RepositoryException, ActionExecutionException {
NodeIterator iterator = getPermissions(context);
String normalizedPath = normalizePath(path);
while (iterator != null && iterator.hasNext()) {
Node node = iterator.nextNode();
if (node.hasProperty(PermissionConstants.REP_ACCESS_CONTROLLED_PATH)) {
String parentPath = node.getProperty(PermissionConstants.REP_ACCESS_CONTROLLED_PATH)
.getString();
String normalizedParentPath = normalizePath(parentPath);
boolean isUsersPermission = parentPath.startsWith(context.getCurrentAuthorizable().getPath());
if (StringUtils.startsWith(normalizedParentPath, normalizedPath) && !isUsersPermission) {
RemoveAll removeAll = new RemoveAll(parentPath);
ActionResult removeAllResult = removeAll.execute(context);
if (Status.ERROR.equals(removeAllResult.getStatus())) {
actionResult.logError(removeAllResult);
}
}
}
}
}
示例6: executeQuery
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
/**
* Execute JCR query returning Nodes matching given statement and return node type
*
* @param statement JCR query string
* @param workspace Search in JCR workspace like website
* @param returnItemType Return nodes based on primary node type
* @return List<Node>
* @throws javax.jcr.RepositoryException
*/
private static List<Node> executeQuery(final String statement,
final String workspace,
final String returnItemType) throws RepositoryException {
List<Node> nodeList = new ArrayList<>(0);
NodeIterator items = QueryUtil.search(workspace, statement, Query.JCR_SQL2, returnItemType);
LOGGER.debug("Query Executed: {}", statement);
while (items.hasNext()) {
Node node = items.nextNode();
nodeList.add(new I18nNodeWrapper(node));
}
return nodeList;
}
示例7: singleRun
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void singleRun() throws Exception {
Session session = MgnlContext.getInstance().getJCRSession("website");
NodeIterator iter = session.getNode("/home").getNodes();
String json = "[]";
int count = 0;
while (iter.hasNext()) {
count++;
Node n = iter.nextNode();
json = JsonTemplatingFunctions.appendFrom(json, n)
.add("name",
"link",
"linkText",
"displayName",
"partnerInContentApp",
"@path",
"mgnl:created",
"mgnl:activationStatus")
.expand("categoriesFilter", "category")
.expand("image", "dam")
.binaryLinkRendition("zoom")
.maskChar(':', '_')
.wrapForI18n()
.inline().print();
}
}
示例8: getTasksComplete
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
public void getTasksComplete(Card card) throws Exception {
ObjectContentManager ocm = ocmFactory.getOcm();
try{
Node node = ocm.getSession().getNode(String.format(URI.TASKS_URI, card.getBoard(), card.getPhase(), card.getId().toString(),""));
int complete = 0;
NodeIterator nodes = node.getNodes();
while(nodes.hasNext()){
Node nextNode = nodes.nextNode();
Property property = nextNode.getProperty("complete");
if( property!=null && property.getBoolean() ){
complete++;
}
}
card.setCompleteTasks(Long.valueOf(complete));
} finally {
ocm.logout();
}
}
示例9: getChildrenList
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
List<?> getChildrenList(Class<?> childObjClass, Node childrenContainer, Object parentObj, Mapper mapper, int depth, NodeFilter nodeFilter,
JcrChildNode jcrChildNode) throws ClassNotFoundException, InstantiationException, RepositoryException, IllegalAccessException, IOException
{
List<Object> children = jcrChildNode.listContainerClass().newInstance();
NodeIterator iterator = childrenContainer.getNodes();
while (iterator.hasNext())
{
Node childNode = iterator.nextNode();
// ignore the policy node when loading child nodes
if (!childNode.getName().equals(POLICY_NODE_NAME))
{
children.add(getSingleChild(childObjClass, childNode, parentObj, mapper, depth, nodeFilter));
}
}
return children;
}
示例10: getGroupNodeByName
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
/**
* Gets the Node for the specified name. If no node with the specified name exists, null is returned.
*
* @param groupName the name of the Group to return
* @return the Node with name groupName
*/
public Node getGroupNodeByName(final String groupName) {
final String escapedGroupName = Text.escapeIllegalJcr10Chars(ISO9075.encode(NodeNameCodec.encode(groupName, true)));
final String queryString = QUERY_GROUP.replace("{}", escapedGroupName);
try {
@SuppressWarnings("deprecation") final Query query = getQueryManager().createQuery(queryString, Query.SQL);
final QueryResult queryResult = query.execute();
final NodeIterator iterator = queryResult.getNodes();
if (!iterator.hasNext()) {
return null;
}
final Node node = iterator.nextNode();
return node;
} catch (RepositoryException e) {
log.error("Unable to check if group '{}' exists, returning true", groupName, e);
return null;
}
}
示例11: checkIfVersionedChild
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
/**
* Check if this node has a child version history reference. If so, then return the referenced node, else return the node supplied.
*
* @param node
* @return
* @throws javax.jcr.RepositoryException
*/
Node checkIfVersionedChild(Node node) throws RepositoryException
{
if (node.hasProperty(Property.JCR_CHILD_VERSION_HISTORY))
{
// Node versionNode =
// node.getSession().getNodeByUUID(node.getProperty("jcr:childVersionHistory").getString());
Node versionNode = getNodeById(node, node.getProperty(Property.JCR_CHILD_VERSION_HISTORY).getString());
NodeIterator it = versionNode.getNodes();
while (it.hasNext())
{
Node n = it.nextNode();
if ((!n.getName().equals("jcr:rootVersion") && !n.getName().equals(Node.JCR_ROOT_VERSION)) && n.isNodeType(NodeType.NT_VERSION)
&& n.hasNode(Node.JCR_FROZEN_NODE) && node.getPath().indexOf("/" + n.getName() + "/") != -1)
{
return n.getNode(Node.JCR_FROZEN_NODE);
}
}
return node;
}
else
{
return node;
}
}
示例12: getDBResource
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void getDBResource(String sqlQuery) throws Exception {
QueryResult result = this.excSQL(sqlQuery, true);
NodeIterator it = result.getNodes();
while (it.hasNext()) {
Node findedNode = it.nextNode();
if (super.getChildById(findedNode.getUUID()) == null) {
UIAddOnSearchOne uiAddOnSearchOne = addChild(UIAddOnSearchOne.class, null, findedNode.getUUID());
uiAddOnSearchOne.setNodeId(findedNode.getUUID());
uiAddOnSearchOne.setCanEdit(this.getCanEdit());
}
this.data.add(findedNode);
}
}
示例13: missingDependencies
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
void missingDependencies( final Dependency dependency,
final Collection< Dependency > missing,
final Session session ) throws Exception {
if ( dependency.exists() ) {
// find all models and all their dependencies
final Node node = session.getNode( dependency.path() );
final NodeIterator itr = node.getNodes();
while ( itr.hasNext() ) {
final Node kid = itr.nextNode();
if ( modelNode( kid ) ) {
final Model dependencyModel = new ModelImpl( this.modelspace, dependency.path() );
missing.addAll( dependencyModel.missingDependencies() );
}
}
} else {
missing.add( dependency );
}
}
示例14: updateInternalSettings
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
private void updateInternalSettings() throws RepositoryException {
// find all internalSettings nodes from DASHBOARDS and change chartId property in entityId
String statement = "/jcr:root" + ISO9075.encodePath(StorageConstants.DASHBOARDS_ROOT) + "//*[fn:name()='internalSettings']";
QueryResult queryResult = getTemplate().query(statement);
NodeIterator nodes = queryResult.getNodes();
LOG.info("Found " + nodes.getSize() + " internalSettings nodes");
while (nodes.hasNext()) {
Node node = nodes.nextNode();
try {
Property prop = node.getProperty("chartId");
node.setProperty("entityId", prop.getValue());
prop.remove();
} catch (PathNotFoundException ex) {
// if property not found we have nothing to do
}
}
}
示例15: getWebResources
import javax.jcr.NodeIterator; //導入方法依賴的package包/類
public Map<String, String> getWebResources(Session session)
throws RepositoryException {
Map<String, String> result = new HashMap<String, String>();
Query query = session
.getWorkspace()
.getQueryManager()
.createQuery(
"SELECT * FROM [webresource:WebResourceGroup] as webResourceGroupSet",
Query.JCR_SQL2);
QueryResult queryResult = query.execute();
NodeIterator queryIt = queryResult.getNodes();
while (queryIt.hasNext()) {
Node webResourceNode = queryIt.nextNode();
result.put(webResourceNode.getProperty(WebResourceGroup.NAME)
.getString(), webResourceNode.getPath());
}
return result;
}