Skip to content

Instantly share code, notes, and snippets.

@lincolnthree
Created October 22, 2013 20:17
Show Gist options
  • Select an option

  • Save lincolnthree/7107422 to your computer and use it in GitHub Desktop.

Select an option

Save lincolnthree/7107422 to your computer and use it in GitHub Desktop.
package org.ocpsoft.redoculous.io.model.repositories;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import org.ocpsoft.redoculous.io.model.DeletableObject;
@Entity
public class SourceRepository extends DeletableObject<SourceRepository>
{
private static final long serialVersionUID = -5073498985294369095L;
@Column(length = 128)
private String url;
@Column
@Enumerated(EnumType.STRING)
private VCSType type;
@Column
private String apiKey;
@ManyToOne
private UserAccount account;
/**
* Getters and Setters
*/
public UserAccount getAccount()
{
return this.account;
}
public void setAccount(final UserAccount account)
{
this.account = account;
}
public String getUrl()
{
return this.url;
}
public void setUrl(final String url)
{
this.url = url;
}
public String getApiKey()
{
return this.apiKey;
}
public void setApiKey(final String apiKey)
{
this.apiKey = apiKey;
}
@Override
public String toString()
{
String result = getClass().getSimpleName() + " ";
result += "serialVersionUID: " + serialVersionUID;
if (url != null && !url.trim().isEmpty())
result += ", url: " + url;
if (apiKey != null && !apiKey.trim().isEmpty())
result += ", apiKey: " + apiKey;
return result;
}
}
@pedroigor
Copy link

@entity
@IdentityManaged({CustomUser.class})
@MappedAttribute("sources")
public class SourceRepository extends DeletableObject
{
private static final long serialVersionUID = -5073498985294369095L;

@column(length = 128)
private String url;

@column
@Enumerated(EnumType.STRING)
private VCSType type;

@column
private String apiKey;

@manytoone
@OwnerReference
private AccountTypeEntity account;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment