Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -16,6 +16,8 @@
// - New Jakarta Persistence 3.2 Features
package org.eclipse.persistence.internal.databaseaccess;

import org.eclipse.persistence.tools.schemaframework.FieldDefinition;

import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
Expand All @@ -34,6 +36,7 @@
* <li> Maintain maximum precision and optionall min &amp; max Scale.</li>
* </ul>
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public class FieldTypeDefinition implements Serializable {

protected String name;
Expand Down Expand Up @@ -431,6 +434,11 @@ public String toString() {
return getClass().getSimpleName() + "(" + getName() + ")";
}

public FieldDefinition.DatabaseType toDatabaseType() {
return new FieldDefinition.DatabaseType(getName(), shouldAllowNull(), isSizeAllowed(), isSizeRequired(),
getDefaultSize(), getDefaultSubSize(), getMaxPrecision(), getMinScale(), getMaxScale());
}

// Constructor helper to build database type name aliases set
// Type name aliases are converted to upper case.
private static Set<String> createAliasesSet(String... typeNameAliases) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
// - 500441: Eclipselink core has System.getProperty() calls that are not potentially executed under doPriv()
package org.eclipse.persistence.internal.helper;

import org.eclipse.persistence.config.SystemProperties;
import org.eclipse.persistence.exceptions.ConversionException;
import org.eclipse.persistence.exceptions.ValidationException;
import org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor;
import org.eclipse.persistence.internal.security.PrivilegedAccessHelper;
import org.eclipse.persistence.logging.AbstractSessionLog;
import org.eclipse.persistence.logging.SessionLog;

import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -67,6 +59,14 @@
import java.util.Vector;
import java.util.concurrent.ConcurrentLinkedQueue;

import org.eclipse.persistence.config.SystemProperties;
import org.eclipse.persistence.exceptions.ConversionException;
import org.eclipse.persistence.exceptions.ValidationException;
import org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor;
import org.eclipse.persistence.internal.security.PrivilegedAccessHelper;
import org.eclipse.persistence.logging.AbstractSessionLog;
import org.eclipse.persistence.logging.SessionLog;

/**
* INTERNAL:
* <p>
Expand Down Expand Up @@ -951,13 +951,39 @@ public static Class<?> getObjectClass(Class<?> javaClass) {
return ConversionManager.getObjectClass(javaClass);
}

/**
* Answers the unqualified class name for the provided class.
* @deprecated Use {@linkplain Class#getSimpleName()} instead.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String getShortClassName(Class<?> javaClass) {
return javaClass.getSimpleName();
}

/**
* Answers the unqualified class name from the specified String.
*/
public static String getShortClassName(String javaClassName) {
return javaClassName.substring(javaClassName.lastIndexOf('.') + 1);
}

/**
* Answers the unqualified class name for the specified object.
* @deprecated Use {@code object.getClass().getSimpleName()} instead.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String getShortClassName(Object object) {
return getShortClassName(object.getClass());
}

/**
* return a package name for the specified class.
* @deprecated Use {@linkplain Class#getPackageName()} instead.
*/
public static String getPackageName(Class<?> javaClass) {
return javaClass.getPackageName();
}

/**
* Return a string containing the specified number of tabs.
*/
Expand All @@ -970,7 +996,7 @@ public static String getTabs(int noOfTabs) {
}

/**
* Returns the index of the the first <code>null</code> element found in the specified
* Returns the index of the first <code>null</code> element found in the specified
* <code>Vector</code> starting the search at the starting index specified.
* Return an int &gt;= 0 and less than size if a <code>null</code> element was found.
* Return -1 if a <code>null</code> element was not found.
Expand Down Expand Up @@ -1015,6 +1041,7 @@ public static boolean isUpperCaseString(String s) {
/**
* Returns true if the character given is a vowel. I.e. one of a,e,i,o,u,A,E,I,O,U.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static boolean isVowel(char c) {
return (c == 'A') || (c == 'a') || (c == 'e') || (c == 'E') || (c == 'i') || (c == 'I') || (c == 'o') || (c == 'O') || (c == 'u') || (c == 'U');
}
Expand Down Expand Up @@ -1189,6 +1216,7 @@ public static <K, V> Map<K, V> rehashMap(Map<K, V> table) {
* Returns a String which has had enough non-alphanumeric characters removed to be equal to
* the maximumStringLength.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String removeAllButAlphaNumericToFit(String s1, int maximumStringLength) {
int s1Size = s1.length();
if (s1Size <= maximumStringLength) {
Expand Down Expand Up @@ -1259,6 +1287,7 @@ public static String removeCharacterToFit(String s1, char aChar, int maximumStri
* Returns a String which has had enough of the specified character removed to be equal to
* the maximumStringLength.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String removeVowels(String s1) {
// Remove the vowels
StringBuilder buf = new StringBuilder();
Expand Down Expand Up @@ -1319,6 +1348,7 @@ public static String rightTrimString(String originalString) {
* vowels removed from them so that the sum of the sized of the two strings is less than
* or equal to the specified size.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String shortenStringsByRemovingVowelsToFit(String s1, String s2, int maximumStringLength) {
int size = s1.length() + s2.length();
if (size <= maximumStringLength) {
Expand Down Expand Up @@ -1964,6 +1994,7 @@ public static String toSlashedClassName(String dottedClassName){
* If the resulting string is still larger than the passed in size after
* removing all vowels, the end of the resulting string will be truncated.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public static String truncate(String originalString, int size) {
if (originalString.length() <= size) {
//no removal and truncation needed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -9,39 +9,34 @@
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/

package org.eclipse.persistence.tools.schemaframework;

import org.eclipse.persistence.exceptions.ValidationException;
import org.eclipse.persistence.internal.sessions.AbstractSession;

import java.io.IOException;
import java.io.Serializable;
import java.io.Writer;

import org.eclipse.persistence.exceptions.ValidationException;
import org.eclipse.persistence.internal.sessions.AbstractSession;

/**
* <b>Purpose</b>: Define a check constraint.
*/
public class CheckConstraint implements Serializable {
protected String name;
public class CheckConstraint extends ConstraintObjectDefinition {
protected String constraint;
protected String options;

public CheckConstraint() {
this.name = "";
this.constraint = "";
this("", "");
}

public CheckConstraint(String name, String constraint) {
this();
this.name = name;
super(name);
this.constraint = constraint;
}

/**
* INTERNAL:
* Append the database field definition string to the table creation statement.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public void appendDBString(Writer writer, AbstractSession session) {
try {
writer.write("CONSTRAINT " + getName() + " CHECK (");
Expand All @@ -52,45 +47,29 @@ public void appendDBString(Writer writer, AbstractSession session) {
writer.write(" ");
}
writer.write(")");
super.appendDBString(writer, session);
} catch (RuntimeException ex) {
if (ex.getCause() instanceof IOException) {
throw ValidationException.fileError((IOException) ex.getCause());
}
throw ValidationException.fileError((new IOException(ex.getCause())));
} catch (IOException ioException) {
throw ValidationException.fileError(ioException);
}
}

/**
* PUBLIC:
*/
public String getName() {
return name;
}

/**
* PUBLIC:
*/
public String getConstraint() {
return constraint;
}

public String getOptions() {
return options;
}

/**
* PUBLIC:
*/
public void setName(String name) {
this.name = name;
}

/**
* PUBLIC:
*/
public void setConstraint(String constraint) {
this.constraint = constraint;
}

public void setOptions(String options) {
this.options = options;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2025 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
package org.eclipse.persistence.tools.schemaframework;

import java.io.IOException;
import java.io.Writer;

import org.eclipse.persistence.exceptions.ValidationException;
import org.eclipse.persistence.internal.sessions.AbstractSession;

public abstract class ConstraintObjectDefinition extends DatabaseObjectDefinition {
private String options;

protected ConstraintObjectDefinition() {
this("");
}

protected ConstraintObjectDefinition(String name) {
super(name);
}

/**
* INTERNAL:
* Append the database field definition string to the table creation statement.
*/
@Deprecated(forRemoval = true, since = "4.0.9")
public void appendDBString(Writer writer, AbstractSession session) {
try {
if (getOptions() != null && !getOptions().isEmpty()) {
writer.write(" ");
writer.write(getOptions());
writer.write(" ");
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public String getOptions() {
return options;
}

public void setOptions(String options) {
this.options = options;
}

@Override
@Deprecated(forRemoval = true, since = "4.0.9")
public Writer buildCreationWriter(AbstractSession session, Writer writer) throws ValidationException {
//noop
return writer;
}

@Override
@Deprecated(forRemoval = true, since = "4.0.9")
public Writer buildDeletionWriter(AbstractSession session, Writer writer) throws ValidationException {
//noop
return writer;
}
}
Loading
Loading