Author: chestnut
Date: Wed Sep 14 07:04:48 2005
New Revision: 280859
URL: http://svn.apache.org/viewcvs?rev=280859&view=rev
Log:
added date, user, and ip to versions for workflow tab
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
lenya/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java
lenya/trunk/src/java/org/apache/lenya/workflow/Version.java
lenya/trunk/src/java/org/apache/lenya/workflow/impl/VersionImpl.java
lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java?rev=280859&r1=280858&r2=280859&view=diff
==============================================================================
---
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
(original)
+++
lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
Wed Sep 14 07:04:48 2005
@@ -16,11 +16,13 @@
*/
package org.apache.lenya.cms.workflow;
+import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Locale;
import org.apache.avalon.framework.container.ContainerUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -186,18 +188,31 @@
String event = null;
String state = null;
+ String user = null;
+ String machine = null;
+ Date date = null;
Map variables = new HashMap();
String[] parts = string.split(" ");
for (int i = 0; i < parts.length; i++) {
- String[] steps = parts[i].split(":");
+ String[] steps = parts[i].split(":",2);
if (steps[0].equals("event")) {
event = steps[1];
}
- if (steps[0].equals("state")) {
+ else if (steps[0].equals("state")) {
state = steps[1];
}
- if (steps[0].equals("var")) {
+ else if (steps[0].equals("user")) {
+ user = steps[1];
+ }
+ else if (steps[0].equals("date")) {
+ SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.US);
+ date = sdf.parse(steps[1],new ParsePosition(0));
+ }
+ else if (steps[0].equals("machine")) {
+ machine = steps[1];
+ }
+ else if (steps[0].equals("var")) {
String[] nameValue = steps[1].split("=");
variables.put(nameValue[0], nameValue[1]);
}
@@ -206,6 +221,9 @@
for (Iterator i = variables.keySet().iterator(); i.hasNext();) {
String name = (String) i.next();
String value = (String) variables.get(name);
+ version.setUserId(user);
+ version.setDate(date);
+ version.setIPAddress(machine);
version.setValue(name, Boolean.valueOf(value).booleanValue());
}
return version;
Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java?rev=280859&r1=280858&r2=280859&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java
(original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/LenyaVersion.java Wed
Sep 14 07:04:48 2005
@@ -19,48 +19,12 @@
package org.apache.lenya.cms.workflow;
-import java.util.Date;
-
import org.apache.lenya.workflow.impl.VersionImpl;
/**
* A CMS version
*/
public class LenyaVersion extends VersionImpl {
-
- private Date date;
-
- /**
- * Returns the date.
- * @return A string.
- */
- public Date getDate() {
- return this.date;
- }
-
- /**
- * Sets the date.
- * @param _date A date.
- */
- public void setDate(Date _date) {
- this.date = _date;
- }
-
- /**
- * Returns the user ID.
- * @return A string.
- */
- public String getUserId() {
- return this.userId;
- }
-
- /**
- * Sets the user ID.
- * @param _userId A user ID.
- */
- public void setUserId(String _userId) {
- this.userId = _userId;
- }
/**
* Ctor.
@@ -70,7 +34,5 @@
public LenyaVersion(String event, String state) {
super(event, state);
}
-
- private String userId;
}
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/Version.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/Version.java?rev=280859&r1=280858&r2=280859&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/Version.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/Version.java Wed Sep 14
07:04:48 2005
@@ -16,10 +16,12 @@
*/
package org.apache.lenya.workflow;
+import java.util.Date;
+
/**
* A version of the workflow history.
*
- * @version $Id:$
+ * @version $Id$
*/
public interface Version {
@@ -34,6 +36,43 @@
* @return A state.
*/
String getState();
+
+
+ /**
+ * Returns the date.
+ * @return A string.
+ */
+ Date getDate();
+
+ /**
+ * Sets the date.
+ * @param _date A date.
+ */
+ void setDate(Date _date);
+
+ /**
+ * Returns the user ID.
+ * @return A string.
+ */
+ public String getUserId();
+
+ /**
+ * Sets the user ID.
+ * @param _userId A user ID.
+ */
+ public void setUserId(String _userId);
+
+ /**
+ * Returns the ip address.
+ * @return A string.
+ */
+ public String getIPAddress();
+
+ /**
+ * Sets the ip address.
+ * @param _ipaddress A ip address.
+ */
+ public void setIPAddress(String _ipaddress);
/**
* Returns the value of a variable.
Modified: lenya/trunk/src/java/org/apache/lenya/workflow/impl/VersionImpl.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/workflow/impl/VersionImpl.java?rev=280859&r1=280858&r2=280859&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/workflow/impl/VersionImpl.java
(original)
+++ lenya/trunk/src/java/org/apache/lenya/workflow/impl/VersionImpl.java Wed
Sep 14 07:04:48 2005
@@ -19,6 +19,7 @@
package org.apache.lenya.workflow.impl;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -46,7 +47,59 @@
public String getState() {
return this.state;
}
+
+ private Date date;
+ private String userId;
+ private String ipAddress;
+
+ /**
+ * Returns the date.
+ * @return A string.
+ */
+ public Date getDate() {
+ return this.date;
+ }
+
+ /**
+ * Sets the date.
+ * @param _date A date.
+ */
+ public void setDate(Date _date) {
+ this.date = _date;
+ }
+
+ /**
+ * Returns the user ID.
+ * @return A string.
+ */
+ public String getUserId() {
+ return this.userId;
+ }
+ /**
+ * Sets the user ID.
+ * @param _userId A user ID.
+ */
+ public void setUserId(String _userId) {
+ this.userId = _userId;
+ }
+
+ /**
+ * Returns the ip address.
+ * @return A string.
+ */
+ public String getIPAddress() {
+ return this.ipAddress;
+ }
+
+ /**
+ * Sets the ip address.
+ * @param _ipaddress A ip address.
+ */
+ public void setIPAddress(String _ipaddress){
+ this.ipAddress = _ipaddress;
+ }
+
/**
* Ctor.
* @param _event The event that caused the version change.
Modified: lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx?rev=280859&r1=280858&r2=280859&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx (original)
+++ lenya/trunk/src/webapp/lenya/usecases/tab/workflow.jx Wed Sep 14 07:04:48
2005
@@ -50,10 +50,10 @@
<th><i18n:text>User</i18n:text></th>
<th><i18n:text>IP Address</i18n:text></th>
</tr>
- <jx:forEach var="item" items="${usecase.getParameter('versions')}">
+ <jx:forEach var="item" items="${usecase.getParameter('versions')}"
varStatus="status">
<tr>
- <td><jx:out value="${item.date}"/></td>
- <td><i18n:text><jx:out
value="${item.event.name}"/></i18n:text></td>
+ <td><jx:formatDate value="${item.getDate()}"/></td>
+ <td><i18n:text><jx:out value="${item.event}"/></i18n:text></td>
<td><i18n:text><jx:out value="${item.state}"/></i18n:text></td>
<td>
<span style="white-space: nobreak">
@@ -61,7 +61,7 @@
</span>
</td>
<td>
- <jx:out value="${item.ip-address}"/>
+ <jx:out value="${item.iPAddress}"/>
</td>
</tr>
</jx:forEach>
|