package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.api.security.FtepPermission;
import com.cgi.eoss.ftep.model.Job;
import com.cgi.eoss.ftep.model.JobStatus;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.config.Projection;

import java.time.LocalDateTime;

/**
 * <p>Default JSON projection for embedded {@link Job}s. Embeds the owner as a ShortUser.</p>
 */
@Projection(name = "shortFtepService", types = {Job.class})
public interface ShortJob extends EmbeddedId {
    String getExtId();
    ShortUser getOwner();
    JobStatus getStatus();
    String getGuiUrl();
    String getStage();
    LocalDateTime getStartTime();
    LocalDateTime getEndTime();
    @Value("#{@ftepSecurityService.getCurrentPermission(target.class, target.id)}")
    FtepPermission getAccessLevel();
}

package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.api.security.FtepPermission;
import com.cgi.eoss.ftep.model.Job;
import com.cgi.eoss.ftep.model.JobStatus;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.config.Projection;

import java.time.LocalDateTime;

/**
 * <p>Default JSON projection for embedded {@link Job}s. Embeds the owner as a ShortUser.</p>
 */
@Projection(name = "shortFtepService", types = {Job.class})
public interface ShortJob extends EmbeddedId {
    String getExtId();
    ShortUser getOwner();
    JobStatus getStatus();
    String getGuiUrl();
    String getStage();
    LocalDateTime getStartTime();
    LocalDateTime getEndTime();
    @Value("#{target.config.service.name}")
    String getServiceName();
    @Value("#{@ftepSecurityService.getCurrentPermission(target.class, target.id)}")
    FtepPermission getAccessLevel();
}

Add service name to embedded Job representations
Add service name to embedded Job representations

Change-Id: I7bb7e8dcbb85f563267dcd9ad823365c8a4efa9c
