com.liferay.change.tracking.internal.reference.TableReferenceAppenderRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.change.tracking.service
Show all versions of com.liferay.change.tracking.service
Liferay Change Tracking Service
/**
* SPDX-FileCopyrightText: (c) 2000 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.change.tracking.internal.reference;
import com.liferay.change.tracking.internal.spi.reference.ExpandoTableReferenceAppender;
import com.liferay.change.tracking.spi.reference.TableReferenceDefinition;
import com.liferay.change.tracking.spi.reference.builder.ChildTableReferenceInfoBuilder;
import com.liferay.change.tracking.spi.reference.builder.ParentTableReferenceInfoBuilder;
import com.liferay.petra.sql.dsl.Column;
import com.liferay.petra.sql.dsl.Table;
import com.liferay.portal.kernel.model.BaseModel;
import com.liferay.portal.kernel.service.persistence.BasePersistence;
import java.util.Collections;
import java.util.List;
/**
* @author Preston Crary
*/
public class TableReferenceAppenderRegistry {
public static > void appendTableReferences(
TableReferenceDefinition tableReferenceDefinition,
Column primaryKeyColumn,
ParentTableReferenceInfoBuilder parentTableReferenceInfoBuilder,
ChildTableReferenceInfoBuilder childTableReferenceInfoBuilder) {
BasePersistence> basePersistence =
tableReferenceDefinition.getBasePersistence();
Class extends BaseModel>> modelClass =
basePersistence.getModelClass();
for (TableReferenceAppender tableReferenceAppender :
_tableReferenceAppenders) {
tableReferenceAppender.appendParentTableReferences(
modelClass, primaryKeyColumn, parentTableReferenceInfoBuilder);
tableReferenceAppender.appendChildTableReferences(
modelClass, primaryKeyColumn, childTableReferenceInfoBuilder);
}
}
private static final List _tableReferenceAppenders =
Collections.singletonList(new ExpandoTableReferenceAppender());
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy