Subversion Repositories WebE

Compare Revisions

Last modification

Ignore whitespace Rev 36 → Rev 37

/trunk/src/struts.xml
14,7 → 14,7
</action>
<action name="saveTerm" method="save"
class="ch.ffhs.webE.action.TermAction">
<result>/user/terms.jsp</result>
<result type="redirect">/user/listTerms</result>
</action>
<action name="editTerm" method="edit"
class="ch.ffhs.webE.action.TermAction">
52,60 → 52,50
<result>/admin/userAddForm.jsp</result>
</action>
 
<action name="doUserAdd" method="addOrUpdate"
<action name="listUsers" method="list"
class="ch.ffhs.webE.action.UserAction">
<result name="success">/admin/userAdd.jsp</result>
<result name="success">/admin/users.jsp</result>
</action>
 
<action name="userList" method="list"
<action name="saveUser" method="save"
class="ch.ffhs.webE.action.UserAction">
<result name="success">/admin/userList.jsp</result>
<result type="redirect">/admin/listUsers</result>
</action>
 
<action name="deleteUser" method="delete"
class="ch.ffhs.webE.action.UserAction">
<result name="success" type="redirect">/admin/userList</result>
<result name="success" type="redirect">/admin/listUsers</result>
</action>
 
<action name="editUser" method="edit"
class="ch.ffhs.webE.action.UserAction">
<result name="success">/admin/userAddForm.jsp</result>
<result name="success">/admin/users.jsp</result>
</action>
 
 
 
 
<!-- Relationship Type management -->
<action name="relTypeList" method="list"
<action name="listRelTypes" method="list"
class="ch.ffhs.webE.action.RelationshipTypeAction">
<result name="success">/admin/relTypeList.jsp</result>
<result name="success">/admin/relTypes.jsp</result>
</action>
 
<action name="relTypeAddForm">
<result>/admin/relTypeAddForm.jsp</result>
</action>
 
<action name="doRelTypeAdd" method="addOrUpdate"
class="ch.ffhs.webE.action.RelationshipTypeAction">
<result name="success" type="redirect">/admin/relTypeList</result>
<result name="success" type="redirect">/admin/listRelTypes</result>
</action>
 
<action name="deleteRelType" method="delete"
class="ch.ffhs.webE.action.RelationshipTypeAction">
<result name="success" type="redirect">/admin/relTypeList</result>
<result name="success" type="redirect">/admin/listRelTypes</result>
</action>
 
<action name="editRelType" method="edit"
class="ch.ffhs.webE.action.RelationshipTypeAction">
<result name="success">/admin/relTypeAddForm.jsp</result>
<result name="success">/admin/relTypes.jsp</result>
<result name="error">/admin/adminError.jsp</result>
</action>
 
</package>
 
 
 
 
<!-- Remaining environment of the session -->
<package name="default" namespace="" extends="hibernate-default">
 
/trunk/src/ch/ffhs/webE/dao/TermDAOImpl.java
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAOImpl.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAOImpl.java (revision 36)
+++ trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAOImpl.java (nonexistent)
@@ -1,118 +0,0 @@
-package ch.ffhs.webE.dao;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
-import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
-import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
-import ch.ffhs.webE.domain.*;
-
-public class RelationshipTypeDAOImpl implements RelationshipTypeDAO
-{
-
- @SessionTarget
- Session session;
- @TransactionTarget
- Transaction transaction;
-
- /**
- * Gets a list of all the relationshipTypes in the database.
- *
- * @return List of all the users. In case of a problem, an empty list is
- * returned.
- */
- @SuppressWarnings("unchecked")
- @Override
- public List<RelationshipType> getRelTypes()
- {
-
- List<RelationshipType> relType = null;
-
- try
- {
- relType = session.createQuery("from RelationshipType").list();
- }
- catch (Exception e)
- {
- // TODO: Logging
- }
-
- if (relType == null)
- {
- relType = new ArrayList<RelationshipType>();
- }
-
- return relType;
- }
-
- /**
- * used to save a relationship type
- *
- * @param RelationshipType
- * relType: A filled DAO
- * @return Boolean indicating success or error in saving the
- * relationshipType
- */
- @Override
- public boolean saveOrUpdateRelType(RelationshipType relType)
- {
- try
- {
- session.saveOrUpdate(relType);
- return true;
- }
- catch (Exception e)
- {
- transaction.rollback();
- return false;
- // TODO: Logging
- }
- }
-
- /**
- * Used to delete a relationship type.
- *
- * @param int RelationshipType ID
- * @return boolean indicating success or error in the query execution
- */
- @Override
- public boolean deleteRelationshipType(int relTypeID)
- {
- try
- {
- RelationshipType relType = (RelationshipType) session.get(
- RelationshipType.class, relTypeID);
- session.delete(relType);
- return true;
- }
- catch (Exception e)
- {
- transaction.rollback();
- // TODO: Logging
- return false;
- }
- }
-
- /**
- * Used to get a relationship type by ID
- */
- @Override
- public RelationshipType getRelTypeById(int relTypeID)
- {
- RelationshipType relType = null;
- try
- {
- relType = (RelationshipType) session.get(RelationshipType.class,
- relTypeID);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- // TODO: Logging
- }
- return relType;
- }
-}
/trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAOImpl.java
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/UserDAOImpl.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/UserDAOImpl.java (revision 36)
+++ trunk/src/ch/ffhs/webE/dao/UserDAOImpl.java (nonexistent)
@@ -1,135 +0,0 @@
-package ch.ffhs.webE.dao;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
-import ch.ffhs.webE.domain.User;
-
-import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
-import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
-
-public class UserDAOImpl implements UserDAO
-{
-
- @SessionTarget
- Session session;
- @TransactionTarget
- Transaction transaction;
-
- /**
- * Creates a list of all the registered users
- *
- * @return an ArrayList with all the users - in case of a problem, an empty
- * list is returned
- */
- @SuppressWarnings("unchecked")
- @Override
- public List<User> listUser()
- {
- List<User> user = null;
- try
- {
- user = this.session.createQuery("from User").list();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- // If no user was checked, return an empty list to mitigate null pointer
- // exceptions
- if (user == null)
- {
- user = new ArrayList<User>();
- }
- return user;
- }
-
- /**
- * Executes the query to save the user
- *
- * @param User
- * Domain object to be saved
- * @return void
- */
- @Override
- public void saveOrUpdateUser(User user)
- {
- try
- {
- this.session.saveOrUpdate(user);
- }
- catch (Exception e)
- {
- this.transaction.rollback();
- e.printStackTrace();
- }
- }
-
- /**
- * Used to delete a user.
- *
- * @param int userId
- */
- @Override
- public void deleteUser(int userId)
- {
- try
- {
- User user = (User) this.session.get(User.class, userId);
- this.session.delete(user);
- }
- catch (Exception e)
- {
- this.transaction.rollback();
- e.printStackTrace();
- }
- }
-
- /**
- * Returns a single user with this user name (used for login)
- *
- * @param username
- * : String - entire user name
- * @return User: Returns a user object if something is found. If not, null is
- * returned
- */
- public User searchUsername(String username)
- {
- User user = null;
-
- // Exec query
- try
- {
- user = (User) this.session
- .createQuery("FROM User " + "WHERE username = :username")
- .setParameter("username", username).uniqueResult();
- }
- catch (Exception e)
- {
- // TODO: Log error
- }
- return user;
- }
-
- /**
- * Used to list a single user by Id.
- */
- @Override
- public User listUserById(int userId)
- {
- User user = null;
- try
- {
- user = (User) this.session.get(User.class, userId);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return user;
- }
-}
\ No newline at end of file
/trunk/src/ch/ffhs/webE/dao/UserDAOImpl.java
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/RelationshipDAOImpl.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/RelationshipDAOImpl.java (revision 36)
+++ trunk/src/ch/ffhs/webE/dao/RelationshipDAOImpl.java (nonexistent)
@@ -1,130 +0,0 @@
-package ch.ffhs.webE.dao;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
-import ch.ffhs.webE.domain.Relationship;
-
-import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
-import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
-
-/**
- * Implements the Database Access Object for terms
- *
- * @author Thomas Lahn
- */
-public class RelationshipDAOImpl
-{
- /**
- * Database session
- */
- @SessionTarget
- Session session;
-
- /**
- * Database transaction
- */
- @TransactionTarget
- Transaction transaction;
-
- /**
- * Creates a list of all relationships
- *
- * @return an ArrayList with all the relationshops - in case of a problem, an
- * empty list is returned
- */
- @SuppressWarnings("unchecked")
- public List<Relationship> getRelationshipList()
- {
- List<Relationship> relationship = null;
- try
- {
- relationship = this.session.createQuery("from Relationship").list(); //$NON-NLS-1$
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- /*
- * If no relationship was checked, return an empty list to mitigate null
- * pointer exceptions
- */
- if (relationship == null)
- {
- relationship = new ArrayList<Relationship>();
- }
-
- return relationship;
- }
-
- /**
- * Executes the query to save the relationship
- *
- * @param relationship
- * Domain object to be saved
- * @return <code>true</code> if successful, <code>false</code> otherwise
- */
- public boolean saveOrUpdate(Relationship relationship)
- {
- try
- {
- relationship.setObjectId(relationship.getObjectId());
- this.session.saveOrUpdate(relationship);
- return true;
- }
- catch (Exception e)
- {
- this.transaction.rollback();
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * Delete a relationship
- *
- * @param id
- * Relationship ID
- */
- public void deleteRelationship(int id)
- {
- try
- {
- Relationship relationship = (Relationship) this.session.get(
- Relationship.class, id);
- this.session.delete(relationship);
- }
- catch (Exception e)
- {
- this.transaction.rollback();
- e.printStackTrace();
- }
- }
-
- /**
- * Retrieves a relationship by ID
- *
- * @param id
- * Term ID
- * @return The relationship with this <var>id</var>
- */
- public Relationship getRelationshipById(int id)
- {
- Relationship relationship = null;
-
- try
- {
- relationship = (Relationship) this.session.get(Relationship.class, id);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return relationship;
- }
-}
\ No newline at end of file
/trunk/src/ch/ffhs/webE/dao/RelationshipDAOImpl.java
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/UserDAO.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/UserDAO.java (revision 36)
+++ trunk/src/ch/ffhs/webE/dao/UserDAO.java (revision 37)
@@ -1,19 +1,134 @@
package ch.ffhs.webE.dao;
+import java.util.ArrayList;
import java.util.List;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
import ch.ffhs.webE.domain.User;
-public interface UserDAO
+import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
+import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
+
+public class UserDAO
{
- List<User> listUser();
+ @SessionTarget
+ Session session;
+ @TransactionTarget
+ Transaction transaction;
- User searchUsername(String username);
+ /**
+ * Creates a list of all the registered users
+ *
+ * @return an ArrayList with all the users - in case of a problem, an empty
+ * list is returned
+ */
+ @SuppressWarnings("unchecked")
+ public List<User> getList()
+ {
+ List<User> user = null;
+ try
+ {
+ user = this.session.createQuery("from User").list();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
- void deleteUser(int userId);
+ // If no user was checked, return an empty list to mitigate null pointer
+ // exceptions
+ if (user == null)
+ {
+ user = new ArrayList<User>();
+ }
+ return user;
+ }
- User listUserById(int userId);
+ /**
+ * Executes the query to save the user
+ *
+ * @param user
+ * Domain object to be saved
+ * @return void
+ */
+ public void saveOrUpdate(User user)
+ {
+ try
+ {
+ this.session.saveOrUpdate(user);
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ }
+ }
- void saveOrUpdateUser(User user);
-}
+ /**
+ * Used to delete a user.
+ *
+ * @param userId
+ */
+ public void delete(int userId)
+ {
+ try
+ {
+ User user = (User) this.session.get(User.class, userId);
+ this.session.delete(user);
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Returns a single user with this user name (used for login)
+ *
+ * @param username
+ * : String - entire user name
+ * @return User: Returns a user object if something is found. If not, null is
+ * returned
+ */
+ public User getByUsername(String username)
+ {
+ User user = null;
+
+ // Exec query
+ try
+ {
+ user = (User) this.session
+ .createQuery("FROM User " + "WHERE username = :username")
+ .setParameter("username", username).uniqueResult();
+ }
+ catch (Exception e)
+ {
+ // TODO: Log error
+ }
+ return user;
+ }
+
+ /**
+ * Used to list a single user by Id.
+ *
+ * @param userId
+ * @return
+ */
+ public User getById(int userId)
+ {
+ User user = null;
+ try
+ {
+ user = (User) this.session.get(User.class, userId);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return user;
+ }
+}
\ No newline at end of file
/trunk/src/ch/ffhs/webE/dao/HistoryDAO.java
0,0 → 1,88
/**
*
*/
package ch.ffhs.webE.dao;
 
import java.util.ArrayList;
import java.util.List;
 
import org.hibernate.Session;
import org.hibernate.Transaction;
 
import ch.ffhs.webE.domain.History;
 
import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
 
/**
* @author pelinux
*
*/
public class HistoryDAO
{
/**
* Database session
*/
@SessionTarget
Session session;
 
/**
* Database transaction
*/
@TransactionTarget
Transaction transaction;
 
/**
* Executes the query to save the history record
*
* @param history
* Domain object to be saved
* @return <code>true</code> if successful, <code>false</code> otherwise
*/
public boolean saveOrUpdate(History history)
{
try
{
history.setId(history.getId());
this.session.saveOrUpdate(history);
return true;
}
catch (Exception e)
{
this.transaction.rollback();
e.printStackTrace();
return false;
}
}
 
/**
* Returns a list of all terms
*
* @return an ArrayList with all the terms - in case of a problem, an empty
* list is returned
*/
@SuppressWarnings("unchecked")
public List<History> getList()
{
List<History> history = null;
try
{
history = this.session.createQuery("from History").list(); //$NON-NLS-1$
}
catch (Exception e)
{
e.printStackTrace();
}
 
/*
* If no term was checked, return an empty list to mitigate null pointer
* exceptions
*/
if (history == null)
{
history = new ArrayList<History>();
}
 
return history;
}
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/RelationshipDAO.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/RelationshipDAO.java (nonexistent)
+++ trunk/src/ch/ffhs/webE/dao/RelationshipDAO.java (revision 37)
@@ -0,0 +1,130 @@
+package ch.ffhs.webE.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+import ch.ffhs.webE.domain.Relationship;
+
+import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
+import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
+
+/**
+ * Implements the Database Access Object for terms
+ *
+ * @author Thomas Lahn
+ */
+public class RelationshipDAO
+{
+ /**
+ * Database session
+ */
+ @SessionTarget
+ Session session;
+
+ /**
+ * Database transaction
+ */
+ @TransactionTarget
+ Transaction transaction;
+
+ /**
+ * Creates a list of all relationships
+ *
+ * @return an ArrayList with all the relationshops - in case of a problem, an
+ * empty list is returned
+ */
+ @SuppressWarnings("unchecked")
+ public List<Relationship> getList()
+ {
+ List<Relationship> relationship = null;
+ try
+ {
+ relationship = this.session.createQuery("from Relationship").list(); //$NON-NLS-1$
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ /*
+ * If no relationship was checked, return an empty list to mitigate null
+ * pointer exceptions
+ */
+ if (relationship == null)
+ {
+ relationship = new ArrayList<Relationship>();
+ }
+
+ return relationship;
+ }
+
+ /**
+ * Executes the query to save the relationship
+ *
+ * @param relationship
+ * Domain object to be saved
+ * @return <code>true</code> if successful, <code>false</code> otherwise
+ */
+ public boolean saveOrUpdate(Relationship relationship)
+ {
+ try
+ {
+ relationship.setObjectId(relationship.getObjectId());
+ this.session.saveOrUpdate(relationship);
+ return true;
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * Delete a relationship
+ *
+ * @param id
+ * Relationship ID
+ */
+ public void delete(int id)
+ {
+ try
+ {
+ Relationship relationship = (Relationship) this.session.get(
+ Relationship.class, id);
+ this.session.delete(relationship);
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Retrieves a relationship by ID
+ *
+ * @param id
+ * Term ID
+ * @return The relationship with this <var>id</var>
+ */
+ public Relationship getById(int id)
+ {
+ Relationship relationship = null;
+
+ try
+ {
+ relationship = (Relationship) this.session.get(Relationship.class, id);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return relationship;
+ }
+}
\ No newline at end of file
/trunk/src/ch/ffhs/webE/dao/RelationshipDAO.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAO.java
===================================================================
--- trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAO.java (revision 36)
+++ trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAO.java (revision 37)
@@ -1,16 +1,130 @@
package ch.ffhs.webE.dao;
+import java.util.ArrayList;
import java.util.List;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
import ch.ffhs.webE.domain.RelationshipType;
-public interface RelationshipTypeDAO {
+import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
+import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
- List<RelationshipType> getRelTypes();
+/**
+ * Data Access Object class for {@link RelationshipType}s
+ *
+ * @author Thomas Lahn
+ */
+public class RelationshipTypeDAO
+{
- boolean deleteRelationshipType(int relTypeID);
-
- RelationshipType getRelTypeById(int relTypeID);
+ /**
+ * Hibernate session target
+ */
+ @SessionTarget
+ Session session;
- boolean saveOrUpdateRelType(RelationshipType relType);
+ /**
+ * Hibernate transaction target
+ */
+ @TransactionTarget
+ Transaction transaction;
+
+ /**
+ * Gets a list of all the relationshipTypes in the database.
+ *
+ * @return List of all the users. In case of a problem, an empty list is
+ * returned.
+ */
+ @SuppressWarnings("unchecked")
+ public List<RelationshipType> getList()
+ {
+
+ List<RelationshipType> relType = null;
+
+ try
+ {
+ relType = this.session.createQuery("from RelationshipType").list(); //$NON-NLS-1$
+ }
+ catch (Exception e)
+ {
+ // TODO: Logging
+ }
+
+ if (relType == null)
+ {
+ relType = new ArrayList<RelationshipType>();
+ }
+
+ return relType;
+ }
+
+ /**
+ * Saves or updates a relationship type
+ *
+ * @param relType
+ * A filled domain object
+ * @return Boolean indicating success or error in saving the relationshipType
+ */
+ public boolean saveOrUpdate(RelationshipType relType)
+ {
+ try
+ {
+ this.session.saveOrUpdate(relType);
+ return true;
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ return false;
+ // TODO: Logging
+ }
+ }
+
+ /**
+ * Delete a relationship type
+ *
+ * @param relTypeId
+ * Relationship type ID
+ * @return boolean indicating success or error in the query execution
+ */
+ public boolean delete(int relTypeId)
+ {
+ try
+ {
+ RelationshipType relType = (RelationshipType) this.session.get(
+ RelationshipType.class, relTypeId);
+ this.session.delete(relType);
+ return true;
+ }
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ // TODO: Logging
+ return false;
+ }
+ }
+
+ /**
+ * Used to get a relationship type by ID
+ *
+ * @param relTypeID
+ * @return
+ */
+ public RelationshipType getById(int relTypeID)
+ {
+ RelationshipType relType = null;
+ try
+ {
+ relType = (RelationshipType) this.session.get(RelationshipType.class,
+ relTypeID);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ // TODO: Logging
+ }
+ return relType;
+ }
}
/trunk/src/ch/ffhs/webE/dao/TermDAO.java
1,28 → 1,108
package ch.ffhs.webE.dao;
 
import java.util.ArrayList;
import java.util.List;
 
import org.hibernate.Session;
import org.hibernate.Transaction;
 
import ch.ffhs.webE.domain.Term;
 
import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
 
/**
* Defines methods all term DAO implementations must implement
* Implements the Database Access Object for terms
*
* @author pelinux
* @author Thomas Lahn
*/
public interface TermDAO
public class TermDAO
{
/**
* @return
* Database session
*/
List<Term> getTerms();
@SessionTarget
Session session;
 
/**
* Database transaction
*/
@TransactionTarget
Transaction transaction;
 
/**
* Returns a list of all terms
*
* @return an ArrayList with all the terms - in case of a problem, an empty
* list is returned
*/
@SuppressWarnings("unchecked")
public List<Term> getList()
{
List<Term> term = null;
try
{
term = this.session.createQuery("from Term").list(); //$NON-NLS-1$
}
catch (Exception e)
{
e.printStackTrace();
}
 
/*
* If no term was checked, return an empty list to mitigate null pointer
* exceptions
*/
if (term == null)
{
term = new ArrayList<Term>();
}
 
return term;
}
 
/**
* Executes the query to save the term
*
* @param term
* Domain object to be saved
* @return <code>true</code> if successful, <code>false</code> otherwise
*/
public boolean saveOrUpdate(Term term)
{
try
{
term.setObjectId(term.getObjectId());
this.session.saveOrUpdate(term);
return true;
}
catch (Exception e)
{
this.transaction.rollback();
e.printStackTrace();
return false;
}
}
 
/**
* Delete a term
*
* @param termId
* Term ID
*/
void deleteTerm(int termId);
public void delete(int termId)
{
try
{
Term term = (Term) this.session.get(Term.class, termId);
this.session.delete(term);
}
catch (Exception e)
{
this.transaction.rollback();
e.printStackTrace();
}
}
 
/**
* Retrieves a term by ID
30,14 → 110,19
* @param termId
* @return
*/
Term getTermById(int termId);
public Term getById(int termId)
{
Term term = null;
 
/**
* Executes the query to save the term
*
* @param term
* Domain object to be saved
* @return <code>true</code> if successful, <code>false</code> otherwise
*/
boolean saveOrUpdate(Term term);
}
try
{
term = (Term) this.session.get(Term.class, termId);
}
catch (Exception e)
{
e.printStackTrace();
}
 
return term;
}
}
/trunk/src/ch/ffhs/webE/domain/ActionType.java
2,13 → 2,15
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.util.HashSet;
import java.util.Set;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
18,47 → 20,78
*/
@Entity
@Table(name = "action_type", catalog = "webengineering")
public class ActionType implements java.io.Serializable {
public class ActionType implements java.io.Serializable
{
/**
* History action ID for adding an item
*/
public static final int ADD = 1;
 
private Integer id;
private String name;
private Set<History> histories = new HashSet<History>(0);
/**
* History action ID for renaming a term
*/
public static final int RENAME = 2;
 
public ActionType() {
}
/**
* History action ID for modifying a relationship
*/
public static final int MODIFY = 3;
 
public ActionType(String name, Set<History> histories) {
this.name = name;
this.histories = histories;
}
private int id;
private String name;
private Set<History> histories = new HashSet<History>(0);
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public ActionType()
{
}
 
public void setId(Integer id) {
this.id = id;
}
/**
* @param id
*/
public ActionType(int id)
{
this.setId(id);
}
 
@Column(name = "name", length = 45)
public String getName() {
return this.name;
}
public ActionType(String name, Set<History> histories)
{
this.setName(name);
this.setHistories(histories);
}
 
public void setName(String name) {
this.name = name;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.id;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "actionType")
public Set<History> getHistories() {
return this.histories;
}
public void setId(int id)
{
this.id = id;
}
 
public void setHistories(Set<History> histories) {
this.histories = histories;
}
@Column(name = "name", length = 45)
public String getName()
{
return this.name;
}
 
public void setName(String name)
{
this.name = name;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "actionType")
public Set<History> getHistories()
{
return this.histories;
}
 
public void setHistories(Set<History> histories)
{
this.histories = histories;
}
 
}
/trunk/src/ch/ffhs/webE/domain/History.java
2,12 → 2,14
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.util.Date;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
20,103 → 22,185
*/
@Entity
@Table(name = "history", catalog = "webengineering")
public class History implements java.io.Serializable {
public class History implements java.io.Serializable
{
/**
* Serialization version ID
*/
private static final long serialVersionUID = 1L;
 
private Integer id;
private User user;
private ActionType actionType;
private ObjectEntity object;
private String value;
private String comment;
private Date date;
private int id;
private User user;
private ActionType actionType;
private ObjectEntity object;
private String value;
private String comment;
private Date date;
 
public History() {
}
/**
*
*/
public History()
{
}
 
public History(User user, ActionType actionType, ObjectEntity object, Date date) {
this.user = user;
this.actionType = actionType;
this.object = object;
this.date = date;
}
/**
* @param user
* @param actionType
* @param object
* @param date
*/
public History(User user, ActionType actionType, ObjectEntity object,
Date date)
{
this.user = user;
this.actionType = actionType;
this.object = object;
this.date = date;
}
 
public History(User user, ActionType actionType, ObjectEntity object,
String value, String comment, Date date) {
this.user = user;
this.actionType = actionType;
this.object = object;
this.value = value;
this.comment = comment;
this.date = date;
}
/**
* @param user
* @param actionType
* @param object
* @param value
* @param comment
* @param date
*/
public History(User user, ActionType actionType, ObjectEntity object,
String value, String comment, Date date)
{
this.user = user;
this.actionType = actionType;
this.object = object;
this.value = value;
this.comment = comment;
this.date = date;
}
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
/**
* @return
*/
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.id;
}
 
public void setId(Integer id) {
this.id = id;
}
/**
* @param id
*/
public void setId(int id)
{
this.id = id;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
public User getUser() {
return this.user;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
public User getUser()
{
return this.user;
}
 
public void setUser(User user) {
this.user = user;
}
/**
* @param user
*/
public void setUser(User user)
{
this.user = user;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "action_type_id", nullable = false)
public ActionType getActionType() {
return this.actionType;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "action_type_id", nullable = false)
public ActionType getActionType()
{
return this.actionType;
}
 
public void setActionType(ActionType actionType) {
this.actionType = actionType;
}
/**
* @param actionType
*/
public void setActionType(ActionType actionType)
{
this.actionType = actionType;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "objects_id", nullable = false)
public ObjectEntity getObject() {
return this.object;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "objects_id", nullable = false)
public ObjectEntity getObject()
{
return this.object;
}
 
public void setObject(ObjectEntity object) {
this.object = object;
}
/**
* @param object
*/
public void setObject(ObjectEntity object)
{
this.object = object;
}
 
@Column(name = "value", length = 45)
public String getValue() {
return this.value;
}
/**
* @return
*/
@Column(name = "value", length = 45)
public String getValue()
{
return this.value;
}
 
public void setValue(String value) {
this.value = value;
}
/**
* @param value
*/
public void setValue(String value)
{
this.value = value;
}
 
@Column(name = "comment")
public String getComment() {
return this.comment;
}
/**
* @return
*/
@Column(name = "comment")
public String getComment()
{
return this.comment;
}
 
public void setComment(String comment) {
this.comment = comment;
}
/**
* @param comment
*/
public void setComment(String comment)
{
this.comment = comment;
}
 
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date", nullable = false, length = 19)
public Date getDate() {
return this.date;
}
/**
* @return
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date", nullable = false, length = 19)
public Date getDate()
{
return this.date;
}
 
public void setDate(Date date) {
this.date = date;
}
/**
* @param date
*/
public void setDate(Date date)
{
this.date = date;
}
 
}
/trunk/src/ch/ffhs/webE/domain/ObjectEntity.java
22,6 → 22,8
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
 
import org.hibernate.annotations.OrderBy;
 
/**
* ObjectEntity generated by hbm2java
*/
43,7 → 45,7
private Date modified;
private Boolean deleted;
private Term term;
private Set<History> histories = new HashSet<History>(0);
private Set<History> history = new HashSet<History>(0);
private Relationship relationship;
 
/**
74,7 → 76,7
* @param modified
* @param deleted
* @param term
* @param histories
* @param history
* @param relationship
*/
public ObjectEntity(User userByEditorId, ObjectType objectType,
88,7 → 90,7
this.modified = modified;
this.deleted = deleted;
this.term = term;
this.histories = histories;
this.history = histories;
this.relationship = relationship;
}
 
239,17 → 241,18
* @return
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "object")
public Set<History> getHistories()
@OrderBy(clause = "date DESC")
public Set<History> getHistory()
{
return this.histories;
return this.history;
}
 
/**
* @param histories
* @param history
*/
public void setHistories(Set<History> histories)
public void setHistory(Set<History> history)
{
this.histories = histories;
this.history = history;
}
 
/**
/trunk/src/ch/ffhs/webE/action/RelationshipAction.java
4,15 → 4,19
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.servlet.http.HttpServletRequest;
 
import org.apache.struts2.StrutsStatics;
 
import ch.ffhs.webE.dao.RelationshipDAOImpl;
import ch.ffhs.webE.dao.RelationshipTypeDAOImpl;
import ch.ffhs.webE.dao.TermDAOImpl;
import ch.ffhs.webE.dao.UserDAOImpl;
import ch.ffhs.webE.dao.HistoryDAO;
import ch.ffhs.webE.dao.RelationshipDAO;
import ch.ffhs.webE.dao.RelationshipTypeDAO;
import ch.ffhs.webE.dao.TermDAO;
import ch.ffhs.webE.dao.UserDAO;
import ch.ffhs.webE.domain.ActionType;
import ch.ffhs.webE.domain.History;
import ch.ffhs.webE.domain.ObjectEntity;
import ch.ffhs.webE.domain.ObjectType;
import ch.ffhs.webE.domain.Relationship;
36,15 → 40,27
private static final long serialVersionUID = 1L;
 
private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
private final RelationshipTypeDAOImpl relationshipTypeDAO = new RelationshipTypeDAOImpl();
private final RelationshipTypeDAO relationshipTypeDAO = new RelationshipTypeDAO();
 
private List<Term> terms = new ArrayList<Term>();
private final TermDAOImpl termDAO = new TermDAOImpl();
private final TermDAO termDAO = new TermDAO();
 
private List<Relationship> relationshipList = new ArrayList<Relationship>();
private final RelationshipDAOImpl relationshipDAO = new RelationshipDAOImpl();
private final UserDAOImpl userDAO = new UserDAOImpl();
private Relationship relationship = new Relationship();
 
/**
* The term that was just saved (added, renamed)
*/
private Relationship modifiedRelationship;
 
private final RelationshipDAO relationshipDAO = new RelationshipDAO();
 
private final UserDAO userDAO = new UserDAO();
 
private Set<History> history;
private final HistoryDAO historyDAO = new HistoryDAO();
 
/**
* Session object
*/
Map<String, Object> session = ActionContext.getContext().getSession();
64,11 → 80,6
private final HttpServletRequest request = (HttpServletRequest) ActionContext
.getContext().get(StrutsStatics.HTTP_REQUEST);
 
/**
* The term that was just saved (added, renamed)
*/
private Relationship modifiedRelationship;
 
/*
* (non-Javadoc)
*
86,9 → 97,9
*/
public String list()
{
this.setTerms(this.termDAO.getTerms());
this.setRelationshipTypes(this.relationshipTypeDAO.getRelTypes());
this.setRelationshipList(this.relationshipDAO.getRelationshipList());
this.setTerms(this.termDAO.getList());
this.setRelationshipTypes(this.relationshipTypeDAO.getList());
this.setRelationshipList(this.relationshipDAO.getList());
return Action.SUCCESS;
}
 
99,31 → 110,51
*/
public String save()
{
this.relationship.setTermFrom(this.termDAO.getTermById(Integer
this.relationship.setTermFrom(this.termDAO.getById(Integer
.parseInt(this.request.getParameter("term1"))));
this.relationship.setTermTo(this.termDAO.getTermById(Integer
this.relationship.setTermTo(this.termDAO.getById(Integer
.parseInt(this.request.getParameter("term2"))));
this.relationship.setRelationshipType(this.relationshipTypeDAO
.getRelTypeById(Integer.parseInt(this.request.getParameter("type"))));
.getById(Integer.parseInt(this.request.getParameter("type"))));
 
User user = this.userDAO.searchUsername((String) this.session
User user = this.userDAO.getByUsername((String) this.session
.get("username"));
Date now = new Date();
ObjectEntity obj;
int action = 0;
 
if ("false".equals(this.request.getParameter("edit")))
{
/* Add a new relationship */
ObjectEntity obj = new ObjectEntity(user, new ObjectType(
ObjectType.RELATIONSHIP), user, null, new Date(), false, null, null,
this.relationship);
obj = new ObjectEntity(user, new ObjectType(ObjectType.RELATIONSHIP),
user, null, new Date(), false, null, null, this.relationship);
this.relationship.setObject(obj);
this.added = true;
action = ActionType.ADD;
}
else
{
obj = new ObjectEntity();
obj.setId(this.relationship.getObjectId());
action = ActionType.MODIFY;
}
 
this.edit = false;
 
String result = Action.SUCCESS;
if (!this.relationshipDAO.saveOrUpdate(this.relationship))
if (this.relationshipDAO.saveOrUpdate(this.relationship))
{
String comment = this.request.getParameter("comment");
 
History historyRecord = new History(user, new ActionType(action), obj,
"(" + this.relationship.getTermFrom().getName() + ") ("
+ this.relationship.getRelationshipType().getNameFrom() + ") ("
+ this.relationship.getTermTo().getName() + ")", comment, now);
 
this.historyDAO.saveOrUpdate(historyRecord);
}
else
{
result = Action.ERROR;
}
 
146,7 → 177,7
String result = Action.ERROR;
if (id > 0)
{
this.setRelationship(this.relationshipDAO.getRelationshipById(id));
this.setRelationship(this.relationshipDAO.getById(id));
if (this.getRelationship() != null)
{
this.edit = true;
173,7 → 204,7
String result = Action.SUCCESS;
if (id > 0)
{
this.relationshipDAO.deleteRelationship(id);
this.relationshipDAO.delete(id);
}
else
{
291,4 → 322,21
{
this.modifiedRelationship = modifiedRelationship;
}
 
/**
* @return the history
*/
public Set<History> getHistory()
{
return this.history;
}
 
/**
* @param history
* the history to set
*/
public void setHistory(Set<History> history)
{
this.history = history;
}
}
/trunk/src/ch/ffhs/webE/action/RelationshipTypeAction.java
8,7 → 8,6
import org.apache.struts2.StrutsStatics;
 
import ch.ffhs.webE.dao.RelationshipTypeDAO;
import ch.ffhs.webE.dao.RelationshipTypeDAOImpl;
import ch.ffhs.webE.domain.RelationshipType;
 
import com.opensymphony.xwork2.Action;
24,8 → 23,12
 
private RelationshipType relType = new RelationshipType();
private List<RelationshipType> relTypeList = new ArrayList<RelationshipType>();
private final RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAOImpl();
private final RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAO();
 
public boolean edit = false;
public boolean added = false;
public RelationshipType savedRelType;
 
@Override
public RelationshipType getModel()
{
34,13 → 37,13
 
public String addOrUpdate()
{
this.relTypeDAO.saveOrUpdateRelType(this.relType);
this.relTypeDAO.saveOrUpdate(this.relType);
return Action.SUCCESS;
}
 
public String list()
{
this.relTypeList = this.relTypeDAO.getRelTypes();
this.relTypeList = this.relTypeDAO.getList();
return Action.SUCCESS;
}
 
48,15 → 51,17
{
int id = this.getIdParameter();
 
String result = Action.ERROR;
if (id > 0)
{
this.relType = this.relTypeDAO.getRelTypeById(id);
return Action.SUCCESS;
this.relType = this.relTypeDAO.getById(id);
this.edit = true;
result = Action.SUCCESS;
}
else
{
return Action.ERROR;
}
 
this.list();
 
return result;
}
 
/**
95,7 → 100,7
// Check for malicious ID values
if (id > 0)
{
this.relTypeDAO.deleteRelationshipType(id);
this.relTypeDAO.delete(id);
return Action.SUCCESS;
}
else
/trunk/src/ch/ffhs/webE/action/TermAction.java
4,13 → 4,17
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.servlet.http.HttpServletRequest;
 
import org.apache.struts2.StrutsStatics;
 
import ch.ffhs.webE.dao.TermDAOImpl;
import ch.ffhs.webE.dao.UserDAOImpl;
import ch.ffhs.webE.dao.HistoryDAO;
import ch.ffhs.webE.dao.TermDAO;
import ch.ffhs.webE.dao.UserDAO;
import ch.ffhs.webE.domain.ActionType;
import ch.ffhs.webE.domain.History;
import ch.ffhs.webE.domain.ObjectEntity;
import ch.ffhs.webE.domain.ObjectType;
import ch.ffhs.webE.domain.Term;
32,8 → 36,8
 
private Term term = new Term();
private List<Term> termList = new ArrayList<Term>();
private final TermDAOImpl termDAO = new TermDAOImpl();
private final UserDAOImpl userDAO = new UserDAOImpl();
private final TermDAO termDAO = new TermDAO();
private final UserDAO userDAO = new UserDAO();
 
/**
* Session object
59,6 → 63,10
*/
public Term savedTerm;
 
private final HistoryDAO historyDAO = new HistoryDAO();
 
private Set<History> history;
 
/*
* (non-Javadoc)
*
76,7 → 84,7
*/
public String list()
{
this.termList = this.termDAO.getTerms();
this.termList = this.termDAO.getList();
return Action.SUCCESS;
}
 
87,24 → 95,41
*/
public String save()
{
User user = this.userDAO.searchUsername((String) this.session
User user = this.userDAO.getByUsername((String) this.session
.get("username"));
Date now = new Date();
ObjectEntity obj;
 
int action = 0;
if ("false".equals(this.request.getParameter("edit")))
{
/* Add a new term */
ObjectEntity obj = new ObjectEntity(user,
new ObjectType(ObjectType.TERM), user, null, new Date(), false,
this.term, null, null);
obj = new ObjectEntity(user, new ObjectType(ObjectType.TERM), user, null,
now, false, this.term, null, null);
 
this.term.setObject(obj);
this.added = true;
action = ActionType.ADD;
}
else
{
obj = new ObjectEntity();
obj.setId(this.term.getObjectId());
action = ActionType.RENAME;
}
 
this.edit = false;
 
String result = Action.SUCCESS;
if (!this.termDAO.saveOrUpdate(this.term))
if (this.termDAO.saveOrUpdate(this.term))
{
String comment = this.request.getParameter("comment");
 
History historyRecord = new History(user, new ActionType(action), obj,
this.term.getName(), comment, now);
 
this.historyDAO.saveOrUpdate(historyRecord);
}
else
{
result = Action.ERROR;
}
 
127,7 → 152,7
String result = Action.ERROR;
if (id > 0)
{
this.term = this.termDAO.getTermById(id);
this.term = this.termDAO.getById(id);
if (this.term != null)
{
this.edit = true;
155,7 → 180,7
String result = Action.SUCCESS;
if (id > 0)
{
this.termDAO.deleteTerm(id);
this.termDAO.delete(id);
}
else
{
222,4 → 247,21
{
this.termList = termList;
}
 
/**
* @return the histories
*/
public Set<History> getHistories()
{
return this.history;
}
 
/**
* @param histories
* the histories to set
*/
public void setHistories(Set<History> histories)
{
this.history = histories;
}
}
/trunk/src/ch/ffhs/webE/action/LoginAction.java
2,7 → 2,7
 
import java.util.Map;
 
import ch.ffhs.webE.dao.UserDAOImpl;
import ch.ffhs.webE.dao.UserDAO;
import ch.ffhs.webE.domain.User;
 
import com.opensymphony.xwork2.Action;
15,7 → 15,7
 
private static final long serialVersionUID = 1799753056277211344L;
private final User user = new User();
private final UserDAOImpl userDAO = new UserDAOImpl();
private final UserDAO userDAO = new UserDAO();
 
/* Form fields */
private String userName;
84,7 → 84,7
public String verifyUser(String username, String password)
{
// DB Query
User u = this.userDAO.searchUsername(username);
User u = this.userDAO.getByUsername(username);
 
// User does not exist
if (u == null)
/trunk/src/ch/ffhs/webE/action/UserAction.java
7,7 → 7,7
 
import org.apache.struts2.StrutsStatics;
 
import ch.ffhs.webE.dao.UserDAOImpl;
import ch.ffhs.webE.dao.UserDAO;
import ch.ffhs.webE.domain.User;
 
import com.opensymphony.xwork2.Action;
22,8 → 22,12
 
private User user = new User();
private List<User> userList = new ArrayList<User>();
private final UserDAOImpl userDAO = new UserDAOImpl();
private final UserDAO userDAO = new UserDAO();
 
public boolean edit = false;
public boolean added = false;
public User savedUser;
 
@Override
public User getModel()
{
31,24 → 35,29
}
 
/**
* Executes the DB query to save the user
* DB query for userList
*
* @return
* @return SUCCESS
*/
public String addOrUpdate()
public String list()
{
this.userDAO.saveOrUpdateUser(this.user);
this.userList = this.userDAO.getList();
return Action.SUCCESS;
}
 
/**
* DB query for userList
* Executes the DB query to save the user
*
* @return SUCCESS
* @return
*/
public String list()
public String save()
{
this.userList = this.userDAO.listUser();
this.userDAO.saveOrUpdate(this.user);
this.savedUser = this.user;
this.user = null;
 
this.list();
 
return Action.SUCCESS;
}
 
56,15 → 65,17
{
int id = this.getIdParameter();
 
String result = Action.ERROR;
if (id > 0)
{
this.user = this.userDAO.listUserById(id);
return Action.SUCCESS;
this.user = this.userDAO.getById(id);
this.edit = true;
result = Action.SUCCESS;
}
else
{
return Action.ERROR;
}
 
this.list();
 
return result;
}
 
/**
104,7 → 115,7
// Check for malicious ID values
if (id > 0)
{
this.userDAO.deleteUser(id);
this.userDAO.delete(id);
return Action.SUCCESS;
}
else
/trunk/WebContent/decorators/mainTemplate.jsp
10,61 → 10,60
<c:set var="isAdmin" value="${fn:contains(requestURI, '/admin/')}" />
 
<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ontologie - <decorator:title />
</title>
<link rel="stylesheet" type="text/css"
href="${contextPath}/resources/css/main.css"
/>
</head>
<body>
 
<%-- Only serves as a container for the different site elements!
Do not write any text directly into the page-container div! --%>
<div id="page-container">
<div id="header">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
class="header"
>
<tr>
<td>&nbsp;</td>
<td
style="vertical-align: top; font-size: 12pt; text-align: right;"
>
<div>
<strong>Semantic Web Project</strong><br /> by Michael
Moos<br /> Thomas Lahn
</div></td>
<td width="56" class="no_padding"><img
src="${contextPath}/resources/images/ontology_logo.jpg"
width="56" height="56" alt="logo"
/>
</td>
</tr>
</table>
</div>
 
<!-- Load nav bars depending on the location -->
<c:if test="${isUser}">
<div id="navbar">
<%@ include file="/user/nav.jsp"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><decorator:title /> &ndash; Ontologie-Editor</title>
<link rel="stylesheet" type="text/css"
href="${contextPath}/resources/css/main.css"
/>
</head>
<body>
<%-- Only serves as a container for the different site elements!
Do not write any text directly into the page-container div! --%>
<div id="page-container">
<div id="header">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
class="header"
>
<tr>
<td>&nbsp;</td>
<td
style="vertical-align: top; font-size: 12pt; text-align: right;"
>
<div>
<strong>Ontologie-Editor</strong><br /> von
Michael&nbsp;Moos<br /> &amp; Thomas&nbsp;Lahn
</div></td>
<td width="56" class="no_padding"><img
src="${contextPath}/resources/images/ontology_logo.jpg"
width="56" height="56" alt="logo"
/>
</td>
</tr>
</table>
</div>
</c:if>
<c:if test="${isAdmin}">
<div id="navbar">
<%@ include file="/admin/nav.jsp"%>
<!-- Load nav bars depending on the location -->
<c:if test="${isUser}">
<div id="navbar">
<%@ include file="/user/nav.jsp"%>
</div>
</c:if>
<c:if test="${isAdmin}">
<div id="navbar">
<%@ include file="/admin/nav.jsp"%>
</div>
</c:if>
<!-- Content DIV loaded via decorator -->
<div id="content">
<decorator:body />
</div>
</c:if>
 
<!-- Content DIV loaded via decorator -->
<div id="content">
<decorator:body />
</div>
 
</div>
</body>
</body>
</html>
/trunk/WebContent/admin/relTypeAdd.jsp
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/relTypeList.jsp
===================================================================
--- trunk/WebContent/admin/relTypeList.jsp (revision 36)
+++ trunk/WebContent/admin/relTypeList.jsp (nonexistent)
@@ -1,43 +0,0 @@
-<%@taglib uri="/struts-tags" prefix="s"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<c:set var="contextPath" value="${pageContext.request.contextPath}" />
-
-<html>
-<head>
-<title>Beziehungstypen bearbeiten</title>
-</head>
-<body>
-
-<h1>Beziehungstypen</h1>
-<p>Hier k&ouml;nnen Sie die Beziehungstypen anpassen.</p>
-
-<s:if test="relTypeList.size() == 0">
-<p>Keine Beziehungstypen gefunden</p>
-</s:if><s:else>
-<table>
- <tr>
- <th>Bezeichnung A =&lt; B</th>
- <th>Bezeichnung B =&lt; A</th>
- </tr>
-<s:iterator value="relTypeList" status="stat">
- <tr>
- <td><s:property value="nameFrom" /></td>
- <td><s:property value="nameTo" /></td>
-
- <td><s:url id="editURL" action="editRelType">
- <s:param name="id" value="%{id}"></s:param>
- </s:url> <s:a href="%{editURL}">
- <img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
- </s:a></td>
-
- <td><s:url id="deleteURL" action="deleteRelType">
- <s:param name="id" value="%{id}"></s:param>
- </s:url> <s:a href="%{deleteURL}">
- <img src="${contextPath}/resources/icons/delete.png" alt="delete" />
- </s:a></td>
- </tr>
-</s:iterator>
-</table>
-</s:else>
-</body>
-</html>
\ No newline at end of file
/trunk/WebContent/admin/relTypeList.jsp
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/userList.jsp
===================================================================
--- trunk/WebContent/admin/userList.jsp (revision 36)
+++ trunk/WebContent/admin/userList.jsp (nonexistent)
@@ -1,49 +0,0 @@
-<%@taglib uri="/struts-tags" prefix="s"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<c:set var="contextPath" value="${pageContext.request.contextPath}" />
-
-<html>
-<head>
-<title>User bearbeiten</title>
-</head>
-<body>
-
-<h1>UserListe</h1>
-<p>Die Liste:</p>
-
-<s:if test="userList.size() == 0">
-<p>Keine Benutzer gefunden</p>
-</s:if>
-<s:else>
-<table>
- <tr>
- <th>Username</th>
- <th>Vorname</th>
- <th>Nachname</th>
- <th>Admin?</th>
- </tr>
-<s:iterator value="userList" status="stat">
- <tr>
- <td><s:property value="username" /></td>
- <td><s:property value="firstname" /></td>
- <td><s:property value="lastname" /></td>
- <td><s:property value="admin" /></td>
-
- <td><s:url id="editURL" action="editUser">
- <s:param name="id" value="%{id}"></s:param>
- </s:url> <s:a href="%{editURL}">
- <img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
- </s:a></td>
-
- <td><s:url id="deleteURL" action="deleteUser">
- <s:param name="id" value="%{id}"></s:param>
- </s:url> <s:a href="%{deleteURL}">
- <img src="${contextPath}/resources/icons/delete.png" alt="delete" />
- </s:a></td>
- </tr>
-</s:iterator>
-</table>
-</s:else>
-
-</body>
-</html>
\ No newline at end of file
/trunk/WebContent/admin/userList.jsp
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/relTypeAddForm.jsp
===================================================================
--- trunk/WebContent/admin/relTypeAddForm.jsp (revision 36)
+++ trunk/WebContent/admin/relTypeAddForm.jsp (nonexistent)
@@ -1,23 +0,0 @@
-<%@taglib uri="/struts-tags" prefix="s"%>
-<html>
-<head>
-<title>Beziehungstyp erstellen</title>
-</head>
-<body>
-
-<h1>Beziehungstyp hinzuf&uuml;gen</h1>
-<p>Bitte geben Sie die Daten f&uuml;r den Beziehungstypen ein</p>
-<s:form action="doRelTypeAdd">
- <s:hidden name="relType.id" />
- <s:textfield name="relType.nameFrom" label="Name vom Ausgangspunkt (z.B. ist Vater von)" />
- <s:textfield name="relType.nameTo" label="Name vom Zielpunkt (z.B. ist Sohn von)" />
-
- <s:if test="relType.id != ''">
- <s:submit value="Edit" />
- </s:if><s:else>
- <s:submit value="Add" />
- </s:else>
-
-</s:form>
-</body>
-</html>
/trunk/WebContent/admin/relTypeAddForm.jsp
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/userAdd.jsp
===================================================================
--- trunk/WebContent/admin/userAdd.jsp (revision 36)
+++ trunk/WebContent/admin/userAdd.jsp (nonexistent)
@@ -1,17 +0,0 @@
-<html>
-<head>
-<title>User added</title>
-</head>
-<body>
-
- <h1>
- User hinzugef&uuml;gt
- </h1>
- <p>
- Der Benutzer wurde hinzugef&uuml;gt
- </p>
- <p>
- TODO: Weiterleitung!!
- </p>
-</body>
-</html>
\ No newline at end of file
/trunk/WebContent/admin/userAdd.jsp
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/userAddForm.jsp
===================================================================
--- trunk/WebContent/admin/userAddForm.jsp (revision 36)
+++ trunk/WebContent/admin/userAddForm.jsp (nonexistent)
@@ -1,27 +0,0 @@
-<%@taglib uri="/struts-tags" prefix="s"%>
-<html>
-<head>
-<title>User erstellen</title>
-</head>
-<body>
-
-<h1>User hinzuf&uuml;gen</h1>
-<p>Bitte geben Sie die Benutzerdaten ein</p>
-<s:form action="doUserAdd">
- <s:hidden name="user.id" />
- <s:textfield name="user.username" label="User Name" />
- <s:password name="user.password" label="Password" />
- <s:textfield name="user.firstname" label="Vorname" />
- <s:textfield name="user.lastname" label="Nachname" />
- <s:checkbox name="user.admin"
- label="Soll der User admin sein?" />
-
- <s:if test="user.id != ''">
- <s:submit value="Edit" />
- </s:if><s:else>
- <s:submit value="Add" />
- </s:else>
-
-</s:form>
-</body>
-</html>
/trunk/WebContent/admin/userAddForm.jsp
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/nav.jsp
===================================================================
--- trunk/WebContent/admin/nav.jsp (revision 36)
+++ trunk/WebContent/admin/nav.jsp (revision 37)
@@ -1,21 +1,14 @@
<div id="navigation">
<ul>
- <li>User
+ <li>Verwalten
<ul>
- <li><a href="userAddForm">Hinzuf&uuml;gen</a></li>
- <li><a href="userList">&Auml;ndern, L&ouml;schen</a></li>
+ <li><a href="listUsers">Benutzer</a></li>
+ <li><a href="listRelTypes">Beziehungstypen</a></li>
</ul></li>
- <li>Beziehungstypen
+ <li>Benutzerfunktionen
<ul>
- <li><a href="relTypeAddForm">Hinzuf&uuml;gen</a></li>
- <li><a href="relTypeList">&Auml;ndern, L&ouml;schen</a></li>
+ <li><a href="../Logout">Abmelden</a></li>
</ul></li>
-
- <li>User-Settings
- <ul>
- <li><a href="../Logout">Logout</a></li>
- </ul></li>
-
</ul>
</div>
/trunk/WebContent/admin/relTypes.jsp
0,0 → 1,87
<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />
 
<html>
<head>
<s:if test="edit">
<title>Beziehungstyp bearbeiten</title>
</s:if>
<s:else>
<title>Beziehungstypen verwalten</title>
</s:else>
</head>
<body>
<s:if test="edit">
<h1>Beziehungstyp bearbeiten</h1>
</s:if>
<s:else>
<h1>Beziehungstypen verwalten</h1>
</s:else>
<s:if test="edit">
<h2>Dieser Beziehungstyp</h2>
</s:if>
<s:else>
<h2>Neuer Beziehungstyp</h2>
</s:else>
<s:form action="doRelTypeAdd">
<s:hidden name="relType.id" />
<s:textfield name="relType.nameFrom"
label="Bezeichnung A --> B (z.B. &quot;ist Sohn von&quot;)"
/>
<s:textfield name="relType.nameTo"
label="Bezeichnung A <-- B (z.B. &quot;ist Vater von&quot;)"
/>
<s:if test="edit">
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
Speichern</s:submit>
</s:if>
<s:else>
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
Hinzuf&uuml;gen
</s:submit>
</s:else>
</s:form>
<h2>Definierte Beziehungstypen</h2>
<s:if test="relTypeList.size() == 0">
<p>Keine Beziehungstypen gefunden</p>
</s:if>
<s:else>
<table>
<tr>
<th>A &rarr; B</th>
<th>A &larr; B</th>
</tr>
<s:iterator value="relTypeList" status="stat">
<tr>
<td><s:property value="nameFrom" /></td>
<td><s:property value="nameTo" /></td>
<td><s:url id="editURL" action="editRelType">
<s:param name="id" value="%{id}"></s:param>
</s:url> <s:a href="%{editURL}">
<img
src="${contextPath}/resources/icons/page_white_edit.png"
alt="edit"
/>
</s:a>
</td>
<td><s:url id="deleteURL" action="deleteRelType">
<s:param name="id" value="%{id}"></s:param>
</s:url> <s:a href="%{deleteURL}">
<img src="${contextPath}/resources/icons/delete.png"
alt="delete"
/>
</s:a>
</td>
</tr>
</s:iterator>
</table>
</s:else>
</body>
</html>
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/WebContent/admin/users.jsp
===================================================================
--- trunk/WebContent/admin/users.jsp (nonexistent)
+++ trunk/WebContent/admin/users.jsp (revision 37)
@@ -0,0 +1,93 @@
+<%@taglib uri="/struts-tags" prefix="s"%>
+<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<c:set var="contextPath" value="${pageContext.request.contextPath}" />
+
+<html>
+ <head>
+ <title>User bearbeiten</title>
+ </head>
+ <body>
+ <s:if test="edit">
+ <h1>Benutzer bearbeiten</h1>
+ </s:if>
+ <s:else>
+ <h1>Benutzer verwalten</h1>
+ </s:else>
+
+ <s:if test="added">
+ <p>Der Benutzer <b><s:text name="savedUser.username"/>
+ <s:if test="savedUser.firstname.length() > 0 || savedUser.lastname.length() > 0))">
+ (<s:text name="savedUser.firstname"/> <s:text name="savedUser.lastname"/>)
+ </s:if></b>
+ wurde hinzugef&uuml;gt.</p>
+ </s:if>
+
+ <s:if test="edit">
+ <h2>Dieser Benutzer</h2>
+ </s:if>
+ <s:else>
+ <h2>Neuer Benutzer</h2>
+ </s:else>
+
+ <s:form action="saveUser">
+ <s:hidden name="edit" />
+ <s:hidden name="user.id" />
+ <s:textfield name="user.username" label="Benutzername" required="true" />
+ <s:password name="user.password" label="Passwort" required="true" />
+ <s:textfield name="user.firstname" label="Vorname" />
+ <s:textfield name="user.lastname" label="Nachname" />
+ <s:checkbox name="user.admin" label="Administrator" />
+
+ <s:if test="edit">
+ <s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
+ Speichern</s:submit>
+ </s:if>
+ <s:else>
+ <s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
+ Hinzuf&uuml;gen
+ </s:submit>
+ </s:else>
+ </s:form>
+
+ <h2>Registrierte Benutzer</h2>
+ <s:if test="userList.size() == 0">
+ <p>Keine Benutzer gefunden</p>
+ </s:if>
+ <s:else>
+ <table>
+ <thead>
+ <tr>
+ <th>Benutzername</th>
+ <th>Vorname</th>
+ <th>Nachname</th>
+ <th>Administrator</th>
+ </tr>
+ </thead>
+ <tbody>
+ <s:iterator value="userList" status="stat">
+ <tr>
+ <td><s:property value="username" /></td>
+ <td><s:property value="firstname" /></td>
+ <td><s:property value="lastname" /></td>
+ <td><s:if test="admin">ja</s:if><s:else>nein</s:else></td>
+
+ <td><s:url id="editURL" action="editUser">
+ <s:param name="id" value="%{id}"></s:param>
+ </s:url> <s:a href="%{editURL}">
+ <img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
+ </s:a></td>
+
+ <s:if test="!admin">
+ <td><s:url id="deleteURL" action="deleteUser">
+ <s:param name="id" value="%{id}"></s:param>
+ </s:url> <s:a href="%{deleteURL}">
+ <img src="${contextPath}/resources/icons/delete.png" alt="delete" />
+ </s:a></td>
+ </s:if>
+ </tr>
+ </s:iterator>
+ </tbody>
+ </table>
+ </s:else>
+ </body>
+</html>
\ No newline at end of file
/trunk/WebContent/admin/users.jsp
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: trunk/WebContent/user/nav.jsp
===================================================================
--- trunk/WebContent/user/nav.jsp (revision 36)
+++ trunk/WebContent/user/nav.jsp (revision 37)
@@ -1,19 +1,15 @@
<div id="navigation">
<ul>
- <li>Begriffe
+ <li>Ontologie
<ul>
- <li><a href="listTerms">Anzeigen/Bearbeiten</a></li>
+ <li><a href="listTerms">Begriffe</a></li>
+ <li><a href="listRelationships">Beziehungen</li>
</ul></li>
- <li>Beziehungen
+ <li>Benutzerfunktionen
<ul>
- <li><a href="listRelationships">Anzeigen/Bearbeiten</a></li>
+ <li><a href="../Logout">Abmelden</a></li>
</ul></li>
- <li>User-Settings
- <ul>
- <li><a href="../Logout">Logout</a></li>
- </ul></li>
-
</ul>
-</div>
+</div>
\ No newline at end of file
/trunk/WebContent/user/relationships.jsp
29,32 → 29,64
</p>
</s:if>
<s:if test="edit">
<h2>Diese Beziehung</h2>
<s:if test="terms.size() == 0">
<p>Bitte definieren Sie zuerst mindestens einen
<s:url id="termURL" action="listTerms" />
<s:a href="%{termURL}">Begriff</s:a>.</p>
</s:if>
<s:else>
<h2>Neue Beziehung</h2>
</s:else>
<s:form action="saveRelationship">
<s:hidden name="edit" />
<s:hidden name="relationship.objectId" />
<s:select name="term1" list="terms" listKey="objectId" listValue="name"
label="Begriff 1" value="relationship.termFrom.objectId" />
<s:select name="type" list="relationshipTypes" listKey="id" listValue="nameFrom"
label="Beziehungstyp" value="relationship.relationshipType.id"/>
<s:select name="term2" list="terms" listKey="objectId" listValue="name"
label="Begriff 2" value="relationship.termTo.objectId"/>
<s:if test="edit">
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
&Auml;nderungen speichern</s:submit>
<h2>Diese Beziehung</h2>
</s:if>
<s:else>
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
Hinzuf&uuml;gen</s:submit>
<h2>Neue Beziehung</h2>
</s:else>
</s:form>
<s:form action="saveRelationship">
<s:hidden name="edit" />
<s:hidden name="relationship.objectId" />
<s:select name="term1" list="terms" listKey="objectId" listValue="name"
label="Begriff 1" value="relationship.termFrom.objectId" />
<s:select name="type" list="relationshipTypes" listKey="id" listValue="nameFrom"
label="Beziehungstyp" value="relationship.relationshipType.id"/>
<s:select name="term2" list="terms" listKey="objectId" listValue="name"
label="Begriff 2" value="relationship.termTo.objectId"/>
<s:textarea name="comment" label="Aenderungskommentar (optional)" />
<s:if test="edit">
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
&Auml;nderungen speichern</s:submit>
</s:if>
<s:else>
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
Hinzuf&uuml;gen</s:submit>
</s:else>
</s:form>
</s:else>
<s:if test="edit">
<h3>&Auml;nderungsprotokoll</h3>
<table>
<thead>
<th>Datum</th>
<th>Benutzer</th>
<th>Aktion</th>
<th>Neuer Wert</th>
<th>Kommentar</th>
</thead>
<tbody>
<s:iterator value="relationship.object.history" status="stat">
<tr>
<td><s:date name="date" format="yyyy-MM-dd hh:mm:ss" /></td>
<td><s:property value="user.firstname" /> <s:property value="user.lastname"/></td>
<td><s:property value="actionType.name" /></td>
<td><s:property value="value" /></td>
<td><s:property value="comment" /></td>
</tr>
</s:iterator>
</tbody>
</table>
</s:if>
<h2>Definierte Beziehungen</h2>
<s:if test="relationshipList.size() == 0">
<p>Keine Beziehungen definiert</p>
69,21 → 101,25
<tbody>
<s:iterator value="relationshipList" status="stat">
<tr>
<td><s:property value="termFrom.name" /></td>
<td><s:url id="term1URL" action="editTerm">
<s:param name="id" value="%{termFrom.objectId}"></s:param>
</s:url><s:a href="%{term1URL}"><s:property value="termFrom.name" /></s:a></td>
<td><s:property value="relationshipType.nameFrom" /></td>
<td><s:property value="termTo.name" /></td>
<td><s:url id="term2URL" action="editTerm">
<s:param name="id" value="%{termTo.objectId}"></s:param>
</s:url><s:a href="%{term2URL}"><s:property value="termTo.name" /></s:a></td>
<td><s:url id="editURL" action="editRelationship">
<s:param name="id" value="%{objectId}"></s:param>
</s:url> <s:a href="%{editURL}">
<img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
</s:a></td>
<s:param name="id" value="%{objectId}"></s:param>
</s:url><s:a href="%{editURL}"><img
src="${contextPath}/resources/icons/page_white_edit.png"
alt="Bearbeiten" title="Bearbeiten" /></s:a></td>
 
<td><s:url id="deleteURL" action="deleteRelationship">
<s:param name="id" value="%{objectId}"></s:param>
</s:url> <s:a href="%{deleteURL}">
<img src="${contextPath}/resources/icons/delete.png" alt="delete" />
</s:a></td>
</s:url><s:a href="%{deleteURL}" onclick="return window.confirm('Beziehung loeschen?')"><img
src="${contextPath}/resources/icons/delete.png"
alt="L&ouml;schen" title="L&ouml;schen" /></s:a></td>
</tr>
</s:iterator>
</tbody>
/trunk/WebContent/user/terms.jsp
4,72 → 4,169
 
<html>
<head>
<s:if test="edit">
<title>Begriff bearbeiten</title>
</s:if>
<s:else>
<title>Begriffe anzeigen/bearbeiten</title>
</s:else>
<s:if test="edit">
<title>Begriff bearbeiten</title>
</s:if>
<s:else>
<title>Begriffe anzeigen/bearbeiten</title>
</s:else>
</head>
<body>
<s:if test="edit">
<h1>Begriff bearbeiten</h1>
</s:if>
<s:else>
<h1>Begriffe anzeigen/bearbeiten</h1>
</s:else>
<s:if test="added">
<p>Der Begriff <b><s:text name="savedTerm.name"/></b> wurde hinzugef&uuml;gt.</p>
</s:if>
<s:if test="edit">
<h2>Dieser Begriff</h2>
</s:if>
<s:else>
<h2>Neuer Begriff</h2>
</s:else>
 
<s:form action="saveTerm">
<s:hidden name="edit" />
<s:hidden name="term.objectId" />
<s:textfield name="term.name" label="Name" />
<body>
<s:if test="edit">
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
Umbenennen</s:submit>
<h1>Begriff bearbeiten</h1>
</s:if>
<s:else>
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
Hinzuf&uuml;gen
</s:submit>
<h1>Begriffe anzeigen/bearbeiten</h1>
</s:else>
</s:form>
<s:if test="added">
<p>Der Begriff <b><s:text name="savedTerm.name"/></b> wurde hinzugef&uuml;gt.</p>
</s:if>
<s:if test="edit">
<h2>Dieser Begriff</h2>
</s:if>
<s:else>
<h2>Neuer Begriff</h2>
</s:else>
<s:form action="saveTerm">
<s:hidden name="edit" />
<s:hidden name="term.objectId" />
<s:textfield name="term.name" label="Name" required="true" />
<s:textarea name="comment" label="Aenderungskommentar (optional)" />
<s:if test="edit">
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" />
Umbenennen</s:submit>
</s:if>
<s:else>
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" />
Hinzuf&uuml;gen
</s:submit>
</s:else>
</s:form>
<s:if test="edit">
<h3>Beziehungen</h3>
<s:if test="term.relationshipsForTermFrom.size() == 0 && term.relationshipsForTermTo.size() == 0">
<p>Dieser Begriff steht mit keinem anderen in Beziehung.</p>
</s:if>
<s:else>
<p>Dieser Begriff steht zur Zeit in folgenden Beziehungen:</p>
<table>
<thead>
<th>Begriff 1</th>
<th>Beziehungstyp</th>
<th>Begriff 2</th>
</thead>
<tbody>
<s:iterator value="term.relationshipsForTermFrom">
<tr>
<td><s:property value="termFrom.name" /></td>
<td><s:property value="relationshipType.nameFrom" /></td>
<td><s:url id="term1URL" action="editTerm">
<s:param name="id" value="%{termTo.objectId}"></s:param>
</s:url><s:a href="%{term1URL}"><s:property value="termTo.name" /></s:a></td>
<td><s:url id="editURL" action="editRelationship">
<s:param name="id" value="%{objectId}" />
</s:url><s:a href="%{editURL}"><img
src="${contextPath}/resources/icons/page_white_edit.png"
alt="Bearbeiten" title="Bearbeiten" />
</s:a></td>
<td><s:url id="deleteURL" action="deleteRelationship">
<s:param name="id" value="%{objectId}"></s:param>
</s:url><s:a href="%{deleteURL}"
onclick="return window.confirm('Beziehung loeschen?')"><img
src="${contextPath}/resources/icons/delete.png"
alt="L&ouml;schen" title="L&ouml;schen""/></s:a></td>
</tr>
</s:iterator>
<s:iterator value="term.relationshipsForTermTo">
<tr>
<td><s:property value="termTo.name" /></td>
<td><s:property value="relationshipType.nameTo" /></td>
<td><s:url id="term2URL" action="editTerm">
<s:param name="id" value="%{termFrom.objectId}" />
</s:url><s:a href="%{term2URL}"><s:property value="termFrom.name" /></s:a></td>
<td><s:url id="editURL" action="editRelationship">
<s:param name="id" value="%{objectId}"></s:param>
</s:url><s:a href="%{editURL}"><img
src="${contextPath}/resources/icons/page_white_edit.png"
alt="Bearbeiten" title="Bearbeiten" />
</s:a></td>
<td><s:url id="deleteURL" action="deleteRelationship">
<s:param name="id" value="%{objectId}"></s:param>
</s:url><s:a href="%{deleteURL}"
onclick="return window.confirm('Beziehung loeschen?')"><img
src="${contextPath}/resources/icons/delete.png"
alt="L&ouml;schen" title="L&ouml;schen" /></s:a></td>
</tr>
</s:iterator>
</tbody>
</table>
</s:else>
<s:if test="termList.size() == 0">
<p>Keine Begriffe eingegeben</p>
</s:if>
<s:else>
<h3>&Auml;nderungsprotokoll</h3>
<s:if test="term.object.history.size() == 0">
<p>Es sind keine &Auml;nderungen f&uuml;r diesen Begriff protokolliert.</p>
</s:if>
<s:else>
<table>
<thead>
<th>Datum</th>
<th>Benutzer</th>
<th>Aktion</th>
<th>Neuer Name</th>
<th>Kommentar</th>
</thead>
<tbody>
<s:iterator value="term.object.history" status="stat">
<tr>
<td><s:date name="date" format="yyyy-MM-dd hh:mm:ss" /></td>
<td><s:property value="user.firstname" /> <s:property value="user.lastname"/></td>
<td><s:property value="actionType.name" /></td>
<td><s:property value="value" /></td>
<td><s:property value="comment" /></td>
</tr>
</s:iterator>
</tbody>
</table>
</s:else>
</s:if>
<h2>Gespeicherte Begriffe</h2>
<table>
<s:iterator value="termList" status="stat">
<tr>
<td><s:property value="name" /></td>
<td><s:url id="editURL" action="editTerm">
<s:if test="termList.size() == 0">
<p>Es wurden noch keine Begriffe eingegeben.</p>
</s:if>
<s:else>
<table>
<tbody>
<s:iterator value="termList" status="stat">
<s:url id="editURL" action="editTerm">
<s:param name="id" value="%{objectId}"></s:param>
</s:url> <s:a href="%{editURL}">
<img src="${contextPath}/resources/icons/page_white_edit.png" alt="edit" />
</s:a></td>
<td><s:url id="deleteURL" action="deleteTerm">
<s:param name="id" value="%{objectId}"></s:param>
</s:url> <s:a href="%{deleteURL}">
<img src="${contextPath}/resources/icons/delete.png" alt="delete" />
</s:a></td>
</tr>
</s:iterator>
</tbody>
</table>
</s:else>
</s:url>
<tr>
<td><s:a href="%{editURL}"><s:property value="name" /></s:a></td>
<td><s:a href="%{editURL}"><img
src="${contextPath}/resources/icons/page_white_edit.png"
alt="Bearbeiten" title="Bearbeiten" /></s:a></td>
<s:if test="false">
<td><s:url id="deleteURL" action="deleteTerm">
<s:param name="id" value="%{objectId}"></s:param>
</s:url><s:a href="%{deleteURL}" onclick="return window.confirm('Begriff loeschen?')"><img
src="${contextPath}/resources/icons/delete.png"
alt="L&ouml;schen" title="L&ouml;schen" /></s:a></td>
</s:if>
</tr>
</s:iterator>
</tbody>
</table>
</s:else>
</body>
</html>