Subversion Repositories bacoAlunos

Rev

Rev 1592 | Rev 1595 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1583 jmachado 1
<%@ tag import="jomm.utils.MessageResources" %>
2
<%@ tag import="pt.estgp.estgweb.domain.JobServiceTaskImpl" %>
3
<%@ tag import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
4
<%@ tag import="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" %>
5
<%@ tag import="jomm.dao.impl.AbstractDao" %>
1594 jmachado 6
<%@tag language="" description="Body Tag Page template" pageEncoding="UTF-8"%>
1583 jmachado 7
<%@attribute name="taskId" type="java.lang.Long" required="false" %> <!-- Task ID to get the JOB from database -->
8
<%@attribute name="transactional" type="java.lang.Boolean" required="true" %> <!-- Define if tag should open database transaction -->
9
<%@attribute name="job" type="pt.estgp.estgweb.domain.JobServiceTaskImpl" required="false"%> <!-- If job defined TaskId is not used -->
10
<%@attribute name="targetUrlWithOutContextPath" type="java.lang.String" required="true" %> <!-- Task ID to get the JOB from database -->
11
<%@attribute name="logSizeXs" type="java.lang.Boolean" required="false" %> <!-- Task Log Size -->
12
 
13
<div class="col-md-12">
14
    <%
15
 
1592 jmachado 16
        if(!transactional.booleanValue())
1583 jmachado 17
        {
18
            AbstractDao.getCurrentSession().beginTransaction();
19
        }
20
 
21
        if(logSizeXs == null)
1592 jmachado 22
            logSizeXs = Boolean.FALSE;
1583 jmachado 23
 
24
        if(taskId != null)
25
        {
1594 jmachado 26
            job = taskId.longValue() > 0 ?
1583 jmachado 27
                (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().load(taskId) :
28
                null;
29
        }
30
        else
31
        {
32
            //do nothing job is already loaded
33
        }
34
 
35
        if(job != null)
36
        {
37
            SchedulleTasksForm schedulleTasksForm = new SchedulleTasksForm();
38
            schedulleTasksForm.setJobServiceTask(job);
39
            schedulleTasksForm.setId(job.getId());
40
            request.setAttribute("SchedulleTasksForm",schedulleTasksForm);
41
            if(job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FAILED ||
42
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.UNKNOWN_ERROR ||
43
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FINISHED_ERRORS )
44
            {
45
    %>
46
    <div class="alert alert-danger"><%=MessageResources.getInstance(request).getMessage("job.status."+job.getStatus())%>, Consulte o Log</div>
47
    <%
48
            }
1591 jmachado 49
        request.setAttribute("logSize",(logSizeXs.booleanValue() ? "task-log-xs" : ""));
1583 jmachado 50
    %>
1590 jmachado 51
    <div class="task-log ${logSize}" data-href="<%=request.getContextPath()%>${targetUrlWithOutContextPath}">
1583 jmachado 52
        <jsp:include page="/admin/configuration/taskLog.jsp"/>
53
    </div>
54
    <%
55
        }
56
        else
57
        {
58
    %>
59
    <div class="alert alert-danger">O sistema não conseguiu encontrar a tarefa de atribuição nas tarefas agendadas, por favor verifique em todos os logs de tarefas <html:link action="/user/configurationJobTasks">Aqui</html:link> </div>
60
    <%
61
        }
62
 
1592 jmachado 63
        if(!transactional.booleanValue())
1583 jmachado 64
        {
65
            AbstractDao.getCurrentSession().getTransaction().commit();
66
        }
67
    %>
68
</div>