Getting Started .

공지사항 게시판을 만들어 보자..

 

“ noticeBoard “

Field ID

Field Name

Value Type

Nullable

Default Value

Field ID

Field Name

Value Type

Nullable

Default Value

id PK

아이디

long

N

 

title

제목

string

N

 

content

내용

clob

N

 

file

첨부파일

string

 

 

enable

사용여부

boolean

 

true

owner FK

등록자

string

 

 

created

등록일

date

 

 

modifier FK

수정자

string

 

 

changed

수정일

date

 

 

 

 

Schema 작성

NodeType

[ { "typeId": "nodeType", "parentId": "root", "tid": "noticeBoard", "typeName": "게시판", "repositoryType": "node", "tableName": "", "propertyTypes": [ ] } ]

 

 

PropertyType

  • Primary Key

    • “idable” : “true”

    • idType

      • id 자동 생성 유형

      • idType 이 없으면 id 직접 입력

      • autoIncrement, UUID, hash

[ { "typeId": "nodeType", "parentId": "root", "tid": "noticeBoard", "typeName": "게시판", "repositoryType": "node", "tableName": "", "propertyTypes": [ { "pid": "id", "name": "ID", "valueType": "LONG", "idable": true, "idType": "hash", "indexable": true, "orderNo": 10 }, { "pid": "title", "name": "제목", "valueType": "STRING", "required": true, "labelable": true, "indexable": true, "analyzer": "simple", "orderNo": 2 }, { "pid": "content", "name": "내용", "valueType": "TEXT", "required": true, "indexable": false, "orderNo": 3 }, { "pid": "file", "name": "File", "valueType": "FILE", "required": false, "indexable": false, "orderNo": 4 }, { "pid": "enable", "name": "사용여부", "valueType": "BOOLEAN", "required": false, "indexable": true, "defaultValue": "true", "orderNo": 5 }, { "pid": "owner", "name": "등록자", "valueType": "REFERENCE", "indexable": true, "analyzer": "code", "referenceType": "user", "orderNo": 6 }, { "pid": "created", "name": "등록일", "valueType": "DATE", "required": false, "indexable": true, "orderNo": 7 }, { "pid": "modifier", "name": "수정자", "valueType": "REFERENCE", "indexable": true, "analyzer": "code", "referenceType": "user", "orderNo": 8 }, { "pid": "changed", "name": "수정일", "valueType": "DATE", "required": false, "indexable": true, "analyzer": "simple", "orderNo": 9 } ] } ]

 

loadSchema

작성한 schema 를 caching 한다.

GET {{protocol}}://{{hostname}}:{{port}}/helper/loadSchema

  • filePath : Absolute Path

  • helper/loadSchema :

  • helper/reloadSchema :

{{protocol}}://{{hostname}}:{{port}}/helper/loadSchema?filePath=/Users/jjong/IdeaProjects/backendcore/src/main/resources/schema/common/site

 

 

Caching 된 Schema (NodeType, PropertyType)를 조회해볼 수 있다. ( NodeController.java 참조 )

GET {{protocol}}://{{hostname}}:{{port}}/node/nodeType/noticeBoard

GET {{protocol}}://{{hostname}}:{{port}}/node/nodeType/read.json?id=noticeBoard

 

{ "result": "200", "resultMessage": "SUCCESS", "item": { "id": "noticeBoard", "lable": "게시판", "parentId": { "value": "root", "label": "root", "refId": "root" }, "tid": "noticeBoard", "repositoryType": { "value": "node", "label": "Node" }, "typeName": "게시판", "microservice": null, "standaloneIndex": true, "targetGroup": null, "eviction": 10000, "i18n": null, "historyable": null, "datasource": null, "tableName": null, "uniqueFields": null, "authorityRule": null, "filter": null, "tempSave": null, "jsonStore": null, "statistic": null, "trace": null, "workflow": null, "owner": { "value": "anonymous", "label": "Anonymous User", "refId": "user::anonymous" }, "created": "20200730144800", "modifier": { "value": "anonymous", "label": "Anonymous User", "refId": "user::anonymous" }, "changed": "20200730144800", "propertyTypes": [ { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "id", "name": "ID", "valueType": { "value": "STRING", "label": "String" }, "required": true, "idable": true, "indexable": true, "analyzer": { "value": "code", "label": "Code Analyzer" }, "orderNo": 1, "created": "20200730144800", "id": "noticeBoard>id", "label": "ID", "defaultValue": null, "description": null, "defaultComponent": null, "labelable": null, "i18n": null, "sortable": null, "facetable": null, "indexNull": null, "idType": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "requiredCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "title", "name": "제목", "valueType": { "value": "STRING", "label": "String" }, "required": true, "labelable": true, "indexable": true, "analyzer": { "value": "simple", "label": "Simple Analyzer" }, "orderNo": 2, "created": "20200730144800", "id": "noticeBoard>title", "label": "제목", "defaultValue": null, "description": null, "defaultComponent": null, "idable": null, "i18n": null, "sortable": null, "facetable": null, "indexNull": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "requiredCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "content", "name": "내용", "valueType": { "value": "TEXT", "label": "Text" }, "required": true, "indexable": false, "orderNo": 3, "created": "20200730144800", "id": "noticeBoard>content", "label": "내용", "defaultValue": null, "description": null, "defaultComponent": null, "idable": null, "labelable": null, "i18n": null, "sortable": null, "facetable": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "requiredCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "file", "name": "File", "valueType": { "value": "FILE", "label": "File" }, "required": false, "indexable": false, "orderNo": 4, "created": "20200730144800", "fileHandler": "default", "id": "noticeBoard>file", "label": "File", "defaultValue": null, "description": null, "defaultComponent": null, "idable": null, "labelable": null, "i18n": null, "facetable": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "enable", "name": "사용여부", "valueType": { "value": "BOOLEAN", "label": "Boolean" }, "defaultValue": "true", "required": false, "indexable": true, "orderNo": 5, "created": "20200730144800", "id": "noticeBoard>enable", "label": "사용여부", "description": null, "defaultComponent": null, "idable": null, "labelable": null, "i18n": null, "facetable": null, "analyzer": null, "indexNull": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "owner", "name": "등록자", "valueType": { "value": "REFERENCE", "label": "Reference" }, "indexable": true, "analyzer": { "value": "code", "label": "Code Analyzer" }, "referenceType": { "value": "user", "label": "사용자", "refId": "user" }, "orderNo": 6, "created": "20200730144800", "id": "noticeBoard>owner", "label": "등록자", "defaultValue": null, "description": null, "defaultComponent": null, "required": null, "idable": null, "labelable": null, "treeable": null, "i18n": null, "facetable": null, "indexNull": null, "filter": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "created", "name": "등록일", "valueType": { "value": "DATE", "label": "Date" }, "required": false, "indexable": true, "orderNo": 7, "created": "20200730144800", "id": "noticeBoard>created", "label": "등록일", "defaultValue": null, "description": null, "defaultComponent": null, "idable": null, "labelable": null, "i18n": null, "facetable": null, "analyzer": null, "indexNull": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "modifier", "name": "수정자", "valueType": { "value": "REFERENCE", "label": "Reference" }, "indexable": true, "analyzer": { "value": "code", "label": "Code Analyzer" }, "referenceType": { "value": "user", "label": "사용자", "refId": "user" }, "orderNo": 8, "created": "20200730144800", "id": "noticeBoard>modifier", "label": "수정자", "defaultValue": null, "description": null, "defaultComponent": null, "required": null, "idable": null, "labelable": null, "treeable": null, "i18n": null, "facetable": null, "indexNull": null, "filter": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "pid": "changed", "name": "수정일", "valueType": { "value": "DATE", "label": "Date" }, "required": false, "indexable": true, "analyzer": { "value": "simple", "label": "Simple Analyzer" }, "orderNo": 9, "created": "20200730144801", "id": "noticeBoard>changed", "label": "수정일", "defaultValue": null, "description": null, "defaultComponent": null, "idable": null, "labelable": null, "i18n": null, "facetable": null, "indexNull": null, "length": null, "encryption": null, "secure": null, "virtual": null, "authority": null, "presetOption": null, "option": null, "relatedPid": null, "enableCondition": null, "valueFunction": null, "columnId": null, "useRefId": null } ], "events": [ { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "create", "name": "create 게시판", "buttonLabel": { "ko": "New" }, "eventType": { "value": "form", "label": "Has Form" }, "enablePageTypes": [ { "value": "list", "label": "List Page" }, { "value": "createForm", "label": "Create Form" } ], "noneExecute": false, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "id": "noticeBoard>create", "label": "create 게시판", "compensatingEvent": null, "trace": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "update", "name": "update 게시판", "buttonLabel": { "ko": "Save" }, "eventType": { "value": "form", "label": "Has Form" }, "enablePageTypes": [ { "value": "view", "label": "View Page" }, { "value": "updateForm", "label": "Update Form" } ], "noneExecute": false, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "id": "noticeBoard>update", "label": "update 게시판", "compensatingEvent": null, "trace": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "delete", "name": "delete 게시판", "buttonLabel": { "ko": "Delete" }, "eventType": { "value": "direct", "label": "Direct Execute" }, "enablePageTypes": [ { "value": "view", "label": "View Page" }, { "value": "updateForm", "label": "Update Form" } ], "noneExecute": false, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "id": "noticeBoard>delete", "label": "delete 게시판", "compensatingEvent": null, "trace": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "read", "name": "read 게시판", "eventType": { "value": "link", "label": "Link Page" }, "enablePageTypes": [ { "value": "list", "label": "List Page" } ], "noneExecute": true, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "buttonLabel": { "ko": null }, "id": "noticeBoard>read", "label": "read 게시판", "compensatingEvent": null, "trace": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "list", "name": "list 게시판", "buttonLabel": { "ko": "List" }, "eventType": { "value": "link", "label": "Link Page" }, "enablePageTypes": [ { "value": "view", "label": "View Page" }, { "value": "createForm", "label": "Create Form" }, { "value": "updateForm", "label": "Update Form" } ], "noneExecute": true, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "id": "noticeBoard>list", "label": "list 게시판", "compensatingEvent": null, "trace": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] }, { "tid": { "value": "noticeBoard", "label": "게시판", "refId": "noticeBoard" }, "event": "allEvent", "name": "allEvent 게시판", "noneExecute": true, "changed": "20200730144800", "linkType": { "value": "modal", "label": "Modal" }, "callbackLinkType": { "value": "page", "label": "Page" }, "buttonLabel": { "ko": null }, "id": "noticeBoard>allEvent", "label": "allEvent 게시판", "eventType": null, "compensatingEvent": null, "trace": null, "enablePageTypes": null, "linkUrl": null, "linkUrlParams": null, "callbackLinkUrl": null, "authority": null, "enableCondition": null, "option": null, "eventActions": [], "eventListeners": [] } ], "eventListeners": null } }

 

기본 CRUD API

작성한 schema nodeType에서 기본 제공하는 crud API

  • primary key 필수

  • primary key 필수

  • primary key 가 없으면 create , 있으면 update

 

 

Custom API

api Cartegory

  • id, categoryName 작성

 


Front 공지사항 리스트

Api Schema

ApiType

  • service : context path “svc”를 사용

Params

  • title

  • sorting

  • page

  • pageSize

Config

  • type : query → noticeBoard 에 query 검색

  • cacheable : true / cacheType : 60 → API 결과를 60초간 캐싱

Response

  • 아래와 같이 api 응답결과의 필드를 지정할수도 있고, 모든 필드를 반환할 수도 있다.

Api Result

  • Paging

    • Param 으로 page, pageSize 가 들어오면 페이징 처리

    • Response 응답 결과에 페이징 관련 필드 함께 내려옴

      • totalCount : 검색된 결과 페이징 제외된 순수 카운트

      • totalTypeCount : noticeBoard nodeType의 데이터 노드리스트 카운트

      • resultCount : Response 결과 카운트

      • pageSize : 페이징 기준 사이즈

      • pageCount : 페이징 된 페이지 건수

      • currentPage : 현재 페이지 번호

 

 


Front 공지사항 조회

Api Schema

ApiType

  • service : context path “svc”를 사용

Parameters

  • id (required)

Config

  • resultType : OBJECT

    • query list 결과 ArrayList [ ] 를 Object { } 로 반환

Api Result

 

 


admin 공지사항 리스트

ApiType

  • admin : context path “adm”을 사용

  • /svc/ 로 call하면 아래와 같다.

Params

  • enable

  • title

  • sorting

  • page

  • pageSize

Config

  • type : query

  • cacheable : false → API 결과를 캐싱하지 않음. 캐시 딜레이 없이 관리자가 실시간으로 조회 처리 가능.

 

 


admin 공지사항 상태변경

Api Schema

Params

  • id

  • enable

Config

  • type : event → noticeBoard 의 event call

  • event : update

  • data에 params 를 셋해서 update 실행

Api Result

 

 


admin 서비스 작성 이벤트 실행

Api Schema

Config

  • type : event

  • event : testEvent → 별도 이벤트 작성

 

NodeType Schema 에 Event 추가

Events

  • event : 기본 event 명 (create,update,delete 등)을 제외한 유니크한 아이디로 작성

EventActions

  • actionType : service

  • actionBody : noticeboardService.test → @Service annotation name.method

 

Service Java 작성

  • Event 에서 사용할 Service

    • @Service annotation 필수

    • event에서 직접 호출할 method 는 반드시 ExecuteContext 를 인자로 갖는다.

    • public void test(ExecuteContext context)

Api Result