org.wso2.carbon.registry.core.Resource.getParentPath()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(77)

本文整理了Java中org.wso2.carbon.registry.core.Resource.getParentPath方法的一些代码示例,展示了Resource.getParentPath的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getParentPath方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:getParentPath

Resource.getParentPath介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry

public String jsGet_parentPath() {
  return this.resource.getParentPath();
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
  String parent = "";
  if (isResource) {
    try {
      parent = session.getUserRegistry().get(path).getParentPath();
    } catch (RegistryException e) {
      log.error("Registry Exception occurred while obtaining " + path);
    }
  } else {
    parent = path;
  }
  return (Node) session.getItem(parent);
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

private String getNodePath() throws RepositoryException {
   if(isResource) {
     try {
       return session.getUserRegistry().get(path).getParentPath();
     } catch (RegistryException e) {
       throw new RepositoryException("Registry level Exception occurred, cannot " +
           "obtain parent path of " + path);
     }
   } else {
     return path;
   }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

private static boolean hasDeepHoldParent(RegistrySession session, String path) throws RepositoryException {
  try {
    String tmp = session.getUserRegistry().get(path).getParentPath();
    if(!tmp.endsWith("/")) {
      tmp = tmp + "/";
    }
    while(tmp.contains(session.getWorkspaceRootPath()) && !tmp.equals(session.getWorkspaceRootPath())){
      for( Hold hold : getHoldsFromRegistry(session,tmp)){
       if(hold.isDeep()){
        return true;
       }
      }
      tmp = session.getUserRegistry().get(tmp).getParentPath();
      if(!tmp.endsWith("/")) {
        tmp = tmp + "/";
      }
    }
  } catch (RegistryException e) {
    throw new RepositoryException("Registry level exception occurred while " +
        "acquiring prent retention holds " + path);
  }
 return false;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private void deleteRecursively(String path,Registry registry) throws RegistryException {
  Resource currentResource = registry.get(path);
  if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){
    registry.delete(path);
    deleteRecursively(currentResource.getParentPath(),registry);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis

/**
 * See CMIS 1.0 section 2.2.3.5 getObjectParents
 *
 * @return  parent of this object
 * @throws  CmisObjectNotFoundException  if this is the root folder
 * @throws  CmisRuntimeException
 */
public RegistryFolder getParent() {
  try {
    if(resource.getPath().equals("/")){
      throw new CmisObjectNotFoundException("No parent for root folder");
    }
    Resource parent = repository.get(resource.getParentPath());
    if  (parent instanceof CollectionImpl){
      FolderTypeHandler handler = new FolderTypeHandler(getRepository(), pathManager, typeManager);
      return handler.getGregNode(parent);
    } else{
      throw new CmisInvalidArgumentException("Resource found. Collection expected");
    }
  }
  catch (RegistryException e) {
    String msg = "Error trying to retrieve the resource ";
    log.error(msg, e);
    throw new CmisRuntimeException(msg, e);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public static void checkRetentionPolicyWithParent(RegistrySession session, String path) throws RepositoryException {
  try {
    if (EffectiveRetentionUtil.checkEffectiveRetentionPolicyFullLocked(
        session, session.getUserRegistry().get(path).getParentPath())) {
      throw new RepositoryException("Cannot remove a node under retention policy" + path);
    }
    if (EffectiveRetentionUtil.checkEffectiveRetentionPolicyFullLocked(session, path)) {
      throw new RepositoryException("Cannot remove a node under retention policy" + path);
    }
  } catch (RegistryException e) {
    throw new RepositoryException("Cannot remove a node under retention policy" + path);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public static void checkRetentionHoldWithParent(RegistrySession session, String path) throws RepositoryException {
  try {
    if (EffectiveRetentionUtil.checkEffectiveRetentionHoldFullLocked(
        session, session.getUserRegistry().get(path).getParentPath())) {
      throw new RepositoryException("Cannot remove a node under retention hold" + path);
    }
    if (EffectiveRetentionUtil.checkEffectiveRetentionHoldFullLocked(session, path)) {
      throw new RepositoryException("Cannot remove a node under retention hold" + path);
    }
  } catch (RegistryException e) {
    throw new RepositoryException("Cannot remove a node under retention hold" + path);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void putChild(RequestContext requestContext) throws RegistryException {
  String path = requestContext.getResourcePath().getPath();
  Resource resource = requestContext.getResource();
  if (resource instanceof Collection) {
    String parentPath = resource.getParentPath();
    String newVersionNumber = RegistryUtils.getResourceName(path);
    if (!CommonConstants.VERSIONED_COLLECTION_MEDIA_TYPE.equals(resource.getMediaType())) {
      throw new RegistryException("Only Collections of type " +
          CommonConstants.VERSIONED_COLLECTION_MEDIA_TYPE + " can be put into the " +
          "collection: " + parentPath);
    }
    if (!newVersionNumber.matches(CommonConstants.SERVICE_VERSION_REGEX)) {
      throw new RegistryException("Version number should be in the format :" +
          "<major no>.<minor no>.<patch no>");
    }
    Registry registry = requestContext.getRegistry();
    Resource parent = registry.get(parentPath);
    parent.setProperty(org.wso2.carbon.registry.common.CommonConstants.
        LATEST_VERSION_PROP_NAME, newVersionNumber);
    registry.put(parentPath, parent);
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

session.getUserRegistry().get(s).getParentPath()) != null) {
throw new RepositoryException("Cannot remove retention from other nodes" + s);

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.ws.client

public static WSResource transformResourceToWSResource(Resource resource, DataHandler dataHandler) {
  WSResource wsResource = new WSResource();
  wsResource.setContentFile(dataHandler);
  wsResource.setAuthorUserName(resource.getAuthorUserName());
  if (resource.getCreatedTime() != null) wsResource.setCreatedTime(resource.getCreatedTime().getTime());
  //         wsResource.setDbBasedContentID(resource)
  wsResource.setDescription(resource.getDescription());
  wsResource.setId(resource.getId());
  if (resource.getLastModified() != null) wsResource.setLastModified(resource.getLastModified().getTime());
  wsResource.setLastUpdaterUserName(resource.getLastUpdaterUserName());
  //         wsResource.setMatchingSnapshotID(resource.get)
  wsResource.setMediaType(resource.getMediaType());
  //         wsResource.setName(resource.)
  wsResource.setParentPath(resource.getParentPath());
  wsResource.setPath(resource.getPath());
  //         wsResource.setPathID();
  wsResource.setPermanentPath(resource.getPermanentPath());
  if (!resource.getProperties().isEmpty()) wsResource.setProperties(getPropertiesForWSResource(resource.getProperties()));
  wsResource.setState(resource.getState());
  wsResource.setUUID(resource.getUUID());
  //         resource.get
  return wsResource;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

try {
  Registry registry =  requestContext.getRegistry();
  String parentPath =  requestContext.getResource().getParentPath();
  Resource currentResource = registry.get(requestContext.getResource().getPath());
  if ((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() != 0 ){

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis

String destPath = CommonUtil.getDestPathOfNode(getNode().getParentPath(), newName);
repository.rename(getNode().getPath(), destPath);
newNode = repository.get(destPath);

相关文章