Skip to content

Commit

Permalink
refactor ImageInspectAction*
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed Feb 11, 2025
1 parent e9025f9 commit 917c4ec
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.redhat.rhn.domain.action.ActionChild;
import com.redhat.rhn.domain.action.rhnpackage.PackageActionDetails;
import com.redhat.rhn.domain.action.rhnpackage.PackageActionResult;
import com.redhat.rhn.domain.action.salt.inspect.ImageInspectActionDetails;
import com.redhat.rhn.domain.action.salt.inspect.ImageInspectActionResult;
import com.redhat.rhn.domain.action.script.ScriptActionDetails;
import com.redhat.rhn.domain.action.script.ScriptResult;
import com.redhat.rhn.domain.audit.XccdfTestResult;
Expand Down Expand Up @@ -225,6 +227,9 @@ private AnnotationRegistry() {
ImageFile.class,
ImageInfo.class,
ImageInfoCustomDataValue.class,
ImageInspectActionDetails.class,
ImageInspectActionResult.class,
ImageInspectActionResult.ImageInspectActionResultId.class,
ImageOverview.class,
ImagePackage.class,
ImageProfile.class,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,48 @@
*/
package com.redhat.rhn.domain.action.salt.inspect;

import com.redhat.rhn.domain.action.Action;
import com.redhat.rhn.domain.action.ActionChild;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
* ImageInspectActionDetails - Class representation of the table rhnActionImageInspect.
*/
@Entity
@Table(name = "rhnActionImageInspect")
public class ImageInspectActionDetails extends ActionChild {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "image_inspect_seq")
@SequenceGenerator(name = "image_inspect_seq", sequenceName = "RHN_ACT_IMAGE_INSPECT_ID_SEQ", allocationSize = 1)
private Long id;
private Long actionId;

@Transient
private String name;

@Transient
private String version;

@Column(name = "image_store_id")
private Long imageStoreId;

@OneToMany(mappedBy = "id.actionImageInspectId", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<ImageInspectActionResult> results = new HashSet<>();

@Column(name = "build_action_id")
private Long buildActionId;

/**
Expand Down Expand Up @@ -89,17 +115,17 @@ public void setId(Long idIn) {
}

/**
* @return the action id
* @return the action
*/
public Long getActionId() {
return actionId;
public Action getAction() {
return super.getParentAction();
}

/**
* @param actionIdIn the action id to set
* @param actionIn the action to set
*/
public void setActionId(Long actionIdIn) {
this.actionId = actionIdIn;
public void setAction(Action actionIn) {
super.setParentAction(actionIn);
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,123 @@

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
* ImageInspectActionResult
*/
@Entity
@Table(name = "rhnActionImageInspectResult")
public class ImageInspectActionResult implements Serializable {

private Long serverId;
private Long actionImageInspectId;
@Embeddable
public static class ImageInspectActionResultId implements Serializable {

@Column(name = "server_id")
private Long serverId;

@Column(name = "action_image_inspect_id")
private Long actionImageInspectId;

/**
* @return the actionImageInspectId
*/
public Long getActionImageInspectId() {
return actionImageInspectId;
}

/**
* @param actionImageInspectIdIn the actionImageInspectId to set.
*/
public void setActionImageInspectId(Long actionImageInspectIdIn) {
actionImageInspectId = actionImageInspectIdIn;
}

/**
* @return the serverId
*/
public Long getServerId() {
return serverId;
}

/**
* @param serverIdIn serverId to set
*/
public void setServerId(Long serverIdIn) {
serverId = serverIdIn;
}
}

@EmbeddedId
private ImageInspectActionResultId id = new ImageInspectActionResultId();

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "action_image_inspect_id", insertable = false, updatable = false)
private ImageInspectActionDetails parentScriptActionDetails;

private ImageInspectActionDetails parentActionDetails;

/**
* @return the Id
*/
public ImageInspectActionResultId getId() {
return id;
}

/**
* @param idIn the id to set
*/
public void setId(ImageInspectActionResultId idIn) {
id = idIn;
}

/**
* @return the serverId
*/
public Long getServerId() {
return serverId;
return this.getId().getServerId();
}

/**
* @param sid serverId to set
*/
public void setServerId(Long sid) {
this.serverId = sid;
this.getId().setServerId(sid);
}

/**
* @return the actionImageInspectId
*/
public Long getActionImageInspectId() {
return actionImageInspectId;
return this.getId().getActionImageInspectId();
}

/**
* @param actionId the actionImageInspectId to set.
*/
public void setActionImageInspectId(Long actionId) {
this.actionImageInspectId = actionId;
this.getId().setActionImageInspectId(actionId);
}

/**
* @return the parentActionDetails
*/
public ImageInspectActionDetails getParentScriptActionDetails() {
return parentActionDetails;
return parentScriptActionDetails;
}

/**
* @param parentActionDetailsIn the parentActionDetails to set
*/
public void setParentScriptActionDetails(
ImageInspectActionDetails parentActionDetailsIn) {
this.parentActionDetails = parentActionDetailsIn;
this.parentScriptActionDetails = parentActionDetailsIn;
}

@Override
Expand Down

0 comments on commit 917c4ec

Please sign in to comment.