Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LRCI-3783 Testing pull #2889

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const ObjectField = ({
system,
type,
}) => {
if (businessType === 'AutoIncrement') {
return false;
}

if (
!listTypeDefinitionExternalReferenceCode &&
(focusedFieldType === 'radio' ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1085,12 +1085,12 @@ public String toString() {
public static enum BusinessType {

AGGREGATION("Aggregation"), ATTACHMENT("Attachment"),
BOOLEAN("Boolean"), DATE("Date"), DATE_TIME("DateTime"),
DECIMAL("Decimal"), ENCRYPTED("Encrypted"), FORMULA("Formula"),
INTEGER("Integer"), LONG_INTEGER("LongInteger"), LONG_TEXT("LongText"),
MULTISELECT_PICKLIST("MultiselectPicklist"), PICKLIST("Picklist"),
PRECISION_DECIMAL("PrecisionDecimal"), RELATIONSHIP("Relationship"),
RICH_TEXT("RichText"), TEXT("Text");
AUTO_INCREMENT("AutoIncrement"), BOOLEAN("Boolean"), DATE("Date"),
DATE_TIME("DateTime"), DECIMAL("Decimal"), ENCRYPTED("Encrypted"),
FORMULA("Formula"), INTEGER("Integer"), LONG_INTEGER("LongInteger"),
LONG_TEXT("LongText"), MULTISELECT_PICKLIST("MultiselectPicklist"),
PICKLIST("Picklist"), PRECISION_DECIMAL("PrecisionDecimal"),
RELATIONSHIP("Relationship"), RICH_TEXT("RichText"), TEXT("Text");

@JsonCreator
public static BusinessType create(String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,12 @@ public String toString() {
public static enum BusinessType {

AGGREGATION("Aggregation"), ATTACHMENT("Attachment"),
BOOLEAN("Boolean"), DATE("Date"), DATE_TIME("DateTime"),
DECIMAL("Decimal"), ENCRYPTED("Encrypted"), FORMULA("Formula"),
INTEGER("Integer"), LONG_INTEGER("LongInteger"), LONG_TEXT("LongText"),
MULTISELECT_PICKLIST("MultiselectPicklist"), PICKLIST("Picklist"),
PRECISION_DECIMAL("PrecisionDecimal"), RELATIONSHIP("Relationship"),
RICH_TEXT("RichText"), TEXT("Text");
AUTO_INCREMENT("AutoIncrement"), BOOLEAN("Boolean"), DATE("Date"),
DATE_TIME("DateTime"), DECIMAL("Decimal"), ENCRYPTED("Encrypted"),
FORMULA("Formula"), INTEGER("Integer"), LONG_INTEGER("LongInteger"),
LONG_TEXT("LongText"), MULTISELECT_PICKLIST("MultiselectPicklist"),
PICKLIST("Picklist"), PRECISION_DECIMAL("PrecisionDecimal"),
RELATIONSHIP("Relationship"), RICH_TEXT("RichText"), TEXT("Text");

public static BusinessType create(String value) {
for (BusinessType businessType : values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ components:
readOnly: true
type: object
businessType:
enum: [Aggregation, Attachment, Boolean, Date, DateTime, Decimal, Encrypted, Formula, Integer, LongInteger, LongText, MultiselectPicklist, Picklist, PrecisionDecimal, Relationship, RichText, Text]
enum: [Aggregation, Attachment, AutoIncrement, Boolean, Date, DateTime, Decimal, Encrypted, Formula, Integer, LongInteger, LongText, MultiselectPicklist, Picklist, PrecisionDecimal, Relationship, RichText, Text]
type: string
defaultValue:
deprecated: true
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/object/object-api/bnd.bnd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundle-Name: Liferay Object API
Bundle-SymbolicName: com.liferay.object.api
Bundle-Version: 79.1.0
Bundle-Version: 80.0.0
Export-Package:\
com.liferay.object.action.engine,\
com.liferay.object.action.executor,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class ObjectFieldConstants {

public static final String BUSINESS_TYPE_ATTACHMENT = "Attachment";

public static final String BUSINESS_TYPE_AUTO_INCREMENT = "AutoIncrement";

public static final String BUSINESS_TYPE_BOOLEAN = "Boolean";

public static final String BUSINESS_TYPE_DATE = "Date";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class ObjectFieldSettingConstants {

public static final String NAME_FILTERS = "filters";

public static final String NAME_INITIAL_VALUE = "initialValue";

public static final String NAME_MAX_FILE_SIZE = "maximumFileSize";

public static final String NAME_MAX_LENGTH = "maxLength";
Expand All @@ -31,6 +33,8 @@ public class ObjectFieldSettingConstants {
public static final String NAME_OBJECT_RELATIONSHIP_ERC_OBJECT_FIELD_NAME =
"objectRelationshipERCObjectFieldName";

public static final String NAME_PREFIX = "prefix";

public static final String NAME_SHOW_COUNTER = "showCounter";

public static final String NAME_SHOW_FILES_IN_DOCS_AND_MEDIA =
Expand All @@ -41,6 +45,8 @@ public class ObjectFieldSettingConstants {
public static final String NAME_STORAGE_DL_FOLDER_PATH =
"storageDLFolderPath";

public static final String NAME_SUFFIX = "suffix";

public static final String NAME_TIME_STORAGE = "timeStorage";

public static final String NAME_UNIQUE_VALUES = "uniqueValues";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
*/
public class ObjectFieldSettingValueException extends PortalException {

public static class ExceedsMaxLength
extends ObjectFieldSettingValueException {

public ExceedsMaxLength(int maxLength, String objectFieldSettingName) {
super(
String.format(
"The setting %s exceeds the maximum length of %s",
objectFieldSettingName, maxLength));
}

}

public static class InvalidValue extends ObjectFieldSettingValueException {

public InvalidValue(
Expand Down Expand Up @@ -59,15 +71,6 @@ public MissingRequiredValues(

}

public static class MustBeLessThan256Characters
extends ObjectFieldSettingValueException {

public MustBeLessThan256Characters() {
super("Storage folder path must be less than 256 characters");
}

}

public static class UnmodifiableValue
extends ObjectFieldSettingValueException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.liferay.object.model.ObjectFieldSetting;
import com.liferay.object.service.ObjectFieldLocalServiceUtil;
import com.liferay.object.service.ObjectFieldSettingLocalServiceUtil;
import com.liferay.petra.string.StringBundler;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
Expand Down Expand Up @@ -172,6 +174,12 @@ public static ObjectField createObjectField(
false, false);
}

public static String getCounterName(ObjectField objectField) {
return StringBundler.concat(
"auto.increment.object.field#", objectField.getCompanyId(),
StringPool.POUND, objectField.getObjectFieldId());
}

public static String getDateTimePattern(String value) {
if (value.length() == 10) {
return "yyyy-MM-dd";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public ObjectDefinition getObjectDefinition()

public java.util.List<ObjectFieldSetting> getObjectFieldSettings();

public String getSortableDBColumnName();

public boolean hasInsertValues();

public boolean hasUniqueValues();

public boolean hasUpdateValues();

public boolean isDeletionAllowed()
throws com.liferay.portal.kernel.exception.PortalException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ public boolean getRequired() {
return model.getRequired();
}

@Override
public String getSortableDBColumnName() {
return model.getSortableDBColumnName();
}

/**
* Returns the state of this object field.
*
Expand Down Expand Up @@ -627,6 +632,21 @@ public String getUuid() {
return model.getUuid();
}

@Override
public boolean hasInsertValues() {
return model.hasInsertValues();
}

@Override
public boolean hasUniqueValues() {
return model.hasUniqueValues();
}

@Override
public boolean hasUpdateValues() {
return model.hasUpdateValues();
}

@Override
public boolean isDeletionAllowed()
throws com.liferay.portal.kernel.exception.PortalException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,20 @@ public DynamicObjectDefinitionTable(
Column.FLAG_PRIMARY);

for (ObjectField objectField : objectFields) {
if (objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_AGGREGATION) ||
objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_FORMULA) ||
objectField.isLocalized()) {

if (!objectField.hasInsertValues() || objectField.isLocalized()) {
continue;
}

createColumn(
objectField.getDBColumnName(),
DynamicObjectDefinitionTableUtil.getJavaClass(
objectField.getDBType()),
DynamicObjectDefinitionTableUtil.getSQLType(
objectField.getDBType()),
Column.FLAG_DEFAULT);
_createColumn(
objectField.getDBColumnName(), objectField.getDBType());

if (objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_AUTO_INCREMENT)) {

_createColumn(
objectField.getSortableDBColumnName(),
ObjectFieldConstants.DB_TYPE_LONG);
}
}
}

Expand Down Expand Up @@ -86,24 +84,19 @@ public String getCreateTableSQL() {
sb.append(" LONG not null primary key");

for (ObjectField objectField : _objectFields) {
if (objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_AGGREGATION) ||
objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_FORMULA) ||
objectField.isLocalized()) {

if (!objectField.hasInsertValues() || objectField.isLocalized()) {
continue;
}

sb.append(", ");
sb.append(objectField.getDBColumnName());
sb.append(" ");
sb.append(
DynamicObjectDefinitionTableUtil.getDataType(
objectField.getDBType()));
sb.append(
DynamicObjectDefinitionTableUtil.getSQLColumnNull(
objectField.getDBType()));
_append(sb, objectField.getDBColumnName(), objectField.getDBType());

if (objectField.compareBusinessType(
ObjectFieldConstants.BUSINESS_TYPE_AUTO_INCREMENT)) {

_append(
sb, objectField.getSortableDBColumnName(),
ObjectFieldConstants.DB_TYPE_LONG);
}
}

sb.append(")");
Expand Down Expand Up @@ -141,6 +134,21 @@ protected <C> Column<DynamicObjectDefinitionTable, C> createColumn(
return super.createColumn(name, javaClass, sqlType, flags);
}

private void _append(StringBundler sb, String dbColumnName, String dbType) {
sb.append(", ");
sb.append(dbColumnName);
sb.append(" ");
sb.append(DynamicObjectDefinitionTableUtil.getDataType(dbType));
sb.append(DynamicObjectDefinitionTableUtil.getSQLColumnNull(dbType));
}

private void _createColumn(String dbColumnName, String dbType) {
createColumn(
dbColumnName, DynamicObjectDefinitionTableUtil.getJavaClass(dbType),
DynamicObjectDefinitionTableUtil.getSQLType(dbType),
Column.FLAG_DEFAULT);
}

private static final Log _log = LogFactoryUtil.getLog(
DynamicObjectDefinitionTable.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version 9.0.0
version 9.1.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version 24.0.0
version 25.0.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version 3.3.0
version 3.4.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version 8.8.0
version 8.9.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bundle-Name: Liferay Object Dynamic Data Mapping Form Field Type API
Bundle-SymbolicName: com.liferay.object.dynamic.data.mapping.form.field.type.api
Bundle-Version: 1.0.3
Bundle-Version: 1.1.0
Export-Package: com.liferay.object.dynamic.data.mapping.form.field.type.constants
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class ObjectDDMFormFieldTypeConstants {

public static final String ATTACHMENT = "attachment";

public static final String AUTO_INCREMENT = "auto-increment";

public static final String OBJECT_RELATIONSHIP = "object-relationship";

}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version 1.0.0
version 1.1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* SPDX-FileCopyrightText: (c) 2023 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

package com.liferay.object.dynamic.data.mapping.form.field.type.internal.auto.increment;

import com.liferay.dynamic.data.mapping.form.field.type.BaseDDMFormFieldType;
import com.liferay.dynamic.data.mapping.form.field.type.DDMFormFieldType;
import com.liferay.frontend.js.loader.modules.extender.npm.JSPackage;
import com.liferay.frontend.js.loader.modules.extender.npm.NPMResolver;
import com.liferay.object.dynamic.data.mapping.form.field.type.constants.ObjectDDMFormFieldTypeConstants;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

/**
* @author Carolina Barbosa
*/
@Component(
property = {
"ddm.form.field.type.name=" + ObjectDDMFormFieldTypeConstants.AUTO_INCREMENT,
"ddm.form.field.type.system=true"
},
service = DDMFormFieldType.class
)
public class AutoIncrementDDMFormFieldType extends BaseDDMFormFieldType {

@Override
public String getModuleName() {
JSPackage jsPackage = _npmResolver.getJSPackage();

return jsPackage.getResolvedId() + "/AutoIncrement/AutoIncrement";
}

@Override
public String getName() {
return ObjectDDMFormFieldTypeConstants.AUTO_INCREMENT;
}

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

@Reference
private NPMResolver _npmResolver;

}
Loading