Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop' into feature/orgs
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
  • Loading branch information
grabsefx committed May 14, 2024
2 parents 5b71681 + 67b6717 commit c15d41f
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 27 deletions.
1 change: 1 addition & 0 deletions project-properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ project.ext {
(migrationsUrl + '/migrations/83_add_slugify_function.up.sql') : 'V083__add_slugify_function.sql',
(migrationsUrl + '/migrations/84_organization_tables.up.sql') : 'V084__organization_tables.sql',
(migrationsUrl + '/migrations/86_notication_update.up.sql') : 'V086__notication_update.sql',
(migrationsUrl + '/migrations/89_add_retention_policy_launch.up.sql') : 'V089__add_retention_policy_launch.sql',

]
excludeTests = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ private List<Field<?>> getSelectSimpleFields() {
LAUNCH.HAS_RETRIES,
LAUNCH.RERUN,
LAUNCH.APPROXIMATE_DURATION,
LAUNCH.RETENTION_POLICY,
STATISTICS.S_COUNTER,
STATISTICS_FIELD.NAME,
USERS.ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2023 EPAM Systems
*
* 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
*
* 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 com.epam.ta.reportportal.entity.enums;

import java.util.Arrays;
import java.util.Optional;

/**
* Retention policy enum.
*
* @author Ivan Kustau
*/
public enum RetentionPolicyEnum {
IMPORTANT, REGULAR;

public static Optional<RetentionPolicyEnum> fromValue(String value) {
return Arrays.stream(RetentionPolicyEnum.values())
.filter(status -> status.name().equalsIgnoreCase(value)).findAny();
}
}
36 changes: 25 additions & 11 deletions src/main/java/com/epam/ta/reportportal/entity/launch/Launch.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.epam.ta.reportportal.entity.ItemAttribute;
import com.epam.ta.reportportal.entity.enums.LaunchModeEnum;
import com.epam.ta.reportportal.entity.enums.PostgreSQLEnumType;
import com.epam.ta.reportportal.entity.enums.RetentionPolicyEnum;
import com.epam.ta.reportportal.entity.enums.StatusEnum;
import com.epam.ta.reportportal.entity.log.Log;
import com.epam.ta.reportportal.entity.statistics.Statistics;
Expand Down Expand Up @@ -57,9 +58,9 @@
@EntityListeners(AuditingEntityListener.class)
@TypeDef(name = "pqsql_enum", typeClass = PostgreSQLEnumType.class)
@Table(name = "launch", schema = "public", uniqueConstraints = {
@UniqueConstraint(columnNames = {"name", "number", "project_id"})}, indexes = {
@UniqueConstraint(columnNames = { "name", "number", "project_id" }) }, indexes = {
@Index(name = "launch_pk", unique = true, columnList = "id ASC"),
@Index(name = "unq_name_number", unique = true, columnList = "name ASC, number ASC, project_id ASC")})
@Index(name = "unq_name_number", unique = true, columnList = "name ASC, number ASC, project_id ASC") })
public class Launch implements Serializable {

@Id
Expand Down Expand Up @@ -111,6 +112,11 @@ public class Launch implements Serializable {
@Type(type = "pqsql_enum")
private StatusEnum status;

@Column(name = "retention_policy", nullable = false)
@Enumerated(EnumType.STRING)
@Type(type = "pqsql_enum")
private RetentionPolicyEnum retentionPolicy;

@OneToMany(mappedBy = "launch", cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@Fetch(FetchMode.JOIN)
private Set<ItemAttribute> attributes = Sets.newHashSet();
Expand Down Expand Up @@ -278,6 +284,14 @@ public void setApproximateDuration(double approximateDuration) {
this.approximateDuration = approximateDuration;
}

public RetentionPolicyEnum getRetentionPolicy() {
return retentionPolicy;
}

public void setRetentionPolicy(RetentionPolicyEnum retentionPolicy) {
this.retentionPolicy = retentionPolicy;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -288,20 +302,19 @@ public boolean equals(Object o) {
}
Launch launch = (Launch) o;
return hasRetries == launch.hasRetries && rerun == launch.rerun && Objects.equals(uuid,
launch.uuid) && Objects.equals(projectId,
launch.projectId
) && Objects.equals(name, launch.name) && Objects.equals(description, launch.description)
&& Objects.equals(startTime,
launch.startTime
) && Objects.equals(endTime, launch.endTime) && Objects.equals(number, launch.number)
&& mode == launch.mode
&& status == launch.status;
launch.uuid
) && Objects.equals(projectId, launch.projectId) && Objects.equals(
name, launch.name) && Objects.equals(description, launch.description) && Objects.equals(
startTime, launch.startTime) && Objects.equals(endTime, launch.endTime) && Objects.equals(
number, launch.number) && mode == launch.mode && status == launch.status
&& retentionPolicy == launch.retentionPolicy;
}

@Override
public int hashCode() {
return Objects.hash(uuid, projectId, name, description, startTime, endTime, number, hasRetries,
rerun, mode, status);
rerun, mode, status, retentionPolicy
);
}

@Override
Expand All @@ -324,6 +337,7 @@ public String toString() {
sb.append(", attributes=").append(attributes);
sb.append(", statistics=").append(statistics);
sb.append(", approximateDuration=").append(approximateDuration);
sb.append(", retentionPolicy=").append(retentionPolicy);
sb.append('}');
return sb.toString();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions src/main/java/com/epam/ta/reportportal/jooq/tables/JLaunch.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c15d41f

Please sign in to comment.