Skip to content
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
@@ -0,0 +1,125 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://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 org.apache.nifi.web.api.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.xml.bind.annotation.XmlType;

@XmlType(name = "rebaseChange")
public class RebaseChangeDTO {
private String componentId;
private String componentName;
private String componentType;
private String differenceType;
private String fieldName;
private String localValue;
private String registryValue;
private String classification;
private String conflictCode;
private String conflictDetail;

@Schema(description = "The ID of the component that was changed")
public String getComponentId() {
return componentId;
}

public void setComponentId(final String componentId) {
this.componentId = componentId;
}

@Schema(description = "The name of the component that was changed")
public String getComponentName() {
return componentName;
}

public void setComponentName(final String componentName) {
this.componentName = componentName;
}

@Schema(description = "The type of the component that was changed")
public String getComponentType() {
return componentType;
}

public void setComponentType(final String componentType) {
this.componentType = componentType;
}

@Schema(description = "The type of difference detected for this change")
public String getDifferenceType() {
return differenceType;
}

public void setDifferenceType(final String differenceType) {
this.differenceType = differenceType;
}

@Schema(description = "The name of the field that was changed, or null if not applicable")
public String getFieldName() {
return fieldName;
}

public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
}

@Schema(description = "The local value of the field, or null if not applicable")
public String getLocalValue() {
return localValue;
}

public void setLocalValue(final String localValue) {
this.localValue = localValue;
}

@Schema(description = "The registry value of the field, or null if not applicable")
public String getRegistryValue() {
return registryValue;
}

public void setRegistryValue(final String registryValue) {
this.registryValue = registryValue;
}

@Schema(description = "The classification of this change: COMPATIBLE, CONFLICTING, or UNSUPPORTED")
public String getClassification() {
return classification;
}

public void setClassification(final String classification) {
this.classification = classification;
}

@Schema(description = "A code identifying the type of conflict, or null if the change is not conflicting")
public String getConflictCode() {
return conflictCode;
}

public void setConflictCode(final String conflictCode) {
this.conflictCode = conflictCode;
}

@Schema(description = "A detailed description of the conflict, or null if the change is not conflicting")
public String getConflictDetail() {
return conflictDetail;
}

public void setConflictDetail(final String conflictDetail) {
this.conflictDetail = conflictDetail;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://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 org.apache.nifi.web.api.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.xml.bind.annotation.XmlRootElement;
import org.apache.nifi.web.api.dto.ComponentDifferenceDTO;
import org.apache.nifi.web.api.dto.RebaseChangeDTO;

import java.util.List;
import java.util.Set;

@XmlRootElement(name = "rebaseAnalysisEntity")
public class RebaseAnalysisEntity extends Entity {
private String processGroupId;
private String currentVersion;
private String targetVersion;
private String analysisFingerprint;
private Boolean rebaseAllowed;
private List<RebaseChangeDTO> localChanges;
private Set<ComponentDifferenceDTO> upstreamChanges;
private String failureReason;

@Schema(description = "The ID of the Process Group being rebased")
public String getProcessGroupId() {
return processGroupId;
}

public void setProcessGroupId(final String processGroupId) {
this.processGroupId = processGroupId;
}

@Schema(description = "The current version of the flow in the Process Group")
public String getCurrentVersion() {
return currentVersion;
}

public void setCurrentVersion(final String currentVersion) {
this.currentVersion = currentVersion;
}

@Schema(description = "The target version to rebase to")
public String getTargetVersion() {
return targetVersion;
}

public void setTargetVersion(final String targetVersion) {
this.targetVersion = targetVersion;
}

@Schema(description = "A fingerprint representing the state of this analysis, used to verify the analysis is still valid when executing the rebase")
public String getAnalysisFingerprint() {
return analysisFingerprint;
}

public void setAnalysisFingerprint(final String analysisFingerprint) {
this.analysisFingerprint = analysisFingerprint;
}

@Schema(description = "Whether the rebase is allowed based on the analysis of local and upstream changes")
public Boolean getRebaseAllowed() {
return rebaseAllowed;
}

public void setRebaseAllowed(final Boolean rebaseAllowed) {
this.rebaseAllowed = rebaseAllowed;
}

@Schema(description = "The list of local changes that were made to the flow since the last version control operation")
public List<RebaseChangeDTO> getLocalChanges() {
return localChanges;
}

public void setLocalChanges(final List<RebaseChangeDTO> localChanges) {
this.localChanges = localChanges;
}

@Schema(description = "The set of upstream changes between the current version and the target version in the flow registry")
public Set<ComponentDifferenceDTO> getUpstreamChanges() {
return upstreamChanges;
}

public void setUpstreamChanges(final Set<ComponentDifferenceDTO> upstreamChanges) {
this.upstreamChanges = upstreamChanges;
}

@Schema(description = "The reason the rebase is not allowed, or null if the rebase is allowed")
public String getFailureReason() {
return failureReason;
}

public void setFailureReason(final String failureReason) {
this.failureReason = failureReason;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://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 org.apache.nifi.web.api.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "rebaseRequestEntity")
public class RebaseRequestEntity extends Entity {
private VersionControlInformationEntity versionControlInformationEntity;
private String analysisFingerprint;

@Schema(description = "The Version Control information for the Process Group being rebased")
public VersionControlInformationEntity getVersionControlInformationEntity() {
return versionControlInformationEntity;
}

public void setVersionControlInformationEntity(final VersionControlInformationEntity versionControlInformationEntity) {
this.versionControlInformationEntity = versionControlInformationEntity;
}

@Schema(description = "The fingerprint of the rebase analysis, used to verify the analysis is still valid when executing the rebase")
public String getAnalysisFingerprint() {
return analysisFingerprint;
}

public void setAnalysisFingerprint(final String analysisFingerprint) {
this.analysisFingerprint = analysisFingerprint;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
import org.apache.nifi.web.api.entity.ProcessorEntity;
import org.apache.nifi.web.api.entity.ProcessorStatusEntity;
import org.apache.nifi.web.api.entity.ProcessorsRunStatusDetailsEntity;
import org.apache.nifi.web.api.entity.RebaseAnalysisEntity;
import org.apache.nifi.web.api.entity.RemoteProcessGroupEntity;
import org.apache.nifi.web.api.entity.RemoteProcessGroupPortEntity;
import org.apache.nifi.web.api.entity.RemoteProcessGroupStatusEntity;
Expand Down Expand Up @@ -1569,6 +1570,47 @@ Set<DocumentedTypeDTO> getControllerServiceTypes(final String serviceType, final
*/
FlowComparisonEntity getLocalModifications(String processGroupId);

/**
* Performs a rebase analysis for the given Process Group, comparing local modifications against
* upstream changes between the current version and the specified target version.
*
* @param processGroupId the ID of the Process Group
* @param targetVersion the target version to rebase to
* @return a RebaseAnalysisEntity that contains the analysis of local and upstream changes
* @throws IllegalStateException if the Process Group with the given ID is not under version control
*/
RebaseAnalysisEntity getRebaseAnalysis(String processGroupId, String targetVersion);

/**
* Verifies that the Process Group with the given identifier can be rebased to a new version.
*
* @param processGroupId the ID of the Process Group
* @param targetVersion the target version to rebase to
* @throws IllegalStateException if the Process Group cannot be rebased
*/
void verifyCanRebase(String processGroupId, String targetVersion);

/**
* Returns a FlowSnapshotContainer for the target version of the flow with the merged rebase contents applied.
* This re-runs the rebase analysis and verifies the fingerprint before producing the merged snapshot.
*
* @param processGroupId the ID of the Process Group
* @param targetVersion the target version to rebase to
* @param expectedAnalysisFingerprint the expected analysis fingerprint to validate that the analysis has not changed
* @return a FlowSnapshotContainer containing the target version snapshot with merged local changes applied
* @throws IllegalStateException if the rebase is not allowed or the fingerprint does not match
*/
FlowSnapshotContainer getRebasedFlowSnapshot(String processGroupId, String targetVersion, String expectedAnalysisFingerprint);

/**
* Resets the Version Control Information snapshot for a process group after a rebase operation.
* After rebase, the VCI snapshot must reference the clean target version (not the merged snapshot)
* so that subsequent local modification checks correctly detect the preserved local changes.
*
* @param processGroupId the process group ID
*/
void resetVersionControlSnapshotAfterRebase(String processGroupId);

/**
* Determines whether the process group with the given id or any of its descendants are under version control.
*
Expand Down
Loading
Loading