Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 2017-2022 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.data.runtime.operations.internal;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.convert.ConversionService;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.data.annotation.Relation;
import io.micronaut.data.model.Association;
import io.micronaut.data.model.query.builder.sql.SqlQueryBuilder;
import io.micronaut.data.model.runtime.RuntimeAssociation;
import io.micronaut.data.model.runtime.RuntimePersistentEntity;
import io.micronaut.data.model.runtime.RuntimePersistentProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import java.util.function.Predicate;
/**
* Synchronous cascade operations.
*
* @param The operation context.
* @author Denis Stepanov
* @since 3.3
*/
@Internal
public final class SyncCascadeOperations extends AbstractCascadeOperations {
private static final Logger LOG = LoggerFactory.getLogger(SyncCascadeOperations.class);
private final SyncCascadeOperationsHelper helper;
/**
* Default constructor.
*
* @param conversionService The conversionService
* @param helper The helper
*/
public SyncCascadeOperations(ConversionService conversionService, SyncCascadeOperationsHelper helper) {
super(conversionService);
this.helper = helper;
}
/**
* Cascade the entity operation.
*
* @param ctx The context
* @param entity The entity instance
* @param persistentEntity The persistent entity
* @param isPost Is post cascade?
* @param cascadeType The cascade type
* @param The entity type
* @return The entity instance
*/
public T cascadeEntity(Ctx ctx,
T entity,
RuntimePersistentEntity persistentEntity,
boolean isPost,
Relation.Cascade cascadeType) {
List cascadeOps = new ArrayList<>();
cascade(ctx.annotationMetadata, ctx.repositoryType,
isPost, cascadeType,
CascadeContext.of(ctx.associations, entity, (RuntimePersistentEntity