<commit_before>package gov.nih.nci.cagrid.gridgrouper.plugin.introduce;

import gov.nih.nci.cagrid.introduce.beans.extension.ExtensionType;
import gov.nih.nci.cagrid.introduce.beans.extension.ExtensionTypeExtensionData;
import gov.nih.nci.cagrid.introduce.beans.service.ServiceType;

import javax.xml.namespace.QName;

import org.apache.axis.message.MessageElement;

public class PluginUtils {

	public static GridGrouperPlugin resetPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		GridGrouperPlugin plugin = null;
		MessageElement[] mes = new MessageElement[1];
		data.set_any(mes);
		plugin = new GridGrouperPlugin();
		mes[0] = new MessageElement(new QName(
				"http://cagrid.nci.nih.gov/1/gridgrouper-plugin",
				"GridGrouperPlugin"), plugin);
		return plugin;
	}

	public static GridGrouperPlugin getPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		MessageElement[] mes = data.get_any();
		if (mes == null) {
			mes = new MessageElement[1];
			data.set_any(mes);
		}

		if (mes[0] == null) {
			return null;
		} else {
			return (GridGrouperPlugin) mes[0].getObjectValue();
		}
	}

	public static GridGrouperPlugin getAddPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		GridGrouperPlugin plugin = null;
		MessageElement[] mes = data.get_any();
		if (mes == null) {
			mes = new MessageElement[1];
			data.set_any(mes);
		}

		if (mes[0] == null) {
			plugin = new GridGrouperPlugin();
			mes[0] = new MessageElement(new QName(
					"http://cagrid.nci.nih.gov/1/gridgrouper-plugin",
					"GridGrouperPlugin"), plugin);
		} else {
			plugin = (GridGrouperPlugin) mes[0].getObjectValue();
		}
		return plugin;
	}

	public static ProtectedService getProtectedService(
			GridGrouperPlugin plugin, ServiceType st) {
		ProtectedService[] services = plugin.getProtectedService();
		if (services != null) {
			for (int i = 0; i < services.length; i++) {
				if (services[i].getServiceName().equals(st.getName())) {
					return services[i];
				}
			}
		}
		return null;
	}

	public static ProtectedService getAddProtectedService(
			GridGrouperPlugin plugin, ServiceType st) {
		ProtectedService service = getProtectedService(plugin, st);
		if (service != null) {
			return service;
		} else {
			service = new ProtectedService();
			service.setServiceName(st.getName());
			ProtectedService[] services = plugin.getProtectedService();
			ProtectedService[] newservices = null;
			if (services == null) {
				newservices = new ProtectedService[1];
			} else {
				newservices = new ProtectedService[services.length + 1];
				System.arraycopy(services, 0, newservices, 0, services.length);
			}
			newservices[services.length] = service;
			return service;<commit_msg>*** empty log message ***<commit_after>package gov.nih.nci.cagrid.gridgrouper.plugin.introduce;

import gov.nih.nci.cagrid.introduce.beans.extension.ExtensionType;
import gov.nih.nci.cagrid.introduce.beans.extension.ExtensionTypeExtensionData;
import gov.nih.nci.cagrid.introduce.beans.service.ServiceType;

import javax.xml.namespace.QName;

import org.apache.axis.message.MessageElement;

public class PluginUtils {

	public static GridGrouperPlugin resetPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		GridGrouperPlugin plugin = null;
		MessageElement[] mes = new MessageElement[1];
		data.set_any(mes);
		plugin = new GridGrouperPlugin();
		mes[0] = new MessageElement(new QName(
				"http://cagrid.nci.nih.gov/1/gridgrouper-plugin",
				"GridGrouperPlugin"), plugin);
		return plugin;
	}

	public static GridGrouperPlugin getPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		MessageElement[] mes = data.get_any();
		if (mes == null) {
			mes = new MessageElement[1];
			data.set_any(mes);
		}

		if (mes[0] == null) {
			return null;
		} else {
			return (GridGrouperPlugin) mes[0].getObjectValue();
		}
	}

	public static GridGrouperPlugin getAddPlugin(ExtensionType ext) {
		ExtensionTypeExtensionData data = ext.getExtensionData();
		if (data == null) {
			data = new ExtensionTypeExtensionData();
			ext.setExtensionData(data);
		}
		GridGrouperPlugin plugin = null;
		MessageElement[] mes = data.get_any();
		if (mes == null) {
			mes = new MessageElement[1];
			data.set_any(mes);
		}

		if (mes[0] == null) {
			plugin = new GridGrouperPlugin();
			mes[0] = new MessageElement(new QName(
					"http://cagrid.nci.nih.gov/1/gridgrouper-plugin",
					"GridGrouperPlugin"), plugin);
		} else {
			plugin = (GridGrouperPlugin) mes[0].getObjectValue();
		}
		return plugin;
	}

	public static ProtectedService getProtectedService(
			GridGrouperPlugin plugin, ServiceType st) {
		ProtectedService[] services = plugin.getProtectedService();
		if (services != null) {
			for (int i = 0; i < services.length; i++) {
				if (services[i].getServiceName().equals(st.getName())) {
					return services[i];
				}
			}
		}
		return null;
	}

	public static ProtectedService getAddProtectedService(
			GridGrouperPlugin plugin, ServiceType st) {
		ProtectedService service = getProtectedService(plugin, st);
		if (service != null) {
			return service;
		} else {
			service = new ProtectedService();
			service.setServiceName(st.getName());
			ProtectedService[] services = plugin.getProtectedService();
			ProtectedService[] newservices = null;
			if (services == null) {
				newservices = new ProtectedService[1];
				newservices[0] = service;
			} else {
				newservices = new ProtectedService[services.length + 1];
				System.arraycopy(services, 0, newservices, 0, services.length);
				newservices[services.length] = service;
			}
		
			return service;
{'fraction_non_alphanumeric': 0.1245985870263327, 'fraction_numerical': 0.0052986512524084775, 'mean_word_length': 4.2788135593220336, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7595861', 'n_tokens_mistral': 2290, 'n_tokens_neox': 1996, 'n_words': 417}