<commit_before>/*
 * jETeL/CloverETL - Java based ETL application framework.
 * Copyright (c) Javlin, a.s. (<EMAIL>)
 *  
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.jetel.graph;

import org.jetel.util.FileType;
import org.jetel.util.string.StringUtils;

/**
 * This enumeration represents various kind of jobs from clover engine family.
 * For now only ETL graph and jobflow types are considered.
 * Each graph has specified its jobType, {@link TransformationGraph#getJobType()}.
 * Job type is defined in *.grf file as an XML attribute of top level 'Graph' element.
 * 
 * @author Kokon (<EMAIL>)
 *         (c) Javlin, a.s. (www.cloveretl.com)
 *
 * @created 2 May 2012
 */
public enum JobType {

	/** This type represents regular ETL graphs */
	ETL_GRAPH("etlGraph", "Graph", FileType.ETL_GRAPH),
	/** This type represents jobflows */
	JOBFLOW("jobflow", "Jobflow", FileType.JOBFLOW),
	PROFILER_JOB("profilerJob", "Profiler job", FileType.PROFILER_JOB),
	SUBGRAPH("subgraph", "Subgraph", FileType.SUBGRAPH, ETL_GRAPH),
	SUBJOBFLOW("subjobflow", "Subjobflow", FileType.SUBJOBFLOW, JOBFLOW);

	/** This type is used in case the type is not specified in different way. */
	public static final JobType DEFAULT = ETL_GRAPH;

	private String id;
	
	private String label;
	
	/** Associated file type. */
	private FileType fileType;
	
	private JobType parent;
	
	private JobType(String id, String label, FileType fileType) {
		this.id = id;
		this.label = label;
		this.fileType = fileType;
	}

	private JobType(String id, String label, FileType fileType, JobType parent) {
		this(id, label, fileType);
		this.parent = parent;
	}

	public String getId() {
		return id;
	}
	
	/** 
	 * Getter which returns response of name() method. 
	 * This getter is useful when the JobType is used as placeholder 
	 * and we must explicitly specify that it should return name() not toString() 
	 * - e.g. JSF may sometimes call toString() in some cases instead of name(). */ 
	public String getName() {
		return this.name();
	}
	
	public String getLabel() {
		return label;
	}
	
	@Override
	public String toString() {
		return name();
	}
	
	/**
	 * @return the fileType
	 */
	public FileType getFileType() {
		return fileType;
	}
	
	/**
	 * Returns <code>true</code> if the current job type
	 * is a sub-type of the given job type (or the type itself).
	 * 
	 * @param parentType
	 * @return
	 */
	public boolean isSubTypeOf(JobType parentType) {
		return (this == parentType) || ((parent != null) && parent.isSubTypeOf(parentType));<commit_msg>SVN: merge   trunk-4-5 to trunk-4-6<commit_after>/*
 * jETeL/CloverETL - Java based ETL application framework.
 * Copyright (c) <NAME>. (<EMAIL>)
 *  
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.jetel.graph;

import org.apache.commons.lang.WordUtils;
import org.jetel.util.FileType;
import org.jetel.util.string.StringUtils;

/**
 * This enumeration represents various kind of jobs from clover engine family.
 * For now only ETL graph and jobflow types are considered.
 * Each graph has specified its jobType, {@link TransformationGraph#getJobType()}.
 * Job type is defined in *.grf file as an XML attribute of top level 'Graph' element.
 * 
 * @author Kokon (<EMAIL>)
 *         (c) Javlin, a.s. (www.cloveretl.com)
 *
 * @created 2 May 2012
 */
public enum JobType {

	/** This type represents regular ETL graphs */
	ETL_GRAPH("etlGraph", "Graph", FileType.ETL_GRAPH),
	/** This type represents jobflows */
	JOBFLOW("jobflow", "Jobflow", FileType.JOBFLOW),
	PROFILER_JOB("profilerJob", "Profiler job", FileType.PROFILER_JOB),
	SUBGRAPH("subgraph", "Subgraph", FileType.SUBGRAPH, ETL_GRAPH),
	SUBJOBFLOW("subjobflow", "Subjobflow", FileType.SUBJOBFLOW, JOBFLOW);

	/** This type is used in case the type is not specified in different way. */
	public static final JobType DEFAULT = ETL_GRAPH;

	private String id;
	
	private String label;
	
	/** Associated file type. */
	private FileType fileType;
	
	private JobType parent;
	
	private JobType(String id, String label, FileType fileType) {
		this.id = id;
		this.label = label;
		this.fileType = fileType;
	}

	private JobType(String id, String label, FileType fileType, JobType parent) {
		this(id, label, fileType);
		this.parent = parent;
	}

	public String getId() {
		return id;
	}
	
	/** 
	 * Getter which returns response of name() method. 
	 * This getter is useful when the JobType is used as placeholder 
	 * and we must explicitly specify that it should return name() not toString() 
	 * - e.g. JSF may sometimes call toString() in some cases instead of name(). */ 
	public String getName() {
		return this.name();
	}
	
	public String getLabel() {
		return label;
	}
	
	/**
	 * Identical with {@link #getLabel()} only for {@link #PROFILER_JOB}
	 * is returned 'Profiler Job' instead of 'Profiler job'.
	 * @return capitalized label
	 */
	public String getCapitalizedLabel() {
		return WordUtils.capitalizeFully(label);
	}
	
	@Override
	public String toString() {
		return name();
	}
	
	/**
	 * @return the fileType
	 */
	public FileType getFileType() {
		return fileType;
	}
	
	/**
	 * Returns <code>true</code> if the current job type
	 * is a sub-type of the given job type (or the type itself).
	 * 
	 * @param parentType
	 * @return
	 */
	public boolean isSubTypeOf(JobType parentType) {
		return (this == parentType) || ((parent != null) && parent.isSubTypeOf(parentType));
{'fraction_non_alphanumeric': 0.10265486725663717, 'fraction_numerical': 0.006784660766961652, 'mean_word_length': 3.7452764170748774, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '522874', 'n_tokens_mistral': 2188, 'n_tokens_neox': 2028, 'n_words': 800}