Search in sources :

Example 1 with TaskDTO

use of com.tomasio.projects.trainning.dto.TaskDTO in project trainning by fernandotomasio.

the class TasksController method listTasksAjax.

@RequestMapping("/ajax")
@ResponseBody
public List listTasksAjax(Model model, WebRequest request) {
    List result = new ArrayList();
    String user = request.getParameter("userLogin");
    TaskDTO[] tasks = tasksBPMService.findAllTasksByUser(user);
    for (TaskDTO task : tasks) {
        Map item = new HashMap();
        item.put("nome", task.getNome());
        item.put("descricao", task.getDescricao());
        item.put("id", task.getId());
        item.put("turmaId", task.getTurmaId());
        result.add(item);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) TaskDTO(com.tomasio.projects.trainning.dto.TaskDTO) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with TaskDTO

use of com.tomasio.projects.trainning.dto.TaskDTO in project trainning by fernandotomasio.

the class TurmasEfetivasController method detailTurma.

@RequestMapping("/detail")
public String detailTurma(Model model, WebRequest request) {
    SimpleDateFormat dfYear = new SimpleDateFormat("yyyy");
    String turmaId = request.getParameter("turmaId");
    TurmaEfetivaDTO turma = atividadesEnsinoService.findTurmaEfetiva(Long.parseLong(turmaId));
    Map data = new HashMap();
    data.put("codigo", turma.getCurso().getCodigo());
    data.put("descricao", turma.getCurso().getDescricao());
    data.put("numero", turma.getNumeroTurma() + " / " + dfYear.format(turma.getExercicio()));
    OrganizacaoDTO responsavel = organizationalService.findOrganizacao(turma.getResponsavelId());
    data.put("responsavel", responsavel.getSigla());
    data.put("vagas", turma.getQuantidadeVagas());
    // turma.getOrganizacaoGestoraId()
    if (turma.getPeriodoIndicacao() != null) {
        data.put("inicioIndicacoes", turma.getPeriodoIndicacao().getDataInicioFormated());
        data.put("terminoIndicacoes", turma.getPeriodoIndicacao().getDataTerminoFormated());
    }
    data.put("processId", turma.getProcessId());
    data.put("taskId", null);
    TaskDTO[] tasks = tasksBPMService.findAllTasksByUser("fernandofot");
    for (TaskDTO task : tasks) {
        Long taskTurmaId = Long.parseLong(task.getTurmaId());
        if (taskTurmaId.equals(turma.getId())) {
            data.put("taskId", task.getId());
            break;
        }
    }
    data.put("dataInicio", turma.getDataInicioFormatted());
    data.put("dataTermino", turma.getDataTerminoFormatted());
    data.put("dataAtivacao", turma.getDataAtivacaoFormatted());
    data.put("local", turma.getLocal());
    // inserção de campos para exibição na tela
    data.put("extra", turma.isExtra());
    data.put("cancelado", turma.isCancelado());
    data.put("adiado", turma.isAdiado());
    data.put("restrictedIndicacoes", turma.isRestrictedIndicacoes());
    data.put("privatedIndicacoes", turma.isPrivatedIndicacoes());
    // responsabilidades
    OrganizacaoDTO resp = organizationalService.findOrganizacao(turma.getResponsavelId());
    data.put("responsavelSigla", resp.getSigla());
    OrganizacaoDTO respApre = organizationalService.findOrganizacao(turma.getResponsavelApresentacaoId());
    data.put("responsavelApresentacaoSigla", respApre.getSigla());
    OrganizacaoDTO respConc = organizationalService.findOrganizacao(turma.getResponsavelConclusaoId());
    data.put("responsavelConclusaoSigla", respConc.getSigla());
    OrganizacaoDTO respMat = organizationalService.findOrganizacao(turma.getResponsavelMatriculaId());
    data.put("responsavelMatriculaSigla", respMat.getSigla());
    OrganizacaoDTO respPreMat = organizationalService.findOrganizacao(turma.getResponsavelPreMatriculaId());
    data.put("responsavelPreMatriculaSigla", respPreMat.getSigla());
    OrganizacaoDTO respSel = organizationalService.findOrganizacao(turma.getResponsavelSelecaoId());
    data.put("responsavelSelecaoSigla", respSel.getSigla());
    data.put("bcaAtivacao", turma.getBCAAtivacao());
    data.put("bcaEncerramento", turma.getBCAEncerramento());
    data.put("dataBCAAtivacao", turma.getDataBCAAtivacaoFormatted());
    data.put("dataBCAEncerramento", turma.getDataBCAEncerramentoFormatted());
    model.addAttribute("data", data);
    model.addAttribute("turma", turma);
    model.addAttribute("tab", "detail");
    return "turmas_efetivas/detail";
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) HashMap(java.util.HashMap) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) SimpleDateFormat(java.text.SimpleDateFormat) Map(java.util.Map) HashMap(java.util.HashMap) TaskDTO(com.tomasio.projects.trainning.dto.TaskDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with TaskDTO

use of com.tomasio.projects.trainning.dto.TaskDTO in project trainning by fernandotomasio.

the class TasksBPMServiceActivitiImpl method findAllTasksByUser.

@Override
public TaskDTO[] findAllTasksByUser(String user) {
    List<Task> tasks = taskService.createTaskQuery().taskAssignee(user).list();
    TaskDTO[] tasksArray = new TaskDTO[tasks.size()];
    for (int i = 0; i < tasksArray.length; i++) {
        Task task = tasks.get(i);
        TaskDTO taskDTO = new TaskDTO();
        String processInstanceId = task.getProcessInstanceId();
        taskDTO.setNome(task.getName() + "(" + runtimeService.getVariable(processInstanceId, "instanceDefinition") + ")");
        taskDTO.setTurmaId((String) runtimeService.getVariable(processInstanceId, "turmaId"));
        taskDTO.setDescricao(task.getDescription());
        taskDTO.setId(task.getId());
        taskDTO.setFlowURL((String) runtimeService.getVariable(processInstanceId, "flowURL"));
        tasksArray[i] = taskDTO;
    }
    return tasksArray;
}
Also used : Task(org.activiti.engine.task.Task) TaskDTO(com.tomasio.projects.trainning.dto.TaskDTO)

Example 4 with TaskDTO

use of com.tomasio.projects.trainning.dto.TaskDTO in project trainning by fernandotomasio.

the class TasksController method index.

@RequestMapping({ "/", "/index", "" })
public String index(Model model, @ModelAttribute("userLogin") String userLogin, WebRequest request) {
    List result = new ArrayList();
    TaskDTO[] tasks = tasksBPMService.findAllTasksByUser(userLogin);
    for (TaskDTO task : tasks) {
        Map item = new HashMap();
        item.put("nome", task.getNome());
        item.put("descricao", task.getDescricao());
        item.put("id", task.getId());
        item.put("flow_url", task.getFlowURL());
        item.put("turmaId", task.getTurmaId());
        result.add(item);
    }
    model.addAttribute("items", result);
    return "tasks";
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) TaskDTO(com.tomasio.projects.trainning.dto.TaskDTO) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

TaskDTO (com.tomasio.projects.trainning.dto.TaskDTO)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Task (org.activiti.engine.task.Task)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1