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

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

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

Registry.applyTag介绍

暂无

代码示例

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

public static void copyTags(Registry registry, String newPath, String path) throws RegistryException {
  Tag[] tags = registry.getTags(path);
  for (Tag tag : tags) {
    registry.applyTag(newPath, tag.getTagName());
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

@Override
public void addTags(String appType, String appId, List<String> tags) throws AppManagementException {
  try {
    PrivilegedCarbonContext.startTenantFlow();
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(this.username);
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(this.tenantDomain, true);
    GenericArtifactManager artifactManager = AppManagerUtil.getArtifactManager(registry, appType);
    GenericArtifact appArtifact = artifactManager.getGenericArtifact(appId);
    if (appArtifact != null) {
      for(String tag : tags){
        registry.applyTag(appArtifact.getPath(), tag);
      }
    } else {
      handleResourceNotFoundException("Failed to get " + appType + " artifact corresponding to artifactId " +
          appId + ". Artifact does not exist");
    }
  } catch (RegistryException e) {
    handleException("Error occurred while adding tags"+StringUtils.join(tags, ",")+" to " + appType +" with id : " + appId, e);
  } finally {
    PrivilegedCarbonContext.endTenantFlow();
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (tagSet != null) {
  for (String tag : tagSet) {
    registry.applyTag(artifactPath, tag);

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (tagSet != null && tagSet.size() > 0) {
  for (String tag : tagSet) {
    registry.applyTag(artifactPath, tag);

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

private String saveWebAppRegistryArtifact(WebApp webApp) throws RegistryException, AppManagementException {
  String artifactId = null;
  GenericArtifactManager artifactManager = getArtifactManager(registry, AppMConstants.WEBAPP_ASSET_TYPE);
  GenericArtifact appArtifact = buildRegistryArtifact(artifactManager, AppMConstants.WEBAPP_ASSET_TYPE, webApp);
  artifactManager.addGenericArtifact(appArtifact);
  artifactId = appArtifact.getId();
  // Set the life cycle for the persisted artifact
  GenericArtifact persistedArtifact = artifactManager.getGenericArtifact(artifactId);
  persistedArtifact.invokeAction(AppMConstants.LifecycleActions.CREATE, AppMConstants.WEBAPP_LIFE_CYCLE);
  // Apply tags
  String artifactPath = GovernanceUtils.getArtifactPath(registry, artifactId);
  if (webApp.getTags() != null) {
    for (String tag : webApp.getTags()) {
      registry.applyTag(artifactPath, tag);
    }
  }
  // Set resources permissions based on app visibility.
  if (webApp.getAppVisibility() != null) {
    AppManagerUtil.setResourcePermissions(webApp.getId().getProviderName(), AppMConstants.API_RESTRICTED_VISIBILITY, webApp.getAppVisibility(), artifactPath);
  }
  // Add registry associations.
  String providerPath = AppManagerUtil.getAPIProviderPath(webApp.getId());
  registry.addAssociation(providerPath, artifactPath, AppMConstants.PROVIDER_ASSOCIATION);
  return artifactId;
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

private void updateWebAppRegistryArtifact(WebApp webApp) throws RegistryException, AppManagementException {
  GenericArtifactManager artifactManager = getArtifactManager(registry, AppMConstants.WEBAPP_ASSET_TYPE);
  GenericArtifact updatedWebAppArtifact = buildRegistryArtifact(artifactManager, AppMConstants.WEBAPP_ASSET_TYPE, webApp);
  updatedWebAppArtifact.setId(webApp.getUUID());
  artifactManager.updateGenericArtifact(updatedWebAppArtifact);
  // Apply tags
  String artifactPath = GovernanceUtils.getArtifactPath(registry, webApp.getUUID());
  if (webApp.getTags() != null) {
    for (String tag : webApp.getTags()) {
      registry.applyTag(artifactPath, tag);
    }
  }
  // Set resources permissions based on app visibility.
  if (webApp.getAppVisibility() == null) {
    AppManagerUtil.setResourcePermissions(webApp.getId().getProviderName(),
                       AppMConstants.API_GLOBAL_VISIBILITY, webApp.getAppVisibility(),
                       artifactPath);
  } else {
    AppManagerUtil.setResourcePermissions(webApp.getId().getProviderName(),
                       AppMConstants.API_RESTRICTED_VISIBILITY, webApp.getAppVisibility(),
                       artifactPath);
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (tagSet != null) {
  for (String tag : tagSet) {
    registry.applyTag(artifactPath, tag);

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (tagSet != null) {
  for (String tag : tagSet) {
    registry.applyTag(artifactPath, tag);

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

if (tagSet != null) {
  for (String tag : tagSet) {
    registry.applyTag(artifactPath, tag);

相关文章