com.jtstand.StepReference Maven / Gradle / Ivy
/*
* Copyright (c) 2009 Albert Kurucz.
*
* This file, StepReference.java is part of JTStand.
*
* JTStand is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JTStand is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GTStand. If not, see .
*/
package com.jtstand;
import org.tmatesoft.svn.core.SVNException;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlTransient;
import java.net.URISyntaxException;
/**
*
* @author albert_kurucz
*/
@Entity
public class StepReference extends FileRevisionReference {
@OneToOne
private TestStep testStep;
@XmlTransient
public TestStep getTestStep() {
return testStep;
}
public void setTestStep(TestStep testStep) {
this.testStep = testStep;
if (testStep != null) {
setCreator(testStep.getCreator());
}
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash += (testStep != null ? testStep.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof StepReference)) {
return false;
}
StepReference other = (StepReference) object;
if (!super.equals(other)) {
return false;
}
if ((this.testStep == null && other.getTestStep() != null) || (this.testStep != null && !this.testStep.equals(other.getTestStep()))) {
return false;
}
return true;
}
public TestStep getTestStep(TestStepInstance step, boolean useCache) throws URISyntaxException, JAXBException, SVNException {
FileRevision creator = testStep.getStepReference().getFileRevision(testStep.getCreator());
if (step.getParent() != null) {
step.getParent().checkLoop(creator);
}
return TestStep.unmarshal(creator, useCache);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy