All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamscale.index.metadata.abap.EAbapLanguageVersion Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) CQSE GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.teamscale.index.metadata.abap;

import org.conqat.lib.commons.collections.CounterSet;
import org.conqat.lib.commons.js_export.ExportToTypeScript;
import org.conqat.lib.commons.test.IndexValueClass;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Lists all possible values of ABAP language versions for ABAP objects. See language
 * version for SAP NetWeaver AS ABAP Release 752 and language
 * version for newer SAP systems.
 */
@ExportToTypeScript
@IndexValueClass
public enum EAbapLanguageVersion {

	/**
	 * Represents a version character that is not known to Teamscale and for which support need to be
	 * provided.
	 */
	UNKNOWN('~', "Unknown"),

	/**
	 * This version of ABAP is obsolete and is no longer supported in the current release. The version
	 * ID of a program of this type is initial. No Unicode checks are performed in programs of this
	 * type.
	 */
	OBSOLETE_ABAP(' ', "Obsolete"),

	/**
	 * The universal basic version. This version of ABAP is an unrestricted ABAP language version for
	 * classic ABAP. It covers the entire language scope of ABAP that can be used in Unicode systems and
	 * apart from the static package concept, access to all other repository objects is allowed. The
	 * syntax check for Standard ABAP is performed as Unicode check, which is the minimum requirement
	 * for a Unicode system. The documentation of this version describes all ABAP language elements.
	 */
	STANDARD_ABAP('X', "Standard"),

	/**
	 * This version of ABAP is intended for the secure implementation of enhancements by key users
	 * within the scope of enhancement options provided by SAP. ABAP for Key Users is a restricted ABAP
	 * language version where the general rules for Standard ABAP (Unicode) apply but only a very
	 * restricted set of language elements is supported and access
	 * to repository objects is restricted. Furthermore, enhancements can be implemented in methods
	 * only, where the stricter syntax rules for classes automatically apply and no obsolete language
	 * elements are allowed. ABAP for Key Users is not supported by the ABAP keyword documentation. Only
	 * ABAP syntax diagrams with a short explanation are shown. For more information, see Key User
	 * Extensibility.
	 */
	ABAP_FOR_KEY_USERS('2', "Key Users"),

	/**
	 * In this version of ABAP, the rules for Standard ABAP (Unicode) apply, with restrictions on access
	 * to external repository objects. Dynamically specified data and statements for dynamic creation of
	 * programs are forbidden here to make sure that static checks can be carried out. The corresponding
	 * language elements are hidden in the documentation for static ABAP with restricted object use.
	 */
	STATIC_ABAP_WITH_RESTRICTED_OBJECT_USE('3', "Static ABAP (Restricted)"),

	/**
	 * In this version of ABAP, the rules for Standard ABAP (Unicode) apply, with restrictions on access
	 * to external repository objects. Dynamic language elements are not forbidden in this version.
	 */
	STANDARD_ABAP_WITH_RESTRICTED_OBJECT_USE('4', "Standard ABAP (Restricted)"),

	/**
	 * This version of ABAP is a restricted ABAP language version for ABAP Cloud. The general rules for
	 * Standard ABAP (Unicode) apply but only a very restricted set of language elements is supported
	 * and to
	 * repository objects is restrictedaccess. Furthermore, most developments can be implemented in
	 * methods only, where the stricter syntax rules of classes automatically apply. Almost no obsolete
	 * language elements are allowed. For ABAP SQL, the most strict syntax check mode currently
	 * available is applied. The documentation for ABAP for Cloud Development is a restricted version of
	 * the full documentation.
	 */
	ABAP_FOR_CLOUD_DEVELOPMENT('5', "Cloud");

	private static final String VERSION_ID_PROPERTY = "versionId";

	private static final String HUMAN_READABLE_NAME_PROPERTY = "humanReadableName";

	@JsonProperty(VERSION_ID_PROPERTY)
	private final char versionId;

	@JsonProperty(HUMAN_READABLE_NAME_PROPERTY)
	private final String humanReadableName;

	@JsonCreator
	EAbapLanguageVersion(@JsonProperty(VERSION_ID_PROPERTY) char versionId,
			@JsonProperty(HUMAN_READABLE_NAME_PROPERTY) String humanReadableName) {
		this.versionId = versionId;
		this.humanReadableName = humanReadableName;
	}

	/**
	 * Derives a {@link EAbapLanguageVersion} from some given version id. Returns {@link #UNKNOWN} if
	 * the type value is not defined in this enumeration.
	 */
	public static EAbapLanguageVersion getLanguageVersionFromId(char versionId) {
		for (EAbapLanguageVersion languageVersion : EAbapLanguageVersion.values()) {
			if (languageVersion.versionId == versionId) {
				return languageVersion;
			}
		}

		return UNKNOWN;
	}

	/** @see #versionId */
	public char getVersionId() {
		return versionId;
	}

	/**
	 * Converts the enum to a human-readable metric.
	 * 

* We are using {@link CounterSet counter sets} because we don't lose the amount of files with the * specific enum on aggregation in a folder. */ public static CounterSet toMetric(EAbapLanguageVersion langVersion) { if (langVersion == null || langVersion == UNKNOWN) { return new CounterSet<>(UNKNOWN.humanReadableName, 1); } return new CounterSet<>(langVersion.humanReadableName, 1); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy