Subversion Repositories bacoAlunos

Rev

Rev 1596 | 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" %>
1595 jmachado 6
<%@tag 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
        {
1629 jmachado 37
            request.setAttribute("JOB_UPDATE_DATE",job.getUpdateDate());
1583 jmachado 38
            SchedulleTasksForm schedulleTasksForm = new SchedulleTasksForm();
39
            schedulleTasksForm.setJobServiceTask(job);
1596 jmachado 40
            schedulleTasksForm.setId(new Long(job.getId()));
1583 jmachado 41
            request.setAttribute("SchedulleTasksForm",schedulleTasksForm);
42
            if(job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FAILED ||
43
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.UNKNOWN_ERROR ||
44
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FINISHED_ERRORS )
45
            {
46
    %>
47
    <div class="alert alert-danger"><%=MessageResources.getInstance(request).getMessage("job.status."+job.getStatus())%>, Consulte o Log</div>
48
    <%
49
            }
1591 jmachado 50
        request.setAttribute("logSize",(logSizeXs.booleanValue() ? "task-log-xs" : ""));
1583 jmachado 51
    %>
1590 jmachado 52
    <div class="task-log ${logSize}" data-href="<%=request.getContextPath()%>${targetUrlWithOutContextPath}">
1583 jmachado 53
        <jsp:include page="/admin/configuration/taskLog.jsp"/>
54
    </div>
55
    <%
56
        }
57
        else
58
        {
59
    %>
60
    <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>
61
    <%
62
        }
63
 
1592 jmachado 64
        if(!transactional.booleanValue())
1583 jmachado 65
        {
66
            AbstractDao.getCurrentSession().getTransaction().commit();
67
        }
68
    %>
69
</div>