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

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

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

Registry.removeAssociation介绍

暂无

代码示例

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

private static void removeEndpointDependencies(String servicePath, Registry registry) throws RegistryException {
  // update lock check removed from for loop to prevent the database lock
    Association[] associations = registry.getAllAssociations(servicePath);
    for (Association association : associations) {
      String path = association.getDestinationPath();
      if (registry.resourceExists(path)) {
        Resource endpointResource = registry.get(path);
        if (CommonConstants.ENDPOINT_MEDIA_TYPE.equals(endpointResource.getMediaType())) {
          registry.removeAssociation(servicePath, path, CommonConstants.DEPENDS);
          registry.removeAssociation(path, servicePath, CommonConstants.USED_BY);
        }
      }
    }
}

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

/**
 * Detach the current artifact from the provided artifact. Both the artifacts should be saved,
 * before calling this method.
 *
 * @param artifactId the artifact id of the attached artifact
 * @throws GovernanceException throws if the operation failed.
 */
public void detach(String artifactId) throws GovernanceException {
  checkRegistryResourceAssociation();
  // uses the path from the getter to make sure the used overloaded method
  String path = getPath();
  String artifactPath = GovernanceUtils.getArtifactPath(registry, artifactId);
  if (artifactPath == null) {
    String msg = "Attached to artifact is not associated with a registry path.";
    log.error(msg);
    throw new GovernanceException(msg);
  }
  try {
    registry.removeAssociation(path, artifactPath, GovernanceConstants.DEPENDS);
    registry.removeAssociation(artifactPath, path, GovernanceConstants.USED_BY);
  } catch (RegistryException e) {
    String msg = "Error in detaching the artifact. source id: " + id + ", path: " + path +
        ", target id: " + artifactId +
        ", target path:" + artifactPath + ".";
    log.error(msg, e);
    throw new GovernanceException(msg, e);
  }
}

代码示例来源:origin: org.wso2.greg/org.wso2.carbon.governance.samples.shutterbug

for(Association association : associations) {
    String destination = association.getDestinationPath();
    registry.removeAssociation(destination, resourcePath, ASSOCIATION_TYPE_VOTED);
    registry.removeAssociation(resourcePath, destination, ASSOCIATION_TYPE_USED_BY);
    ASSOCIATION_TYPE_THUMBNAIL);
if (thumbnailAssociations != null && thumbnailAssociations.length != 0) {
  registry.removeAssociation(thumbnailAssociations[0].getSourcePath(),
      thumbnailAssociations[0].getDestinationPath(), ASSOCIATION_TYPE_THUMBNAIL);

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

registry.removeAssociation(params[0], params[1], params[2]);

代码示例来源:origin: org.wso2.greg/org.wso2.carbon.governance.samples.shutterbug

public void removeAssociation(RequestContext requestContext) throws RegistryException {
  String type = requestContext.getAssociationType();
  if (!type.equals(ASSOCIATION_TYPE_VOTED)) {
    log.debug("Non-voted association added to votes resource");
    return;
  }
  Registry registry = Utils.getRegistryService().getSystemRegistry();
  Resource shutterbugCollection = registry.get(shutterbugHome);
  String tenantUser = Utils.getTenantUser();
  String uuid = shutterbugCollection.getProperty(tenantUser);
  if (uuid == null) {
    throw new RegistryException("You need to upload an image before you vote");
  }
  String destination = requestContext.getTargetPath();
  if (!registry.resourceExists(destination)) {
    throw new RegistryException("Provided image path is invalid");
  }
  String source = shutterbugHome + RegistryConstants.PATH_SEPARATOR + uuid +
      RegistryConstants.PATH_SEPARATOR + VOTE_PATH;
  registry.removeAssociation(destination, source, ASSOCIATION_TYPE_USED_BY);
  registry.removeAssociation(source, destination, ASSOCIATION_TYPE_VOTED);
  requestContext.setProcessingComplete(true);
}

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

if (!(oldPathNewPathMap.containsValue(association.getSourcePath()))
    || !(oldPathNewPathMap.containsValue(association.getDestinationPath()))) {
  registry.removeAssociation(association.getSourcePath(), association.getDestinationPath()
      , association.getAssociationType());

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

Resource targetResource = registry.get(targetPath);
if (CommonConstants.ENDPOINT_MEDIA_TYPE.equals(targetResource.getMediaType())) {
  registry.removeAssociation(servicePath, targetResource.getPath(),
      CommonConstants.DEPENDS);
  registry.removeAssociation(targetResource.getPath(), servicePath,
      CommonConstants.USED_BY);

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

registry.removeAssociation(servicePath, oldSwaggerUrl, CommonConstants.DEPENDS);
registry.removeAssociation(oldSwaggerUrl, servicePath, CommonConstants.USED_BY);
registry.removeAssociation(servicePath, oldWadlUrl, CommonConstants.DEPENDS);
registry.removeAssociation(oldWadlUrl, servicePath, CommonConstants.USED_BY);

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

for(Association dependency : dependencies) {
  if(dependency.getSourcePath().equals(schemaPath)) {
    registry.removeAssociation(dependency.getSourcePath(), dependency.getDestinationPath(), CommonConstants.DEPENDS);
    registry.removeAssociation(dependency.getDestinationPath(), dependency.getSourcePath(), CommonConstants.USED_BY);

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

for(Association dependency : dependencies) {
  if(dependency.getSourcePath().equals(schemaPath)) {
    registry.removeAssociation(dependency.getSourcePath(),
        dependency.getDestinationPath(), CommonConstants.DEPENDS);
    registry.removeAssociation(dependency.getDestinationPath(),
        dependency.getSourcePath(), CommonConstants.USED_BY);

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

for (Association association : associations) {
  associatedRes.add(association.getDestinationPath());
  registry.removeAssociation(resourcePath.getPath(), association.getDestinationPath(), association.getAssociationType());
  for (Association association : allAssociations) {
    allAssociatedRes.add(association.getDestinationPath());
    registry.removeAssociation(path, association.getDestinationPath(), association.getAssociationType());

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

|| (!"".endsWith(oldDefinition) && !oldDefinition.equals(definitionURL))) {
try {
  registry.removeAssociation(servicePath, oldDefinition, CommonConstants.DEPENDS);
  registry.removeAssociation(oldDefinition, servicePath, CommonConstants.USED_BY);
  EndpointUtils.removeEndpointEntry(oldDefinition,servicePath, serviceInfoElement, registry);
  resource.setContent(RegistryUtils.decodeBytes((serviceInfoElement.toString()).getBytes()));

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

|| (!"".endsWith(oldDefinition) && !oldDefinition.equals(definitionURL))) {
try {
  registry.removeAssociation(servicePath, oldDefinition, CommonConstants.DEPENDS);
  registry.removeAssociation(oldDefinition, servicePath, CommonConstants.USED_BY);
  EndpointUtils.removeEndpointEntry(oldDefinition, servicePath, serviceInfoElement, registry);
  resource.setContent(RegistryUtils.decodeBytes((serviceInfoElement.toString()).getBytes()));

相关文章