All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.change.tracking.internal.reference.TableReferenceInfoFactory Maven / Gradle / Ivy

There is a newer version: 3.0.107
Show newest version
/**
 * 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.reference.builder.ChildTableReferenceInfoBuilderImpl;
import com.liferay.change.tracking.internal.reference.builder.ParentTableReferenceInfoBuilderImpl;
import com.liferay.change.tracking.spi.reference.TableReferenceDefinition;
import com.liferay.petra.sql.dsl.Column;
import com.liferay.petra.sql.dsl.Table;

/**
 * @author Preston Crary
 */
public class TableReferenceInfoFactory {

	public static > TableReferenceInfo create(
		long classNameId, Column primaryKeyColumn,
		TableReferenceDefinition tableReferenceDefinition) {

		ParentTableReferenceInfoBuilderImpl
			parentTableReferenceInfoBuilderImpl =
				new ParentTableReferenceInfoBuilderImpl<>(
					tableReferenceDefinition, primaryKeyColumn);

		tableReferenceDefinition.defineParentTableReferences(
			parentTableReferenceInfoBuilderImpl);

		ChildTableReferenceInfoBuilderImpl
			childTableReferenceInfoBuilderImpl =
				new ChildTableReferenceInfoBuilderImpl<>(
					tableReferenceDefinition, primaryKeyColumn);

		tableReferenceDefinition.defineChildTableReferences(
			childTableReferenceInfoBuilderImpl);

		TableReferenceAppenderRegistry.appendTableReferences(
			tableReferenceDefinition, primaryKeyColumn,
			parentTableReferenceInfoBuilderImpl,
			childTableReferenceInfoBuilderImpl);

		return new TableReferenceInfo<>(
			childTableReferenceInfoBuilderImpl.getTableJoinHoldersMap(),
			classNameId,
			parentTableReferenceInfoBuilderImpl.getTableJoinHoldersMap(),
			tableReferenceDefinition);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy