@SuppressWarnings({ "unchecked", "rawtypes" }) public TaskSummary(Task task) { Preconditions.checkNotNull(task); // 'ported' from groovy web console TaskSummary.groovy , not sure if always works as intended Entity entity = (Entity) Iterables.tryFind(task.getTags(), Predicates.instanceOf(Entity.class)).orNull(); if (entity!=null) { this.entityId = entity.getId(); this.entityDisplayName = entity.getDisplayName(); } else { this.entityId = null; this.entityDisplayName = null; } this.tags = task.getTags(); this.displayName = task.getDisplayName(); this.description = task.getDescription(); this.id = task.getId(); this.rawSubmitTimeUtc = task.getSubmitTimeUtc(); this.submitTimeUtc = (task.getSubmitTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getSubmitTimeUtc())); this.startTimeUtc = (task.getStartTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getStartTimeUtc())); this.endTimeUtc = (task.getEndTimeUtc() == -1) ? "" : formatter.get().format(new Date(task.getEndTimeUtc())); this.currentStatus = task.getStatusSummary(); this.detailedStatus = task.getStatusDetail(true); }
task.getTags(), ifPositive(task.getSubmitTimeUtc()), ifPositive(task.getStartTimeUtc()), ifPositive(task.getEndTimeUtc()), task.getStatusSummary(), children, asLink(task.getSubmittedByTask()), task instanceof TaskInternal ? asLink(((TaskInternal<?>)task).getBlockingTask()) : null,