Disable all overrides for a specified path with overrideType

@param pathID ID of path containing overrides
@param clientUUID UUID of client
@param overrideType Override type identifier
976094
public void disableAllOverrides(int pathID, String clientUUID, int overrideType) {
        PreparedStatement statement = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            ArrayList<Integer> enabledOverrides = new ArrayList<Integer>();
            enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_ADD);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_REMOVE);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM_POST_BODY);

            String overridePlaceholders = preparePlaceHolders(enabledOverrides.size());

            statement = sqlConnection.prepareStatement(
                "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                    " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ? " +
                    " AND " + Constants.GENERIC_CLIENT_UUID + " = ? " +
                    " AND " + Constants.ENABLED_OVERRIDES_OVERRIDE_ID +
                    (overrideType == Constants.OVERRIDE_TYPE_RESPONSE ? " NOT" : "") +
                    " IN ( " + overridePlaceholders + " )"
            );
            statement.setInt(1, pathID);
            statement.setString(2, clientUUID);
            for (int i = 3; i <= enabledOverrides.size() + 2; ++i) {
                statement.setInt(i, enabledOverrides.get(i - 3));
            }
            statement.execute();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
119267
public void setResourceId(String resourceId) {

        try {
            if (!m_type.isFolder()) {
                m_resourceId = new CmsUUID(resourceId);
            } else {
                m_resourceId = new CmsUUID();
            }
        } catch (Throwable e) {
            setThrowable(e);
        }
    }
1271098
public void removeConfig(AbstractInterfaceConfig config, String overridePath, ChildData data,
                             AbstractInterfaceConfig registerConfig)
        throws Exception {
        if (data == null) {
            if (LOGGER.isInfoEnabled(config.getAppName())) {
                LOGGER.infoWithApp(config.getAppName(), "Receive data is null");
            }
        } else if (registerConfig == null) {
            if (LOGGER.isInfoEnabled(config.getAppName())) {
                LOGGER.infoWithApp(config.getAppName(), "Register config is null");
            }
        } else {
            if (LOGGER.isInfoEnabled(config.getAppName())) {
                LOGGER.infoWithApp(config.getAppName(), "Receive data: path=[" + data.getPath() + "]" + ", data=[" +
                    StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]");
            }
            notifyListeners(config, overridePath, data, true, registerConfig);
        }
    }
893488
public void updateClientId(String clientId) {
        if (configForVM != null) {
            configForVM.withClientId(clientId);
        } else {
            configForAppService.withClientId(clientId);
        }
    }
1102882
public boolean addMethodToResponseOverride(String pathName, String methodName) {
        // need to find out the ID for the method
        // TODO: change api for adding methods to take the name instead of ID
        try {
            Integer overrideId = getOverrideIdForMethodName(methodName);

            // now post to path api to add this is a selected override
            BasicNameValuePair[] params = {
                new BasicNameValuePair("addOverride", overrideId.toString()),
                new BasicNameValuePair("profileIdentifier", this._profileName)
            };
            JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName), params));
            // check enabled endpoints array to see if this overrideID exists
            JSONArray enabled = response.getJSONArray("enabledEndpoints");
            for (int x = 0; x < enabled.length(); x++) {
                if (enabled.getJSONObject(x).getInt("overrideId") == overrideId) {
                    return true;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return false;
    }
623542
@Override
    public void setClientID(String clientID) throws InvalidClientIDRuntimeException, IllegalStateRuntimeException, JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setClientID", new Object[] { clientID });

        try {
            jmsConnection.setClientID(clientID);
        } catch (InvalidClientIDException icie) {
            throw (InvalidClientIDRuntimeException) JmsErrorUtils.getJMS2Exception(icie, InvalidClientIDRuntimeException.class);
        } catch (IllegalStateException ise) {
            throw (IllegalStateRuntimeException) JmsErrorUtils.getJMS2Exception(ise, IllegalStateRuntimeException.class);
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "setClientID");
        }

    }
1142821
public static void addOverrideToPath() throws Exception {
        Client client = new Client("ProfileName", false);

        // Use the fully qualified name for a plugin override.
        client.addMethodToResponseOverride("Test Path", "com.groupon.odo.sample.Common.delay");

        // The third argument is the ordinal - the nth instance of this override added to this path
        // The final arguments count and type are determined by the override. "delay" used in this sample
        // has a single int argument - # of milliseconds delay to simulate
        client.setMethodArguments("Test Path", "com.groupon.odo.sample.Common.delay", 1, "100");
    }
373071
public String getOverrideForce(String configurationId, String parameterName) {
    Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(configurationId);
    if (overrideForceScopeMapEntry != null) {
      return overrideForceScopeMapEntry.get(parameterName);
    }
    return null;
  }
1037959
private static boolean overridePropsInNodeBean(final NodeBean nodeBean, final String[] pathList,
      final int idx, final Props prop) {
    if (idx < pathList.length && nodeBean.getName().equals(pathList[idx])) {
      if (idx == pathList.length - 1) {
        if (prop.containsKey(Constants.NODE_TYPE)) {
          nodeBean.setType(prop.get(Constants.NODE_TYPE));
        }
        final Map<String, String> config = prop.getFlattened();
        config.remove(Constants.NODE_TYPE);
        nodeBean.setConfig(config);
        return true;
      }
      for (final NodeBean bean : nodeBean.getNodes()) {
        if (overridePropsInNodeBean(bean, pathList, idx + 1, prop)) {
          return true;
        }
      }
    }
    return false;
  }
285712
@Override
	public void removeByUuid(String uuid) {
		for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid(
				uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceVirtualOrderItem);
		}
	}
982074
@Override
	public final void setClientID(String clientID) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
    	{
	        super.setClientID(clientID);
	        try
	        {
	        	ClientIDRegistry.getInstance().register(clientID);
	        }
	        catch (JMSException e)
	        {
	        	this.clientID = null; // Clear client ID
	        	throw e;
	        }
    	}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
615710
protected void remove(CmsUUID structureId, String rootPath, int type) {

        if (CmsResource.isTemporaryFileName(rootPath)) {
            return;
        }
        m_pathCache.remove(structureId);
        if (isSitemapConfiguration(rootPath, type)) {
            m_workQueue.add(structureId);
        } else if (isModuleConfiguration(rootPath, type)) {
            m_workQueue.add(ID_UPDATE_MODULES);
        } else if (isElementView(type)) {
            m_workQueue.add(ID_UPDATE_ELEMENT_VIEWS);
        } else if (m_state.getFolderTypes().containsKey(rootPath)) {
            m_workQueue.add(ID_UPDATE_FOLDERTYPES);
        }
    }
96219
private void overridePacksAndModules(Celerio celerio) {
        String filename = xmlTemplatePacksOverride;
        if (!FileUtils.fileExists(filename)) {
            return;
        }
        getLog().info("Overriding configuration with " + filename);

        CelerioLoader celerioLoader = context.getBean(CelerioLoader.class);
        try {
            Configuration configuration = celerioLoader.load(filename).getConfiguration();
            // override celerioContext
            CelerioTemplateContext ctc = configuration.getCelerioTemplateContext();
            if (ctc != null) {
                celerio.getConfiguration().setCelerioTemplateContext(ctc);
            }

            // override packs
            List<Pack> newPacks = configuration.getPacks();
            if (newPacks != null && !newPacks.isEmpty()) {
                celerio.getConfiguration().setPacks(newPacks);
            }

            // override modules
            List<Module> newModules = configuration.getModules();
            if (newModules != null && !newModules.isEmpty()) {
                celerio.getConfiguration().setModules(newModules);
            }
        } catch (Exception e) {
            throw new RuntimeException("Could not do override: ["+ filename + "]", e);
        }
    }
931986
@Override
	public void removeByUuid(String uuid) {
		for (CommerceOrder commerceOrder : findByUuid(uuid, QueryUtil.ALL_POS,
				QueryUtil.ALL_POS, null)) {
			remove(commerceOrder);
		}
	}
859917
@Override
	public void removeByUuid_C(String uuid, long companyId) {
		for (CommerceSubscriptionEntry commerceSubscriptionEntry : findByUuid_C(
				uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(commerceSubscriptionEntry);
		}
	}
612581
public void setClientID(String clientID) {
        if (clientID == null || clientID.isEmpty()) {
            this.clientID = DEFAULT_CLIENT_ID;
            return;
        }
        this.clientID = clientID;
    }
1096268
private Integer getNextOrdinalForMethodId(int methodId, String pathName) throws Exception {
        String pathInfo = doGet(BASE_PATH + uriEncode(pathName), new BasicNameValuePair[0]);
        JSONObject pathResponse = new JSONObject(pathInfo);

        JSONArray enabledEndpoints = pathResponse.getJSONArray("enabledEndpoints");
        int lastOrdinal = 0;
        for (int x = 0; x < enabledEndpoints.length(); x++) {
            if (enabledEndpoints.getJSONObject(x).getInt("overrideId") == methodId) {
                lastOrdinal++;
            }
        }
        return lastOrdinal + 1;
    }