TheOpenCloudEngine / uEngine5-base

uEngine5 BPMS that totally re-written in Microservices architecture. uEngine5 can act as not only a conventional Workflow or BPMS but also as a REST api orchestrator or a BPaaS (Business process as a service) of members of OCE's MSA components.
MIT License
10 stars 13 forks source link

WorkItemHandler 의 Mail 연동 #124

Open jinyoung opened 5 years ago

jinyoung commented 5 years ago
  1. BPM에서 email 발송처리 1.1. JPAWorkList.java 참고 (bpm_worklist 라는 테이블에 쌓는 strategy 구현체), Worklist implementation 으로, 메일 수신자에게 메일을 통하여 workitem 위치를 보내는 구현체 작성후, Application.java 에 @Bean worklist(){ return new EMailWorkList(); } 를 밷으면 됨.

https://github.com/TheOpenCloudEngine/uEngine5-base/blob/master/process-service/src/main/java/org/uengine/five/overriding/JPAWorkList.java 참고.

혹은, Pub/Sub 개념으로, task 가 발생시 workitem service 가 task 발생 이벤트를 듣고서, email 내, workitem handler url 혹은 google form 을 발송한다.

  1. 열린 메일 내에서 workitemhandler 주소로 연결되었을 시 어떻게 보안처리 하는가?

1.1. Auto-generated workitem 인 경우 - 임시 workitem 처리용 token 발행 및 validation 으로 열어줌.

1.2. Google forms / sheet / docs 를 이용한 경우는: google login 을 유도 --> SSO 창이 열려서 열 수 있으면, 열리는거고, 아니면 못열지... ==> 아래에 풀이

Google Form 사용 필요 API

Step0. 폼 발행할때, taskId 를 폼의 히든값으로 부여하고, 우리쪽에서도, 발행한 폼 아이디를 워크아이템 필드에 가지고 있으면 좋음.

Step1. 모델러에서, 휴먼액티비티에 Google Sheep api 로 설문지 목록을 선택함.

Step2. 모델러 저장시, 다음과 같은 작업을 Google app script api 로 실행하여 설문지를 업데이트함.

2018-09-19 4 52 48 2018-09-19 4 54 27

업무 처리자가 Google 로 로그인 한 놈이 아니면?

2018-09-19 5 01 48 2018-09-19 4 59 41
jinyoung commented 5 years ago

추가적으로, 설문지가 도달된 결과물을 parsing 하여, 각 field 의 값을 bpm 의 프로세스 변수 및, 매핑으로 연결된 값들에 전송.

SeungpilPark commented 5 years ago

이거 보고 힌트 얻음 https://www.44bits.io/ko/post/google-app-script-external-execution-by-ruby

정독하기 https://developers.google.com/apps-script/api/quickstart/target-script

Google Script Project 와 Google Cloud 플랫폼 연동 문제 이슈

2018-09-27 4 46 30

아래 링크를 통해 Google 에 OAuth Developer Verification Update Form 인증을 받아야 함. https://support.google.com/code/contact/oauth_app_update

폼 작성 후 submit 하면 2~3일 걸린다고 나옴....

2018-09-27 4 58 15
SeungpilPark commented 5 years ago

Google Form Enum Type 들을 알아야 variable 와 매핑이 가능

Enum Alignment

Property Type Description
LEFT Enum Align the image to the left side of the form.
CENTER Enum Align the image to the center of the form.
RIGHT Enum Align the image to the right side of the form.

Enum ItemType

CHECKBOX Enum A question item that allows the respondent to select one or more checkboxes, as well as an optional "other" field.
CHECKBOX_GRID Enum A question item, presented as a grid of columns and rows, that allows the respondent to select multiple choices per row from a sequence of checkboxes.
DATE Enum A question item that allows the respondent to indicate a date.
DATETIME Enum A question item that allows the respondent to indicate a date and time.
DURATION Enum A question item that allows the respondent to indicate a length of time.
GRID Enum A question item, presented as a grid of columns and rows, that allows the respondent to select one choice per row from a sequence of radio buttons.
IMAGE Enum A layout item that displays an image.
LIST Enum A question item that allows the respondent to select one choice from a drop-down list.
MULTIPLE_CHOICE Enum A question item that allows the respondent to select one choice from a list of radio buttons or an optional "other" field.
PAGE_BREAK Enum A layout item that marks the start of a page.
PARAGRAPH_TEXT Enum A question item that allows the respondent to enter a block of text.
SCALE Enum A question item that allows the respondent to choose one option from a numbered sequence of radio buttons.
SECTION_HEADER Enum A layout item that visually indicates the start of a section.
TEXT Enum A question item that allows the respondent to enter a single line of text.
TIME Enum A question item that allows the respondent to indicate a time of day.
VIDEO Enum A layout item that displays a YouTube video.

Enum DestinationType

Property Type Description
SPREADSHEET Enum A Google Sheets spreadsheet as a destination for form responses.

Enum FeedbackType

Property Type Description
CORRECT Enum Feedback that is automatically displayed to respondents for a question answered correctly. Correct feedback can only be attached to a question type that supports autograding (e.g. radio, checkbox, select)
INCORRECT Enum Feedback that is automatically displayed to respondents for a question answered incorrectly. Incorrect feedback can only be attached to a question type that supports autograding (e.g. radio, checkbox, select)
GENERAL Enum Feedback that is automatically displayed to respondents when they submit their response. General feedback can only be attached to question types that do not support auto-grading, but are gradeable (ie everything but grid)

Enum PageNavigationType

Property Type Description
CONTINUE Enum Continue to the next page of the form after completing the current page.
GO_TO_PAGE Enum Jump to a specified page of the form after completing the current page.
RESTART Enum Restart the form from the beginning, without clearing answers entered so far, after completing the current page.
SUBMIT Enum Submit the form response after completing the current page.
SeungpilPark commented 5 years ago

Form submit (installable) 응답 객체

2018-09-28 4 17 48

서버에서 오프라인(부재중 접속) 가능 시나리오

https://developers.google.com/identity/protocols/OAuth2WebServer

Fields

access_token | The token that your application sends to authorize a Google API request. refresh_token | A token that you can use to obtain a new access token. Refresh tokens are valid until the user revokes access. Again, this field is only present in this response if you set theaccess_type parameter to offline in the initial request to Google's authorization server. expires_in | The remaining lifetime of the access token in seconds. token_type | The type of token returned. At this time, this field's value is always set to Bearer.

{
  "access_token":"1/fFAGRNJru1FTz70BzhT3Zg",
  "expires_in":3920,
  "token_type":"Bearer",
  "refresh_token":"1/xEoDL4iW3cxlI7yDbSRFYNG01kVKM2C-259HOF2aQbI"
}

토큰 생성 요청시 "access_type" 을 "offline" 으로 주면 refresh_token 을 받급 받을 수 있게 된다.