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

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

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

Resource.getPropertyValues介绍

暂无

代码示例

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

protected boolean validatePropertyOfResource(Resource resource) {
    if (propertyName != null && propertyValue != null) {
      if (!isMultiValued) {
        return propertyValue.equals(resource.getProperty(propertyName));
      }

      List<String> resourceProperties = resource.getPropertyValues(propertyName);
      if (resourceProperties == null) {
        throw new RuntimeException("Error in lifecycle configuration. " +
            "Invalid property found: " + propertyName);
      }
      for (String value : resourceProperties) {
        if (propertyValue.equals(value)) {
          return true;
        }
      }
      return false;
    }
    return true;
  }
}

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

public static Hold[] getHoldsFromRegistry(RegistrySession session, String s) throws RepositoryException {
  Resource resource = null;
  List<Hold> holdList = new ArrayList<Hold>();
  try {
    resource = session.getUserRegistry().get(s);
    List holds = resource.getPropertyValues("org.wso2.carbon.registry.jcr.retention.holds");
    if (holds != null) {
      for (Object hold : holds) {
        String[] vals = hold.toString().split(";");
        holdList.add(new RegistryHold(vals[0], Boolean.valueOf(vals[1])));
      }
    }
  } catch (RegistryException e) {
    throw new RepositoryException("Registry level exception when setting retention policy at " + s);
  }
  return holdList.toArray(new RegistryHold[0]);
}

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

public static NativeArray jsFunction_getPropertyValues(Context cx, Scriptable thisObj, Object[] arguments,
                      Function funObj) throws CarbonException {
  ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
  if (arguments.length == 1) {
    if (arguments[0] instanceof String) {
      return new NativeArray(resourceHostObject.resource.getPropertyValues((String) arguments[0]).toArray());
    } else {
      throw new CarbonException("Invalid argument type for getProperty() method");
    }
  } else {
    throw new CarbonException("Invalid no. of arguments for getProperty() method");
  }
}

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

public static Hold addHoldsToRegistry(RegistrySession session, String s, String s1, boolean b) throws RepositoryException {
  Resource resource = null;
  try {
    resource = session.getUserRegistry().get(s);
    if (resource.getPropertyValues("org.wso2.carbon.registry.jcr.retention.holds") == null) {
      List list = new ArrayList();
      list.add(s1 + ";" + String.valueOf(b));
      resource.setProperty("org.wso2.carbon.registry.jcr.retention.holds", list);
    } else {
      resource.getPropertyValues("org.wso2.carbon.registry.jcr.retention.holds").
          add(s1 + ";" + String.valueOf(b));
    }
    session.getUserRegistry().put(s, resource);
  } catch (RegistryException e) {
    throw new RepositoryException("Registry level exception when setting retention policy at " + s);
  }
  return new RegistryHold(s1, b);
}

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

String resourcePropertyNameForItem = LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_VOTES_OPTION 
    + aspectName + "." + order + LifecycleConstants.VOTE;
List<String> list = resource.getPropertyValues(resourcePropertyNameForItem);
for (String value : list) {
  if (value.startsWith("current:")) {

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

private List<String> getVersionList(String nodePath) throws RegistryException {
  String confPath = RegistryJCRSpecificStandardLoderUtil.
      getSystemConfigVersionPath((RegistrySession) session);
  return ((RegistrySession) session).getUserRegistry().get(confPath).getPropertyValues(nodePath);
}

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

public void removeMixin(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {
  RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());
  try {
    Resource resource = registrySession.getUserRegistry().get(nodePath);
    if (resource.getPropertyValues("jcr:mixinTypes").contains(s)) {
      resource.getPropertyValues("jcr:mixinTypes").remove(s);
    } else {
      throw new NoSuchNodeTypeException("No such mix node type to remove");
    }
    registrySession.getUserRegistry().put(nodePath, resource);
  } catch (RegistryException e) {
    String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
    log.debug(msg);
    throw new RepositoryException(msg, e);
  }
  isModified = true;
}

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

public static void removeHoldFromRegistry(RegistrySession session, String s, Hold hold) throws RepositoryException {
  Resource resource = null;
  try {
    resource = session.getUserRegistry().get(s);
    List holds = resource.getPropertyValues("org.wso2.carbon.registry.jcr.retention.holds");
    List<Hold> holdList = new ArrayList<Hold>();
    String refHold = hold.getName() + ";" + hold.isDeep();
    if (holds != null) {
      for (Object _hold : holds) {
        if (_hold.equals(refHold)) {
          resource.getPropertyValues("org.wso2.carbon.registry.jcr.retention.holds").remove(_hold);
        }
      }
    }
    session.getUserRegistry().put(s, resource);
  } catch (RegistryException e) {
    throw new RepositoryException("Registry level exception when setting retention policy at " + s);
  }
}

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

/**
   * This method is used to update checkpoint current state duration information.
   *
   * @param resource       registry resource.
   * @param nextState      next lifecycle state.
   * @throws RegistryException
   */
  private void updateCheckpointProperties(Resource resource, String nextState)
      throws RegistryException {

    String checkpointProperty = LifecycleConstants.REGISTRY_LIFECYCLE + aspectName + LifecycleConstants.CHECKPOINT;
    List<String> checkpoints = resource.getPropertyValues(checkpointProperty);
    if (checkpoints != null && !checkpoints.isEmpty()) {
      for (String checkpoint : checkpoints) {
        resource.removeProperty(checkpointProperty + LifecycleConstants.DOT + checkpoint);
      }
    }
    resource.removeProperty(checkpointProperty);
    addCheckPointProperties(resource, nextState);
  }
}

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

/**
 * Remove a property from a GREG node
 */
public static void removeProperty(Registry repository,Resource resource, PropertyData<?> propertyData) throws RegistryException {
  String id = propertyData.getId();
  if(resource.getPropertyValues(id) != null ){ //has property
    resource.removeProperty(id);
    repository.put(resource.getPath(), resource);
  }
}

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

public NodeType[] getMixinNodeTypes() throws RepositoryException {
  List<NodeType> nodeTypeList = new ArrayList<NodeType>();
  try {
    Resource resource = registrySession.getUserRegistry().get(nodePath);
    List<String> mixNames = resource.getPropertyValues("jcr:mixinTypes");
    if (mixNames != null) {
      for (String name : mixNames) {
        NodeType nt = registrySession.getWorkspace().getNodeTypeManager().getNodeType(name);
        nodeTypeList.add(nt);
      }
    }
  } catch (RegistryException e) {
    throw new RepositoryException("Error while getting  mix node types from registry " + e.getMessage());
  }
  if (nodeTypeList.size() == 0) {
    return new NodeType[0];
  } else {
    return nodeTypeList.toArray(new NodeType[0]);
  }
}

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam2.core

private Integer[] getTenantsWithIndexes() throws RegistryException {
  ConfigurationContext superTenantContext = ServiceHolder.getConfigurationContextService().
      getServerConfigContext();
  UserRegistry superTenantRegistry = ServiceHolder.getRegistryService().
      getConfigSystemRegistry(SuperTenantCarbonContext.
          getCurrentContext(superTenantContext).getTenantId());
  Resource tenantTrackerResource;
  String trackerPath = PersistencyConstants.INDEX_TRACKER_PATH;
  List<Integer> tenantsWithIndexes = new ArrayList<Integer>();
  if (superTenantRegistry.resourceExists(trackerPath)) {
    tenantTrackerResource = superTenantRegistry.get(trackerPath);
    List<String> propertyValues = tenantTrackerResource.getPropertyValues(
        PersistencyConstants.TENANTS_PROPERTY);
    if (propertyValues == null) {
      propertyValues = new ArrayList<String>();
    }
    for (String propertyValue : propertyValues) {
      tenantsWithIndexes.add(Integer.valueOf(propertyValue));
    }
  }
  return tenantsWithIndexes.toArray(new Integer[]{});
}

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam2.core

if (superTenantRegistry.resourceExists(trackerPath)) {
  tenantTrackerResource = superTenantRegistry.get(trackerPath);
  List<String> propertyValues = tenantTrackerResource.getPropertyValues(
      PersistencyConstants.TENANTS_PROPERTY);
  if (propertyValues == null) {

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

private void addVersionToHistory(String nodePath, String nodeVersion) {
  try {
    String confPath = RegistryJCRSpecificStandardLoderUtil.
        getSystemConfigVersionPath((RegistrySession) session);
    Resource resource = ((RegistrySession) session).getUserRegistry().get(confPath);
    if (resource.getProperty(nodePath) != null) {
      resource.getPropertyValues(nodePath).add(nodeVersion);
    } else {
      List<String> list = new ArrayList<String>();
      list.add(nodeVersion);
      resource.setProperty(nodePath, list);
    }
    ((RegistrySession) session).getUserRegistry().put(confPath, resource);
  } catch (RegistryException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
  }
}

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam2.analyzer

if (superTenantRegistry.resourceExists(trackerPath)) {
  tenantTrackerResource = superTenantRegistry.get(trackerPath);
  List<String> propertyValues = tenantTrackerResource.getPropertyValues(
      AnalyzerConfigConstants.TENANTS_PROPERTY);
  if (propertyValues == null) {

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.analyzer

if (superTenantRegistry.resourceExists(trackerPath)) {
  tenantTrackerResource = superTenantRegistry.get(trackerPath);
  List<String> propertyValues = tenantTrackerResource.getPropertyValues(
      AnalyzerConfigConstants.TENANTS_PROPERTY);
  if (propertyValues == null) {

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam2.analyzer

if (superTenantRegistry.resourceExists(analyzerTrackerPath)) {
  tenantTrackerResource = superTenantRegistry.get(analyzerTrackerPath);
  List<String> propertyValues = tenantTrackerResource.getPropertyValues(
      AnalyzerConfigConstants.TENANTS_PROPERTY);
  if (propertyValues == null) {

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.analyzer

if (superTenantRegistry.resourceExists(analyzerTrackerPath)) {
  tenantTrackerResource = superTenantRegistry.get(analyzerTrackerPath);
  List<String> propertyValues = tenantTrackerResource.getPropertyValues(
      AnalyzerConfigConstants.TENANTS_PROPERTY);
  if (propertyValues == null) {

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

@Override
  public void delete(RequestContext requestContext) throws RegistryException {
    if (!CommonUtil.isUpdateLockAvailable()) {
      return;
    }
    CommonUtil.acquireUpdateLock();
    try {
      Resource resource = requestContext.getRegistry().get(
          requestContext.getResourcePath().getPath());
      List<String> symlinkPaths = resource.getPropertyValues("registry.resource.symlink.path");
      if (symlinkPaths != null && symlinkPaths.size() > 0) {
      for (String symlinkPath : symlinkPaths) {
        if (symlinkPath != null) {
          if (requestContext.getRegistry()
              .resourceExists(symlinkPath)) {
            requestContext.getRegistry().delete(symlinkPath);
          }
        }
      }
    }

    } finally {
      CommonUtil.releaseUpdateLock();
    }
  }
}

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

bean.setPathWithVersion(resourcePath.getPathWithVersion());
bean.setAbsent(resource.getProperty("registry.absent"));
List mountPoints = resource.getPropertyValues("registry.mountpoint");
List targetPoints = resource.getPropertyValues("registry.targetpoint");
List actualPaths = resource.getPropertyValues("registry.actualpath"); 
String user = resource.getProperty("registry.user");

相关文章