Skip to content

Commit

Permalink
added decorator feature and minor naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Mar 2, 2010
1 parent 5007df3 commit 3b77887
Show file tree
Hide file tree
Showing 14 changed files with 665 additions and 33 deletions.
7 changes: 7 additions & 0 deletions jsf/pastecode/ejb/pom.xml
Expand Up @@ -46,6 +46,13 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
Expand Down
@@ -0,0 +1,144 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This 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 2.1 of
* the License, or (at your option) any later version.
*
* This software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.weld.examples.pastecode.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GenerationType;
import javax.persistence.GeneratedValue;
import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Lob;
import java.util.Date;

/**
* The persistent class for the code database table.
*
*/
@Entity
@Table(name = "code")
public class CodeEntity implements Serializable, Cloneable
{
private static final long serialVersionUID = 1L;
private int id;
private Date datetime;
private String language;
private String note;
private String text;
private String user;
private String hash;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
public int getId()
{
return id;
}

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

@Column(name = "hash")
public String getHash()
{
return hash;
}

public void setHash(String hash)
{
this.hash = hash;
}

public CodeEntity()
{
this.language = "";
this.note = "";
this.text = "";
this.user = "";
this.hash = null;
this.datetime = null;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "datetime")
public Date getDatetime()
{
return this.datetime;
}

public void setDatetime(Date datetime)
{
this.datetime = datetime;
}

@Column(name = "language")
public String getLanguage()
{
return this.language;
}

public void setLanguage(String language)
{
this.language = language;
}

@Lob()
@Column(name = "note")
public String getNote()
{
return this.note;
}

public void setNote(String note)
{
this.note = note;
}

@Lob()
@Column(name = "text")
public String getText()
{
return this.text;
}

public void setText(String text)
{
this.text = text;
}

@Column(name = "user")
public String getUser()
{
return this.user;
}

public void setUser(String user)
{
this.user = user;
}
}
@@ -0,0 +1,97 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This 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 2.1 of
* the License, or (at your option) any later version.
*
* This software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.weld.examples.pastecode.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GenerationType;
import javax.persistence.GeneratedValue;
import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

@Entity
@Table(name = "largecodelog")
public class LargeCodeLog implements Serializable
{
private static final long serialVersionUID = 1L;
private int id;
private Date datetime;
private int codeId;
private String access;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
public int getId()
{
return id;
}

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

public LargeCodeLog(int codeId, Date dateTime, String access)
{
this.codeId = codeId;
this.datetime = dateTime;
this.access = access;
}

public int getCodeId()
{
return codeId;
}

public void setCodeId(int codeId)
{
this.codeId = codeId;
}

public String getAccess()
{
return access;
}

public void setAccess(String access)
{
this.access = access;
}

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "datetime")
public Date getDatetime()
{
return this.datetime;
}

public void setDatetime(Date datetime)
{
this.datetime = datetime;
}

}
@@ -0,0 +1,38 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This 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 2.1 of
* the License, or (at your option) any later version.
*
* This software 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 this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.weld.examples.pastecode.session;

import javax.ejb.Local;
import java.util.List;
import org.jboss.weld.examples.pastecode.model.CodeEntity;

@Local
public interface Code
{
public String addCode(CodeEntity code, boolean secured);

public CodeEntity getCode(String id);

public List<CodeEntity> recentCodes();

public List<CodeEntity> searchCodes(CodeEntity code, int page, QueryInfo info);
}

0 comments on commit 3b77887

Please sign in to comment.