Refs #1666 Scheduled tasks - add description and show parameters values in task list

This commit is contained in:
Maxim Gorbunkov 2012-11-15 07:57:21 +00:00
parent 84c5d0d498
commit e32823e026
11 changed files with 53 additions and 2 deletions

View File

@ -118,6 +118,7 @@ create table SYS_SCHEDULED_TASK (
LOG_FINISH tinyint,
LAST_START_TIME datetime,
LAST_START_SERVER varchar(50),
DESCRIPTION varchar(1000),
--
primary key (ID)
)^

View File

@ -118,6 +118,7 @@ create table SYS_SCHEDULED_TASK (
LOG_FINISH boolean,
LAST_START_TIME timestamp with time zone,
LAST_START_SERVER varchar(50),
DESCRIPTION varchar(1000),
--
primary key (ID)
)^

View File

@ -123,6 +123,7 @@ create table SYS_SCHEDULED_TASK (
LOG_FINISH smallint,
LAST_START_TIME timestamp,
LAST_START_SERVER varchar(50),
DESCRIPTION varchar(1000),
primary key (ID),
constraint UNIQ_SYS_SCHEDULED_TASK_BEAN_METHOD unique (BEAN_NAME, METHOD_NAME)

View File

@ -0,0 +1,3 @@
-- $Id$
alter table SYS_SCHEDULED_TASK add DESCRIPTION varchar(1000);

View File

@ -0,0 +1,3 @@
-- $Id$
alter table SYS_SCHEDULED_TASK add DESCRIPTION varchar(1000);

View File

@ -82,8 +82,7 @@ public class MethodInfo implements Serializable {
for (int i = 0; i < this.parameters.size(); i++) {
MethodParameterInfo param1 = this.parameters.get(i);
MethodParameterInfo param2 = methodInfo.getParameters().get(i);
if (!param1.getName().equals(param2.getName())
|| !param1.getType().equals(param2.getType()))
if (!param1.getType().equals(param2.getType()))
return false;
}

View File

@ -111,6 +111,9 @@ public class ScheduledTask extends BaseUuidEntity implements Updatable, SoftDele
@Column(name = "METHOD_PARAMS")
protected String methodParamsXml;
@Column(name = "DESCRIPTION", length = 1000)
protected String description;
@Override
public Date getUpdateTs() {
return updateTs;
@ -312,6 +315,14 @@ public class ScheduledTask extends BaseUuidEntity implements Updatable, SoftDele
this.methodParamsXml = methodParamsXml;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<MethodParameterInfo> getMethodParameters() {
ArrayList<MethodParameterInfo> result = new ArrayList<MethodParameterInfo>();
String xml = getMethodParamsXml();
@ -360,4 +371,24 @@ public class ScheduledTask extends BaseUuidEntity implements Updatable, SoftDele
(startDate != null ? ", startDate=" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(startDate) : "") +
'}';
}
@MetaProperty
public String getMethodParametersString() {
StringBuilder sb = new StringBuilder();
int count = 0;
List<MethodParameterInfo> parameters = getMethodParameters();
for (MethodParameterInfo param : parameters) {
sb.append(param.getType().getSimpleName())
.append(" ")
.append(param.getName())
.append(" = ")
.append(param.getValue());
if (++count != parameters.size())
sb.append(", ");
}
return sb.toString();
}
}

View File

@ -72,6 +72,8 @@ ScheduledTask.logFinish = Log finish
ScheduledTask.definedBy = Defined by
ScheduledTask.className = Class name
ScheduledTask.scriptName = Script name
ScheduledTask.description = Description
ScheduledTask.methodParametersString = Method parameters
ScheduledExecution = Scheduled Execution
ScheduledExecution.task = Task

View File

@ -68,6 +68,8 @@ ScheduledTask.logFinish = Log finish
ScheduledTask.definedBy = Defined by
ScheduledTask.className = Class name
ScheduledTask.scriptName = Script name
ScheduledTask.description = Description
ScheduledTask.methodParametersString = Method parameters
ScheduledExecution = Выполнение задания
ScheduledExecution.task = Task

View File

@ -29,6 +29,7 @@
<button action="tasksTable.remove" icon="icons/remove.png"/>
<button action="tasksTable.executions"/>
</buttonsPanel>
<rowsCount/>
<columns>
<column id="active"/>
<column id="beanName"/>
@ -44,6 +45,8 @@
<column id="permittedServers"/>
<column id="logStart"/>
<column id="logFinish"/>
<column id="methodParametersString"/>
<column id="description"/>
</columns>
<rows datasource="tasksDs"/>
</table>

View File

@ -88,6 +88,11 @@
<label value="msg://com.haulmont.cuba.core.entity/ScheduledTask.logFinish"/>
<checkBox id="logFinishField" datasource="taskDs" property="logFinish"/>
</row>
<row>
<label value="msg://com.haulmont.cuba.core.entity/ScheduledTask.description"/>
<textField id="description" datasource="taskDs" property="description"
width="500px" rows="3" colspan="1"/>
</row>
</rows>
</grid>
<iframe id="windowActions" src="/com/haulmont/cuba/gui/edit-window.actions.xml"/>