AnsweredAssumed Answered

Error while rewriting AdminPanel

Question asked by lossril on Aug 10, 2015
Hello there,

I've tried to change something in Administration part - namely Completed Instances panel - funny thing about it is that completed process instances are sorted by day of the week when you try to sort them by date. When I noticed it, I was like 'okay, clearly not like it should be' and tried to fix it.

The problem is that when Activiti has to show us the information about completed instance (which is represented by HistoricProcessInstance class if I got it correctly), it gets the java.util.Date field, which is good, and then goes .toString(), which is awful due to the fact Date.toString() returns String starting with day of the week, what actually leads to the behavior I described.

How I tried to fix it:
* I wrote dateToString method, which gets Date and returns String in format which can be actually sorted as intended. It clearly works - I've made some tests with dates.
* Then changed refreshInstancesTable() method of class org.activiti.ui.management.admin.AdminComletedInstancesPanel in a way to use my dateToString() instead of toString() - like this:

protected void refreshInstancesTable() {
     instancesTable.removeAllItems();
     for (HistoricProcessInstance instance : selectedManagementDefinition.runningInstances) {
        instancesTable.addItem(new String[]{instance.getId(),
              instance.getBusinessKey(),
            instance.getStartUserId(),
            instance.getStartActivityId(),
            DateToString.dateToString(instance.getStartTime()),
            instance.getEndTime() != null ? instance.getEndTime().toString() : "",
            instance.getDurationInMillis() != null ? instance.getDurationInMillis().toString() : ""},
            instance.getId());
     }

So on table refresh it should parse startTime my way.

Then i exported activiti-explorer jar(there were some warnings), but eclipse compiled it and copied jar into webapps\activiti-explorer\WEB-INF\lib directory.
Then I restarted Tomcat and got this error:
org.springframework.context.NoSuchMessageException: No message found under code 'login.username' for locale 'en_US'.

org.springframework.context.NoSuchMessageException: No message found under code 'login.username' for locale 'en_US'.
   org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:159)
   sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   java.lang.reflect.Method.invoke(Method.java:497)
   org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
   org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
   org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
   org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
   com.sun.proxy.$Proxy20.getMessage(Unknown Source)
   org.activiti.explorer.I18nManager.getMessage(I18nManager.java:33)
   org.activiti.explorer.ui.login.ExplorerLoginForm.<init>(ExplorerLoginForm.java:43)
   org.activiti.explorer.ui.login.LoginPage.initUi(LoginPage.java:81)
   org.activiti.explorer.ui.login.LoginPage.<init>(LoginPage.java:75)
   org.activiti.explorer.ui.MainWindow.showLoginPage(MainWindow.java:60)
   org.activiti.explorer.DefaultViewManager.showLoginPage(DefaultViewManager.java:85)
   org.activiti.explorer.ExplorerApp.onRequestStart(ExplorerApp.java:189)
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:478)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   org.activiti.explorer.filter.ExplorerFilter.doFilter(ExplorerFilter.java:44)

Activiti installation was blank, no changes besides those described above were made. What did I do wrong and why it happened?

Outcomes