Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • GRIN-Global CE Server GRIN-Global CE Server
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 36
    • Issues 36
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GG-CE
  • GRIN-Global CE ServerGRIN-Global CE Server
  • Issues
  • #135

Closed
Open
Created Jan 27, 2021 by Matija Obreza@mobrezaOwner

Inventory Viability Actions

Add a new entity InventoryViabilityAction and one new code group:

public static final String INVENTORY_VIABILITY_ACTION = "INVENTORY_VIABILITY_ACTION";

// with
new CodeValueDef(INVENTORY_VIABILITY_ACTION, "PRETREATMENT", "Pretreatment", "A method of pretreatment is applied");

Add our standard actions controllers to InventoryViabilityController.

Update liquibase.

ER design

Note: the two tables are replaced with InventoryViabilityAction:

image

Draft code

/**
 * Records actions during viability testing.
 */
@Entity
@Table(name = "inventory_viability_action")
@JsonIdentityInfo(scope = InventoryViabilityAction.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class InventoryViabilityAction extends AbstractAction {
	private static final long serialVersionUID = 4820082734646288915L;

	@Id
	@JsonProperty
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "inventory_action_id")
	private Long id;

	@Basic
	@Column(name = "action_name_code", nullable = false, length = 20)
	@CodeValueField(CommunityCodeValues.INVENTORY_VIABILITY_ACTION)
	private String actionNameCode;

	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "inventory_viability_id", nullable = false)
	@JsonIdentityReference
	@JsonIdentityInfo(scope = InventoryViability.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
	@JsonIgnoreProperties({ "ownedBy" })
	private InventoryViability inventoryViability;

	@ManyToOne(fetch = FetchType.LAZY, cascade = {})
	@JoinColumn(name = "method_id")
	private Method method;


	public InventoryViabilityAction() {
	}

	public InventoryViabilityAction(final Long id) {
		this.id = id;
	}

	public Long getId() {
		return id;
	}

	public void setId(final Long id) {
		this.id = id;
	}

	@Override
	public Long getOwningEntityId() {
		return inventoryViability == null ? null : inventoryViability.getInventory().getId();
	}
	
	public InventoryViability getInventoryViability() {
		return inventoryViability;
	}

	public void setInventoryViability(final InventoryViability inventoryViability) {
		this.inventoryViability = inventoryViability;
	}

	@Override
	public String getActionNameCode() {
		return this.actionNameCode;
	}

	@Override
	public void setActionNameCode(String actionNameCode) {
		this.actionNameCode = actionNameCode;
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(final Method method) {
		this.method = method;
	}

}
Edited Jan 27, 2021 by Matija Obreza
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking