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

org.conqat.engine.index.shared.InternalProjectId Maven / Gradle / Ivy

The newest version!
package org.conqat.engine.index.shared;

import java.util.UUID;

import org.conqat.lib.commons.test.IndexValueClass;

import com.fasterxml.jackson.annotation.JsonCreator;

/**
 * An internal project ID (as opposed to a {@link PublicProjectId}) is project ID which is never
 * user-facing. The assignment of an internal project ID to a project is both unambiguous and
 * non-volatile, i.e. at any given point in time the ID will refer to the same Teamscale project. It
 * is used for internal purposes such as scheduling and managing the project storage systems.
 *
 * Internal project IDs are represented by a randomly chosen UUID that remains persistent during the
 * lifetime of the project.
 */
@IndexValueClass(containedInBackup = true)
public class InternalProjectId extends ProjectIdBase {

	private static final long serialVersionUID = 1L;

	@JsonCreator
	public InternalProjectId(String projectId) {
		super(projectId);
		if (!projectId.equals("##maintenance##") && !isUuidFormat()) {
			throw new IllegalArgumentException("Tried to create an internal project ID from \"" + projectId
					+ "\", which does not fit the expected format. Did you supply a public project ID by mistake?");
		}
	}

	private InternalProjectId() {
		super(UUID.randomUUID().toString());
	}

	/** Creates a new internal project ID initialized with a random UUID. */
	public static InternalProjectId create() {
		return new InternalProjectId();
	}

	@Override
	public boolean isInternal() {
		return true;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy