Skip to content

Commit

Permalink
first commit of pastecode example
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Feb 16, 2010
1 parent 1a845c3 commit aa15ba3
Show file tree
Hide file tree
Showing 80 changed files with 7,606 additions and 0 deletions.
8 changes: 8 additions & 0 deletions jsf/pastecode/build.xml
@@ -0,0 +1,8 @@
<project basedir="." name="PasteCode Example Build" default="restart">

<property name="example.name" value="weld-pastecode" />
<property name="type" value="ear" />

<import file="../../build.xml" />

</project>
86 changes: 86 additions & 0 deletions jsf/pastecode/ear/pom.xml
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-ear</artifactId>
<packaging>ear</packaging>
<name>Weld Examples: PasteCode (ear)</name>

<pluginRepositories>
<pluginRepository>
<id>codehaus snapshot repository</id>
<url>http://snapshots.repository.codehaus.org/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>

<dependencies>

<dependency>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-ejb</artifactId>
<type>ejb</type>
</dependency>

<dependency>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-war</artifactId>
<type>war</type>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<!-- <dependency>
<groupId>org.jboss.el</groupId>
<artifactId>jboss-el</artifactId>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>-->
</dependencies>

<build>
<finalName>weld-pastecode</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<generateApplicationXml>true</generateApplicationXml>
<applicationXml>${project.build.directory}/application.xml</applicationXml>
<modules>
<webModule>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-war</artifactId>
<bundleFileName>weld-pastecode.war</bundleFileName>
<contextRoot>/weld-pastecode</contextRoot>
</webModule>
<ejbModule>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-ejb</artifactId>
<bundleFileName>weld-pastecode.jar</bundleFileName>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>

</project>

65 changes: 65 additions & 0 deletions jsf/pastecode/ejb/pom.xml
@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode-ejb</artifactId>
<packaging>ejb</packaging>
<name>Weld Examples: PasteCode (ejb)</name>

<pluginRepositories>
<pluginRepository>
<id>codehaus snapshot repository</id>
<url>http://snapshots.repository.codehaus.org/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>

<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<finalName>weld-pastecode</finalName>
</build>

</project>

@@ -0,0 +1,136 @@
package org.jboss.weld.examples.pastecode.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;

/**
* The persistent class for the code database table.
*
*/
@Entity
@Table(name = "code")
public class Code 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 Code()
{
this.language = "";
this.note = "";
this.text = "";
this.user = "";
this.hash = 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;
}

// public Object clone()
// {
// Code c = null;
// try
// {
// c = (Code) super.clone();
// c.setDatetime(this.datetime);
// c.setHash(this.hash);
// c.setId(this.id);
// c.setLanguage(this.language);
// c.setNote(this.note);
// c.setText(this.text);
// c.setUser(this.user);
// }
// catch (CloneNotSupportedException e)
// {
// e.printStackTrace();
// }
// return c;
// }

}
@@ -0,0 +1,19 @@
package org.jboss.weld.examples.pastecode.session;

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

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

public Code getCode(String id);

public List<Code> allCodes();

public List<Code> recentCodes();

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

0 comments on commit aa15ba3

Please sign in to comment.