public void dissociate(RequestContext context) { Resource resource = context.getResource(); if (resource != null) { resource.removeProperty(stateProperty); resource.removeProperty(lifecycleProperty); } }
@Override public void dissociate(RequestContext requestContext) { Resource resource = requestContext.getResource(); if (resource != null) { resource.removeProperty(stateProperty); resource.removeProperty(lifecycleProperty); } }
public void dissociate(RequestContext context) { Resource resource = context.getResource(); if (resource != null) { resource.removeProperty(stateProperty); resource.removeProperty(lifecyleProperty); } }
public static void clearTransitionApprovals(Resource resource, String aspectName) { Properties properties = (Properties) resource.getProperties().clone(); for (Object o : properties.keySet()) { String key = (String) o; if (key.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_VOTES_OPTION + aspectName)) { resource.removeProperty(key); } else if (key.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_USER_VOTE + aspectName)) { resource.removeProperty(key); } } }
public static void clearCheckItems(Resource resource, String aspectName){ Properties properties = (Properties) resource.getProperties().clone(); for (Object o : properties.keySet()) { String key = (String) o; if(key.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_CHECKLIST_OPTION + aspectName + LifecycleConstants.DOT)){ resource.removeProperty(key); } } }
public void dissociate(RequestContext context) { context.getResource().removeProperty(PHASE_PROPERTY); }
/** * 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); } }
public static void addTransitionUI(Resource resource,Map<String,String> transitionUI, String aspectName){ List<String> tobeRemoved = new ArrayList<String>(); Properties properties = resource.getProperties(); for (Object key : properties.keySet()) { if(key.toString().startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_CHECKLIST_TRANSITION_UI + aspectName)){ tobeRemoved.add(key.toString()); } } for (String key : tobeRemoved) { resource.removeProperty(key); } if (transitionUI != null) { for (Map.Entry<String, String> entry : transitionUI.entrySet()) { resource.setProperty( LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_CHECKLIST_TRANSITION_UI + aspectName + "." + entry.getKey() ,entry.getValue()); } } }
public static void jsFunction_removeProperty(Context cx, Scriptable thisObj, Object[] arguments, Function funObj) throws CarbonException { ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj; if (arguments.length == 1) { if (arguments[0] instanceof String) { resourceHostObject.resource.removeProperty((String) arguments[0]); } else { throw new CarbonException("Invalid argument type for removeProperty() method"); } } else { throw new CarbonException("Invalid no. of arguments for removeProperty() method"); } }
/** * @param parameterDO * @throws IdentityException */ public void removeParameter(ParameterDO parameterDO) throws IdentityException { String path = null; Resource resource = null; if (log.isDebugEnabled()) { log.debug("Removing parameter"); } try { path = IdentityRegistryResources.CARD_ISSUER; if (registry.resourceExists(path)) { resource = registry.get(path); if (resource != null) { resource.removeProperty(parameterDO.getName()); registry.put(path, resource); } } } catch (RegistryException e) { log.error("Error while removing parameter", e); throw IdentityException.error("Error while removing parameter", e); } }
/** * 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); } }
public static void removeRetentionPolicies(RegistrySession session) throws RepositoryException { try { if(session.getUserRegistry().resourceExists("/jcr_system/workspaces/default_workspace/testroot")) { Resource r = session.getUserRegistry().get("/jcr_system/workspaces/default_workspace/testroot"); r.removeProperty("org.wso2.carbon.registry.jcr.retention.policy"); r.removeProperty("org.wso2.carbon.registry.jcr.retention.holds"); session.getUserRegistry().put(r.getPath(),r); } } catch (RegistryException e) { throw new RepositoryException("Unable to remove TCK retention test data"); } } }
public static void removeRetentionPolicyFromRegistry(RegistrySession session, String s) throws RepositoryException { Resource resource = null; try { resource = session.getUserRegistry().get(s); resource.removeProperty("org.wso2.carbon.registry.jcr.retention.policy"); session.getUserRegistry().put(s, resource); } catch (RegistryException e) { throw new RepositoryException("Registry level exception when setting retention policy at " + s); } }
private void removeTrustedService(String groupName, String serviceName, String trustedService) throws SecurityConfigException { Registry registry; String resourcePath; Resource resource; try { resourcePath = RegistryResources.SERVICE_GROUPS + groupName + RegistryResources.SERVICES + serviceName + "/trustedServices"; registry = getConfigSystemRegistry(); //TODO: Multitenancy if (registry != null && registry.resourceExists(resourcePath)) { resource = registry.get(resourcePath); if (resource.getProperty(trustedService) != null) { resource.removeProperty(trustedService); } registry.put(resourcePath, resource); } } catch (Exception e) { log.error("Error occured while removing trusted service for STS", e); throw new SecurityConfigException("Error occured while adding trusted service for STS", e); } }
private void removeTrustedService(String groupName, String serviceName, String trustedService) throws SecurityConfigException { Registry registry; String resourcePath; Resource resource; try { resourcePath = RegistryResources.SERVICE_GROUPS + groupName + RegistryResources.SERVICES + serviceName + "/trustedServices"; registry = getConfigSystemRegistry(); //TODO: Multitenancy if (registry != null && registry.resourceExists(resourcePath)) { resource = registry.get(resourcePath); if (resource.getProperty(trustedService) != null) { resource.removeProperty(trustedService); } registry.put(resourcePath, resource); } } catch (Exception e) { log.error("Error occured while removing trusted service for STS", e); throw new SecurityConfigException("Error occured while adding trusted service for STS", e); } }
public void removeProperty(String path, String key) { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); Resource resource = registry.get(path); resource.removeProperty(key); registry.put(path, resource); } catch (RegistryException e) { String msg = "Unable to remove property."; log.error(msg, e); // we are unable to throw a customized exception or an exception with the cause or if // not, JConsole needs additional Jars to marshall exceptions. throw new RuntimeException(Utils.buildMessageForRuntimeException(e, msg)); } finally { PrivilegedCarbonContext.endTenantFlow(); } } }
public void removeVersionLabel(String s) throws VersionException, RepositoryException { try { Resource res = ((RegistrySession) session).getUserRegistry().get( RegistryJCRSpecificStandardLoderUtil. getSystemConfigVersionLabelPath((RegistrySession) session)); if (res.getProperty(s) != null) { res.removeProperty(s); } ((RegistrySession) session).getUserRegistry().put(RegistryJCRSpecificStandardLoderUtil. getSystemConfigVersionLabelPath((RegistrySession) session), res); } catch (RegistryException e) { throw new RepositoryException("Exception occurred in registry level " + s); } }
/** * Method to remove property. * * @param path path of the resource. * @param name property name. * * @throws RegistryException throws if there is an error. */ public void removeProperty(String path, String name) throws RegistryException { UserRegistry registry = (UserRegistry) getRootRegistry(); if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) { return; } Resource resource = registry.get(path); resource.removeProperty(name); registry.put(resource.getPath(), resource); resource.discard(); }
public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException { RegistryJCRItemOperationUtil.validateReadOnlyItemOpr(session); RegistryJCRItemOperationUtil.checkRetentionPolicy(session, getNodePath()); RegistryJCRItemOperationUtil.checkRetentionHold(session, getNodePath()); try { if (isResource) { session.getUserRegistry().delete(path); } else { Resource node = session.getUserRegistry().get(path); node.removeProperty(name); session.getUserRegistry().put(path, node); } } catch (RegistryException e) { String msg = "failed to remove the property " + this; log.debug(msg); throw new RepositoryException(msg, e); } }
/** * Update the topic index by holding the thread * * @param mode Insert | Delete * @param id subscription id * @param topic topic name * @throws Exception RegistryException */ private synchronized void updateTopicIndex(boolean mode, String id, String topic) throws RegistryException { if (mode) { resTopicIndex = registry.get(getTopicIndexPath()); resTopicIndex.addProperty(id, topic + "/" + SUBSCRIPTION_COLLECTION_NAME); registry.put(getTopicIndexPath(), resTopicIndex); } else { resTopicIndex = registry.get(getTopicIndexPath()); resTopicIndex.removeProperty(id); registry.put(getTopicIndexPath(), resTopicIndex); } }