/*
 * Copyright 2017 Javier A. Ortiz Bultron javier.ortiz.78@gmail.com.
 *
 * 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.validation.manager.core.db;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.TableGenerator;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Javier A. Ortiz Bultron javier.ortiz.78@gmail.com
 */
@Embeddable
public class WorkflowStepPK implements Serializable {

    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WFSGEN")
    @TableGenerator(name = "WFSGEN",
            table = "vm_id",
            pkColumnName = "table_name",
            valueColumnName = "last_id",
            pkColumnValue = "workflow_step",
            initialValue = 0,
            allocationSize = 1)
    private int id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "workflow")
    private int workflow;

    public WorkflowStepPK() {
    }

    public WorkflowStepPK(int workflow) {
        this.workflow = workflow;
    }

    public int getId() {
        return id;
    }

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

    public int getWorkflow() {
        return workflow;
    }

    public void setWorkflow(int workflow) {
        this.workflow = workflow;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) id;
        hash += (int) workflow;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorkflowStepPK)) {
            return false;
        }
        WorkflowStepPK other = (WorkflowStepPK) object;
        if (this.id != other.id) {
            return false;
        }
        if (this.workflow != other.workflow) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.validation.manager.core.db.WorkflowStepPK[ id=" + id + ", workflow=" + workflow + " ]";
    }

}

@@ -1512,16 +1512,20 @@
 Value = 
+1_00
 0,%0D%0A    
@@ -2613,28 +2613,31 @@
  %7D%0D%0A        
-if (
+return 
 this.workflo
@@ -2638,17 +2638,17 @@
 orkflow 
-!
+=
 = other.
@@ -2659,70 +2659,8 @@
 flow
-) %7B%0D%0A            return false;%0D%0A        %7D%0D%0A        return true
 ;%0D%0A 
@@ -2781,16 +2781,33 @@
 PK%5B id=%22
+%0D%0A               
  + id + 
@@ -2847,13 +2847,11 @@
 %0A    %7D%0D%0A
-%0D%0A
 %7D%0D%0A

Use higher initial value so it doesn't collide with default steps.