Skip to content
Permalink
Browse files

Added 'statusMessage' field to JobTarget

Signed-off-by: coduz <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Jan 24, 2019
1 parent 4720fbe commit 2761087f0bed90be9eb88267055acfb5051a879c
@@ -90,14 +90,17 @@ protected void load(Object loadConfig, AsyncCallback<PagingLoadResult<GwtJobTarg
columnConfig.setSortable(false);
columnConfigs.add(columnConfig);

columnConfig = new ColumnConfig("displayName", MSGS.gridJobTargetColumnHeaderDisplayName(), 300);
columnConfig = new ColumnConfig("displayName", MSGS.gridJobTargetColumnHeaderDisplayName(), 250);
columnConfig.setSortable(false);
columnConfigs.add(columnConfig);

columnConfig = new ColumnConfig("stepIndex", MSGS.gridJobTargetColumnHeaderJobStepIndex(), 300);
columnConfig = new ColumnConfig("stepIndex", MSGS.gridJobTargetColumnHeaderJobStepIndex(), 100);
columnConfigs.add(columnConfig);

columnConfig = new ColumnConfig("status", MSGS.gridJobTargetColumnHeaderStatus(), 200);
columnConfig = new ColumnConfig("status", MSGS.gridJobTargetColumnHeaderStatus(), 150);
columnConfigs.add(columnConfig);

columnConfig = new ColumnConfig("statusMessage", MSGS.gridJobTargetColumnHeaderStatusMessage(), 400);
columnConfigs.add(columnConfig);

return columnConfigs;
@@ -20,7 +20,6 @@
}

@Override
@SuppressWarnings({ "unchecked" })
public <X> X get(String property) {
if ("statusEnum".equals(property)) {
return (X) GwtJobTargetStatus.valueOf(getStatus());
@@ -65,14 +64,17 @@ public void setStepIndex(int stepIndex) {
set("stepIndex", stepIndex);
}

public String getErrorMessage() {
return get("errorMessage");
public String getStatusMessage() {
return get("statusMessage");
}

public void setErrorMessage(String errorMessage) {
set("errorMessage", errorMessage);
public void setStatusMessage(String statusMessage) {
set("statusMessage", statusMessage);
}

//
// Additional fields
//
public String getClientId() {
return get("clientId");
}
@@ -141,8 +141,7 @@ public static JobQuery convertJobQuery(GwtJobQuery gwtJobQuery, PagingLoadConfig
sortField = JobAttributes.CREATED_ON;
}
SortOrder sortOrder = loadConfig.getSortDir().equals(SortDir.DESC) ? SortOrder.DESCENDING : SortOrder.ASCENDING;
FieldSortCriteria sortCriteria = new FieldSortCriteria(sortField, sortOrder);
jobQuery.setSortCriteria(sortCriteria);
jobQuery.setSortCriteria(new FieldSortCriteria(sortField, sortOrder));
jobQuery.setPredicate(predicate);

return jobQuery;
@@ -163,8 +162,7 @@ public static JobTargetQuery convertJobTargetQuery(GwtJobTargetQuery gwtJobTarge

String sortField = StringUtils.isEmpty(loadConfig.getSortField()) ? JobTargetAttributes.ENTITY_ID : loadConfig.getSortField();
SortOrder sortOrder = loadConfig.getSortDir().equals(SortDir.DESC) ? SortOrder.DESCENDING : SortOrder.ASCENDING;
FieldSortCriteria sortCriteria = new FieldSortCriteria(sortField, sortOrder);
jobTargetQuery.setSortCriteria(sortCriteria);
jobTargetQuery.setSortCriteria(new FieldSortCriteria(sortField, sortOrder));
}

return jobTargetQuery;
@@ -296,8 +294,7 @@ public static JobExecutionQuery convertJobExecutionQuery(PagingLoadConfig paging
sortField = JobAttributes.ENDED_ON;
}
SortOrder sortOrder = pagingLoadConfig.getSortDir().equals(SortDir.DESC) ? SortOrder.DESCENDING : SortOrder.ASCENDING;
FieldSortCriteria sortCriteria = new FieldSortCriteria(sortField, sortOrder);
query.setSortCriteria(sortCriteria);
query.setSortCriteria(new FieldSortCriteria(sortField, sortOrder));
query.setLimit(pagingLoadConfig.getLimit());
query.setOffset(pagingLoadConfig.getOffset());

@@ -86,7 +86,7 @@ public static GwtJobTarget convertJobTarget(JobTarget jobTarget) {
gwtJobTarget.setClientId(KapuaGwtCommonsModelConverter.convertKapuaId(jobTarget.getJobTargetId()));
gwtJobTarget.setStatus(jobTarget.getStatus().toString());
gwtJobTarget.setStepIndex(jobTarget.getStepIndex());
gwtJobTarget.setErrorMessage(jobTarget.getException() != null ? jobTarget.getException().getMessage() : null);
gwtJobTarget.setStatusMessage(jobTarget.getStatusMessage());
return gwtJobTarget;
}

@@ -24,7 +24,7 @@ gridJobTabSchedulesLabel=Schedules
gridJobTargetColumnHeaderJobId=Job Id
gridJobTargetColumnHeaderJobClientId=Client ID
gridJobTargetColumnHeaderStatus=Status
gridJobTargetColumnHeaderErrorMessage=Error Message
gridJobTargetColumnHeaderStatusMessage=Status Message
gridJobTargetColumnHeaderJobStepIndex=Step Index
gridJobTargetColumnHeaderDisplayName=Display Name
gridJobStepColumnHeaderStepIndex=Step Index
@@ -57,6 +57,7 @@ public void writeItems(List<Object> items) throws Exception {

jobTarget.setStepIndex(stepContextWrapper.getStepIndex());
jobTarget.setStatus(processedJobTarget.getStatus());
jobTarget.setStatusMessage(processedWrappedJobTarget.getProcessingException() != null ? processedWrappedJobTarget.getProcessingException().getMessage() : null);

if (JobTargetStatus.PROCESS_OK.equals(jobTarget.getStatus())) {

@@ -52,6 +52,10 @@ default String getType() {

void setStepIndex(int stepIndex);

String getStatusMessage();

void setStatusMessage(String statusMessage);

/**
* @deprecated No longer used.
*/
@@ -11,6 +11,12 @@
*******************************************************************************/
package org.eclipse.kapua.service.job.targets.internal;

import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
import org.eclipse.kapua.commons.model.id.KapuaEid;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.job.targets.JobTarget;
import org.eclipse.kapua.service.job.targets.JobTargetStatus;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Basic;
@@ -22,12 +28,6 @@
import javax.persistence.Table;
import javax.persistence.Transient;

import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
import org.eclipse.kapua.commons.model.id.KapuaEid;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.service.job.targets.JobTarget;
import org.eclipse.kapua.service.job.targets.JobTargetStatus;

@Entity(name = "JobTarget")
@Table(name = "job_job_target")
public class JobTargetImpl extends AbstractKapuaUpdatableEntity implements JobTarget {
@@ -54,6 +54,10 @@
@Column(name = "status", nullable = false, updatable = true)
private JobTargetStatus status;

@Basic
@Column(name = "status_message", nullable = true, updatable = true)
private String statusMessage;

@Transient
private Exception e;

@@ -104,6 +108,16 @@ public void setStatus(JobTargetStatus status) {
this.status = status;
}

@Override
public String getStatusMessage() {
return statusMessage;
}

@Override
public void setStatusMessage(String statusMessage) {
this.statusMessage = statusMessage;
}

@Override
public Exception getException() {
return e;
@@ -18,5 +18,6 @@
logicalFilePath="KapuaDB/changelog-job-1.1.0.xml">

<include relativeToChangelogFile="true" file="./job_execution_target.xml"/>
<include relativeToChangelogFile="true" file="./job_target-status_message.xml"/>

</databaseChangeLog>
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2017 Eurotech and/or its affiliates and others
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Eurotech - initial API and implementation
-->
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd"

logicalFilePath="KapuaDB/changelog-job-1.1.0.xml">

<include relativeToChangelogFile="true" file="../common-properties.xml"/>

<changeSet id="changelog-job_target-1.1.0_addStatusMessage" author="eurotech">
<addColumn tableName="job_job_target">
<column name="status_message" type="varchar(1024)"/>
</addColumn>
</changeSet>
</databaseChangeLog>

0 comments on commit 2761087

Please sign in to comment.
You can’t perform that action at this time.