Github user kevdoran commented on a diff in the pull request:
https://github.com/apache/nifi-registry/pull/6#discussion_r135267708
--- Diff:
nifi-registry-data-model/src/main/java/org/apache/nifi/registry/flow/VersionedFlowSnapshotMetadata.java
---
@@ -0,0 +1,117 @@
+/*
+ * 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.registry.flow;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Objects;
+
+/**
+ * The metadata information about a VersionedFlowSnapshot. This class
implements Comparable in order
+ * to sort based on the snapshot version in ascending order.
+ */
+@ApiModel(value = "versionedFlowSnapshot")
+public class VersionedFlowSnapshotMetadata implements
Comparable<VersionedFlowSnapshotMetadata> {
+
+ private String bucketIdentifier;
+ private String flowIdentifier;
+ private String flowName;
+ private int version;
+ private long timestamp;
+ private String comments;
+
+ @ApiModelProperty("The identifier of the bucket this snapshot belongs
to.")
+ public String getBucketIdentifier() {
+ return bucketIdentifier;
+ }
+
+ public void setBucketIdentifier(String bucketIdentifier) {
+ this.bucketIdentifier = bucketIdentifier;
+ }
+
+ @ApiModelProperty("The identifier of the flow this snapshot belongs
to.")
+ public String getFlowIdentifier() {
+ return flowIdentifier;
+ }
+
+ public void setFlowIdentifier(String flowIdentifier) {
+ this.flowIdentifier = flowIdentifier;
+ }
+
+ @ApiModelProperty("The name of the flow this snapshot belongs to.")
+ public String getFlowName() {
+ return flowName;
+ }
+
+ public void setFlowName(String flowName) {
+ this.flowName = flowName;
+ }
+
+ @ApiModelProperty("The version of this snapshot of the flow.")
+ public int getVersion() {
+ return version;
+ }
+
+ public void setVersion(int version) {
+ this.version = version;
+ }
+
+ @ApiModelProperty("The timestamp when the flow was saved.")
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ @ApiModelProperty("The comments provided by the user when creating the
snapshot.")
+ public String getComments() {
+ return comments;
+ }
+
+ public void setComments(String comments) {
+ this.comments = comments;
+ }
+
+ @Override
+ public int compareTo(final VersionedFlowSnapshotMetadata o) {
+ return o == null ? -1 : Integer.compare(version, o.version);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.bucketIdentifier, this.flowIdentifier,
Integer.valueOf(this.version));
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final VersionedFlowSnapshotMetadata other =
(VersionedFlowSnapshotMetadata) obj;
+
+ return Objects.equals(this.bucketIdentifier,
other.bucketIdentifier)
+ && Objects.equals(this.flowIdentifier,
other.flowIdentifier)
+ && Objects.equals(this.version, other.version);
+ }
--- End diff --
This is a a nit-pick, but is including bucketIdentifier necessary for
equals() and hashcode() here? It's omitted from BucketItem, where only the
item's identifier is used. It should work fine both ways as we will be using
UUIDs. I don't know if anything is needed, it just caught my eye as a minor
inconsistency between BucketItem (and VersionedFlow which extends BucketItem)
and VersionedFlowSnapshot/VersionedFlowSnapshotMetadata.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---