-
-
Save esfand/635083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
import javax.jdo.PersistenceManager; | |
import javax.jdo.annotations.Column; | |
import javax.jdo.annotations.IdGeneratorStrategy; | |
import javax.jdo.annotations.PersistenceCapable; | |
import javax.jdo.annotations.Persistent; | |
import javax.jdo.annotations.PrimaryKey; | |
import com.google.gwt.requestfactory.shared.Version; | |
@PersistenceCapable | |
public class User { | |
public static User get(Long id) { | |
PersistenceManager pm = PMF.getPm(); | |
try { | |
return pm.getObjectById(User.class, id); | |
} finally { | |
pm.close(); | |
} | |
} | |
public void persist() { | |
PersistenceManager pm = PMF.getPm(); | |
try { | |
pm.makePersistent(this); | |
} finally { | |
pm.close(); | |
} | |
} | |
public void remove() { | |
PersistenceManager pm = PMF.getPm(); | |
try { | |
User attached = pm.getObjectById(User.class, this.id); | |
pm.deletePersistent(attached); | |
} finally { | |
pm.close(); | |
} | |
} | |
@Version | |
@Persistent | |
private Integer version; | |
public Integer getVersion() { | |
return this.version; | |
} | |
public void setVersion(Integer version) { | |
this.version = version; | |
} | |
@PrimaryKey | |
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) | |
private Long id; | |
@Persistent | |
@Column(allowsNull = "false") | |
private String firstname; | |
@Persistent | |
@Column(allowsNull = "false") | |
private String lastname; | |
@Persistent | |
@Column(allowsNull = "false") | |
private String email; | |
@Persistent | |
@Column(allowsNull = "false") | |
private String password; | |
@Persistent | |
@Column(allowsNull = "false") | |
private de.....client.db.UserProxy.Type type; | |
@Persistent | |
private String steamid; | |
@Persistent | |
private Date lastLogin; | |
@Persistent | |
@Column(allowsNull = "false") | |
private Date created; | |
public User() {} | |
public Long getId() { | |
return id; | |
} | |
public void setId(Long id) { | |
this.id = id; | |
} | |
public String getFirstname() { | |
return firstname; | |
} | |
public void setFirstname(String firstname) { | |
this.firstname = firstname; | |
} | |
public String getLastname() { | |
return lastname; | |
} | |
public void setLastname(String lastname) { | |
this.lastname = lastname; | |
} | |
public String getEmail() { | |
return email; | |
} | |
public void setEmail(String email) { | |
this.email = email; | |
} | |
public String getPassword() { | |
return password; | |
} | |
public void setPassword(String password) { | |
this.password = password; | |
} | |
public de.....client.db.UserProxy.Type getType() { | |
return type; | |
} | |
public void setType(de.....db.UserProxy.Type type) { | |
this.type = type; | |
} | |
public String getSteamid() { | |
return steamid; | |
} | |
public void setSteamid(String steamid) { | |
this.steamid = steamid; | |
} | |
public Date getLastLogin() { | |
return lastLogin; | |
} | |
public void setLastLogin(Date lastLogin) { | |
this.lastLogin = lastLogin; | |
} | |
public Date getCreated() { | |
return created; | |
} | |
public void setCreated(Date created) { | |
this.created = created; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date; | |
import com.google.gwt.requestfactory.shared.EntityProxy; | |
import com.google.gwt.requestfactory.shared.EntityProxyId; | |
import com.google.gwt.requestfactory.shared.ProxyFor; | |
@ProxyFor(de.....server.db.User.class) | |
public interface UserProxy extends EntityProxy { | |
public static enum Type { | |
Admin, Member, User | |
} | |
Long getId(); | |
void setId(Long id); | |
String getFirstname(); | |
void setFirstname(String firstname); | |
String getLastname(); | |
void setLastname(String lastname); | |
String getEmail(); | |
void setEmail(String email); | |
String getPassword(); | |
void setPassword(String password); | |
Type getType(); | |
void setType(de.....client.db.UserProxy.Type type); | |
String getSteamid(); | |
void setSteamid(String steamid); | |
Date getLastLogin(); | |
void setLastLogin(Date lastLogin); | |
Date getCreated(); | |
void setCreated(Date created); | |
EntityProxyId<UserProxy> stableId(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment