mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-24 15:30:49 +01:00
Add queryable store with SQLite implementation
This adds the new "queryable store" API, that allows complex queries and is backed by SQLite. This new API can be used for entities annotated with the new QueryableType annotation.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2020 - present Cloudogu GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program 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 Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
package sonia.scm.store;
|
||||
|
||||
import sonia.scm.plugin.PluginAnnotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This annotation is used to mark a class as queryable type. Classes annotated with this annotation can be stored in
|
||||
* a store and later be queried more efficiently and with more flexibility than with a simple key-value store.
|
||||
* <br/>
|
||||
* If the annotation is used without any parameters, the class name is used as the name of the queryable type and
|
||||
* the objects of this class will be stored with ids (either given or generated by the store) independently of any
|
||||
* other (parent) objects. If the objects are related to other objects, the parent objects can be specified with the
|
||||
* {@link #value()} parameter. The parent objects are used to create a hierarchy of objects (formerly it only was
|
||||
* possible to store objects related to repositories; with this annotation it is possible to use other objects as
|
||||
* parents, too, like for instance users).
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@PluginAnnotation("queryable-type")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface QueryableType {
|
||||
/**
|
||||
* The parent types of the queryable type. The parent objects are used to create a hierarchy of objects. If no parent
|
||||
* types are specified, the type is stored independently of any other objects.
|
||||
*/
|
||||
Class<?>[] value() default {};
|
||||
|
||||
/**
|
||||
* This can be used to specify a name for the queryable type. If no name is specified, the class name is used as the
|
||||
* name of the queryable type.
|
||||
*/
|
||||
String name() default "";
|
||||
}
|
||||
Reference in New Issue
Block a user