-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Brings mail capabilities with thymeleaf and code mirror.
Store forms and mail templates as files to easily store in git.
- Loading branch information
Showing
35 changed files
with
2,210 additions
and
493 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 75 additions & 44 deletions
119
src/main/java/org/example/camunda/process/solution/ProcessVariables.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,86 @@ | ||
package org.example.camunda.process.solution; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.apache.commons.lang3.builder.MultilineRecursiveToStringStyle; | ||
import org.apache.commons.lang3.builder.ToStringBuilder; | ||
import org.apache.commons.lang3.builder.ToStringStyle; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
public class ProcessVariables { | ||
|
||
private String texte; | ||
private Long number; | ||
private String date; | ||
|
||
public String getTexte() { | ||
return texte; | ||
} | ||
|
||
public ProcessVariables setTexte(String texte) { | ||
this.texte = texte; | ||
return this; | ||
} | ||
|
||
public Long getNumber() { | ||
return number; | ||
} | ||
|
||
public ProcessVariables setNumber(Long number) { | ||
this.number = number; | ||
return this; | ||
} | ||
|
||
public String getDate() { | ||
return date; | ||
} | ||
|
||
public ProcessVariables setDate(String date) { | ||
this.date = date; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ToStringBuilder.reflectionToString( | ||
this, | ||
new MultilineRecursiveToStringStyle() { | ||
public ToStringStyle withShortPrefixes() { | ||
this.setUseShortClassName(true); | ||
this.setUseIdentityHashCode(false); | ||
return this; | ||
} | ||
private String intialMessage; | ||
private String assignee1; | ||
private String assignee2; | ||
private List<Map<String, String>> comments; | ||
private Map<String, Object> file; | ||
private String date; | ||
|
||
public String getIntialMessage() { | ||
return intialMessage; | ||
} | ||
|
||
public void setIntialMessage(String intialMessage) { | ||
this.intialMessage = intialMessage; | ||
} | ||
|
||
public String getAssignee1() { | ||
return assignee1; | ||
} | ||
|
||
public ProcessVariables setAssignee1(String assignee1) { | ||
this.assignee1 = assignee1; | ||
return this; | ||
} | ||
|
||
public String getAssignee2() { | ||
return assignee2; | ||
} | ||
|
||
public ProcessVariables setAssignee2(String assignee2) { | ||
this.assignee2 = assignee2; | ||
return this; | ||
} | ||
|
||
public List<Map<String, String>> getComments() { | ||
return comments; | ||
} | ||
|
||
public ProcessVariables setComments(List<Map<String, String>> comments) { | ||
this.comments = comments; | ||
return this; | ||
} | ||
|
||
public Map<String, Object> getFile() { | ||
return file; | ||
} | ||
|
||
public ProcessVariables setFile(Map<String, Object> file) { | ||
this.file = file; | ||
return this; | ||
} | ||
|
||
public String getDate() { | ||
return date; | ||
} | ||
|
||
public ProcessVariables setDate(String date) { | ||
this.date = date; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ToStringBuilder.reflectionToString(this, new MultilineRecursiveToStringStyle() { | ||
public ToStringStyle withShortPrefixes() { | ||
this.setUseShortClassName(true); | ||
this.setUseIdentityHashCode(false); | ||
return this; | ||
} | ||
}.withShortPrefixes()); | ||
} | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
src/main/java/org/example/camunda/process/solution/dao/FormRepository.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/org/example/camunda/process/solution/facade/MailEditionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.example.camunda.process.solution.facade; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import org.example.camunda.process.solution.facade.dto.Form; | ||
import org.example.camunda.process.solution.facade.dto.MailTemplate; | ||
import org.example.camunda.process.solution.service.MailTemplateService; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.CrossOrigin; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.camunda.tasklist.exception.TaskListException; | ||
|
||
@RestController | ||
@RequestMapping("/edition/mails") | ||
@CrossOrigin(origins = "*") | ||
public class MailEditionController extends AbstractController { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(MailEditionController.class); | ||
|
||
@Autowired private MailTemplateService mailTemplateService; | ||
|
||
@PostMapping | ||
public ResponseEntity<MailTemplate> save(@RequestBody MailTemplate mailTemplate) throws IOException { | ||
mailTemplateService.saveMail(mailTemplate); | ||
return new ResponseEntity<>(mailTemplate, HttpStatus.CREATED); | ||
} | ||
|
||
@GetMapping("/{templateName}") | ||
@ResponseBody | ||
public MailTemplate getMailTemplate(@PathVariable String templateName) | ||
throws TaskListException, IOException { | ||
return mailTemplateService.findByName(templateName); | ||
} | ||
|
||
@DeleteMapping("/{templateName}") | ||
public void deleteForm(@PathVariable String templateName) | ||
throws TaskListException, IOException { | ||
mailTemplateService.deleteByName(templateName); | ||
} | ||
|
||
|
||
@GetMapping(value = "/names") | ||
@ResponseBody | ||
public List<String> formNames() { | ||
return mailTemplateService.findNames(); | ||
} | ||
|
||
@Override | ||
public Logger getLogger() { | ||
return logger; | ||
} | ||
} |
31 changes: 27 additions & 4 deletions
31
src/main/java/org/example/camunda/process/solution/facade/SimulationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
package org.example.camunda.process.solution.facade; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.example.camunda.process.solution.facade.dto.FormJsListValue; | ||
import org.example.camunda.process.solution.model.User; | ||
import org.example.camunda.process.solution.service.UserService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.CrossOrigin; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.camunda.tasklist.exception.TaskListException; | ||
|
||
@RestController | ||
@RequestMapping("/simul") | ||
@CrossOrigin(origins = "*") | ||
public class SimulationController { | ||
|
||
@GetMapping("/checklist") | ||
public List<FormJsListValue> getChecklist() { | ||
return List.of(new FormJsListValue("1", "choice 1"), new FormJsListValue("2", "choice 2")); | ||
} | ||
@Autowired | ||
private UserService userService; | ||
|
||
@GetMapping("/users") | ||
public List<FormJsListValue> users() throws TaskListException, IOException { | ||
|
||
List<User> users = userService.all(); | ||
List<FormJsListValue> result = new ArrayList<>(); | ||
for (User u : users) { | ||
result.add(new FormJsListValue(u.getUsername(), u.getFirstname() + " " + u.getLastname())); | ||
} | ||
return result; | ||
} | ||
|
||
@GetMapping("/checklist") | ||
public List<FormJsListValue> getChecklist() { | ||
return List.of(new FormJsListValue("1", "choice 1"), new FormJsListValue("2", "choice 2")); | ||
} | ||
} |
Oops, something went wrong.