Subversion Repositories bacoAlunos

Rev

Rev 1591 | Rev 1594 | 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" %>
1592 jmachado 6
<%@ tag import="com.oss.asn1.BOOLEAN" %>
1583 jmachado 7
<%@tag description="Body Tag Page template" pageEncoding="UTF-8"%>
8
<%@taglib prefix="t" tagdir="/WEB-INF/tags/examples" %>
9
<%@attribute name="taskId" type="java.lang.Long" required="false" %> <!-- Task ID to get the JOB from database -->
10
<%@attribute name="transactional" type="java.lang.Boolean" required="true" %> <!-- Define if tag should open database transaction -->
11
<%@attribute name="job" type="pt.estgp.estgweb.domain.JobServiceTaskImpl" required="false"%> <!-- If job defined TaskId is not used -->
12
<%@attribute name="targetUrlWithOutContextPath" type="java.lang.String" required="true" %> <!-- Task ID to get the JOB from database -->
13
<%@attribute name="logSizeXs" type="java.lang.Boolean" required="false" %> <!-- Task Log Size -->
14
 
15
<div class="col-md-12">
16
    <%
17
 
1592 jmachado 18
        if(!transactional.booleanValue())
1583 jmachado 19
        {
20
            AbstractDao.getCurrentSession().beginTransaction();
21
        }
22
 
23
        if(logSizeXs == null)
1592 jmachado 24
            logSizeXs = Boolean.FALSE;
1583 jmachado 25
 
26
        if(taskId != null)
27
        {
28
            job = taskId > 0 ?
29
                (JobServiceTaskImpl) DaoFactory.getJobServiceTaskDaoImpl().load(taskId) :
30
                null;
31
        }
32
        else
33
        {
34
            //do nothing job is already loaded
35
        }
36
 
37
        if(job != null)
38
        {
39
            SchedulleTasksForm schedulleTasksForm = new SchedulleTasksForm();
40
            schedulleTasksForm.setJobServiceTask(job);
41
            schedulleTasksForm.setId(job.getId());
42
            request.setAttribute("SchedulleTasksForm",schedulleTasksForm);
43
            if(job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FAILED ||
44
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.UNKNOWN_ERROR ||
45
                    job.getStatusEnum() == JobServiceTaskImpl.JobStatus.FINISHED_ERRORS )
46
            {
47
    %>
48
    <div class="alert alert-danger"><%=MessageResources.getInstance(request).getMessage("job.status."+job.getStatus())%>, Consulte o Log</div>
49
    <%
50
            }
1591 jmachado 51
        request.setAttribute("logSize",(logSizeXs.booleanValue() ? "task-log-xs" : ""));
1583 jmachado 52
    %>
1590 jmachado 53
    <div class="task-log ${logSize}" data-href="<%=request.getContextPath()%>${targetUrlWithOutContextPath}">
1583 jmachado 54
        <jsp:include page="/admin/configuration/taskLog.jsp"/>
55
    </div>
56
    <%
57
        }
58
        else
59
        {
60
    %>
61
    <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>
62
    <%
63
        }
64
 
1592 jmachado 65
        if(!transactional.booleanValue())
1583 jmachado 66
        {
67
            AbstractDao.getCurrentSession().getTransaction().commit();
68
        }
69
    %>
70
</div>