com.greenpepper.server.domain.Document Maven / Gradle / Ivy
package com.greenpepper.server.domain;
import static com.greenpepper.server.rpc.xmlrpc.XmlRpcDataMarshaller.DOCUMENT_NAME_IDX;
import static com.greenpepper.server.rpc.xmlrpc.XmlRpcDataMarshaller.DOCUMENT_REPOSITORY_IDX;
import java.util.Vector;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import com.greenpepper.server.GreenPepperServerException;
/**
* Abstract Document class.
*
* @author oaouattara
* @version $Id: $Id
*/
@SuppressWarnings("serial")
@MappedSuperclass
public abstract class Document extends AbstractUniqueEntity implements Comparable
{
private String name;
private String resolvedName;
private Repository repository;
/**
* Getter for the field name
.
*
* @return a {@link java.lang.String} object.
*/
@Basic
@Column(name = "NAME", nullable = false, length=255)
public String getName()
{
return this.name;
}
/**
* Getter for the field repository
.
*
* @return a {@link com.greenpepper.server.domain.Repository} object.
*/
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinColumn(name="REPOSITORY_ID")
public Repository getRepository()
{
return this.repository;
}
/**
* For UI purposes
*
* @param resolvedName a {@link java.lang.String} object.
*/
public void setResolvedName(String resolvedName)
{
this.resolvedName = resolvedName;
}
/**
* Setter for the field name
.
*
* @param name a {@link java.lang.String} object.
*/
public void setName(String name)
{
this.name = name;
}
/**
* Setter for the field repository
.
*
* @param repository a {@link com.greenpepper.server.domain.Repository} object.
*/
public void setRepository(Repository repository)
{
this.repository = repository;
}
// @Transient
// public String getResolvedUri() throws GreenPepperServerException
// {
// return repository.resolveUri(this);
// }
/**
* Getter for the field resolvedName
.
*
* @return a {@link java.lang.String} object.
* @throws com.greenpepper.server.GreenPepperServerException if any.
*/
@Transient
public String getResolvedName() throws GreenPepperServerException
{
if(resolvedName != null){return resolvedName;}
return repository.resolveName(this);
}
/**
* marshallize.
*
* @return a {@link java.util.Vector} object.
*/
public Vector
© 2015 - 2025 Weber Informatics LLC | Privacy Policy