* mainTemplate.jsp - Moved application name to back for better bookmarks * Terms.java - Added relationship links * Relationships: - Added term links * General: - Implemented history for term+relationship create and update (TODO: also for delete, using flag) - Removed unnecessary interfaces - Unifiorm method names in actions and DAO - Unified UI and actions (only one template for CRUD of an object) - Removed edit=false assignment in favor of redirection
/trunk/src/struts.xml |
---|
14,7 → 14,7 |
</action> |
<action name="saveTerm" method="save" |
class="ch.ffhs.webE.action.TermAction"> |
<result type="redirect">/user/listTerms</result> |
<result>/user/terms.jsp</result> |
</action> |
<action name="editTerm" method="edit" |
class="ch.ffhs.webE.action.TermAction"> |
52,50 → 52,60 |
<result>/admin/userAddForm.jsp</result> |
</action> |
<action name="listUsers" method="list" |
<action name="doUserAdd" method="addOrUpdate" |
class="ch.ffhs.webE.action.UserAction"> |
<result name="success">/admin/users.jsp</result> |
<result name="success">/admin/userAdd.jsp</result> |
</action> |
<action name="saveUser" method="save" |
<action name="userList" method="list" |
class="ch.ffhs.webE.action.UserAction"> |
<result type="redirect">/admin/listUsers</result> |
<result name="success">/admin/userList.jsp</result> |
</action> |
<action name="deleteUser" method="delete" |
class="ch.ffhs.webE.action.UserAction"> |
<result name="success" type="redirect">/admin/listUsers</result> |
<result name="success" type="redirect">/admin/userList</result> |
</action> |
<action name="editUser" method="edit" |
class="ch.ffhs.webE.action.UserAction"> |
<result name="success">/admin/users.jsp</result> |
<result name="success">/admin/userAddForm.jsp</result> |
</action> |
<!-- Relationship Type management --> |
<action name="listRelTypes" method="list" |
<action name="relTypeList" method="list" |
class="ch.ffhs.webE.action.RelationshipTypeAction"> |
<result name="success">/admin/relTypes.jsp</result> |
<result name="success">/admin/relTypeList.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/listRelTypes</result> |
<result name="success" type="redirect">/admin/relTypeList</result> |
</action> |
<action name="deleteRelType" method="delete" |
class="ch.ffhs.webE.action.RelationshipTypeAction"> |
<result name="success" type="redirect">/admin/listRelTypes</result> |
<result name="success" type="redirect">/admin/relTypeList</result> |
</action> |
<action name="editRelType" method="edit" |
class="ch.ffhs.webE.action.RelationshipTypeAction"> |
<result name="success">/admin/relTypes.jsp</result> |
<result name="success">/admin/relTypeAddForm.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/RelationshipDAO.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: src/ch/ffhs/webE/dao/HistoryDAO.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/HistoryDAO.java (revision 37) |
+++ src/ch/ffhs/webE/dao/HistoryDAO.java (nonexistent) |
@@ -1,88 +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.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; |
- } |
-} |
/src/ch/ffhs/webE/dao/HistoryDAO.java |
---|
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-text/plain |
\ No newline at end of property |
Index: src/ch/ffhs/webE/dao/RelationshipDAOImpl.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/RelationshipDAOImpl.java (nonexistent) |
+++ src/ch/ffhs/webE/dao/RelationshipDAOImpl.java (revision 36) |
@@ -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 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 |
/src/ch/ffhs/webE/dao/RelationshipDAOImpl.java |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: src/ch/ffhs/webE/dao/RelationshipTypeDAO.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/RelationshipTypeDAO.java (revision 37) |
+++ src/ch/ffhs/webE/dao/RelationshipTypeDAO.java (revision 36) |
@@ -1,130 +1,16 @@ |
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; |
-import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget; |
-import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget; |
+public interface RelationshipTypeDAO { |
-/** |
- * Data Access Object class for {@link RelationshipType}s |
- * |
- * @author Thomas Lahn |
- */ |
-public class RelationshipTypeDAO |
-{ |
+ List<RelationshipType> getRelTypes(); |
- /** |
- * Hibernate session target |
- */ |
- @SessionTarget |
- Session session; |
+ boolean deleteRelationshipType(int relTypeID); |
+ |
+ RelationshipType getRelTypeById(int relTypeID); |
- /** |
- * 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; |
- } |
+ boolean saveOrUpdateRelType(RelationshipType relType); |
} |
/trunk/src/ch/ffhs/webE/dao/RelationshipTypeDAOImpl.java |
---|
0,0 → 1,118 |
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; |
} |
} |
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: src/ch/ffhs/webE/dao/TermDAO.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/TermDAO.java (revision 37) |
+++ src/ch/ffhs/webE/dao/TermDAO.java (revision 36) |
@@ -1,66 +1,37 @@ |
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; |
- |
/** |
- * Implements the Database Access Object for terms |
+ * Defines methods all term DAO implementations must implement |
* |
- * @author Thomas Lahn |
+ * @author pelinux |
*/ |
-public class TermDAO |
+public interface TermDAO |
{ |
/** |
- * Database session |
+ * @return |
*/ |
- @SessionTarget |
- Session session; |
+ List<Term> getTerms(); |
/** |
- * Database transaction |
+ * Delete a term |
+ * |
+ * @param termId |
+ * Term ID |
*/ |
- @TransactionTarget |
- Transaction transaction; |
+ void deleteTerm(int termId); |
/** |
- * Returns a list of all terms |
+ * Retrieves a term by ID |
* |
- * @return an ArrayList with all the terms - in case of a problem, an empty |
- * list is returned |
+ * @param termId |
+ * @return |
*/ |
- @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(); |
- } |
+ Term getTermById(int termId); |
- /* |
- * 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 |
* |
@@ -68,61 +39,5 @@ |
* 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 |
- */ |
- 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 |
- * |
- * @param termId |
- * @return |
- */ |
- public Term getById(int termId) |
- { |
- Term term = null; |
- |
- try |
- { |
- term = (Term) this.session.get(Term.class, termId); |
- } |
- catch (Exception e) |
- { |
- e.printStackTrace(); |
- } |
- |
- return term; |
- } |
-} |
\ No newline at end of file |
+ boolean saveOrUpdate(Term term); |
+} |
/trunk/src/ch/ffhs/webE/dao/TermDAOImpl.java |
---|
0,0 → 1,124 |
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; |
/** |
* Implements the Database Access Object for terms |
* |
* @author Thomas Lahn |
*/ |
public class TermDAOImpl implements TermDAO |
{ |
/** |
* Database session |
*/ |
@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> getTerms() |
{ |
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; |
} |
/* |
* (non-Javadoc) |
* |
* @see ch.ffhs.webE.dao.TermDAO#saveOrUpdate(ch.ffhs.webE.domain.Term) |
*/ |
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; |
} |
} |
/* |
* (non-Javadoc) |
* |
* @see ch.ffhs.webE.dao.TermDAO#deleteTerm(int) |
*/ |
public void deleteTerm(int termId) |
{ |
try |
{ |
Term term = (Term) this.session.get(Term.class, termId); |
this.session.delete(term); |
} |
catch (Exception e) |
{ |
this.transaction.rollback(); |
e.printStackTrace(); |
} |
} |
/* |
* (non-Javadoc) |
* |
* @see ch.ffhs.webE.dao.TermDAO#getTermById(int) |
*/ |
public Term getTermById(int termId) |
{ |
Term term = null; |
try |
{ |
term = (Term) this.session.get(Term.class, termId); |
} |
catch (Exception e) |
{ |
e.printStackTrace(); |
} |
return term; |
} |
} |
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: src/ch/ffhs/webE/dao/UserDAOImpl.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/UserDAOImpl.java (nonexistent) |
+++ src/ch/ffhs/webE/dao/UserDAOImpl.java (revision 36) |
@@ -0,0 +1,135 @@ |
+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 |
/src/ch/ffhs/webE/dao/UserDAOImpl.java |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: src/ch/ffhs/webE/dao/UserDAO.java |
=================================================================== |
--- src/ch/ffhs/webE/dao/UserDAO.java (revision 37) |
+++ src/ch/ffhs/webE/dao/UserDAO.java (revision 36) |
@@ -1,134 +1,19 @@ |
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 UserDAO |
+public interface UserDAO |
{ |
- @SessionTarget |
- Session session; |
- @TransactionTarget |
- Transaction transaction; |
+ List<User> listUser(); |
- /** |
- * 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(); |
- } |
+ User searchUsername(String username); |
- // If no user was checked, return an empty list to mitigate null pointer |
- // exceptions |
- if (user == null) |
- { |
- user = new ArrayList<User>(); |
- } |
- return user; |
- } |
+ void deleteUser(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(); |
- } |
- } |
+ User listUserById(int userId); |
- /** |
- * 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 |
+ void saveOrUpdateUser(User user); |
+} |
/trunk/src/ch/ffhs/webE/domain/History.java |
---|
2,14 → 2,12 |
// 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; |
22,185 → 20,103 |
*/ |
@Entity |
@Table(name = "history", catalog = "webengineering") |
public class History implements java.io.Serializable |
{ |
/** |
* Serialization version ID |
*/ |
private static final long serialVersionUID = 1L; |
public class History implements java.io.Serializable { |
private int id; |
private User user; |
private ActionType actionType; |
private ObjectEntity object; |
private String value; |
private String comment; |
private Date date; |
private Integer id; |
private User user; |
private ActionType actionType; |
private ObjectEntity object; |
private String value; |
private String comment; |
private Date date; |
/** |
* |
*/ |
public History() |
{ |
} |
public History() { |
} |
/** |
* @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, Date date) { |
this.user = user; |
this.actionType = actionType; |
this.object = object; |
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; |
} |
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; |
} |
/** |
* @return |
*/ |
@Id |
@GeneratedValue(strategy = IDENTITY) |
@Column(name = "id", unique = true, nullable = false) |
public int getId() |
{ |
return this.id; |
} |
@Id |
@GeneratedValue(strategy = IDENTITY) |
@Column(name = "id", unique = true, nullable = false) |
public Integer getId() { |
return this.id; |
} |
/** |
* @param id |
*/ |
public void setId(int id) |
{ |
this.id = id; |
} |
public void setId(Integer id) { |
this.id = id; |
} |
/** |
* @return |
*/ |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "user_id", nullable = false) |
public User getUser() |
{ |
return this.user; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "user_id", nullable = false) |
public User getUser() { |
return this.user; |
} |
/** |
* @param user |
*/ |
public void setUser(User user) |
{ |
this.user = user; |
} |
public void setUser(User user) { |
this.user = user; |
} |
/** |
* @return |
*/ |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "action_type_id", nullable = false) |
public ActionType getActionType() |
{ |
return this.actionType; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "action_type_id", nullable = false) |
public ActionType getActionType() { |
return this.actionType; |
} |
/** |
* @param actionType |
*/ |
public void setActionType(ActionType actionType) |
{ |
this.actionType = actionType; |
} |
public void setActionType(ActionType actionType) { |
this.actionType = actionType; |
} |
/** |
* @return |
*/ |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "objects_id", nullable = false) |
public ObjectEntity getObject() |
{ |
return this.object; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "objects_id", nullable = false) |
public ObjectEntity getObject() { |
return this.object; |
} |
/** |
* @param object |
*/ |
public void setObject(ObjectEntity object) |
{ |
this.object = object; |
} |
public void setObject(ObjectEntity object) { |
this.object = object; |
} |
/** |
* @return |
*/ |
@Column(name = "value", length = 45) |
public String getValue() |
{ |
return this.value; |
} |
@Column(name = "value", length = 45) |
public String getValue() { |
return this.value; |
} |
/** |
* @param value |
*/ |
public void setValue(String value) |
{ |
this.value = value; |
} |
public void setValue(String value) { |
this.value = value; |
} |
/** |
* @return |
*/ |
@Column(name = "comment") |
public String getComment() |
{ |
return this.comment; |
} |
@Column(name = "comment") |
public String getComment() { |
return this.comment; |
} |
/** |
* @param comment |
*/ |
public void setComment(String comment) |
{ |
this.comment = comment; |
} |
public void setComment(String comment) { |
this.comment = comment; |
} |
/** |
* @return |
*/ |
@Temporal(TemporalType.TIMESTAMP) |
@Column(name = "date", nullable = false, length = 19) |
public Date getDate() |
{ |
return this.date; |
} |
@Temporal(TemporalType.TIMESTAMP) |
@Column(name = "date", nullable = false, length = 19) |
public Date getDate() { |
return this.date; |
} |
/** |
* @param date |
*/ |
public void setDate(Date date) |
{ |
this.date = date; |
} |
public void setDate(Date date) { |
this.date = date; |
} |
} |
/trunk/src/ch/ffhs/webE/domain/ObjectEntity.java |
---|
22,8 → 22,6 |
import javax.persistence.Temporal; |
import javax.persistence.TemporalType; |
import org.hibernate.annotations.OrderBy; |
/** |
* ObjectEntity generated by hbm2java |
*/ |
45,7 → 43,7 |
private Date modified; |
private Boolean deleted; |
private Term term; |
private Set<History> history = new HashSet<History>(0); |
private Set<History> histories = new HashSet<History>(0); |
private Relationship relationship; |
/** |
76,7 → 74,7 |
* @param modified |
* @param deleted |
* @param term |
* @param history |
* @param histories |
* @param relationship |
*/ |
public ObjectEntity(User userByEditorId, ObjectType objectType, |
90,7 → 88,7 |
this.modified = modified; |
this.deleted = deleted; |
this.term = term; |
this.history = histories; |
this.histories = histories; |
this.relationship = relationship; |
} |
241,18 → 239,17 |
* @return |
*/ |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "object") |
@OrderBy(clause = "date DESC") |
public Set<History> getHistory() |
public Set<History> getHistories() |
{ |
return this.history; |
return this.histories; |
} |
/** |
* @param history |
* @param histories |
*/ |
public void setHistory(Set<History> history) |
public void setHistories(Set<History> histories) |
{ |
this.history = history; |
this.histories = histories; |
} |
/** |
/trunk/src/ch/ffhs/webE/domain/ActionType.java |
---|
2,15 → 2,13 |
// 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; |
20,78 → 18,47 |
*/ |
@Entity |
@Table(name = "action_type", catalog = "webengineering") |
public class ActionType implements java.io.Serializable |
{ |
/** |
* History action ID for adding an item |
*/ |
public static final int ADD = 1; |
public class ActionType implements java.io.Serializable { |
/** |
* History action ID for renaming a term |
*/ |
public static final int RENAME = 2; |
private Integer id; |
private String name; |
private Set<History> histories = new HashSet<History>(0); |
/** |
* History action ID for modifying a relationship |
*/ |
public static final int MODIFY = 3; |
public ActionType() { |
} |
private int id; |
private String name; |
private Set<History> histories = new HashSet<History>(0); |
public ActionType(String name, Set<History> histories) { |
this.name = name; |
this.histories = histories; |
} |
public ActionType() |
{ |
} |
@Id |
@GeneratedValue(strategy = IDENTITY) |
@Column(name = "id", unique = true, nullable = false) |
public Integer getId() { |
return this.id; |
} |
/** |
* @param id |
*/ |
public ActionType(int id) |
{ |
this.setId(id); |
} |
public void setId(Integer id) { |
this.id = id; |
} |
public ActionType(String name, Set<History> histories) |
{ |
this.setName(name); |
this.setHistories(histories); |
} |
@Column(name = "name", length = 45) |
public String getName() { |
return this.name; |
} |
@Id |
@GeneratedValue(strategy = IDENTITY) |
@Column(name = "id", unique = true, nullable = false) |
public int getId() |
{ |
return this.id; |
} |
public void setName(String name) { |
this.name = name; |
} |
public void setId(int id) |
{ |
this.id = id; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "actionType") |
public Set<History> getHistories() { |
return this.histories; |
} |
@Column(name = "name", length = 45) |
public String getName() |
{ |
return this.name; |
} |
public void setHistories(Set<History> histories) { |
this.histories = histories; |
} |
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/action/RelationshipAction.java |
---|
4,19 → 4,15 |
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.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.dao.RelationshipDAOImpl; |
import ch.ffhs.webE.dao.RelationshipTypeDAOImpl; |
import ch.ffhs.webE.dao.TermDAOImpl; |
import ch.ffhs.webE.dao.UserDAOImpl; |
import ch.ffhs.webE.domain.ObjectEntity; |
import ch.ffhs.webE.domain.ObjectType; |
import ch.ffhs.webE.domain.Relationship; |
40,27 → 36,15 |
private static final long serialVersionUID = 1L; |
private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>(); |
private final RelationshipTypeDAO relationshipTypeDAO = new RelationshipTypeDAO(); |
private final RelationshipTypeDAOImpl relationshipTypeDAO = new RelationshipTypeDAOImpl(); |
private List<Term> terms = new ArrayList<Term>(); |
private final TermDAO termDAO = new TermDAO(); |
private final TermDAOImpl termDAO = new TermDAOImpl(); |
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(); |
80,6 → 64,11 |
private final HttpServletRequest request = (HttpServletRequest) ActionContext |
.getContext().get(StrutsStatics.HTTP_REQUEST); |
/** |
* The term that was just saved (added, renamed) |
*/ |
private Relationship modifiedRelationship; |
/* |
* (non-Javadoc) |
* |
97,9 → 86,9 |
*/ |
public String list() |
{ |
this.setTerms(this.termDAO.getList()); |
this.setRelationshipTypes(this.relationshipTypeDAO.getList()); |
this.setRelationshipList(this.relationshipDAO.getList()); |
this.setTerms(this.termDAO.getTerms()); |
this.setRelationshipTypes(this.relationshipTypeDAO.getRelTypes()); |
this.setRelationshipList(this.relationshipDAO.getRelationshipList()); |
return Action.SUCCESS; |
} |
110,51 → 99,31 |
*/ |
public String save() |
{ |
this.relationship.setTermFrom(this.termDAO.getById(Integer |
this.relationship.setTermFrom(this.termDAO.getTermById(Integer |
.parseInt(this.request.getParameter("term1")))); |
this.relationship.setTermTo(this.termDAO.getById(Integer |
this.relationship.setTermTo(this.termDAO.getTermById(Integer |
.parseInt(this.request.getParameter("term2")))); |
this.relationship.setRelationshipType(this.relationshipTypeDAO |
.getById(Integer.parseInt(this.request.getParameter("type")))); |
.getRelTypeById(Integer.parseInt(this.request.getParameter("type")))); |
User user = this.userDAO.getByUsername((String) this.session |
User user = this.userDAO.searchUsername((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 */ |
obj = new ObjectEntity(user, new ObjectType(ObjectType.RELATIONSHIP), |
user, null, new Date(), false, null, null, this.relationship); |
ObjectEntity 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; |
} |
177,7 → 146,7 |
String result = Action.ERROR; |
if (id > 0) |
{ |
this.setRelationship(this.relationshipDAO.getById(id)); |
this.setRelationship(this.relationshipDAO.getRelationshipById(id)); |
if (this.getRelationship() != null) |
{ |
this.edit = true; |
204,7 → 173,7 |
String result = Action.SUCCESS; |
if (id > 0) |
{ |
this.relationshipDAO.delete(id); |
this.relationshipDAO.deleteRelationship(id); |
} |
else |
{ |
322,21 → 291,4 |
{ |
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/TermAction.java |
---|
4,17 → 4,13 |
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.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.dao.TermDAOImpl; |
import ch.ffhs.webE.dao.UserDAOImpl; |
import ch.ffhs.webE.domain.ObjectEntity; |
import ch.ffhs.webE.domain.ObjectType; |
import ch.ffhs.webE.domain.Term; |
36,8 → 32,8 |
private Term term = new Term(); |
private List<Term> termList = new ArrayList<Term>(); |
private final TermDAO termDAO = new TermDAO(); |
private final UserDAO userDAO = new UserDAO(); |
private final TermDAOImpl termDAO = new TermDAOImpl(); |
private final UserDAOImpl userDAO = new UserDAOImpl(); |
/** |
* Session object |
63,10 → 59,6 |
*/ |
public Term savedTerm; |
private final HistoryDAO historyDAO = new HistoryDAO(); |
private Set<History> history; |
/* |
* (non-Javadoc) |
* |
84,7 → 76,7 |
*/ |
public String list() |
{ |
this.termList = this.termDAO.getList(); |
this.termList = this.termDAO.getTerms(); |
return Action.SUCCESS; |
} |
95,41 → 87,24 |
*/ |
public String save() |
{ |
User user = this.userDAO.getByUsername((String) this.session |
User user = this.userDAO.searchUsername((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 */ |
obj = new ObjectEntity(user, new ObjectType(ObjectType.TERM), user, null, |
now, false, this.term, null, null); |
ObjectEntity obj = new ObjectEntity(user, |
new ObjectType(ObjectType.TERM), user, null, new Date(), 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; |
} |
152,7 → 127,7 |
String result = Action.ERROR; |
if (id > 0) |
{ |
this.term = this.termDAO.getById(id); |
this.term = this.termDAO.getTermById(id); |
if (this.term != null) |
{ |
this.edit = true; |
180,7 → 155,7 |
String result = Action.SUCCESS; |
if (id > 0) |
{ |
this.termDAO.delete(id); |
this.termDAO.deleteTerm(id); |
} |
else |
{ |
247,21 → 222,4 |
{ |
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/RelationshipTypeAction.java |
---|
8,6 → 8,7 |
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; |
23,12 → 24,8 |
private RelationshipType relType = new RelationshipType(); |
private List<RelationshipType> relTypeList = new ArrayList<RelationshipType>(); |
private final RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAO(); |
private final RelationshipTypeDAO relTypeDAO = new RelationshipTypeDAOImpl(); |
public boolean edit = false; |
public boolean added = false; |
public RelationshipType savedRelType; |
@Override |
public RelationshipType getModel() |
{ |
37,13 → 34,13 |
public String addOrUpdate() |
{ |
this.relTypeDAO.saveOrUpdate(this.relType); |
this.relTypeDAO.saveOrUpdateRelType(this.relType); |
return Action.SUCCESS; |
} |
public String list() |
{ |
this.relTypeList = this.relTypeDAO.getList(); |
this.relTypeList = this.relTypeDAO.getRelTypes(); |
return Action.SUCCESS; |
} |
51,17 → 48,15 |
{ |
int id = this.getIdParameter(); |
String result = Action.ERROR; |
if (id > 0) |
{ |
this.relType = this.relTypeDAO.getById(id); |
this.edit = true; |
result = Action.SUCCESS; |
this.relType = this.relTypeDAO.getRelTypeById(id); |
return Action.SUCCESS; |
} |
this.list(); |
return result; |
else |
{ |
return Action.ERROR; |
} |
} |
/** |
100,7 → 95,7 |
// Check for malicious ID values |
if (id > 0) |
{ |
this.relTypeDAO.delete(id); |
this.relTypeDAO.deleteRelationshipType(id); |
return Action.SUCCESS; |
} |
else |
/trunk/src/ch/ffhs/webE/action/LoginAction.java |
---|
2,7 → 2,7 |
import java.util.Map; |
import ch.ffhs.webE.dao.UserDAO; |
import ch.ffhs.webE.dao.UserDAOImpl; |
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 UserDAO userDAO = new UserDAO(); |
private final UserDAOImpl userDAO = new UserDAOImpl(); |
/* Form fields */ |
private String userName; |
84,7 → 84,7 |
public String verifyUser(String username, String password) |
{ |
// DB Query |
User u = this.userDAO.getByUsername(username); |
User u = this.userDAO.searchUsername(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.UserDAO; |
import ch.ffhs.webE.dao.UserDAOImpl; |
import ch.ffhs.webE.domain.User; |
import com.opensymphony.xwork2.Action; |
22,12 → 22,8 |
private User user = new User(); |
private List<User> userList = new ArrayList<User>(); |
private final UserDAO userDAO = new UserDAO(); |
private final UserDAOImpl userDAO = new UserDAOImpl(); |
public boolean edit = false; |
public boolean added = false; |
public User savedUser; |
@Override |
public User getModel() |
{ |
35,29 → 31,24 |
} |
/** |
* DB query for userList |
* Executes the DB query to save the user |
* |
* @return SUCCESS |
* @return |
*/ |
public String list() |
public String addOrUpdate() |
{ |
this.userList = this.userDAO.getList(); |
this.userDAO.saveOrUpdateUser(this.user); |
return Action.SUCCESS; |
} |
/** |
* Executes the DB query to save the user |
* DB query for userList |
* |
* @return |
* @return SUCCESS |
*/ |
public String save() |
public String list() |
{ |
this.userDAO.saveOrUpdate(this.user); |
this.savedUser = this.user; |
this.user = null; |
this.list(); |
this.userList = this.userDAO.listUser(); |
return Action.SUCCESS; |
} |
65,17 → 56,15 |
{ |
int id = this.getIdParameter(); |
String result = Action.ERROR; |
if (id > 0) |
{ |
this.user = this.userDAO.getById(id); |
this.edit = true; |
result = Action.SUCCESS; |
this.user = this.userDAO.listUserById(id); |
return Action.SUCCESS; |
} |
this.list(); |
return result; |
else |
{ |
return Action.ERROR; |
} |
} |
/** |
115,7 → 104,7 |
// Check for malicious ID values |
if (id > 0) |
{ |
this.userDAO.delete(id); |
this.userDAO.deleteUser(id); |
return Action.SUCCESS; |
} |
else |
/trunk/WebContent/user/nav.jsp |
---|
1,15 → 1,19 |
<div id="navigation"> |
<ul> |
<li>Ontologie |
<li>Begriffe |
<ul> |
<li><a href="listTerms">Begriffe</a></li> |
<li><a href="listRelationships">Beziehungen</li> |
<li><a href="listTerms">Anzeigen/Bearbeiten</a></li> |
</ul></li> |
<li>Benutzerfunktionen |
<li>Beziehungen |
<ul> |
<li><a href="../Logout">Abmelden</a></li> |
<li><a href="listRelationships">Anzeigen/Bearbeiten</a></li> |
</ul></li> |
<li>User-Settings |
<ul> |
<li><a href="../Logout">Logout</a></li> |
</ul></li> |
</ul> |
</div> |
</div> |
/trunk/WebContent/user/relationships.jsp |
---|
29,64 → 29,32 |
</p> |
</s:if> |
<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 test="edit"> |
<h2>Diese Beziehung</h2> |
</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"> |
<h2>Diese Beziehung</h2> |
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" /> |
Änderungen speichern</s:submit> |
</s:if> |
<s:else> |
<h2>Neue Beziehung</h2> |
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" /> |
Hinzufügen</s:submit> |
</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:textarea name="comment" label="Aenderungskommentar (optional)" /> |
<s:if test="edit"> |
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" /> |
Änderungen speichern</s:submit> |
</s:if> |
<s:else> |
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" /> |
Hinzufügen</s:submit> |
</s:else> |
</s:form> |
</s:else> |
</s:form> |
<s:if test="edit"> |
<h3>Ä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> |
101,25 → 69,21 |
<tbody> |
<s:iterator value="relationshipList" status="stat"> |
<tr> |
<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="termFrom.name" /></td> |
<td><s:property value="relationshipType.nameFrom" /></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:property value="termTo.name" /></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> |
<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="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öschen" title="Löschen" /></s:a></td> |
</s:url> <s:a href="%{deleteURL}"> |
<img src="${contextPath}/resources/icons/delete.png" alt="delete" /> |
</s:a></td> |
</tr> |
</s:iterator> |
</tbody> |
/trunk/WebContent/user/terms.jsp |
---|
4,169 → 4,72 |
<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> |
<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ü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" /> |
<s:if test="edit"> |
<h1>Begriff bearbeiten</h1> |
<s:submit type="button"><img src="${contextPath}/resources/icons/tick.png" alt="" /> |
Umbenennen</s:submit> |
</s:if> |
<s:else> |
<h1>Begriffe anzeigen/bearbeiten</h1> |
<s:submit type="button"><img src="${contextPath}/resources/icons/add.png" alt="" /> |
Hinzufügen |
</s:submit> |
</s:else> |
<s:if test="added"> |
<p>Der Begriff <b><s:text name="savedTerm.name"/></b> wurde hinzugefü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ü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öschen" title="Lö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öschen" title="Löschen" /></s:a></td> |
</tr> |
</s:iterator> |
</tbody> |
</table> |
</s:else> |
</s:form> |
<h3>Änderungsprotokoll</h3> |
<s:if test="term.object.history.size() == 0"> |
<p>Es sind keine Änderungen fü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> |
<s:if test="termList.size() == 0"> |
<p>Keine Begriffe eingegeben</p> |
</s:if> |
<s:else> |
<h2>Gespeicherte Begriffe</h2> |
<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"> |
<table> |
<s:iterator value="termList" status="stat"> |
<tr> |
<td><s:property value="name" /></td> |
<td><s:url id="editURL" action="editTerm"> |
<s:param name="id" value="%{objectId}"></s:param> |
</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öschen" title="Löschen" /></s:a></td> |
</s:if> |
</tr> |
</s:iterator> |
</tbody> |
</table> |
</s:else> |
</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> |
</body> |
</html> |
/trunk/WebContent/admin/relTypes.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: WebContent/admin/users.jsp |
=================================================================== |
--- WebContent/admin/users.jsp (revision 37) |
+++ WebContent/admin/users.jsp (nonexistent) |
@@ -1,93 +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> |
- <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ü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ü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 |
/WebContent/admin/users.jsp |
---|
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-text/plain |
\ No newline at end of property |
Index: WebContent/admin/relTypeList.jsp |
=================================================================== |
--- WebContent/admin/relTypeList.jsp (nonexistent) |
+++ WebContent/admin/relTypeList.jsp (revision 36) |
@@ -0,0 +1,43 @@ |
+<%@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ö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 =< B</th> |
+ <th>Bezeichnung B =< 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 |
/WebContent/admin/relTypeList.jsp |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/admin/relTypeAddForm.jsp |
=================================================================== |
--- WebContent/admin/relTypeAddForm.jsp (nonexistent) |
+++ WebContent/admin/relTypeAddForm.jsp (revision 36) |
@@ -0,0 +1,23 @@ |
+<%@taglib uri="/struts-tags" prefix="s"%> |
+<html> |
+<head> |
+<title>Beziehungstyp erstellen</title> |
+</head> |
+<body> |
+ |
+<h1>Beziehungstyp hinzufügen</h1> |
+<p>Bitte geben Sie die Daten fü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> |
/WebContent/admin/relTypeAddForm.jsp |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/admin/nav.jsp |
=================================================================== |
--- WebContent/admin/nav.jsp (revision 37) |
+++ WebContent/admin/nav.jsp (revision 36) |
@@ -1,14 +1,21 @@ |
<div id="navigation"> |
<ul> |
- <li>Verwalten |
+ <li>User |
<ul> |
- <li><a href="listUsers">Benutzer</a></li> |
- <li><a href="listRelTypes">Beziehungstypen</a></li> |
+ <li><a href="userAddForm">Hinzufügen</a></li> |
+ <li><a href="userList">Ändern, Löschen</a></li> |
</ul></li> |
- <li>Benutzerfunktionen |
+ <li>Beziehungstypen |
<ul> |
- <li><a href="../Logout">Abmelden</a></li> |
+ <li><a href="relTypeAddForm">Hinzufügen</a></li> |
+ <li><a href="relTypeList">Ändern, Löschen</a></li> |
</ul></li> |
+ |
+ <li>User-Settings |
+ <ul> |
+ <li><a href="../Logout">Logout</a></li> |
+ </ul></li> |
+ |
</ul> |
</div> |
/trunk/WebContent/admin/userAdd.jsp |
---|
0,0 → 1,17 |
<html> |
<head> |
<title>User added</title> |
</head> |
<body> |
<h1> |
User hinzugefügt |
</h1> |
<p> |
Der Benutzer wurde hinzugefügt |
</p> |
<p> |
TODO: Weiterleitung!! |
</p> |
</body> |
</html> |
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/admin/relTypeAdd.jsp |
=================================================================== |
--- WebContent/admin/relTypeAdd.jsp (nonexistent) |
+++ WebContent/admin/relTypeAdd.jsp (revision 36) |
@@ -0,0 +1,17 @@ |
+<html> |
+<head> |
+<title>Beziehungstyp added</title> |
+</head> |
+<body> |
+ |
+ <h1> |
+ Beziehungstyp hinzugefügt |
+ </h1> |
+ <p> |
+ Der Beziehungstyp wurde hinzugefügt |
+ </p> |
+ <p> |
+ TODO: Weiterleitung!! |
+ </p> |
+</body> |
+</html> |
\ No newline at end of file |
/WebContent/admin/relTypeAdd.jsp |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/admin/userList.jsp |
=================================================================== |
--- WebContent/admin/userList.jsp (nonexistent) |
+++ WebContent/admin/userList.jsp (revision 36) |
@@ -0,0 +1,49 @@ |
+<%@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 |
/WebContent/admin/userList.jsp |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/admin/userAddForm.jsp |
=================================================================== |
--- WebContent/admin/userAddForm.jsp (nonexistent) |
+++ WebContent/admin/userAddForm.jsp (revision 36) |
@@ -0,0 +1,27 @@ |
+<%@taglib uri="/struts-tags" prefix="s"%> |
+<html> |
+<head> |
+<title>User erstellen</title> |
+</head> |
+<body> |
+ |
+<h1>User hinzufü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> |
/WebContent/admin/userAddForm.jsp |
---|
Property changes: |
Added: svn:mime-type |
## -0,0 +1 ## |
+text/plain |
\ No newline at end of property |
Index: WebContent/decorators/mainTemplate.jsp |
=================================================================== |
--- WebContent/decorators/mainTemplate.jsp (revision 37) |
+++ WebContent/decorators/mainTemplate.jsp (revision 36) |
@@ -10,60 +10,61 @@ |
<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><decorator:title /> – 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> </td> |
- <td |
- style="vertical-align: top; font-size: 12pt; text-align: right;" |
- > |
- <div> |
- <strong>Ontologie-Editor</strong><br /> von |
- 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> |
+<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> </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"%> |
</div> |
- |
- <!-- 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 /> |
+ </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> |
- </body> |
+ |
+ </div> |
+</body> |
</html> |
\ No newline at end of file |