Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Deprecate CUBA classes that have Jmix equivalents #96
Browse files Browse the repository at this point in the history
  • Loading branch information
knstvk committed Oct 17, 2021
1 parent fd8c34d commit 055c366
Show file tree
Hide file tree
Showing 66 changed files with 203 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
* }
* }
* </pre>
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.metamodel.annotation.InstanceName}.
*/
@Deprecated
@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@MetaAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@

/**
* Registry for {@link Datatype}s
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.metamodel.datatype.DatatypeRegistry}.
*/
@Deprecated
public interface DatatypeRegistry {

String NAME = "cuba_DatatypeRegistry";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@

/**
* Utility class for accessing datatypes and format strings.
* Consider using {@link io.jmix.core.metamodel.datatype.DatatypeRegistry} and {@link FormatStringsRegistry} beans directly.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.metamodel.datatype.DatatypeRegistry}
* and {@link FormatStringsRegistry} beans directly.
*/
@Deprecated
public class Datatypes {

/**
Expand Down
3 changes: 3 additions & 0 deletions cuba/src/main/java/com/haulmont/chile/core/model/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

/**
* Legacy meta-model entry point.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.metamodel.model.Session}.
*/
@Deprecated
public interface Session extends io.jmix.core.metamodel.model.Session {

@Nullable
Expand Down
4 changes: 4 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/EntityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
*
* <p>Mostly mimics the {@code javax.persistence.EntityManager} interface and adds methods for working with fetch plans and
* soft deletion.</p>
*
* @deprecated use only in legacy CUBA code. In new code, use {@link javax.persistence.EntityManager} injected
* using {@link javax.persistence.PersistenceContext} annotation.
*/
@Deprecated
public interface EntityManager {

String NAME = "cuba_EntityManager";
Expand Down
10 changes: 10 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/Persistence.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@

/**
* Central infrastructure interface to provide ORM persistence.
*
* @deprecated use only in legacy CUBA code. In new code, use
* <ul>
* <li>{@link javax.persistence.EntityManager} injected
* using {@link javax.persistence.PersistenceContext} annotation</li>
* <li>{@link org.springframework.transaction.annotation.Transactional} annotation</li>
* <li>{@link org.springframework.transaction.support.TransactionTemplate}</li>
* <li>{@link io.jmix.data.persistence.DbmsSpecifics} bean</li>
* </ul>
*/
@Deprecated
public interface Persistence {

String NAME = "cuba_Persistence";
Expand Down
11 changes: 11 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/PersistenceTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
import javax.sql.DataSource;
import java.util.Set;

/**
* @deprecated use only in legacy CUBA code. In new code, use:
* <ul>
* <li>{@link EntityStates}</li>
* <li>{@link AttributeChangesProvider}</li>
* <li>{@link ReferenceIdProvider}</li>
* <li>{@link MetadataTools#getDatabaseTable(MetaClass)} and {@link MetadataTools#getPrimaryKeyName(MetaClass)}</li>
* </ul>
*
*/
@Deprecated
@Component("cuba_PersistenceTools")
public class PersistenceTools {

Expand Down
3 changes: 3 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
* Interface used to control query execution.
*
* <br>Consider use of {@link TypedQuery} instead of this interface.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link javax.persistence.Query}.
*/
@Deprecated
public interface Query {

String NAME = "cuba_Query";
Expand Down
3 changes: 3 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
* </pre>
*
* @see Transactions
*
* @deprecated use only in legacy CUBA code. In new code, use {@link org.springframework.transaction.support.TransactionTemplate}.
*/
@Deprecated
public interface Transaction extends AutoCloseable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
* </pre>
* Transactions can also be created/committed programmatically using the {@link Transactions} interface which is available
* via {@link #transactions()} method.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.DataManager}.
*/
@Deprecated
@SuppressWarnings("rawtypes")
public interface TransactionalDataManager {

Expand Down
3 changes: 3 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/Transactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

/**
* Factory for creating {@link Transaction}s.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link org.springframework.transaction.support.TransactionTemplate}.
*/
@Deprecated
public interface Transactions {

String NAME = "cuba_Transactions";
Expand Down
3 changes: 3 additions & 0 deletions cuba/src/main/java/com/haulmont/cuba/core/TypedQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@

/**
* Type-safe extension of Query interface.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link javax.persistence.TypedQuery}.
*/
@Deprecated
public interface TypedQuery<T> extends Query {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

/**
* Interface to store and load files defined by {@link FileDescriptor}s.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.FileStorage}.
*/
@Deprecated
public interface FileStorageAPI {
String NAME = "cuba_FileStorage";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@

/**
* Service interface for pessimistic locking.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.pessimisticlocking.LockManager}.
*/
@Deprecated
public interface LockService {

String NAME = "cuba_LockService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
/**
* Provides sequences of unique numbers based on database sequences.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.data.Sequences}.
*/
@Deprecated
public interface UniqueNumbersAPI {

String NAME = "cuba_UniqueNumbers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
* An object describing changes in entity attributes.
*
* @see EntityChangedEvent#getChanges()
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.event.AttributeChanges}.
*/
@Deprecated
public class AttributeChanges {

protected final io.jmix.core.event.AttributeChanges changes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
*
* @param <E> entity type
* @param <K> entity identifier type
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.event.EntityChangedEvent}.
*/
@Deprecated
public class EntityChangedEvent<E extends Entity, K> extends ApplicationEvent implements ResolvableTypeProvider {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
* </pre>
*
* @param <E> entity type
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.event.EntitySavingEvent}.
*/
@Deprecated
public class EntityPersistingEvent<E> extends ApplicationEvent implements ResolvableTypeProvider {

private final E entity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Interface to be implemented by entities that contain information about who created them and when.
*
* @deprecated use {@link CreatedBy} and {@link CreatedDate} on fields instead.
* @deprecated use only in legacy CUBA code. In new code, use {@link CreatedBy} and {@link CreatedDate} on fields.
*/
@Deprecated
public interface Creatable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Interface to be implemented by entities that support soft deletion.
*
* @deprecated use {@link DeletedDate} and {@link DeletedBy} annotations instead
* @deprecated use only in legacy CUBA code. In new code, use {@link DeletedDate} and {@link DeletedBy} annotations
*/
@Deprecated
public interface SoftDelete {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Interface to be implemented by entities that contain information about who updated them and when.
*
* @deprecated use {@link LastModifiedBy} and {@link LastModifiedDate} on fields instead.
* @deprecated use only in legacy CUBA code. In new code, use {@link LastModifiedBy} and {@link LastModifiedDate} on fields.
*/
@Deprecated
public interface Updatable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/**
* Interface to be implemented by optimistically locked entities.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link javax.persistence.Version} annotation.
*/
@Deprecated
public interface Versioned {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.haulmont.cuba.core.entity.annotation;

import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.entity.annotation.MetaAnnotation;

import java.lang.annotation.ElementType;
Expand All @@ -26,7 +27,11 @@
/**
* Defines sequence name in the database for id generation for {@link com.haulmont.cuba.core.entity.BaseLongIdEntity}
* and {@link com.haulmont.cuba.core.entity.BaseIntegerIdEntity}
*
* @deprecated use only in legacy CUBA code. In new code, use {@link JmixGeneratedValue#sequenceName()}
* and {@link JmixGeneratedValue#sequenceCache()} annotation parameters.
*/
@Deprecated
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@MetaAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@

/**
* Defines a reference lookup type.
*
* @deprecated use only in legacy CUBA code. In new code, use {@code jmix.ui.component.entityFieldType}
* and {@code jmix.ui.component.entityFieldActions} application properties.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
@MetaAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
import java.lang.annotation.Target;

/**
* Indicates that {@code EntityChangedEvent}s must be published on the middle tier when the annotated entity is changed
* in the data store.
* @deprecated this annotation is required only for sending legacy {@link com.haulmont.cuba.core.app.events.EntityChangedEvent}.
* The new {@link io.jmix.core.event.EntityChangedEvent} is sent for any entity without marking it with an annotation.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@MetaAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
import java.lang.annotation.Target;

/**
* Indicates whether to track an edit screen opening for this entity. If no such annotation present for an entity, or
* value() is false, no tracking performed.
*
* <p>Can be overridden in <code>*-metadata.xml</code> file.</p>
*
* @deprecated does not have any effect in Jmix apps
*/
@Deprecated
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@MetaAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
* Convenient class for methods that receive Id of an entity as a parameter.
*
* @param <T> entity type
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.Id}.
*/
@Deprecated
public final class Id<T extends Entity, K> implements Serializable {
private final K id;
private final Class<T> entityClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
* Helper class which represent a collection of {@link io.jmix.core.Id}
*
* @param <T> type of entity
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.Ids}.
*/
@Deprecated
public final class Ids<T extends Entity, K> extends ArrayList<Id<T, K>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.haulmont.cuba.core.global;

import com.haulmont.cuba.core.global.BeanLocator;
import io.jmix.core.annotation.Internal;
import org.springframework.context.ApplicationContext;

Expand All @@ -27,7 +26,9 @@
* Contains static methods for access to all managed beans of the application block.
*
* @see BeanLocator
* @deprecated use only in legacy CUBA code. In new code, use {@link ApplicationContext}.
*/
@Deprecated
public class AppBeans {

private static ApplicationContext applicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

/**
* Provides access to all managed beans of the application block.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link org.springframework.context.ApplicationContext}.
*/
@Deprecated
public interface BeanLocator {

String NAME = "core_BeanLocator";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
* DTO that contains information about currently committed entities.
* <p>
* Used by {@link DataManager}.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link SaveContext}.
*/
@Deprecated
@SuppressWarnings("unchecked")
public class CommitContext extends SaveContext {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
* When used on the client tier - always applies security restrictions. When used on the middleware - does not apply
* security restrictions by default. If you want to apply security, get {@link #secure()} instance or set the
* {@code cuba.dataManagerChecksSecurityOnMiddleware} application property to use it by default.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.DataManager}.
*/
@Deprecated
@SuppressWarnings("rawtypes")
public interface DataManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
* <li>For string keys: the key surrounded by curly brackets, e.g {mykey}</li>
* </ul>
* Use {@link EntityLoadInfoBuilder#parse(String)} and {@link #toString()} methods to convert from/to a string.
*
* @deprecated use only in legacy CUBA code. In new code, use {@link io.jmix.core.IdSerialization}.
*/
@Deprecated
public class EntityLoadInfo {

public static final String NEW_PREFIX = "NEW-";
Expand Down

0 comments on commit 055c366

Please sign in to comment.