From 5768f0fa6a9f6a13183336e2587ca99e7a43936b Mon Sep 17 00:00:00 2001 From: Ralph Atallah Date: Mon, 17 Nov 2008 18:34:22 +0000 Subject: IMPORTANT NOTE: With this commit, OrkWeb and OrkTrack are NO LONGER COMPATIBLE WITH PREVIOUS VERSIONS! - Modified classes and underlying SQL table names by prefixing them with "ork". This allows oreka to run in any database without risk of collision with existing tables. - Now using MySQLInnoDBDialect to access DB instead of MySQLMyISAMDialect. - Fixed Browse page filtering to allow open-ended start and end dates git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@570 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkbasej/java/mysql.hbm.template.xml | 2 +- orkbasej/java/net/sf/oreka/HibernateManager.java | 46 +- orkbasej/java/net/sf/oreka/bo/UserBo.java | 10 +- .../net/sf/oreka/persistent/AnnotationsTest.java | 24 +- orkbasej/java/net/sf/oreka/persistent/Domain.java | 95 ---- .../java/net/sf/oreka/persistent/LoginString.java | 131 ------ .../java/net/sf/oreka/persistent/OrkDomain.java | 95 ++++ .../net/sf/oreka/persistent/OrkLoginString.java | 131 ++++++ orkbasej/java/net/sf/oreka/persistent/OrkPort.java | 37 ++ .../java/net/sf/oreka/persistent/OrkPortFace.java | 53 +++ .../java/net/sf/oreka/persistent/OrkProgram.java | 512 +++++++++++++++++++++ .../java/net/sf/oreka/persistent/OrkSegment.java | 333 ++++++++++++++ .../java/net/sf/oreka/persistent/OrkService.java | 176 +++++++ .../java/net/sf/oreka/persistent/OrkSession.java | 82 ++++ orkbasej/java/net/sf/oreka/persistent/OrkTape.java | 262 +++++++++++ orkbasej/java/net/sf/oreka/persistent/OrkUser.java | 210 +++++++++ orkbasej/java/net/sf/oreka/persistent/RecPort.java | 37 -- .../java/net/sf/oreka/persistent/RecPortFace.java | 53 --- .../java/net/sf/oreka/persistent/RecProgram.java | 512 --------------------- .../java/net/sf/oreka/persistent/RecSegment.java | 333 -------------- .../java/net/sf/oreka/persistent/RecSession.java | 82 ---- orkbasej/java/net/sf/oreka/persistent/RecTape.java | 262 ----------- orkbasej/java/net/sf/oreka/persistent/Service.java | 176 ------- orkbasej/java/net/sf/oreka/persistent/User.java | 210 --------- orkbasej/java/net/sf/oreka/srvc/UserService.java | 4 +- .../java/net/sf/oreka/srvc/UserServiceHbn.java | 66 +-- .../net/sf/oreka/srvc/test/UserServiceHbnTest.java | 10 +- orkbasej/java/net/sf/oreka/test/FillDatabase.java | 38 +- .../net/sf/oreka/test/FillDatabaseProgram.java | 8 +- .../java/net/sf/oreka/test/FillDatabaseUser.java | 12 +- orktrack/src/net/sf/oreka/orktrack/Port.java | 80 ++-- .../src/net/sf/oreka/orktrack/PortManager.java | 52 +-- .../src/net/sf/oreka/orktrack/ProgramManager.java | 22 +- .../src/net/sf/oreka/orktrack/ServiceManager.java | 16 +- .../src/net/sf/oreka/orktrack/TapeManager.java | 22 +- .../src/net/sf/oreka/orktrack/UserManager.java | 16 +- .../oreka/orktrack/messages/MetadataMessage.java | 4 +- .../sf/oreka/orktrack/messages/TapeMessage.java | 4 +- .../oreka/orktrack/messages/UserStateMessage.java | 4 +- .../src/net/sf/oreka/orktrack/test/PortTest.java | 32 +- .../net/sf/oreka/orktrack/test/ProgramTest.java | 26 +- orkweb/context/WEB-INF/RecSegments.html | 8 +- orkweb/context/WEB-INF/RecSegments.properties | 2 +- orkweb/src/net/sf/oreka/pages/HomePage.java | 4 +- .../src/net/sf/oreka/pages/SessionStateObject.java | 8 +- .../net/sf/oreka/services/RecSegmentResult.java | 16 +- .../sf/oreka/services/RecSegmentServiceHbn.java | 26 +- orkweb/src/net/sf/oreka/services/UserService.java | 4 +- .../src/net/sf/oreka/services/UserServiceHbn.java | 14 +- 49 files changed, 2185 insertions(+), 2177 deletions(-) delete mode 100644 orkbasej/java/net/sf/oreka/persistent/Domain.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/LoginString.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkDomain.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkPort.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkProgram.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkSegment.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkService.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkSession.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkTape.java create mode 100644 orkbasej/java/net/sf/oreka/persistent/OrkUser.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecPort.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecPortFace.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecProgram.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecSegment.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecSession.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/RecTape.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/Service.java delete mode 100644 orkbasej/java/net/sf/oreka/persistent/User.java diff --git a/orkbasej/java/mysql.hbm.template.xml b/orkbasej/java/mysql.hbm.template.xml index 2ff47f4..3806981 100644 --- a/orkbasej/java/mysql.hbm.template.xml +++ b/orkbasej/java/mysql.hbm.template.xml @@ -4,7 +4,7 @@ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> - org.hibernate.dialect.MySQLMyISAMDialect + org.hibernate.dialect.MySQLInnoDBDialect com.mysql.jdbc.Driver jdbc:mysql://localhost/test password diff --git a/orkbasej/java/net/sf/oreka/HibernateManager.java b/orkbasej/java/net/sf/oreka/HibernateManager.java index a22c44c..729ece0 100644 --- a/orkbasej/java/net/sf/oreka/HibernateManager.java +++ b/orkbasej/java/net/sf/oreka/HibernateManager.java @@ -21,16 +21,16 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; -import net.sf.oreka.persistent.Domain; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.RecPort; -import net.sf.oreka.persistent.RecPortFace; -import net.sf.oreka.persistent.RecProgram; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.RecSession; -import net.sf.oreka.persistent.RecTape; -import net.sf.oreka.persistent.Service; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkDomain; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkPort; +import net.sf.oreka.persistent.OrkPortFace; +import net.sf.oreka.persistent.OrkProgram; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkSession; +import net.sf.oreka.persistent.OrkTape; +import net.sf.oreka.persistent.OrkService; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.Logger; import org.hibernate.HibernateException; @@ -84,16 +84,16 @@ public class HibernateManager { config.setProperty("hibernate.proxool.pool_alias", alias); config.setProperty("hibernate.proxool.existing_pool", "true"); - config.addAnnotatedClass(RecProgram.class); - config.addAnnotatedClass(RecSession.class); - config.addAnnotatedClass(RecSegment.class); - config.addAnnotatedClass(RecTape.class); - config.addAnnotatedClass(User.class); - config.addAnnotatedClass(LoginString.class); - config.addAnnotatedClass(Domain.class); - config.addAnnotatedClass(Service.class); - config.addAnnotatedClass(RecPort.class); - config.addAnnotatedClass(RecPortFace.class); + config.addAnnotatedClass(OrkProgram.class); + config.addAnnotatedClass(OrkSession.class); + config.addAnnotatedClass(OrkSegment.class); + config.addAnnotatedClass(OrkTape.class); + config.addAnnotatedClass(OrkUser.class); + config.addAnnotatedClass(OrkLoginString.class); + config.addAnnotatedClass(OrkDomain.class); + config.addAnnotatedClass(OrkService.class); + config.addAnnotatedClass(OrkPort.class); + config.addAnnotatedClass(OrkPortFace.class); sessionFactory = config.buildSessionFactory(); // Add admin user if does not exist yet @@ -103,13 +103,13 @@ public class HibernateManager { { hbnSession = getSession(); tx = hbnSession.beginTransaction(); - User admin = (User)hbnSession.get(User.class, 1); + OrkUser admin = (OrkUser)hbnSession.get(OrkUser.class, 1); if(admin == null) { - admin = new User(); + admin = new OrkUser(); admin.setPassword("admin"); admin.setFirstname("adminfn"); admin.setLastname("adminln"); - LoginString ls = new LoginString(); + OrkLoginString ls = new OrkLoginString(); ls.setUser(admin); ls.setLoginString("admin"); hbnSession.save(admin); diff --git a/orkbasej/java/net/sf/oreka/bo/UserBo.java b/orkbasej/java/net/sf/oreka/bo/UserBo.java index f5ef2ea..315b82b 100644 --- a/orkbasej/java/net/sf/oreka/bo/UserBo.java +++ b/orkbasej/java/net/sf/oreka/bo/UserBo.java @@ -3,15 +3,15 @@ package net.sf.oreka.bo; import java.io.Serializable; import java.util.Iterator; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.Logger; public class UserBo implements Serializable { static Logger logger = Logger.getLogger(UserBo.class); - private User user = new User(); + private OrkUser user = new OrkUser(); private boolean selected = false; @@ -36,11 +36,11 @@ public class UserBo implements Serializable { return false; } - public User getUser() { + public OrkUser getUser() { return user; } - public void setUser(User user) { + public void setUser(OrkUser user) { this.user = user; } diff --git a/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java b/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java index 43a973a..aae1f91 100644 --- a/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java +++ b/orkbasej/java/net/sf/oreka/persistent/AnnotationsTest.java @@ -77,16 +77,16 @@ public class AnnotationsTest { config.configure("hsqldb.hbm.xml"); config.addAnnotatedClass(AnnotatedTestClass.class); - config.addAnnotatedClass(RecProgram.class); - config.addAnnotatedClass(RecSession.class); - config.addAnnotatedClass(RecSegment.class); - config.addAnnotatedClass(RecTape.class); - config.addAnnotatedClass(User.class); - config.addAnnotatedClass(LoginString.class); - config.addAnnotatedClass(Domain.class); - config.addAnnotatedClass(Service.class); - config.addAnnotatedClass(RecPort.class); - config.addAnnotatedClass(RecPortFace.class); + config.addAnnotatedClass(OrkProgram.class); + config.addAnnotatedClass(OrkSession.class); + config.addAnnotatedClass(OrkSegment.class); + config.addAnnotatedClass(OrkTape.class); + config.addAnnotatedClass(OrkUser.class); + config.addAnnotatedClass(OrkLoginString.class); + config.addAnnotatedClass(OrkDomain.class); + config.addAnnotatedClass(OrkService.class); + config.addAnnotatedClass(OrkPort.class); + config.addAnnotatedClass(OrkPortFace.class); SessionFactory sessions = config.buildSessionFactory(); Session session = sessions.openSession(); @@ -279,7 +279,7 @@ public class AnnotationsTest { tx = session.beginTransaction(); System.out.println("hello"); - RecSegment seg = new RecSegment(); + OrkSegment seg = new OrkSegment(); GregorianCalendar cal = new GregorianCalendar(); Date now = cal.getTime(); seg.setTimestamp(now); @@ -296,7 +296,7 @@ public class AnnotationsTest { .list() .iterator(); if(segments.hasNext()) { - RecSegment seg2 = (RecSegment)segments.next(); + OrkSegment seg2 = (OrkSegment)segments.next(); System.out.println("db timestamp:" + seg2.getTimestamp().getTime() + " my:" + now.getTime()); } else { diff --git a/orkbasej/java/net/sf/oreka/persistent/Domain.java b/orkbasej/java/net/sf/oreka/persistent/Domain.java deleted file mode 100644 index 7a0926b..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/Domain.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -/** - * - */ -package net.sf.oreka.persistent; -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "domain") -public class Domain implements Serializable { - - private int id; - private String name = ""; - private String description = ""; - - /** - * - */ - public Domain() { - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the description. - */ - public String getDescription() { - return description; - } - - - /** - * @param description The description to set. - */ - public void setDescription(String description) { - this.description = description; - } - - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the name. - */ - public String getName() { - return name; - } - - - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/orkbasej/java/net/sf/oreka/persistent/LoginString.java b/orkbasej/java/net/sf/oreka/persistent/LoginString.java deleted file mode 100644 index c650859..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/LoginString.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -/** - * - */ -package net.sf.oreka.persistent; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "loginstring") -public class LoginString implements Serializable { - - private int id; - private String loginString; - private User user; - private Domain domain; - - /** - * @hibernate.many-to-one - * @return Returns the domain. - */ - @ManyToOne - public Domain getDomain() { - return domain; - } - - - /** - * @param domain The domain to set. - */ - public void setDomain(Domain domain) { - this.domain = domain; - } - - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the loginString. - */ - public String getLoginString() { - return loginString; - } - - - /** - * @param loginString The loginString to set. - */ - public void setLoginString(String loginString) { - this.loginString = loginString; - } - - - /** - * @hibernate.many-to-one - * @return Returns the user. - */ - @ManyToOne - public User getUser() { - return user; - } - - - /** - * @param user The user to set. - */ - public void setUser(User user) { - this.user = user; - } - -// public void bidirSetUser(User user) { -// this.user = user; -// if(user != null) { -// user.getLoginStrings().add(this); -// } -// } -// -// public void bidirRemoveUser(User user) { -// this.user = null; -// if(user != null) { -// user.getLoginStrings().remove(this); -// } -// } - - /** - * - */ - public LoginString() { - } - -} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkDomain.java b/orkbasej/java/net/sf/oreka/persistent/OrkDomain.java new file mode 100644 index 0000000..ab5c955 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkDomain.java @@ -0,0 +1,95 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.persistent; +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orkdomain") +public class OrkDomain implements Serializable { + + private int id; + private String name = ""; + private String description = ""; + + /** + * + */ + public OrkDomain() { + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the description. + */ + public String getDescription() { + return description; + } + + + /** + * @param description The description to set. + */ + public void setDescription(String description) { + this.description = description; + } + + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the name. + */ + public String getName() { + return name; + } + + + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java b/orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java new file mode 100644 index 0000000..98f6722 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkLoginString.java @@ -0,0 +1,131 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.persistent; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orkloginstring") +public class OrkLoginString implements Serializable { + + private int id; + private String loginString; + private OrkUser user; + private OrkDomain domain; + + /** + * @hibernate.many-to-one + * @return Returns the domain. + */ + @ManyToOne + public OrkDomain getDomain() { + return domain; + } + + + /** + * @param domain The domain to set. + */ + public void setDomain(OrkDomain domain) { + this.domain = domain; + } + + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the loginString. + */ + public String getLoginString() { + return loginString; + } + + + /** + * @param loginString The loginString to set. + */ + public void setLoginString(String loginString) { + this.loginString = loginString; + } + + + /** + * @hibernate.many-to-one + * @return Returns the user. + */ + @ManyToOne + public OrkUser getUser() { + return user; + } + + + /** + * @param user The user to set. + */ + public void setUser(OrkUser user) { + this.user = user; + } + +// public void bidirSetUser(User user) { +// this.user = user; +// if(user != null) { +// user.getLoginStrings().add(this); +// } +// } +// +// public void bidirRemoveUser(User user) { +// this.user = null; +// if(user != null) { +// user.getLoginStrings().remove(this); +// } +// } + + /** + * + */ + public OrkLoginString() { + } + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkPort.java b/orkbasej/java/net/sf/oreka/persistent/OrkPort.java new file mode 100644 index 0000000..f3de87d --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkPort.java @@ -0,0 +1,37 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.persistent; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "orkport") +public class OrkPort implements Serializable { + + private int id; + + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java b/orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java new file mode 100644 index 0000000..c1704d0 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkPortFace.java @@ -0,0 +1,53 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.persistent; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "orkportface") +public class OrkPortFace implements Serializable { + + private OrkPort port; + private OrkService service; + private String name; + + @Id + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + @ManyToOne + public OrkPort getPort() { + return port; + } + public void setPort(OrkPort recPort) { + this.port = recPort; + } + @ManyToOne + public OrkService getService() { + return service; + } + public void setService(OrkService service) { + this.service = service; + } + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkProgram.java b/orkbasej/java/net/sf/oreka/persistent/OrkProgram.java new file mode 100644 index 0000000..6b0bb5f --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkProgram.java @@ -0,0 +1,512 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.persistent; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Collection; +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import net.sf.oreka.Cycle; +import net.sf.oreka.Day; +import net.sf.oreka.Direction; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orkprogram") +public class OrkProgram implements Serializable { + + private int id; + private String name = ""; + private String description = ""; + private boolean discarded = false; + private Date timestamp; + private OrkUser creator; + private boolean active = true; + private Direction direction = Direction.ALL; + private int minDuration = 0; + private int maxDuration = 0; + private double randomPercent = 0.0; + private Cycle cycle = Cycle.PERMANENT; + private Day startDay = Day.UNKN; + private Day stopDay = Day.UNKN; + private Date startTime = null; + private Date stopTime = null; + private int recPerCycle = 0; + private int recordedSoFar = 0; + private String localParty = ""; + private String remoteParty = ""; + private int keepForHours = 0; + private OrkUser targetUser; + private OrkPort targetPort; + + //private Set RecSegments; + private Collection recSegments; + + /** + * @hibernate.set + * lazy="true" + * table="PrgToSeg" + * @hibernate.collection-key + * column="RecProgram" + * @hibernate.collection-many-to-many + * column="RecSegment" + * class="net.sf.oreka.persistent.RecSegment" + * @return Returns the recSegments. + */ + @ManyToMany +// ( +// targetEntity="net.sf.oreka.persistent.RecSegment" +// ) + @JoinTable( + table=@Table(name="orkprogtoseg"), + joinColumns={@JoinColumn(name="progId")}, + inverseJoinColumns={@JoinColumn(name="segId")} + ) + public Collection getRecSegments() { + return recSegments; + } + + + /** + * @param recSegments The recSegments to set. + */ + public void setRecSegments(Collection recSegments) { + this.recSegments = recSegments; + } + + + public OrkProgram () { + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + try { + startTime = sdf.parse("00:00:00"); + stopTime = sdf.parse("00:00:00"); + } + catch (Exception e) {;} + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the active. + */ + public boolean isActive() { + return active; + } + + + /** + * @param active The active to set. + */ + public void setActive(boolean active) { + this.active = active; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the cycle. + */ + public Cycle getCycle() { + return cycle; + } + + + /** + * @param cycle The cycle to set. + */ + public void setCycle(Cycle cycle) { + this.cycle = cycle; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the description. + */ + public String getDescription() { + return description; + } + + + /** + * @param description The description to set. + */ + public void setDescription(String description) { + this.description = description; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the direction. + */ + public Direction getDirection() { + return direction; + } + + + /** + * @param direction The direction to set. + */ + public void setDirection(Direction direction) { + this.direction = direction; + } + + + /** + * @return Returns the discarded. + */ + public boolean isDiscarded() { + return discarded; + } + + + /** + * @param discarded The discarded to set. + */ + public void setDiscarded(boolean discarded) { + this.discarded = discarded; + } + + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the keepForHours. + */ + public int getKeepForHours() { + return keepForHours; + } + + + /** + * @param keepForHours The keepForHours to set. + */ + public void setKeepForHours(int keepForHours) { + this.keepForHours = keepForHours; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the localParty. + */ + public String getLocalParty() { + return localParty; + } + + + /** + * @param localParty The localParty to set. + */ + public void setLocalParty(String localParty) { + this.localParty = localParty; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the maxDuration. + */ + public int getMaxDuration() { + return maxDuration; + } + + + /** + * @param maxDuration The maxDuration to set. + */ + public void setMaxDuration(int maxDuration) { + this.maxDuration = maxDuration; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the minDuration. + */ + public int getMinDuration() { + return minDuration; + } + + + /** + * @param minDuration The minDuration to set. + */ + public void setMinDuration(int minDuration) { + this.minDuration = minDuration; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the name. + */ + public String getName() { + return name; + } + + + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the randomPercent. + */ + public double getRandomPercent() { + return randomPercent; + } + + + /** + * @param randomPercent The randomPercent to set. + */ + public void setRandomPercent(double randomPercent) { + this.randomPercent = randomPercent; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the recordedSoFar. + */ + public int getRecordedSoFar() { + return recordedSoFar; + } + + + /** + * @param recordedSoFar The recordedSoFar to set. + */ + public void setRecordedSoFar(int recordedSoFar) { + this.recordedSoFar = recordedSoFar; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the recPerCycle. + */ + public int getRecPerCycle() { + return recPerCycle; + } + + + /** + * @param recPerCycle The recPerCycle to set. + */ + public void setRecPerCycle(int recPerCycle) { + this.recPerCycle = recPerCycle; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the remoteParty. + */ + public String getRemoteParty() { + return remoteParty; + } + + + /** + * @param remoteParty The remoteParty to set. + */ + public void setRemoteParty(String remoteParty) { + this.remoteParty = remoteParty; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the startTime. + */ + public Date getStartTime() { + return startTime; + } + + + /** + * @param startTime The startTime to set. + */ + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + + public Day getStartDay() { + return startDay; + } + + + + public void setStartDay(Day startDay) { + this.startDay = startDay; + } + + + + public Day getStopDay() { + return stopDay; + } + + + + public void setStopDay(Day stopDay) { + this.stopDay = stopDay; + } + + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the stopTime. + */ + public Date getStopTime() { + return stopTime; + } + + + /** + * @param stopTime The stopTime to set. + */ + public void setStopTime(Date stopTime) { + this.stopTime = stopTime; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the targetPort. + */ + @ManyToOne + public OrkPort getTargetPort() { + return targetPort; + } + + + /** + * @param targetPort The targetPort to set. + */ + public void setTargetPort(OrkPort targetPort) { + this.targetPort = targetPort; + } + + /** + * @hibernate.many-to-one + * @return Returns the targetUser. + */ + @ManyToOne + public OrkUser getTargetUser() { + return targetUser; + } + + + + /** + * @param targetUser The targetUser to set. + */ + public void setTargetUser(OrkUser targetUser) { + this.targetUser = targetUser; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the timestamp. + */ + public Date getTimestamp() { + return timestamp; + } + + + /** + * @param timestamp The timestamp to set. + */ + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + + /** + * @hibernate.many-to-one + * @return Returns the owner. + */ + @ManyToOne + public OrkUser getCreator() { + return creator; + } + + + + /** + * @param owner The owner to set. + */ + public void setCreator(OrkUser creator) { + this.creator = creator; + } +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkSegment.java b/orkbasej/java/net/sf/oreka/persistent/OrkSegment.java new file mode 100644 index 0000000..1227c00 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkSegment.java @@ -0,0 +1,333 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.persistent; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Transient; + +import net.sf.oreka.Direction; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orksegment") +public class OrkSegment implements Serializable { + + private int id; + private OrkSession session; + private long sessionOffset; + private OrkTape tape; + private long tapeOffset; + private Date timestamp = new Date(0); + private long duration; + private String localParty = ""; + private String localEntryPoint = ""; + private String remoteParty = ""; + private Direction direction; + private OrkUser user; + private String loginString = ""; + private OrkPort port; + private String portName; + //private java.util.Set RecPrograms; + private Collection recPrograms; + + public OrkSegment() { + direction = Direction.UNKN; + recPrograms = new ArrayList(); + } + + /** + * @hibernate.property + * + * @hibernate.column + * name="direction" + * index="direction" + * not-null="true" + * @return Returns the direction. + */ + public Direction getDirection() { + return direction; + } + + /** + * @param direction The direction to set. + */ + public void setDirection(Direction direction) { + this.direction = direction; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the duration. + */ + public long getDuration() { + return duration; + } + + /** + * @param duration The duration to set. + */ + public void setDuration(long duration) { + this.duration = duration; + } + + /** + * @hibernate.id + * generator-class="native" + * @hibernate.collection-many-to-many + * column="RecSegmentId" + * class="RecProgram" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + /** + * @hibernate.property + * + * @hibernate.column + * name="localParty" + * index="localParty" + * not-null="true" + * + * @return Returns the localParty. + */ + public String getLocalParty() { + return localParty; + } + + /** + * @param localParty The localParty to set. + */ + public void setLocalParty(String localParty) { + this.localParty = localParty; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the loginString. + */ + public String getLoginString() { + return loginString; + } + + /** + * @param loginString The loginString to set. + */ + public void setLoginString(String loginString) { + this.loginString = loginString; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the remoteParty. + */ + public String getRemoteParty() { + return remoteParty; + } + + /** + * @param remoteParty The remoteParty to set. + */ + public void setRemoteParty(String remoteParty) { + this.remoteParty = remoteParty; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the RecTapeOffset. + */ + public long getTapeOffset() { + return tapeOffset; + } + + /** + * @param RecTapeOffset The RecTapeOffset to set. + */ + public void setTapeOffset(long recTapeOffset) { + this.tapeOffset = recTapeOffset; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the timestamp. + */ + public Date getTimestamp() { + return timestamp; + } + + /** + * @param timestamp The timestamp to set. + */ + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + /** + * @hibernate.many-to-one + * @return Returns the RecSession. + */ + @ManyToOne + public OrkSession getSession() { + return session; + } + + /** + * @param OrkSession The RecSession to set. + */ + public void setSession(OrkSession recSession) { + this.session = recSession; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the RecSessionOffset. + */ + public long getSessionOffset() { + return sessionOffset; + } + + /** + * @param RecSessionOffset The RecSessionOffset to set. + */ + public void setSessionOffset(long recSessionOffset) { + this.sessionOffset = recSessionOffset; + } + + /** + * @hibernate.many-to-one + * @return Returns the recTape. + */ + @ManyToOne + public OrkTape getTape() { + return tape; + } + + + /** + * @param recTape The recTape to set. + */ + public void setTape(OrkTape recTape) { + this.tape = recTape; + } + + /** + * @hibernate.set + * lazy="true" + * table="PrgToSeg" + * @hibernate.collection-key + * column="RecSegment" + * @hibernate.collection-many-to-many + * column="RecProgram" + * class="net.sf.oreka.persistent.RecProgram" + * @return Returns the recPrograms. + */ + @ManyToMany + @JoinTable( + table=@Table(name="orkprogtoseg"), + joinColumns={@JoinColumn(name="segId")}, + inverseJoinColumns={@JoinColumn(name="progId")} + ) + public Collection getRecPrograms() { + return recPrograms; + } + + + /** + * @param recPrograms The recPrograms to set. + */ + public void setRecPrograms(Collection recPrograms) { + this.recPrograms = recPrograms; + } + + /** + * @hibernate.many-to-one + * @return Returns the user. + */ + @ManyToOne + public OrkUser getUser() { + return user; + } + + + /** + * @param user The user to set. + */ + public void setUser(OrkUser user) { + this.user = user; + } + + public String getLocalEntryPoint() { + return localEntryPoint; + } + + public void setLocalEntryPoint(String localEntryPoint) { + this.localEntryPoint = localEntryPoint; + } + + @Transient + public long getStopTime() { + return timestamp.getTime() + duration; + } + + @ManyToOne + public OrkPort getPort() { + return port; + } + + public void setPort(OrkPort port) { + this.port = port; + } + + public String getPortName() { + return portName; + } + + + public void setPortName(String recPortName) { + this.portName = recPortName; + } + + + + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkService.java b/orkbasej/java/net/sf/oreka/persistent/OrkService.java new file mode 100644 index 0000000..7964834 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkService.java @@ -0,0 +1,176 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.persistent; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.Table; + +import net.sf.oreka.ServiceClass; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orkservice") +public class OrkService implements Serializable { + + private int id; + private String name = ""; + private String hostname = ""; + private int tcpPort = 0; + private String fileServeProtocol = ""; + private int fileServeTcpPort = 0; + private String fileServePath = ""; + private ServiceClass serviceClass; + private boolean recordMaster = false; + + /** + * + */ + public OrkService() { + serviceClass = ServiceClass.UNKN; + } + + /** + * + * @hibernate.property + * not-null="true" + * @return Returns the fileServePath. + */ + public String getFileServePath() { + return fileServePath; + } + + + /** + * @param fileServePath The fileServePath to set. + */ + public void setFileServePath(String fileServePath) { + this.fileServePath = fileServePath; + } + + public int getFileServeTcpPort() { + return fileServeTcpPort; + } + + public void setFileServeTcpPort(int fileServeTcpPort) { + this.fileServeTcpPort = fileServeTcpPort; + } + + public int getTcpPort() { + return tcpPort; + } + + public void setTcpPort(int tcpPort) { + this.tcpPort = tcpPort; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the fileServeProtocol. + */ + public String getFileServeProtocol() { + return fileServeProtocol; + } + + + /** + * @param fileServeProtocol The fileServeProtocol to set. + */ + public void setFileServeProtocol(String fileServeProtocol) { + this.fileServeProtocol = fileServeProtocol; + } + + + /** + * @hibernate.property + * unique="true" + * not-null="true" + * @return Returns the gUID. + */ + public String getName() { + return name; + } + + + /** + * @param name The name to set. + */ + public void setName(String name) { + this.name = name; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the hostname. + */ + public String getHostname() { + return hostname; + } + + + /** + * @param hostname The hostname to set. + */ + public void setHostname(String hostname) { + this.hostname = hostname; + } + + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + public ServiceClass getServiceClass() { + return serviceClass; + } + + public void setServiceClass(ServiceClass serviceClass) { + this.serviceClass = serviceClass; + } + + public boolean isRecordMaster() { + return recordMaster; + } + + public void setRecordMaster(boolean cdrMaster) { + this.recordMaster = cdrMaster; + } + + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkSession.java b/orkbasej/java/net/sf/oreka/persistent/OrkSession.java new file mode 100644 index 0000000..cbee4ee --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkSession.java @@ -0,0 +1,82 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.persistent; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orksession") +public class OrkSession implements Serializable { + private int id; + private Date timestamp = new Date(0); + private long duration; + + /** + * @hibernate.property + * not-null="true" + * @return + */ + public long getDuration() { + return duration; + } + + public void setDuration(long duration) { + this.duration = duration; + } + + /** + * @hibernate.id + * generator-class="native" + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + public void setId(int id) { + this.id = id; + } + + /** + * @hibernate.property + * @return + */ + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + @Transient + public long getStopTime() { + return timestamp.getTime() + duration; + } + + public void setStopTime(long stopTime) { + duration = stopTime - timestamp.getTime(); + } +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkTape.java b/orkbasej/java/net/sf/oreka/persistent/OrkTape.java new file mode 100644 index 0000000..f04b1c3 --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkTape.java @@ -0,0 +1,262 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.persistent; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Transient; + +import net.sf.oreka.Direction; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orktape") +public class OrkTape implements Serializable { + + private int id; + private Date timestamp = new Date(0); + private long duration; + private String filename = ""; + private OrkService service; + private String localParty = ""; + private String localEntryPoint = ""; + private String remoteParty = ""; + private Direction direction; + private OrkPort port; + private String portName; + private Date expiryTimestamp = new Date(0); + + public OrkTape() + { + // Defaults + direction = Direction.UNKN; + } + + /** + * @hibernate.property + * @hibernate.column + * name="direction" + * index="direction" + * not-null="true" + * @return Returns the direction. + */ + public Direction getDirection() { + return direction; + } + + /** + * @param direction The direction to set. + */ + public void setDirection(Direction direction) { + this.direction = direction; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the duration. + */ + public long getDuration() { + return duration; + } + + /** + * @param duration The duration to set. + */ + public void setDuration(long duration) { + this.duration = duration; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the expiryTimestamp. + */ + public Date getExpiryTimestamp() { + return expiryTimestamp; + } + + /** + * @param expiryTimestamp The expiryTimestamp to set. + */ + public void setExpiryTimestamp(Date expiryTimestamp) { + this.expiryTimestamp = expiryTimestamp; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the filename. + */ + public String getFilename() { + return filename; + } + + /** + * @param filename The filename to set. + */ + public void setFilename(String filename) { + this.filename = filename; + } + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + /** + * @param id The id to set. + */ + public void setId(int id) { + this.id = id; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the localParty. + */ + public String getLocalParty() { + return localParty; + } + + /** + * @param localParty The localParty to set. + */ + public void setLocalParty(String localParty) { + this.localParty = localParty; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the port. + */ + @ManyToOne + public OrkPort getPort() { + return port; + } + + /** + * @param port The port to set. + */ + public void setPort(OrkPort port) { + this.port = port; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the remoteParty. + */ + public String getRemoteParty() { + return remoteParty; + } + + /** + * @param remoteParty The remoteParty to set. + */ + public void setRemoteParty(String remoteParty) { + this.remoteParty = remoteParty; + } + + /** + * @hibernate.property + * not-null="true" + * @return Returns the timestamp. + */ + public Date getTimestamp() { + return timestamp; + } + + /** + * @param timestamp The timestamp to set. + */ + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + /** + * @hibernate.many-to-one + * @return Returns the service. + */ + @ManyToOne + public OrkService getService() { + return service; + } + + + /** + * @param server The service to set. + */ + public void setService(OrkService service) { + this.service = service; + } + + public String getLocalEntryPoint() { + return localEntryPoint; + } + + public void setLocalEntryPoint(String localEntryPoint) { + this.localEntryPoint = localEntryPoint; + } + + @Transient + public long getStopTime() { + return timestamp.getTime() + duration; + } + + @Transient + public String getUrl() { + + if(service != null) { + return service.getFileServeProtocol() + "://" + + service.getHostname() + ":" + service.getFileServeTcpPort() + + "/" + service.getFileServePath() + "/" + filename; + } + else { + return ""; + } + } + + @Transient + public String getPlayUrl() { + + return "javascript:play('" + getUrl() + "')"; + } + + public String getPortName() { + return portName; + } + + + public void setPortName(String recPortName) { + this.portName = recPortName; + } + + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/OrkUser.java b/orkbasej/java/net/sf/oreka/persistent/OrkUser.java new file mode 100644 index 0000000..1414abe --- /dev/null +++ b/orkbasej/java/net/sf/oreka/persistent/OrkUser.java @@ -0,0 +1,210 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.persistent; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratorType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +/** + * @hibernate.class + */ +@Entity +@Table(name = "orkuser") +public class OrkUser implements Serializable { + + private int id = 0; + private String password = ""; + private String firstname = ""; + private String lastname = ""; + private String email = ""; + private boolean deleted = false; + private boolean disabled = false; + private Date dateCreated = new Date(0); + private Date dateDisabled = new Date(0); + private Date dateDeleted = new Date(0); + + //private Set loginStrings; + + /** + * @hibernate.property + * not-null="true" + * @return Returns the email. + */ + public String getEmail() { + return email; + } + + + /** + * @param email The email to set. + */ + public void setEmail(String email) { + this.email = email; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the firstname. + */ + public String getFirstname() { + return firstname; + } + + + /** + * @param firstname The firstname to set. + */ + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + + /** + * @hibernate.id + * generator-class="native" + * @return Returns the id. + */ + @Id(generate=GeneratorType.AUTO) + public int getId() { + return id; + } + + + /** + * @param id The id to set. + */ + @Id(generate=GeneratorType.AUTO) + public void setId(int id) { + this.id = id; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the lastname. + */ + public String getLastname() { + return lastname; + } + + + /** + * @param lastname The lastname to set. + */ + public void setLastname(String lastname) { + this.lastname = lastname; + } + + + /** + * @hibernate.property + * not-null="true" + * @return Returns the password. + */ + public String getPassword() { + return password; + } + + + /** + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + + + /** + * + */ + public OrkUser() { + //loginStrings = new HashSet(); + } + + public Date getDateCreated() { + return dateCreated; + } + + + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + + + public Date getDateDeleted() { + return dateDeleted; + } + + + + public void setDateDeleted(Date dateDeleted) { + this.dateDeleted = dateDeleted; + } + + + + public Date getDateDisabled() { + return dateDisabled; + } + + + + public void setDateDisabled(Date dateDisabled) { + this.dateDisabled = dateDisabled; + } + + + + public boolean isDeleted() { + return deleted; + } + + + + public void setDeleted(boolean deleted) { + this.deleted = deleted; + } + + + + public boolean isDisabled() { + return disabled; + } + + + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + + +} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecPort.java b/orkbasej/java/net/sf/oreka/persistent/RecPort.java deleted file mode 100644 index ebd83d0..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecPort.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -package net.sf.oreka.persistent; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "recport") -public class RecPort implements Serializable { - - private int id; - - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } -} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecPortFace.java b/orkbasej/java/net/sf/oreka/persistent/RecPortFace.java deleted file mode 100644 index e1671d6..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecPortFace.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -package net.sf.oreka.persistent; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "recportface") -public class RecPortFace implements Serializable { - - private RecPort recPort; - private Service service; - private String name; - - @Id - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - @ManyToOne - public RecPort getRecPort() { - return recPort; - } - public void setRecPort(RecPort recPort) { - this.recPort = recPort; - } - @ManyToOne - public Service getService() { - return service; - } - public void setService(Service service) { - this.service = service; - } - -} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecProgram.java b/orkbasej/java/net/sf/oreka/persistent/RecProgram.java deleted file mode 100644 index 206ff69..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecProgram.java +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -/** - * - */ -package net.sf.oreka.persistent; - -import java.io.Serializable; -import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.Date; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -import net.sf.oreka.Cycle; -import net.sf.oreka.Day; -import net.sf.oreka.Direction; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "recprogram") -public class RecProgram implements Serializable { - - private int id; - private String name = ""; - private String description = ""; - private boolean discarded = false; - private Date timestamp; - private User owner; - private boolean active = true; - private Direction direction = Direction.ALL; - private int minDuration = 0; - private int maxDuration = 0; - private double randomPercent = 0.0; - private Cycle cycle = Cycle.PERMANENT; - private Day startDay = Day.UNKN; - private Day stopDay = Day.UNKN; - private Date startTime = null; - private Date stopTime = null; - private int recPerCycle = 0; - private int recordedSoFar = 0; - private String localParty = ""; - private String remoteParty = ""; - private int keepForHours = 0; - private User targetUser; - private RecPort targetPort; - - //private Set RecSegments; - private Collection recSegments; - - /** - * @hibernate.set - * lazy="true" - * table="PrgToSeg" - * @hibernate.collection-key - * column="RecProgram" - * @hibernate.collection-many-to-many - * column="RecSegment" - * class="net.sf.oreka.persistent.RecSegment" - * @return Returns the recSegments. - */ - @ManyToMany -// ( -// targetEntity="net.sf.oreka.persistent.RecSegment" -// ) - @JoinTable( - table=@Table(name="progtoseg"), - joinColumns={@JoinColumn(name="ProgId")}, - inverseJoinColumns={@JoinColumn(name="SegId")} - ) - public Collection getRecSegments() { - return recSegments; - } - - - /** - * @param recSegments The recSegments to set. - */ - public void setRecSegments(Collection recSegments) { - this.recSegments = recSegments; - } - - - public RecProgram () { - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); - try { - startTime = sdf.parse("00:00:00"); - stopTime = sdf.parse("00:00:00"); - } - catch (Exception e) {;} - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the active. - */ - public boolean isActive() { - return active; - } - - - /** - * @param active The active to set. - */ - public void setActive(boolean active) { - this.active = active; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the cycle. - */ - public Cycle getCycle() { - return cycle; - } - - - /** - * @param cycle The cycle to set. - */ - public void setCycle(Cycle cycle) { - this.cycle = cycle; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the description. - */ - public String getDescription() { - return description; - } - - - /** - * @param description The description to set. - */ - public void setDescription(String description) { - this.description = description; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the direction. - */ - public Direction getDirection() { - return direction; - } - - - /** - * @param direction The direction to set. - */ - public void setDirection(Direction direction) { - this.direction = direction; - } - - - /** - * @return Returns the discarded. - */ - public boolean isDiscarded() { - return discarded; - } - - - /** - * @param discarded The discarded to set. - */ - public void setDiscarded(boolean discarded) { - this.discarded = discarded; - } - - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the keepForHours. - */ - public int getKeepForHours() { - return keepForHours; - } - - - /** - * @param keepForHours The keepForHours to set. - */ - public void setKeepForHours(int keepForHours) { - this.keepForHours = keepForHours; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the localParty. - */ - public String getLocalParty() { - return localParty; - } - - - /** - * @param localParty The localParty to set. - */ - public void setLocalParty(String localParty) { - this.localParty = localParty; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the maxDuration. - */ - public int getMaxDuration() { - return maxDuration; - } - - - /** - * @param maxDuration The maxDuration to set. - */ - public void setMaxDuration(int maxDuration) { - this.maxDuration = maxDuration; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the minDuration. - */ - public int getMinDuration() { - return minDuration; - } - - - /** - * @param minDuration The minDuration to set. - */ - public void setMinDuration(int minDuration) { - this.minDuration = minDuration; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the name. - */ - public String getName() { - return name; - } - - - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the randomPercent. - */ - public double getRandomPercent() { - return randomPercent; - } - - - /** - * @param randomPercent The randomPercent to set. - */ - public void setRandomPercent(double randomPercent) { - this.randomPercent = randomPercent; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the recordedSoFar. - */ - public int getRecordedSoFar() { - return recordedSoFar; - } - - - /** - * @param recordedSoFar The recordedSoFar to set. - */ - public void setRecordedSoFar(int recordedSoFar) { - this.recordedSoFar = recordedSoFar; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the recPerCycle. - */ - public int getRecPerCycle() { - return recPerCycle; - } - - - /** - * @param recPerCycle The recPerCycle to set. - */ - public void setRecPerCycle(int recPerCycle) { - this.recPerCycle = recPerCycle; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the remoteParty. - */ - public String getRemoteParty() { - return remoteParty; - } - - - /** - * @param remoteParty The remoteParty to set. - */ - public void setRemoteParty(String remoteParty) { - this.remoteParty = remoteParty; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the startTime. - */ - public Date getStartTime() { - return startTime; - } - - - /** - * @param startTime The startTime to set. - */ - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - - public Day getStartDay() { - return startDay; - } - - - - public void setStartDay(Day startDay) { - this.startDay = startDay; - } - - - - public Day getStopDay() { - return stopDay; - } - - - - public void setStopDay(Day stopDay) { - this.stopDay = stopDay; - } - - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the stopTime. - */ - public Date getStopTime() { - return stopTime; - } - - - /** - * @param stopTime The stopTime to set. - */ - public void setStopTime(Date stopTime) { - this.stopTime = stopTime; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the targetPort. - */ - @ManyToOne - public RecPort getTargetPort() { - return targetPort; - } - - - /** - * @param targetPort The targetPort to set. - */ - public void setTargetPort(RecPort targetPort) { - this.targetPort = targetPort; - } - - /** - * @hibernate.many-to-one - * @return Returns the targetUser. - */ - @ManyToOne - public User getTargetUser() { - return targetUser; - } - - - - /** - * @param targetUser The targetUser to set. - */ - public void setTargetUser(User targetUser) { - this.targetUser = targetUser; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the timestamp. - */ - public Date getTimestamp() { - return timestamp; - } - - - /** - * @param timestamp The timestamp to set. - */ - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - - /** - * @hibernate.many-to-one - * @return Returns the owner. - */ - @ManyToOne - public User getOwner() { - return owner; - } - - - - /** - * @param owner The owner to set. - */ - public void setOwner(User owner) { - this.owner = owner; - } -} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecSegment.java b/orkbasej/java/net/sf/oreka/persistent/RecSegment.java deleted file mode 100644 index 4ab9a1e..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecSegment.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -package net.sf.oreka.persistent; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Transient; - -import net.sf.oreka.Direction; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "recsegment") -public class RecSegment implements Serializable { - - private int id; - private RecSession recSession; - private long recSessionOffset; - private RecTape recTape; - private long recTapeOffset; - private Date timestamp = new Date(0); - private long duration; - private String localParty = ""; - private String localEntryPoint = ""; - private String remoteParty = ""; - private Direction direction;; - private User user; - private String loginString = ""; - private RecPort recPort; - private String recPortName; - //private java.util.Set RecPrograms; - private Collection recPrograms; - - public RecSegment() { - direction = Direction.UNKN; - recPrograms = new ArrayList(); - } - - /** - * @hibernate.property - * - * @hibernate.column - * name="direction" - * index="direction" - * not-null="true" - * @return Returns the direction. - */ - public Direction getDirection() { - return direction; - } - - /** - * @param direction The direction to set. - */ - public void setDirection(Direction direction) { - this.direction = direction; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the duration. - */ - public long getDuration() { - return duration; - } - - /** - * @param duration The duration to set. - */ - public void setDuration(long duration) { - this.duration = duration; - } - - /** - * @hibernate.id - * generator-class="native" - * @hibernate.collection-many-to-many - * column="RecSegmentId" - * class="RecProgram" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - /** - * @hibernate.property - * - * @hibernate.column - * name="localParty" - * index="localParty" - * not-null="true" - * - * @return Returns the localParty. - */ - public String getLocalParty() { - return localParty; - } - - /** - * @param localParty The localParty to set. - */ - public void setLocalParty(String localParty) { - this.localParty = localParty; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the loginString. - */ - public String getLoginString() { - return loginString; - } - - /** - * @param loginString The loginString to set. - */ - public void setLoginString(String loginString) { - this.loginString = loginString; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the remoteParty. - */ - public String getRemoteParty() { - return remoteParty; - } - - /** - * @param remoteParty The remoteParty to set. - */ - public void setRemoteParty(String remoteParty) { - this.remoteParty = remoteParty; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the RecTapeOffset. - */ - public long getRecTapeOffset() { - return recTapeOffset; - } - - /** - * @param RecTapeOffset The RecTapeOffset to set. - */ - public void setRecTapeOffset(long recTapeOffset) { - this.recTapeOffset = recTapeOffset; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the timestamp. - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * @param timestamp The timestamp to set. - */ - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - /** - * @hibernate.many-to-one - * @return Returns the RecSession. - */ - @ManyToOne - public RecSession getRecSession() { - return recSession; - } - - /** - * @param RecSession The RecSession to set. - */ - public void setRecSession(RecSession recSession) { - this.recSession = recSession; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the RecSessionOffset. - */ - public long getRecSessionOffset() { - return recSessionOffset; - } - - /** - * @param RecSessionOffset The RecSessionOffset to set. - */ - public void setRecSessionOffset(long recSessionOffset) { - this.recSessionOffset = recSessionOffset; - } - - /** - * @hibernate.many-to-one - * @return Returns the recTape. - */ - @ManyToOne - public RecTape getRecTape() { - return recTape; - } - - - /** - * @param recTape The recTape to set. - */ - public void setRecTape(RecTape recTape) { - this.recTape = recTape; - } - - /** - * @hibernate.set - * lazy="true" - * table="PrgToSeg" - * @hibernate.collection-key - * column="RecSegment" - * @hibernate.collection-many-to-many - * column="RecProgram" - * class="net.sf.oreka.persistent.RecProgram" - * @return Returns the recPrograms. - */ - @ManyToMany - @JoinTable( - table=@Table(name="progtoseg"), - joinColumns={@JoinColumn(name="SegId")}, - inverseJoinColumns={@JoinColumn(name="ProgId")} - ) - public Collection getRecPrograms() { - return recPrograms; - } - - - /** - * @param recPrograms The recPrograms to set. - */ - public void setRecPrograms(Collection recPrograms) { - this.recPrograms = recPrograms; - } - - /** - * @hibernate.many-to-one - * @return Returns the user. - */ - @ManyToOne - public User getUser() { - return user; - } - - - /** - * @param user The user to set. - */ - public void setUser(User user) { - this.user = user; - } - - public String getLocalEntryPoint() { - return localEntryPoint; - } - - public void setLocalEntryPoint(String localEntryPoint) { - this.localEntryPoint = localEntryPoint; - } - - @Transient - public long getStopTime() { - return timestamp.getTime() + duration; - } - - @ManyToOne - public RecPort getRecPort() { - return recPort; - } - - public void setRecPort(RecPort port) { - this.recPort = port; - } - - public String getRecPortName() { - return recPortName; - } - - - public void setRecPortName(String recPortName) { - this.recPortName = recPortName; - } - - - - -} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecSession.java b/orkbasej/java/net/sf/oreka/persistent/RecSession.java deleted file mode 100644 index eff8417..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecSession.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -package net.sf.oreka.persistent; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "recsession") -public class RecSession implements Serializable { - private int id; - private Date timestamp = new Date(0); - private long duration; - - /** - * @hibernate.property - * not-null="true" - * @return - */ - public long getDuration() { - return duration; - } - - public void setDuration(long duration) { - this.duration = duration; - } - - /** - * @hibernate.id - * generator-class="native" - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - public void setId(int id) { - this.id = id; - } - - /** - * @hibernate.property - * @return - */ - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - @Transient - public long getStopTime() { - return timestamp.getTime() + duration; - } - - public void setStopTime(long stopTime) { - duration = stopTime - timestamp.getTime(); - } -} diff --git a/orkbasej/java/net/sf/oreka/persistent/RecTape.java b/orkbasej/java/net/sf/oreka/persistent/RecTape.java deleted file mode 100644 index 66d796d..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/RecTape.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -package net.sf.oreka.persistent; - -import java.io.Serializable; -import java.util.Date; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Transient; - -import net.sf.oreka.Direction; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "rectape") -public class RecTape implements Serializable { - - private int id; - private Date timestamp = new Date(0); - private long duration; - private String filename = ""; - private Service service; - private String localParty = ""; - private String localEntryPoint = ""; - private String remoteParty = ""; - private Direction direction; - private RecPort recPort; - private String recPortName; - private Date expiryTimestamp = new Date(0); - - public RecTape() - { - // Defaults - direction = Direction.UNKN; - } - - /** - * @hibernate.property - * @hibernate.column - * name="direction" - * index="direction" - * not-null="true" - * @return Returns the direction. - */ - public Direction getDirection() { - return direction; - } - - /** - * @param direction The direction to set. - */ - public void setDirection(Direction direction) { - this.direction = direction; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the duration. - */ - public long getDuration() { - return duration; - } - - /** - * @param duration The duration to set. - */ - public void setDuration(long duration) { - this.duration = duration; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the expiryTimestamp. - */ - public Date getExpiryTimestamp() { - return expiryTimestamp; - } - - /** - * @param expiryTimestamp The expiryTimestamp to set. - */ - public void setExpiryTimestamp(Date expiryTimestamp) { - this.expiryTimestamp = expiryTimestamp; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the filename. - */ - public String getFilename() { - return filename; - } - - /** - * @param filename The filename to set. - */ - public void setFilename(String filename) { - this.filename = filename; - } - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the localParty. - */ - public String getLocalParty() { - return localParty; - } - - /** - * @param localParty The localParty to set. - */ - public void setLocalParty(String localParty) { - this.localParty = localParty; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the port. - */ - @ManyToOne - public RecPort getRecPort() { - return recPort; - } - - /** - * @param port The port to set. - */ - public void setRecPort(RecPort port) { - this.recPort = port; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the remoteParty. - */ - public String getRemoteParty() { - return remoteParty; - } - - /** - * @param remoteParty The remoteParty to set. - */ - public void setRemoteParty(String remoteParty) { - this.remoteParty = remoteParty; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the timestamp. - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * @param timestamp The timestamp to set. - */ - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - /** - * @hibernate.many-to-one - * @return Returns the service. - */ - @ManyToOne - public Service getService() { - return service; - } - - - /** - * @param server The service to set. - */ - public void setService(Service service) { - this.service = service; - } - - public String getLocalEntryPoint() { - return localEntryPoint; - } - - public void setLocalEntryPoint(String localEntryPoint) { - this.localEntryPoint = localEntryPoint; - } - - @Transient - public long getStopTime() { - return timestamp.getTime() + duration; - } - - @Transient - public String getUrl() { - - if(service != null) { - return service.getFileServeProtocol() + "://" + - service.getHostname() + ":" + service.getFileServeTcpPort() + - "/" + service.getFileServePath() + "/" + filename; - } - else { - return ""; - } - } - - @Transient - public String getPlayUrl() { - - return "javascript:play('" + getUrl() + "')"; - } - - public String getRecPortName() { - return recPortName; - } - - - public void setRecPortName(String recPortName) { - this.recPortName = recPortName; - } - - -} diff --git a/orkbasej/java/net/sf/oreka/persistent/Service.java b/orkbasej/java/net/sf/oreka/persistent/Service.java deleted file mode 100644 index 701948e..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/Service.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -/** - * - */ -package net.sf.oreka.persistent; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.Table; - -import net.sf.oreka.ServiceClass; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "service") -public class Service implements Serializable { - - private int id; - private String name = ""; - private String hostname = ""; - private int tcpPort = 0; - private String fileServeProtocol = ""; - private int fileServeTcpPort = 0; - private String fileServePath = ""; - private ServiceClass serviceClass; - private boolean recordMaster = false; - - /** - * - */ - public Service() { - serviceClass = ServiceClass.UNKN; - } - - /** - * - * @hibernate.property - * not-null="true" - * @return Returns the fileServePath. - */ - public String getFileServePath() { - return fileServePath; - } - - - /** - * @param fileServePath The fileServePath to set. - */ - public void setFileServePath(String fileServePath) { - this.fileServePath = fileServePath; - } - - public int getFileServeTcpPort() { - return fileServeTcpPort; - } - - public void setFileServeTcpPort(int fileServeTcpPort) { - this.fileServeTcpPort = fileServeTcpPort; - } - - public int getTcpPort() { - return tcpPort; - } - - public void setTcpPort(int tcpPort) { - this.tcpPort = tcpPort; - } - - /** - * @hibernate.property - * not-null="true" - * @return Returns the fileServeProtocol. - */ - public String getFileServeProtocol() { - return fileServeProtocol; - } - - - /** - * @param fileServeProtocol The fileServeProtocol to set. - */ - public void setFileServeProtocol(String fileServeProtocol) { - this.fileServeProtocol = fileServeProtocol; - } - - - /** - * @hibernate.property - * unique="true" - * not-null="true" - * @return Returns the gUID. - */ - public String getName() { - return name; - } - - - /** - * @param name The name to set. - */ - public void setName(String name) { - this.name = name; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the hostname. - */ - public String getHostname() { - return hostname; - } - - - /** - * @param hostname The hostname to set. - */ - public void setHostname(String hostname) { - this.hostname = hostname; - } - - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - - public ServiceClass getServiceClass() { - return serviceClass; - } - - public void setServiceClass(ServiceClass serviceClass) { - this.serviceClass = serviceClass; - } - - public boolean isRecordMaster() { - return recordMaster; - } - - public void setRecordMaster(boolean cdrMaster) { - this.recordMaster = cdrMaster; - } - - -} diff --git a/orkbasej/java/net/sf/oreka/persistent/User.java b/orkbasej/java/net/sf/oreka/persistent/User.java deleted file mode 100644 index 2ce404f..0000000 --- a/orkbasej/java/net/sf/oreka/persistent/User.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Oreka -- A media capture and retrieval platform - * - * Copyright (C) 2005, orecx LLC - * - * http://www.orecx.com - * - * This program is free software, distributed under the terms of - * the GNU General Public License. - * Please refer to http://www.gnu.org/copyleft/gpl.html - * - */ - -/** - * - */ -package net.sf.oreka.persistent; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratorType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -/** - * @hibernate.class - */ -@Entity -@Table(name = "user") -public class User implements Serializable { - - private int id = 0; - private String password = ""; - private String firstname = ""; - private String lastname = ""; - private String email = ""; - private boolean deleted = false; - private boolean disabled = false; - private Date dateCreated = new Date(0); - private Date dateDisabled = new Date(0); - private Date dateDeleted = new Date(0); - - //private Set loginStrings; - - /** - * @hibernate.property - * not-null="true" - * @return Returns the email. - */ - public String getEmail() { - return email; - } - - - /** - * @param email The email to set. - */ - public void setEmail(String email) { - this.email = email; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the firstname. - */ - public String getFirstname() { - return firstname; - } - - - /** - * @param firstname The firstname to set. - */ - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - - /** - * @hibernate.id - * generator-class="native" - * @return Returns the id. - */ - @Id(generate=GeneratorType.AUTO) - public int getId() { - return id; - } - - - /** - * @param id The id to set. - */ - @Id(generate=GeneratorType.AUTO) - public void setId(int id) { - this.id = id; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the lastname. - */ - public String getLastname() { - return lastname; - } - - - /** - * @param lastname The lastname to set. - */ - public void setLastname(String lastname) { - this.lastname = lastname; - } - - - /** - * @hibernate.property - * not-null="true" - * @return Returns the password. - */ - public String getPassword() { - return password; - } - - - /** - * @param password The password to set. - */ - public void setPassword(String password) { - this.password = password; - } - - - /** - * - */ - public User() { - //loginStrings = new HashSet(); - } - - public Date getDateCreated() { - return dateCreated; - } - - - - public void setDateCreated(Date dateCreated) { - this.dateCreated = dateCreated; - } - - - - public Date getDateDeleted() { - return dateDeleted; - } - - - - public void setDateDeleted(Date dateDeleted) { - this.dateDeleted = dateDeleted; - } - - - - public Date getDateDisabled() { - return dateDisabled; - } - - - - public void setDateDisabled(Date dateDisabled) { - this.dateDisabled = dateDisabled; - } - - - - public boolean isDeleted() { - return deleted; - } - - - - public void setDeleted(boolean deleted) { - this.deleted = deleted; - } - - - - public boolean isDisabled() { - return disabled; - } - - - - public void setDisabled(boolean disabled) { - this.disabled = disabled; - } - - - -} diff --git a/orkbasej/java/net/sf/oreka/srvc/UserService.java b/orkbasej/java/net/sf/oreka/srvc/UserService.java index fd2485f..9f1f784 100644 --- a/orkbasej/java/net/sf/oreka/srvc/UserService.java +++ b/orkbasej/java/net/sf/oreka/srvc/UserService.java @@ -3,7 +3,7 @@ package net.sf.oreka.srvc; import java.util.List; import net.sf.oreka.bo.UserBo; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkUser; public interface UserService { @@ -18,7 +18,7 @@ public interface UserService { public String getUserLoginStrings(int userId); public void setUserLoginStrings(int userId, String loginStringsCsv); - public User getUserByLoginString(String loginString); + public OrkUser getUserByLoginString(String loginString); public int getNumNonDisabledUsers(); } diff --git a/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java b/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java index 8ee6e00..402b862 100644 --- a/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java +++ b/orkbasej/java/net/sf/oreka/srvc/UserServiceHbn.java @@ -10,8 +10,8 @@ import net.sf.oreka.HibernateManager; import net.sf.oreka.OrkBase; import net.sf.oreka.OrkException; import net.sf.oreka.bo.UserBo; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkUser; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -38,7 +38,7 @@ public class UserServiceHbn implements UserService { { hbnSession = HibernateManager.instance().getSession(); - String queryString = new String("from LoginString as ls left join ls.user as user where ls.loginString=:ls and user.deleted=0 "); + String queryString = new String("from OrkLoginString as ls left join ls.user as user where ls.loginString=:ls and user.deleted=0 "); if (OrkBase.instance().isDebugSwitch() == false) { queryString = queryString + " and user.password=:password"; } @@ -51,7 +51,7 @@ public class UserServiceHbn implements UserService { Object[] row = (Object[])query.uniqueResult(); if (row != null) { userBo = new UserBo(); - userBo.setUser((User)row[1]); + userBo.setUser((OrkUser)row[1]); logger.debug("Found userid:" + userBo.getUser().getId() + " for login string:" + username); } } @@ -72,7 +72,7 @@ public class UserServiceHbn implements UserService { Session hbnSession = null; Transaction tx = null; - User user = null; + OrkUser user = null; boolean success = false; logger.debug("Trying to change password for userid:" + userId); @@ -82,7 +82,7 @@ public class UserServiceHbn implements UserService { hbnSession = HibernateManager.instance().getSession(); - user = (User)hbnSession.get(User.class, userId); + user = (OrkUser)hbnSession.get(OrkUser.class, userId); if(user == null) { logger.warn("Userid:" + userId + " does not exist"); } @@ -115,7 +115,7 @@ public class UserServiceHbn implements UserService { Session hbnSession = null; Transaction tx = null; logger.debug("Entering getUsers"); - List users; + List users; int numResults = 0; try @@ -145,7 +145,7 @@ public class UserServiceHbn implements UserService { } */ - StringBuffer queryString = new StringBuffer("from User as user where user.deleted=0 "); + StringBuffer queryString = new StringBuffer("from OrkUser as user where user.deleted=0 "); Query query = hbnSession.createQuery(queryString.toString()); ScrollableResults scrollRes = query.scroll(); @@ -160,7 +160,7 @@ public class UserServiceHbn implements UserService { while(scrollRes.next() && numRetrieved oldLoginStrings = new HashSet(); HashSet newLoginStrings = new HashSet(); - HashMap loginStringMap = new HashMap(); + HashMap loginStringMap = new HashMap(); Session hbnSession = null; Transaction tx = null; @@ -274,14 +274,14 @@ public class UserServiceHbn implements UserService { newLoginStrings.add(loginStrings[i]); // see if the login string exists for another user - String queryString = new String("from LoginString as ls where ls.loginString=:loginString"); + String queryString = new String("from OrkLoginString as ls where ls.loginString=:loginString"); Query query = hbnSession.createQuery(queryString); query.setString("loginString", loginStrings[i]); List list = query.list(); - LoginString ls = null; + OrkLoginString ls = null; if(list.size() > 0) { - ls = (LoginString)list.get(0); + ls = (OrkLoginString)list.get(0); if(ls != null) { if(ls.getUser() != null) { if(ls.getUser().getId() != userId && !ls.getUser().isDeleted()) { @@ -293,7 +293,7 @@ public class UserServiceHbn implements UserService { } // Create a new login string if it does not exist yet in the DB if(ls == null) { - ls = new LoginString(); + ls = new OrkLoginString(); ls.setLoginString(loginStrings[i]); hbnSession.save(ls); } @@ -301,17 +301,17 @@ public class UserServiceHbn implements UserService { } // 2. get the user and extract all old login strings - User user = (User)hbnSession.get(User.class, userId); + OrkUser user = (OrkUser)hbnSession.get(OrkUser.class, userId); if(user == null) { throw new OrkException("UserId:" + userId + " does not exist"); } - String queryString = new String("from LoginString as ls where ls.user=:user"); + String queryString = new String("from OrkLoginString as ls where ls.user=:user"); Query query = hbnSession.createQuery(queryString); query.setEntity("user", user); List list = query.list(); Iterator it = list.iterator(); while(it.hasNext()) { - LoginString ls = (LoginString)it.next(); + OrkLoginString ls = (OrkLoginString)it.next(); oldLoginStrings.add(ls.getLoginString()); loginStringMap.put(ls.getLoginString(), ls); } @@ -321,7 +321,7 @@ public class UserServiceHbn implements UserService { while(it.hasNext()) { String ls = (String)it.next(); if(oldLoginStrings.contains(ls) == false) { - LoginString lso = loginStringMap.get(ls); + OrkLoginString lso = loginStringMap.get(ls); lso.setUser(user); logger.debug("Added loginstring:" + lso.getLoginString() + " to user:" + user.getFirstname()); } @@ -332,7 +332,7 @@ public class UserServiceHbn implements UserService { while(it.hasNext()) { String ls = (String)it.next(); if(newLoginStrings.contains(ls) == false) { - LoginString lso = loginStringMap.get(ls); + OrkLoginString lso = loginStringMap.get(ls); lso.setUser(null); logger.debug("Removed loginstring:" + lso.getLoginString() + " from user:" + user.getFirstname()); } @@ -359,24 +359,24 @@ public class UserServiceHbn implements UserService { public String getUserLoginStrings(int userId) { Session hbnSession = null; - User user = null; + OrkUser user = null; String loginStringsCsv = ""; try { hbnSession = HibernateManager.instance().getSession(); - user = (User)hbnSession.get(User.class, userId); - String queryString = new String("from LoginString as ls where ls.user=:user"); + user = (OrkUser)hbnSession.get(OrkUser.class, userId); + String queryString = new String("from OrkLoginString as ls where ls.user=:user"); Query query = hbnSession.createQuery(queryString); query.setEntity("user", user); List list = query.list(); Iterator it = list.iterator(); if(it.hasNext()) { - loginStringsCsv = ((LoginString)it.next()).getLoginString(); + loginStringsCsv = ((OrkLoginString)it.next()).getLoginString(); } while(it.hasNext()) { - loginStringsCsv += ", " + ((LoginString)it.next()).getLoginString(); + loginStringsCsv += ", " + ((OrkLoginString)it.next()).getLoginString(); } } catch ( HibernateException he ) { @@ -401,7 +401,7 @@ public class UserServiceHbn implements UserService { { hbnSession = HibernateManager.instance().getSession(); - Criteria crit = hbnSession.createCriteria(User.class); + Criteria crit = hbnSession.createCriteria(OrkUser.class); crit.add( Expression.eq( "disabled", false ) ); crit.add( Expression.eq( "deleted", false ) ); @@ -425,20 +425,20 @@ public class UserServiceHbn implements UserService { return numUsers; } - public User getUserByLoginString(String loginString) { + public OrkUser getUserByLoginString(String loginString) { Session hbnSession = null; - User user = null; + OrkUser user = null; try { hbnSession = HibernateManager.instance().getSession(); - String queryString = new String("from LoginString as ls where ls.loginstring=:ls"); + String queryString = new String("from OrkLoginString as ls where ls.loginstring=:ls"); Query query = hbnSession.createQuery(queryString); query.setString("ls", loginString); List list = query.list(); Iterator it = list.iterator(); if (it.hasNext()) { - LoginString ls = (LoginString)it.next(); + OrkLoginString ls = (OrkLoginString)it.next(); user = ls.getUser(); } } diff --git a/orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java b/orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java index 213f676..584180c 100644 --- a/orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java +++ b/orkbasej/java/net/sf/oreka/srvc/test/UserServiceHbnTest.java @@ -4,8 +4,8 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import net.sf.oreka.HibernateManager; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkUser; import net.sf.oreka.srvc.ObjectService; import net.sf.oreka.srvc.ObjectServiceHbn; import net.sf.oreka.srvc.UserService; @@ -46,15 +46,15 @@ public class UserServiceHbnTest extends TestCase { Session hbnSession = hibernateManager.getSession(); Transaction tx = hbnSession.beginTransaction(); - User user1 = new User(); + OrkUser user1 = new OrkUser(); user1.setFirstname("fn1"); hbnSession.save(user1); - User user2 = new User(); + OrkUser user2 = new OrkUser(); user2.setFirstname("fn2"); hbnSession.save(user2); - User deletedUser = new User(); + OrkUser deletedUser = new OrkUser(); deletedUser.setFirstname("dlt"); //deletedUser.setDeleted(true); hbnSession.save(deletedUser); diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabase.java b/orkbasej/java/net/sf/oreka/test/FillDatabase.java index 43f4d71..b1e1c8c 100644 --- a/orkbasej/java/net/sf/oreka/test/FillDatabase.java +++ b/orkbasej/java/net/sf/oreka/test/FillDatabase.java @@ -17,12 +17,12 @@ import java.util.Date; import net.sf.oreka.Direction; import net.sf.oreka.HibernateManager; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.RecProgram; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.RecTape; -import net.sf.oreka.persistent.Service; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkProgram; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkTape; +import net.sf.oreka.persistent.OrkService; +import net.sf.oreka.persistent.OrkUser; import org.hibernate.Session; import org.hibernate.Transaction; @@ -38,7 +38,7 @@ public class FillDatabase { Session hbnSession = hibernateManager.getSession(); Transaction tx = hbnSession.beginTransaction(); - Service service = new Service(); + OrkService service = new OrkService(); service.setFileServePath(""); service.setFileServeProtocol("http"); service.setFileServeTcpPort(8080); @@ -48,17 +48,17 @@ public class FillDatabase { hbnSession.save(service); // user 1 - User user = new User(); + OrkUser user = new OrkUser(); user.setFirstname("Raymond"); user.setLastname("Stein"); user.setPassword("raymond"); - LoginString ls = new LoginString(); + OrkLoginString ls = new OrkLoginString(); ls.setUser(user); ls.setLoginString("2005"); - LoginString lsA = new LoginString(); + OrkLoginString lsA = new OrkLoginString(); lsA.setUser(user); lsA.setLoginString("2006"); - LoginString lsB = new LoginString(); + OrkLoginString lsB = new OrkLoginString(); lsB.setUser(user); lsB.setLoginString("raymond"); hbnSession.save(user); @@ -67,17 +67,17 @@ public class FillDatabase { hbnSession.save(lsB); // user 2 - User user2 = new User(); + OrkUser user2 = new OrkUser(); user2.setFirstname("Bert"); user2.setLastname("Nolte"); user2.setPassword("bert"); - LoginString ls2 = new LoginString(); + OrkLoginString ls2 = new OrkLoginString(); ls2.setUser(user2); ls2.setLoginString("2000"); - LoginString ls2A = new LoginString(); + OrkLoginString ls2A = new OrkLoginString(); ls2A.setUser(user2); ls2A.setLoginString("2001"); - LoginString ls2B = new LoginString(); + OrkLoginString ls2B = new OrkLoginString(); ls2B.setUser(user2); ls2B.setLoginString("bert"); hbnSession.save(user2); @@ -86,7 +86,7 @@ public class FillDatabase { hbnSession.save(ls2B); // create program that does not filter anything - RecProgram prog1 = new RecProgram(); + OrkProgram prog1 = new OrkProgram(); prog1.setName("Test program"); hbnSession.save(prog1); @@ -94,8 +94,8 @@ public class FillDatabase { String lastParty = "123-234-5678"; java.util.Random generator = new java.util.Random(); for(int i=0; i<500; i++) { - RecSegment seg = new RecSegment(); - RecTape tape = new RecTape(); + OrkSegment seg = new OrkSegment(); + OrkTape tape = new OrkTape(); tape.setService(service); tape.setFilename("f1.mp3"); @@ -142,7 +142,7 @@ public class FillDatabase { seg.setDuration(duration); tape.setDuration(duration+1); - seg.setRecTape(tape); + seg.setTape(tape); hbnSession.save(tape); hbnSession.save(seg); } diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java b/orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java index 8d980bc..b57c26e 100644 --- a/orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java +++ b/orkbasej/java/net/sf/oreka/test/FillDatabaseProgram.java @@ -3,7 +3,7 @@ package net.sf.oreka.test; import java.util.List; import net.sf.oreka.HibernateManager; -import net.sf.oreka.persistent.RecProgram; +import net.sf.oreka.persistent.OrkProgram; import org.hibernate.Criteria; import org.hibernate.Session; @@ -20,12 +20,12 @@ public class FillDatabaseProgram { Session hbnSession = hibernateManager.getSession(); Transaction tx = hbnSession.beginTransaction(); - RecProgram prg = new RecProgram(); + OrkProgram prg = new OrkProgram(); prg.setDescription("my program 1"); prg.setName("myprog1"); hbnSession.save(prg); - prg = new RecProgram(); + prg = new OrkProgram(); prg.setDescription("my program 2"); prg.setName("myprog2"); hbnSession.save(prg); @@ -33,7 +33,7 @@ public class FillDatabaseProgram { tx.commit(); List recPrograms; - Criteria crit = hbnSession.createCriteria(RecProgram.class); + Criteria crit = hbnSession.createCriteria(OrkProgram.class); //crit.add( Expression.eq( "color", eg.Color.BLACK ) ); //crit.setMaxResults(10); recPrograms = crit.list(); diff --git a/orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java b/orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java index 6942312..6b14114 100644 --- a/orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java +++ b/orkbasej/java/net/sf/oreka/test/FillDatabaseUser.java @@ -4,8 +4,8 @@ import java.util.Collection; import java.util.Iterator; import net.sf.oreka.HibernateManager; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.PropertyConfigurator; import org.hibernate.Session; @@ -17,7 +17,7 @@ public class FillDatabaseUser { public static void main(String args[]) throws Exception { - User usr = null; + OrkUser usr = null; try { PropertyConfigurator.configure("c:/oreka/test/log4j.properties"); @@ -28,19 +28,19 @@ public class FillDatabaseUser { Transaction tx = hbnSession.beginTransaction(); for(int i=0; i<100; i++) { - User user = new User(); + OrkUser user = new OrkUser(); user.setFirstname("fn" + i); user.setLastname("ln" + i); user.setPassword("password"); hbnSession.save(user); - LoginString ls = new LoginString(); + OrkLoginString ls = new OrkLoginString(); ls.setLoginString("ls" + i); //ls.bidirSetUser(user); ls.setUser(user); hbnSession.save(ls); - LoginString ls2 = new LoginString(); + OrkLoginString ls2 = new OrkLoginString(); ls2.setLoginString("ls2" + i); //ls2.bidirSetUser(user); ls2.setUser(user); diff --git a/orktrack/src/net/sf/oreka/orktrack/Port.java b/orktrack/src/net/sf/oreka/orktrack/Port.java index 72a82fb..e14b127 100644 --- a/orktrack/src/net/sf/oreka/orktrack/Port.java +++ b/orktrack/src/net/sf/oreka/orktrack/Port.java @@ -20,34 +20,34 @@ import java.util.LinkedList; import net.sf.oreka.orktrack.messages.MetadataMessage; import net.sf.oreka.orktrack.messages.TapeMessage; -import net.sf.oreka.persistent.RecPort; -import net.sf.oreka.persistent.RecPortFace; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.RecTape; -import net.sf.oreka.persistent.Service; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkPort; +import net.sf.oreka.persistent.OrkPortFace; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkTape; +import net.sf.oreka.persistent.OrkService; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.Logger; import org.hibernate.Session; public class Port { - public ArrayList portFaces = new ArrayList(); - private RecPort recPort = null; + public ArrayList portFaces = new ArrayList(); + private OrkPort recPort = null; private TapeMessage lastTapeMessage = null; private MetadataMessage lastMetadataMessage = null; - private User user = null; + private OrkUser user = null; - private LinkedList recSegments = new LinkedList (); - private LinkedList recTapes = new LinkedList (); + private LinkedList recSegments = new LinkedList (); + private LinkedList recTapes = new LinkedList (); static Logger logger = Logger.getLogger(ProgramManager.class); - public Port(RecPort recPort) { + public Port(OrkPort recPort) { this.recPort = recPort; } - private synchronized void addTapeToLocalCache(RecTape tape) { + private synchronized void addTapeToLocalCache(OrkTape tape) { if (recTapes.size() > 50) { recTapes.removeLast(); @@ -55,7 +55,7 @@ public class Port { recTapes.addFirst(tape); } - private synchronized void addSegmentToLocalCache(RecSegment seg) { + private synchronized void addSegmentToLocalCache(OrkSegment seg) { if (recSegments.size() > 50) { recSegments.removeLast(); @@ -63,7 +63,7 @@ public class Port { recSegments.addFirst(seg); } - private boolean areTogether(RecTape tape, RecSegment seg) { + private boolean areTogether(OrkTape tape, OrkSegment seg) { boolean result = false; long segStartTime = seg.getTimestamp().getTime(); @@ -83,21 +83,21 @@ public class Port { return result; } - private void joinTogether(RecTape tape, RecSegment seg, Session hbnSession) { + private void joinTogether(OrkTape tape, OrkSegment seg, Session hbnSession) { - seg.setRecTape(tape); - seg.setRecTapeOffset(seg.getTimestamp().getTime() - tape.getTimestamp().getTime()); + seg.setTape(tape); + seg.setTapeOffset(seg.getTimestamp().getTime() - tape.getTimestamp().getTime()); hbnSession.save(seg); } - private synchronized void findAndAssociateTape(RecSegment segment, Session hbnSession) { + private synchronized void findAndAssociateTape(OrkSegment segment, Session hbnSession) { // Iterate over tapes and find the ones corresponding to this segment - Iterator it = recTapes.iterator(); + Iterator it = recTapes.iterator(); boolean foundOne = false; boolean done = false; while (it.hasNext() && !done) { - RecTape tape = it.next(); + OrkTape tape = it.next(); if (areTogether(tape, segment)) { joinTogether(tape, segment, hbnSession); logger.info("#" + recPort.getId() + ": associating segment:" + segment.getId() + " with tape:" + tape.getId()); @@ -111,14 +111,14 @@ public class Port { } } - private synchronized void findAndAssociateSegment(RecTape tape, Session hbnSession) { + private synchronized void findAndAssociateSegment(OrkTape tape, Session hbnSession) { // Iterate over segments and find the ones corresponding to this tape - Iterator it = recSegments.iterator(); + Iterator it = recSegments.iterator(); boolean foundOne = false; boolean done = false; while (it.hasNext() && !done) { - RecSegment segment = it.next(); + OrkSegment segment = it.next(); if (areTogether(tape, segment)) { joinTogether(tape, segment, hbnSession); logger.info("#" + recPort.getId() + ": associating segment:" + segment.getId() + " with tape:" + tape.getId()); @@ -132,7 +132,7 @@ public class Port { } } - public void notifyMetadataMessage(MetadataMessage metadataMessage, Session hbnSession, Service srv) { + public void notifyMetadataMessage(MetadataMessage metadataMessage, Session hbnSession, OrkService srv) { long duration = 0; Date startDate = null; @@ -156,17 +156,17 @@ public class Port { if (srv.isRecordMaster()) { // create segment - RecSegment recSegment = new RecSegment(); + OrkSegment recSegment = new OrkSegment(); recSegment.setTimestamp(startDate); recSegment.setDirection(metadataMessage.getDirection()); recSegment.setDuration(duration); recSegment.setLocalParty(metadataMessage.getLocalParty()); recSegment.setLocalEntryPoint(metadataMessage.getLocalEntryPoint()); - recSegment.setRecSessionOffset(0); - recSegment.setRecPort(recPort); + recSegment.setSessionOffset(0); + recSegment.setPort(recPort); if(metadataMessage.getLocalParty() != "") { - User user = UserManager.instance().getByLoginString(metadataMessage.getLocalParty(), hbnSession); + OrkUser user = UserManager.instance().getByLoginString(metadataMessage.getLocalParty(), hbnSession); recSegment.setUser(user); } @@ -185,7 +185,7 @@ public class Port { } } - public void notifyTapeMessage(TapeMessage tapeMessage, Session hbnSession, Service srv) { + public void notifyTapeMessage(TapeMessage tapeMessage, Session hbnSession, OrkService srv) { if (tapeMessage.getStage() == TapeMessage.CaptureStage.START) { lastTapeMessage = tapeMessage; @@ -212,13 +212,13 @@ public class Port { Date timestamp = new Date(date); // create a new tape record - RecTape recTape = new RecTape(); + OrkTape recTape = new OrkTape(); recTape.setDirection(stopMessage.getDirection()); recTape.setDuration(duration); recTape.setExpiryTimestamp(new Date()); recTape.setFilename(stopMessage.getFilename()); recTape.setLocalParty(stopMessage.getLocalParty()); - recTape.setRecPort(recPort); + recTape.setPort(recPort); recTape.setRemoteParty(stopMessage.getRemoteParty()); recTape.setTimestamp(timestamp); recTape.setService(srv); @@ -226,18 +226,18 @@ public class Port { logger.info("#" + tapeMessage.getCapturePort() + ": written tape " + recTape.getId()); if (generateSegment) { - RecSegment recSegment = new RecSegment(); + OrkSegment recSegment = new OrkSegment(); recSegment.setTimestamp(timestamp); recSegment.setDirection(stopMessage.getDirection()); recSegment.setDuration(duration); recSegment.setRemoteParty(stopMessage.getRemoteParty()); recSegment.setLocalParty(stopMessage.getLocalParty()); recSegment.setLocalEntryPoint(stopMessage.getLocalEntryPoint()); - recSegment.setRecTape(recTape); - recSegment.setRecPort(recPort); + recSegment.setTape(recTape); + recSegment.setPort(recPort); if(stopMessage.getLocalParty() != "") { - User user = UserManager.instance().getByLoginString(stopMessage.getLocalParty(), hbnSession); + OrkUser user = UserManager.instance().getByLoginString(stopMessage.getLocalParty(), hbnSession); recSegment.setUser(user); } if (ProgramManager.instance().filterSegmentAgainstAllPrograms(recSegment, hbnSession)) { @@ -256,19 +256,19 @@ public class Port { } } - public RecPort getRecPort() { + public OrkPort getRecPort() { return recPort; } - public void setRecPort(RecPort recPort) { + public void setRecPort(OrkPort recPort) { this.recPort = recPort; } - public User getUser() { + public OrkUser getUser() { return user; } - public void setUser(User user) { + public void setUser(OrkUser user) { this.user = user; } diff --git a/orktrack/src/net/sf/oreka/orktrack/PortManager.java b/orktrack/src/net/sf/oreka/orktrack/PortManager.java index 60a40c0..f7a4a2f 100644 --- a/orktrack/src/net/sf/oreka/orktrack/PortManager.java +++ b/orktrack/src/net/sf/oreka/orktrack/PortManager.java @@ -17,9 +17,9 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import net.sf.oreka.persistent.RecPort; -import net.sf.oreka.persistent.RecPortFace; -import net.sf.oreka.persistent.Service; +import net.sf.oreka.persistent.OrkPort; +import net.sf.oreka.persistent.OrkPortFace; +import net.sf.oreka.persistent.OrkService; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -49,7 +49,7 @@ public class PortManager { return portByName.get(name); } - public Port getAndCreatePort(String name, Session hbnSession, Service service) { + public Port getAndCreatePort(String name, Session hbnSession, OrkService service) { Port port = portByName.get(name); if (port == null) { @@ -59,24 +59,24 @@ public class PortManager { return port; } - public synchronized Port createPort(String name, Session hbnSession, Service service) { + public synchronized Port createPort(String name, Session hbnSession, OrkService service) { - RecPort recPort = null; + OrkPort recPort = null; - RecPortFace portFace = (RecPortFace)hbnSession.get(RecPortFace.class, name); + OrkPortFace portFace = (OrkPortFace)hbnSession.get(OrkPortFace.class, name); if (portFace == null) { - portFace = new RecPortFace(); + portFace = new OrkPortFace(); portFace.setName(name); - portFace.setRecPort(recPort); + portFace.setPort(recPort); portFace.setService(service); - recPort = new RecPort(); - portFace.setRecPort(recPort); + recPort = new OrkPort(); + portFace.setPort(recPort); } else { - portFace.setRecPort(recPort); + portFace.setPort(recPort); portFace.setService(service); - recPort = portFace.getRecPort(); + recPort = portFace.getPort(); } hbnSession.save(recPort); @@ -94,14 +94,14 @@ public class PortManager { // for testing purposes public void addPort(String face1, String face2, Session hbnSession) { - RecPort recPort = new RecPort(); + OrkPort recPort = new OrkPort(); Port port = new Port(recPort); - RecPortFace portFace1 = new RecPortFace(); + OrkPortFace portFace1 = new OrkPortFace(); portFace1.setName(face1); - portFace1.setRecPort(recPort); - RecPortFace portFace2 = new RecPortFace(); + portFace1.setPort(recPort); + OrkPortFace portFace2 = new OrkPortFace(); portFace2.setName(face2); - portFace2.setRecPort(recPort); + portFace2.setPort(recPort); hbnSession.save(recPort); hbnSession.save(portFace1); @@ -123,17 +123,17 @@ public class PortManager { Transaction tx = hbnSession.beginTransaction(); Iterator portFaces = hbnSession.createQuery( - "from RecPortFace") + "from OrkPortFace") .list() .iterator(); while ( portFaces.hasNext() ) { - RecPortFace portFace = (RecPortFace)portFaces.next(); + OrkPortFace portFace = (OrkPortFace)portFaces.next(); - int portId = portFace.getRecPort().getId(); + int portId = portFace.getPort().getId(); Port port = portById.get(portId); if(port == null) { - RecPort recPort = (RecPort)hbnSession.get(RecPort.class, portId); + OrkPort recPort = (OrkPort)hbnSession.get(OrkPort.class, portId); if (recPort != null) { port = new Port(recPort); portById.put(portId, port); @@ -154,16 +154,16 @@ public class PortManager { return success; } - public RecPort getRecPortByFace(String face, Session hbnSession) { - RecPort port = null; + public OrkPort getRecPortByFace(String face, Session hbnSession) { + OrkPort port = null; List ports = hbnSession.createQuery( - "from RecPortFace as pf join pf.recPort as p where pf.name=:face") + "from OrkPortFace as pf join pf.port as p where pf.name=:face") .setString("face", face) .list(); if (ports.size() > 0) { Object[] row = (Object[])ports.get(0); if (row.length > 1) { - port = (RecPort)row[1]; + port = (OrkPort)row[1]; } } return port; diff --git a/orktrack/src/net/sf/oreka/orktrack/ProgramManager.java b/orktrack/src/net/sf/oreka/orktrack/ProgramManager.java index b7b78bd..6e30d73 100644 --- a/orktrack/src/net/sf/oreka/orktrack/ProgramManager.java +++ b/orktrack/src/net/sf/oreka/orktrack/ProgramManager.java @@ -20,8 +20,8 @@ import java.util.List; import net.sf.oreka.Cycle; import net.sf.oreka.Direction; import net.sf.oreka.HibernateManager; -import net.sf.oreka.persistent.RecProgram; -import net.sf.oreka.persistent.RecSegment; +import net.sf.oreka.persistent.OrkProgram; +import net.sf.oreka.persistent.OrkSegment; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -32,7 +32,7 @@ public class ProgramManager { static Logger logger = Logger.getLogger(ProgramManager.class); private static ProgramManager programManager = null; - private ArrayList recPrograms = new ArrayList(); + private ArrayList recPrograms = new ArrayList(); private ProgramManager() { } @@ -56,12 +56,12 @@ public class ProgramManager { tx = hbnSession.beginTransaction(); List progs = hbnSession.createQuery( - "from RecProgram as prg where prg.active=:active and prg.discarded=:discarded") + "from OrkProgram as prg where prg.active=:active and prg.discarded=:discarded") .setBoolean("active", true) .setBoolean("discarded", false) .list(); - recPrograms = new ArrayList(progs); + recPrograms = new ArrayList(progs); tx.commit(); success = true; } @@ -74,16 +74,16 @@ public class ProgramManager { return success; } - public void addProgram(RecProgram prog) { + public void addProgram(OrkProgram prog) { recPrograms.add(prog); } - public boolean filterSegmentAgainstAllPrograms(RecSegment seg, Session hbnSession) { + public boolean filterSegmentAgainstAllPrograms(OrkSegment seg, Session hbnSession) { boolean result = false; // Iterate over programs - ArrayList progs = recPrograms; + ArrayList progs = recPrograms; if(recPrograms.size() == 0) { // If there are no programs specified, keep everything result = true; @@ -98,7 +98,7 @@ public class ProgramManager { return result; } - public boolean filterSegmentAgainstProgram(RecSegment seg, RecProgram prog, Session hbnSession) { + public boolean filterSegmentAgainstProgram(OrkSegment seg, OrkProgram prog, Session hbnSession) { boolean drop = false; boolean result = false; @@ -151,7 +151,7 @@ public class ProgramManager { if ( !drop && (prog.getTargetPort() != null) && - (seg.getRecPort().getId() != prog.getTargetPort().getId()) ) { + (seg.getPort().getId() != prog.getTargetPort().getId()) ) { dropReason = "Target Port"; drop = true; } @@ -184,7 +184,7 @@ public class ProgramManager { return result; } - public boolean filterSegmentAgainstProgramSchedule(RecSegment seg, RecProgram prog) { + public boolean filterSegmentAgainstProgramSchedule(OrkSegment seg, OrkProgram prog) { if(prog.getCycle() == Cycle.PERMANENT) { return true; diff --git a/orktrack/src/net/sf/oreka/orktrack/ServiceManager.java b/orktrack/src/net/sf/oreka/orktrack/ServiceManager.java index d52a0eb..df3bb7d 100644 --- a/orktrack/src/net/sf/oreka/orktrack/ServiceManager.java +++ b/orktrack/src/net/sf/oreka/orktrack/ServiceManager.java @@ -15,7 +15,7 @@ package net.sf.oreka.orktrack; import java.util.List; -import net.sf.oreka.persistent.Service; +import net.sf.oreka.persistent.OrkService; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -24,11 +24,11 @@ public class ServiceManager { static Logger logger = Logger.getLogger(ServiceManager.class); - public static Service retrieveOrCreate(String name, String hostname, Session hbnSession) { - Service service = retrieveByName(name, hbnSession); + public static OrkService retrieveOrCreate(String name, String hostname, Session hbnSession) { + OrkService service = retrieveByName(name, hbnSession); if (service == null) { logger.info("Creating service:" + name + " on host:" + hostname ); - service = new Service(); + service = new OrkService(); service.setName(name); service.setHostname(hostname); service.setFileServeProtocol("http"); @@ -42,15 +42,15 @@ public class ServiceManager { return service; } - public static Service retrieveByName(String name, Session hbnSession) { + public static OrkService retrieveByName(String name, Session hbnSession) { - Service service = null; + OrkService service = null; List services = hbnSession.createQuery( - "from Service as srv where srv.name=:name") + "from OrkService as srv where srv.name=:name") .setString("name", name) .list(); if (services.size() > 0) { - service = (Service)services.get(0); + service = (OrkService)services.get(0); } return service; } diff --git a/orktrack/src/net/sf/oreka/orktrack/TapeManager.java b/orktrack/src/net/sf/oreka/orktrack/TapeManager.java index 66e15ae..483fc4a 100644 --- a/orktrack/src/net/sf/oreka/orktrack/TapeManager.java +++ b/orktrack/src/net/sf/oreka/orktrack/TapeManager.java @@ -3,10 +3,10 @@ package net.sf.oreka.orktrack; import java.util.Date; import net.sf.oreka.orktrack.messages.TapeMessage; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.RecTape; -import net.sf.oreka.persistent.Service; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkTape; +import net.sf.oreka.persistent.OrkService; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -33,7 +33,7 @@ public class TapeManager { * @param srv * @return false if the tape is rejected and should be deleted, otherwise true */ - public boolean notifyTapeMessage(TapeMessage tapeMessage, Session hbnSession, Service srv) { + public boolean notifyTapeMessage(TapeMessage tapeMessage, Session hbnSession, OrkService srv) { boolean keepTape = true; @@ -46,31 +46,31 @@ public class TapeManager { Date timestamp = new Date(date); // create a new tape record - RecTape recTape = new RecTape(); + OrkTape recTape = new OrkTape(); recTape.setDirection(tapeMessage.getDirection()); recTape.setDuration(tapeMessage.getDuration()); recTape.setExpiryTimestamp(new Date()); recTape.setFilename(tapeMessage.getFilename()); recTape.setLocalParty(tapeMessage.getLocalParty()); - recTape.setRecPortName(tapeMessage.getCapturePort()); + recTape.setPortName(tapeMessage.getCapturePort()); recTape.setRemoteParty(tapeMessage.getRemoteParty()); recTape.setTimestamp(timestamp); recTape.setService(srv); hbnSession.save(recTape); logger.info("Written tape:" + tapeMessage.getRecId() + " as " + recTape.getId()); - RecSegment recSegment = new RecSegment(); + OrkSegment recSegment = new OrkSegment(); recSegment.setTimestamp(timestamp); recSegment.setDirection(tapeMessage.getDirection()); recSegment.setDuration(tapeMessage.getDuration()); recSegment.setRemoteParty(tapeMessage.getRemoteParty()); recSegment.setLocalParty(tapeMessage.getLocalParty()); recSegment.setLocalEntryPoint(tapeMessage.getLocalEntryPoint()); - recSegment.setRecTape(recTape); - recSegment.setRecPortName(recTape.getRecPortName()); + recSegment.setTape(recTape); + recSegment.setPortName(recTape.getPortName()); if(tapeMessage.getLocalParty() != "") { - User user = UserManager.instance().getByLoginString(tapeMessage.getLocalParty(), hbnSession); + OrkUser user = UserManager.instance().getByLoginString(tapeMessage.getLocalParty(), hbnSession); recSegment.setUser(user); } if (ProgramManager.instance().filterSegmentAgainstAllPrograms(recSegment, hbnSession)) { diff --git a/orktrack/src/net/sf/oreka/orktrack/UserManager.java b/orktrack/src/net/sf/oreka/orktrack/UserManager.java index 4c5ce02..22f490c 100644 --- a/orktrack/src/net/sf/oreka/orktrack/UserManager.java +++ b/orktrack/src/net/sf/oreka/orktrack/UserManager.java @@ -16,7 +16,7 @@ package net.sf.oreka.orktrack; import java.util.HashMap; import java.util.List; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkUser; import org.apache.log4j.Logger; import org.hibernate.Session; @@ -26,7 +26,7 @@ public class UserManager { private static Logger log = null; private static UserManager userManager = null; - private HashMap userLocations = new HashMap(); + private HashMap userLocations = new HashMap(); private UserManager() { log = LogManager.getInstance().getUserLogger(); @@ -40,27 +40,27 @@ public class UserManager { return userManager; } - public User getByLoginString(String loginString, Session hbnSession) { + public OrkUser getByLoginString(String loginString, Session hbnSession) { - User user = null; + OrkUser user = null; List users = hbnSession.createQuery( - "from LoginString as ls join ls.user as usr where ls.loginString=:loginstring") + "from OrkLoginString as ls join ls.user as usr where ls.loginString=:loginstring") .setString("loginstring", loginString) .list(); if (users.size() > 0) { Object[] row = (Object[])users.get(0); if (row.length > 1) { - user = (User)row[1]; + user = (OrkUser)row[1]; } } return user; } - public synchronized void setUserLocation(User user, Port port) { + public synchronized void setUserLocation(OrkUser user, Port port) { userLocations.put(user, port); } - public synchronized Port getUserLocation(User user) { + public synchronized Port getUserLocation(OrkUser user) { return userLocations.get(user); } } diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java b/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java index abf37e4..c815d4c 100644 --- a/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java +++ b/orktrack/src/net/sf/oreka/orktrack/messages/MetadataMessage.java @@ -24,7 +24,7 @@ import net.sf.oreka.orktrack.Port; import net.sf.oreka.orktrack.PortManager; import net.sf.oreka.orktrack.ServiceManager; import net.sf.oreka.orktrack.messages.TapeMessage.CaptureStage; -import net.sf.oreka.persistent.Service; +import net.sf.oreka.persistent.OrkService; import net.sf.oreka.serializers.OrkSerializer; import net.sf.oreka.serializers.SingleLineSerializer; @@ -65,7 +65,7 @@ public class MetadataMessage extends SyncMessage { SingleLineSerializer ser = new SingleLineSerializer(); log.info("Message: " + ser.serialize(this)); - Service service = ServiceManager.retrieveByName(this.service, session); + OrkService service = ServiceManager.retrieveByName(this.service, session); if (service != null) { Port port = PortManager.instance().getAndCreatePort(this.getCapturePort(), session, service); diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java b/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java index aede055..7ca5c2e 100644 --- a/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java +++ b/orktrack/src/net/sf/oreka/orktrack/messages/TapeMessage.java @@ -22,7 +22,7 @@ import net.sf.oreka.orktrack.LogManager; import net.sf.oreka.orktrack.OrkTrack; import net.sf.oreka.orktrack.ServiceManager; import net.sf.oreka.orktrack.TapeManager; -import net.sf.oreka.persistent.Service; +import net.sf.oreka.persistent.OrkService; import net.sf.oreka.serializers.OrkSerializer; import net.sf.oreka.serializers.SingleLineSerializer; @@ -81,7 +81,7 @@ public class TapeMessage extends SyncMessage { SingleLineSerializer ser = new SingleLineSerializer(); logger.info("Message: " + ser.serialize(this)); - Service service = ServiceManager.retrieveOrCreate(this.service, this.getHostname(), session); + OrkService service = ServiceManager.retrieveOrCreate(this.service, this.getHostname(), session); //Port port = PortManager.instance().getAndCreatePort(this.getCapturePort(), session, service); //port.notifyTapeMessage(this, session, service); diff --git a/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java b/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java index e6cdf12..886d8ed 100644 --- a/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java +++ b/orktrack/src/net/sf/oreka/orktrack/messages/UserStateMessage.java @@ -23,7 +23,7 @@ import net.sf.oreka.orktrack.OrkTrack; import net.sf.oreka.orktrack.Port; import net.sf.oreka.orktrack.PortManager; import net.sf.oreka.orktrack.UserManager; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkUser; import net.sf.oreka.serializers.OrkSerializer; import org.apache.log4j.Logger; @@ -57,7 +57,7 @@ public class UserStateMessage extends SyncMessage { hbnSession = OrkTrack.hibernateManager.getSession(); tx = hbnSession.beginTransaction(); // find out user - User user = UserManager.instance().getByLoginString(loginString, hbnSession); + OrkUser user = UserManager.instance().getByLoginString(loginString, hbnSession); if (user == null) { comment = "Could not find user for login string:" + loginString; log.warn(comment); diff --git a/orktrack/src/net/sf/oreka/orktrack/test/PortTest.java b/orktrack/src/net/sf/oreka/orktrack/test/PortTest.java index 9359ffb..7ab17d7 100644 --- a/orktrack/src/net/sf/oreka/orktrack/test/PortTest.java +++ b/orktrack/src/net/sf/oreka/orktrack/test/PortTest.java @@ -28,12 +28,12 @@ import net.sf.oreka.orktrack.ProgramManager; import net.sf.oreka.orktrack.ServiceManager; import net.sf.oreka.orktrack.messages.MetadataMessage; import net.sf.oreka.orktrack.messages.TapeMessage; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.RecProgram; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.RecTape; -import net.sf.oreka.persistent.Service; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkProgram; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkTape; +import net.sf.oreka.persistent.OrkService; +import net.sf.oreka.persistent.OrkUser; import org.hibernate.Session; import org.hibernate.Transaction; @@ -190,14 +190,14 @@ public class PortTest extends TestCase { Session hbnSession = OrkTrack.hibernateManager.getSession(); Transaction tx = hbnSession.beginTransaction(); - Service recService = ServiceManager.retrieveOrCreate("recservice", "localhost", hbnSession); - Service ctiService = ServiceManager.retrieveOrCreate("ctiservice", "localhost", hbnSession); + OrkService recService = ServiceManager.retrieveOrCreate("recservice", "localhost", hbnSession); + OrkService ctiService = ServiceManager.retrieveOrCreate("ctiservice", "localhost", hbnSession); ctiService.setRecordMaster(true); hbnSession.save(recService); - User user = new User(); + OrkUser user = new OrkUser(); user.setFirstname("salisse"); - LoginString ls = new LoginString(); + OrkLoginString ls = new OrkLoginString(); ls.setUser(user); ls.setLoginString("1973"); hbnSession.save(user); @@ -206,7 +206,7 @@ public class PortTest extends TestCase { PortManager.instance().addPort("recport", "ctiport", hbnSession); // create program that does not filter anything - RecProgram prog1 = new RecProgram(); + OrkProgram prog1 = new OrkProgram(); hbnSession.save(prog1); ProgramManager.instance().addProgram(prog1); @@ -264,21 +264,21 @@ public class PortTest extends TestCase { GregorianCalendar cal = new GregorianCalendar(); cal.setTimeInMillis(time); - RecSegment seg = null; + OrkSegment seg = null; Iterator segments = hbnSession.createQuery( "from RecSegment as seg where seg.timestamp=:date") .setCalendar("date", cal) .list() .iterator(); if(segments.hasNext()) { - seg = (RecSegment)segments.next(); + seg = (OrkSegment)segments.next(); assertTrue(seg.getLocalParty().equals("1973")); - assertTrue(seg.getRecTapeOffset() == 3000); + assertTrue(seg.getTapeOffset() == 3000); - RecTape tape = seg.getRecTape(); + OrkTape tape = seg.getTape(); assertTrue(tape.getFilename().equals("test.wav")); - User user2 = seg.getUser(); + OrkUser user2 = seg.getUser(); assertTrue(user.getId() == user2.getId()); } else { diff --git a/orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java b/orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java index 26325eb..7274e32 100644 --- a/orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java +++ b/orktrack/src/net/sf/oreka/orktrack/test/ProgramTest.java @@ -26,10 +26,10 @@ import net.sf.oreka.Direction; import net.sf.oreka.HibernateManager; import net.sf.oreka.orktrack.OrkTrack; import net.sf.oreka.orktrack.ProgramManager; -import net.sf.oreka.persistent.LoginString; -import net.sf.oreka.persistent.RecProgram; -import net.sf.oreka.persistent.RecSegment; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkLoginString; +import net.sf.oreka.persistent.OrkProgram; +import net.sf.oreka.persistent.OrkSegment; +import net.sf.oreka.persistent.OrkUser; import org.hibernate.Session; import org.hibernate.Transaction; @@ -53,16 +53,16 @@ public class ProgramTest extends TestCase { Transaction tx = hbnSession.beginTransaction(); // create a user - User user = new User(); + OrkUser user = new OrkUser(); user.setFirstname("mawagade"); hbnSession.save(user); - LoginString ls = new LoginString(); + OrkLoginString ls = new OrkLoginString(); ls.setLoginString("1234"); ls.setUser(user); hbnSession.save(ls); // create a program - RecProgram prog1 = new RecProgram(); + OrkProgram prog1 = new OrkProgram(); prog1.setDirection(Direction.IN); prog1.setTargetUser(user); hbnSession.save(prog1); @@ -73,7 +73,7 @@ public class ProgramTest extends TestCase { ProgramManager.instance().load(); // segment 1: should pass - RecSegment seg = new RecSegment(); + OrkSegment seg = new OrkSegment(); seg.setDirection(Direction.IN); seg.setUser(user); @@ -88,9 +88,9 @@ public class ProgramTest extends TestCase { hbnSession = OrkTrack.hibernateManager.getSession(); tx = hbnSession.beginTransaction(); - RecProgram prog = (RecProgram)hbnSession.load(RecProgram.class, prog1.getId()); + OrkProgram prog = (OrkProgram)hbnSession.load(OrkProgram.class, prog1.getId()); assertTrue(prog.getRecordedSoFar() == 1); - Iterator it = prog.getRecSegments().iterator(); + Iterator it = prog.getRecSegments().iterator(); assertTrue(it.next().getId() == seg.getId()); tx.commit(); hbnSession.close(); @@ -99,14 +99,14 @@ public class ProgramTest extends TestCase { public void testSchedule() throws Exception { // create a "daily" program - RecProgram progDaily = new RecProgram(); + OrkProgram progDaily = new OrkProgram(); progDaily.setDirection(Direction.ALL); progDaily.setCycle(Cycle.DAILY); progDaily.setStartTime(new Date(10*3600*1000)); // 10:00 am progDaily.setStopTime(new Date(11*3600*1000)); // 11:00 am // create a "weekly" program - RecProgram progWeekly = new RecProgram(); + OrkProgram progWeekly = new OrkProgram(); progWeekly.setDirection(Direction.ALL); progWeekly.setCycle(Cycle.WEEKLY); progWeekly.setStartDay(Day.TUESDAY); @@ -116,7 +116,7 @@ public class ProgramTest extends TestCase { // segment 1: should pass - RecSegment seg = new RecSegment(); + OrkSegment seg = new OrkSegment(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date segTimestamp = sdf.parse("2005-11-29 10:30:00"); seg.setTimestamp(segTimestamp); // 10:30 diff --git a/orkweb/context/WEB-INF/RecSegments.html b/orkweb/context/WEB-INF/RecSegments.html index 75c5263..93ccfdb 100644 --- a/orkweb/context/WEB-INF/RecSegments.html +++ b/orkweb/context/WEB-INF/RecSegments.html @@ -124,13 +124,13 @@ remote party - - tape id + + tape id - - Play + + Play diff --git a/orkweb/context/WEB-INF/RecSegments.properties b/orkweb/context/WEB-INF/RecSegments.properties index a8606db..1adb6a6 100644 --- a/orkweb/context/WEB-INF/RecSegments.properties +++ b/orkweb/context/WEB-INF/RecSegments.properties @@ -15,4 +15,4 @@ lastPage=>> previousPage=< nextPage=> -NoResults=There was no results \ No newline at end of file +NoResults=There were no results \ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/pages/HomePage.java b/orkweb/src/net/sf/oreka/pages/HomePage.java index dc32314..b22ae18 100644 --- a/orkweb/src/net/sf/oreka/pages/HomePage.java +++ b/orkweb/src/net/sf/oreka/pages/HomePage.java @@ -15,7 +15,7 @@ package net.sf.oreka.pages; import net.sf.oreka.orkweb.ContextListener; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkUser; import net.sf.oreka.services.UserServiceHbn; import org.apache.tapestry.IRequestCycle; @@ -49,7 +49,7 @@ public abstract class HomePage extends OrkPage implements PageBeginRenderListene setUsername("admin"); } - User user = srv.login(getUsername(), getPassword()); + OrkUser user = srv.login(getUsername(), getPassword()); if (user != null) { getSessionStateObject().setUser(user); cycle.activate("RecSegments"); diff --git a/orkweb/src/net/sf/oreka/pages/SessionStateObject.java b/orkweb/src/net/sf/oreka/pages/SessionStateObject.java index aba5f29..5b63a9b 100644 --- a/orkweb/src/net/sf/oreka/pages/SessionStateObject.java +++ b/orkweb/src/net/sf/oreka/pages/SessionStateObject.java @@ -1,10 +1,10 @@ package net.sf.oreka.pages; -import net.sf.oreka.persistent.User; +import net.sf.oreka.persistent.OrkUser; public class SessionStateObject { - private User user = null; + private OrkUser user = null; public boolean isUserLoggedIn() { if(user == null) { @@ -13,12 +13,12 @@ public class SessionStateObject { return true; } - public User getUser() { + public OrkUser getUser() { return user; } - public void setUser(User user) { + public void setUser(OrkUser user) { this.user = user; } diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentResult.java b/orkweb/src/net/sf/oreka/services/RecSegmentResult.java index fd43ad5..804d940 100644 --- a/orkweb/src/net/sf/oreka/services/RecSegmentResult.java +++ b/orkweb/src/net/sf/oreka/services/RecSegmentResult.java @@ -21,20 +21,20 @@ import net.sf.oreka.persistent.*; public class RecSegmentResult { - private RecSegment RecSegment; - private RecTape RecTape; + private OrkSegment RecSegment; + private OrkTape RecTape; private String foo = "henri"; public RecSegmentResult() { - RecSegment = new RecSegment(); - RecTape = new RecTape(); + RecSegment = new OrkSegment(); + RecTape = new OrkTape(); } /** * @return Returns the recSegment. */ - public RecSegment getRecSegment() { + public OrkSegment getRecSegment() { return RecSegment; } @@ -42,14 +42,14 @@ public class RecSegmentResult { /** * @param recSegment The recSegment to set. */ - public void setRecSegment(RecSegment recSegment) { + public void setRecSegment(OrkSegment recSegment) { RecSegment = recSegment; } /** * @return Returns the recTape. */ - public RecTape getRecTape() { + public OrkTape getRecTape() { return RecTape; } @@ -57,7 +57,7 @@ public class RecSegmentResult { /** * @param recTape The recTape to set. */ - public void setRecTape(RecTape recTape) { + public void setRecTape(OrkTape recTape) { RecTape = recTape; } diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java b/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java index 03289f0..e76d8ea 100644 --- a/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java +++ b/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java @@ -21,7 +21,7 @@ import java.util.List; import net.sf.oreka.Direction; import net.sf.oreka.orkweb.OrkWeb; -import net.sf.oreka.persistent.RecSegment; +import net.sf.oreka.persistent.OrkSegment; import org.apache.log4j.Level; import org.apache.log4j.Logger; @@ -94,12 +94,17 @@ public class RecSegmentServiceHbn implements RecSegmentService{ { session = OrkWeb.hibernateManager.getSession(); - StringBuffer queryString = new StringBuffer("from RecSegment as seg left join seg.recTape as tape left join tape.service as srv "); + StringBuffer queryString = new StringBuffer("from OrkSegment as seg left join seg.tape as tape left join tape.service as srv "); //StringBuffer queryString = new StringBuffer("from RecSegment as seg "); //boolean firstCriterium = false; - queryString.append(" where seg.timestamp between :startDate and :endDate "); + if (filter.getStartDate() != null && filter.getEndDate() != null) + queryString.append(" where seg.timestamp between :startDate and :endDate "); + else if (filter.getStartDate() != null) + queryString.append(" where seg.timestamp > :startDate "); + else if (filter.getEndDate() != null) + queryString.append(" where seg.timestamp < :endDate "); if(filter.getLocalParty().length() > 0) { queryString.append(" and seg.localParty=:localParty "); @@ -132,11 +137,14 @@ public class RecSegmentServiceHbn implements RecSegmentService{ Query query = session.createQuery(queryString.toString()); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - logger.debug("Filter start date:" + dateFormat.format(filter.getStartDate())); - query.setTimestamp("startDate", filter.getStartDate()); - logger.debug("Filter end date:" + dateFormat.format(filter.getEndDate())); - query.setTimestamp("endDate", filter.getEndDate()); - + if (filter.getStartDate() != null) { + logger.debug("Filter start date:" + dateFormat.format(filter.getStartDate())); + query.setTimestamp("startDate", filter.getStartDate()); + } + if (filter.getEndDate() != null) { + logger.debug("Filter end date:" + dateFormat.format(filter.getEndDate())); + query.setTimestamp("endDate", filter.getEndDate()); + } if(filter.getLocalParty().length() > 0) { query.setString("localParty", filter.getLocalParty()); @@ -174,7 +182,7 @@ public class RecSegmentServiceHbn implements RecSegmentService{ while (scrollDocs.get()!= null && rowsSoFar