本文整理汇总了Java中org.wso2.carbon.registry.api.Registry.delete方法的典型用法代码示例。如果您正苦于以下问题:Java Registry.delete方法的具体用法?Java Registry.delete怎么用?Java Registry.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.api.Registry
的用法示例。
在下文中一共展示了Registry.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renameAppPermissionPathNode
import org.wso2.carbon.registry.api.Registry; //导入方法依赖的package包/类
/**
* Rename the registry path node name for a deleted Service provider role.
*
* @param oldName
* @param newName
* @throws IdentityApplicationManagementException
*/
public static void renameAppPermissionPathNode(String oldName, String newName)
throws IdentityApplicationManagementException {
List<ApplicationPermission> loadPermissions = loadPermissions(oldName);
String newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + oldName;
Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.USER_GOVERNANCE);
//creating new application node
try {
for (ApplicationPermission applicationPermission : loadPermissions) {
tenantGovReg.delete(newApplicationNode + PATH_CONSTANT + applicationPermission.getValue());
}
tenantGovReg.delete(newApplicationNode);
Collection permissionNode = tenantGovReg.newCollection();
permissionNode.setProperty("name", newName);
newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + newName;
ApplicationMgtUtil.applicationNode = newApplicationNode;
tenantGovReg.put(newApplicationNode, permissionNode);
addPermission(loadPermissions.toArray(new ApplicationPermission[loadPermissions.size()]), tenantGovReg);
} catch (RegistryException e) {
throw new IdentityApplicationManagementException("Error while renaming permission node "
+ oldName + "to " + newName, e);
}
}
示例2: deletePermissions
import org.wso2.carbon.registry.api.Registry; //导入方法依赖的package包/类
/**
* Delete the resource
*
* @param applicationName
* @throws IdentityApplicationManagementException
*/
public static void deletePermissions(String applicationName) throws IdentityApplicationManagementException {
String applicationNode = getApplicationPermissionPath() + PATH_CONSTANT + applicationName;
Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.USER_GOVERNANCE);
try {
boolean exist = tenantGovReg.resourceExists(applicationNode);
if (exist) {
tenantGovReg.delete(applicationNode);
}
} catch (RegistryException e) {
throw new IdentityApplicationManagementException("Error while storing permissions", e);
}
}
示例3: deletePolicy
import org.wso2.carbon.registry.api.Registry; //导入方法依赖的package包/类
@Override
public void deletePolicy(String policyId) throws EntitlementException {
Registry registry = EntitlementServiceComponent.
getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId());
try {
if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId)) {
registry.delete(PDPConstants.ENTITLEMENT_POLICY_VERSION + policyId);
}
} catch (RegistryException e) {
log.error("Error while deleting all versions of policy", e);
}
}
示例4: deleteDASConfigInfo
import org.wso2.carbon.registry.api.Registry; //导入方法依赖的package包/类
/**
* Delete DAS configuration details (received from PC), from config registry
*
* @param processDefinitionIdJSONString JSON string contains process definition id
* @throws RegistryException Throws RegistryException if error occurred in accessing registry
* @throws IOException Throws IOException if an error occurred in hadling json content
*/
private void deleteDASConfigInfo(String processDefinitionIdJSONString) throws RegistryException, IOException {
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
Registry configRegistry = carbonContext.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode dasConfigDetailsJOb = objectMapper.readTree(processDefinitionIdJSONString);
String processDefinitionId = dasConfigDetailsJOb.get(AnalyticsPublisherConstants.PROCESS_DEFINITION_ID)
.textValue();
configRegistry.delete(AnalyticsPublisherConstants.REG_PATH_BPMN_ANALYTICS + processDefinitionId + "/"
+ AnalyticsPublisherConstants.ANALYTICS_CONFIG_FILE_NAME);
}
示例5: updatePermissions
import org.wso2.carbon.registry.api.Registry; //导入方法依赖的package包/类
/**
* Updates the permissions of the application
*
* @param applicationName
* @param permissions
* @throws IdentityApplicationManagementException
*/
public static void updatePermissions(String applicationName, ApplicationPermission[] permissions)
throws IdentityApplicationManagementException {
applicationNode = getApplicationPermissionPath() + PATH_CONSTANT + applicationName;
Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.USER_GOVERNANCE);
try {
boolean exist = tenantGovReg.resourceExists(applicationNode);
if (!exist) {
Collection appRootNode = tenantGovReg.newCollection();
appRootNode.setProperty("name", applicationName);
tenantGovReg.put(applicationNode, appRootNode);
}
Collection appNodeCollec = (Collection) tenantGovReg.get(applicationNode);
String[] childern = appNodeCollec.getChildren();
// new permissions are null. deleting all permissions case
if ((childern != null && childern.length > 0)
&& (permissions == null || permissions.length == 0)) { // there are permissions
tenantGovReg.delete(applicationNode);
}
if (ArrayUtils.isEmpty(permissions)) {
return;
}
// no permission exist for the application, create new
if (childern == null || appNodeCollec.getChildCount() < 1) {
addPermission(permissions, tenantGovReg);
} else { // there are permission
List<ApplicationPermission> loadPermissions = loadPermissions(applicationName);
for (ApplicationPermission applicationPermission : loadPermissions) {
tenantGovReg.delete(applicationNode + PATH_CONSTANT + applicationPermission.getValue());
}
addPermission(permissions, tenantGovReg);
}
} catch (RegistryException e) {
throw new IdentityApplicationManagementException("Error while storing permissions", e);
}
}