Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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

“ noticeBoard “

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

GET {{protocol}}://{{hostname}}:{{port}}/node/nodeType/list.json?id_matching=noticeBoard

GET {{protocol}}://{{hostname}}:{{port}}/node/propertyType/list.json?tid_matching=noticeBoard

 Api Response
{
    "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

GET {{protocol}}://{{hostname}}:{{port}}/node/noticeBoard/list.json

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

POST {{protocol}}://{{hostname}}:{{port}}/node/noticeBoard/create.json

POST {{protocol}}://{{hostname}}:{{port}}/node/noticeBoard/update.json

  • primary key 필수

POST {{protocol}}://{{hostname}}:{{port}}/node/noticeBoard/delete.json

  • primary key 필수

POST {{protocol}}://{{hostname}}:{{port}}/node/noticeBoard/save.json

  • primary key 가 없으면 CREATE , 없으면 UPDATE 처리

Custom API

api Cartegory

[
  {
    "typeId": "apiCategory",
    "id": "notice",
    "categoryName": "Notice Board  API",
    "dateFormat": "yyyy-MM-dd HH:mm:ss",
    "fileUrlFormat": {
      "default": "{{:getEnvValue('core.cluster.api-url-prefix')}}"
    },
    "commonParameters": [
      {
        "parameter": "apiKey",
        "required": false
      }
    ],
    "commonResponse": [
      {
        "field": "time",
        "type": "field",
        "value": "{{:sysdate}}"
      }
    ]
  }
]

Api Context

FRONT /svc/

ADMIN /adm/

MANAGER /mng/


FRONT 공지사항 리스트

GET {{protocol}}://{{hostname}}:{{port}}/svc/notice/list

Api Schema

{
    "typeId": "api",
    "category": "notice",
    "apiId": "list",
    "apiName": "공지사항 리스트",
    "apiType": "service",
    "method": "GET",
    "parameters": [
    ],
    "config": [
      {
        "configId": "root",
        "tid": "noticeBoard",
        "type": "query",
        "allowParams": false,
        "orderNo": 1,
        "cacheable": true,
        "cacheTime": 60,
        "query": [
          {
            "method": "matching",
            "field": "enable",
            "value": "true"
          },
          {
            "method": "matching",
            "field": "title",
            "value": "{{:title}}"
          },
          {
            "method": "sorting",
            "value": "{{:sorting}},id desc"
          },
          {
            "method": "page",
            "value": "{{:page}}"
          },
          {
            "method": "pageSize",
            "value": "{{:pageSize}}"
          }
        ],
        "response": [
          {
            "field": "id",
            "type": "field",
            "value": ""
          },
          {
            "field": "title",
            "type": "field",
            "value": ""
          },
          {
            "field": "owner",
            "type": "field",
            "value": ""
          },
          {
            "field": "created",
            "type": "field",
            "value": ""
          }
        ]
      }
    ]
  }

ApiType

  • service : context path “svc”를 사용

Params

  • title

  • sorting

  • page

  • pageSize

Config

  • type : query → noticeBoard 에 query 검색

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

Response

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

"response": [
  {
    "field": "id",
    "type": "field",
    "value": ""
  },
  {
    "field": "title",
    "type": "field",
    "value": ""
  }
]
"response": [
  {
    "field": "_all_",
    "type": "all"
  }
]

Api Result

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 2,
    "totalTypeCount": 2,
    "resultCount": 2,
    "pageSize": 10,
    "pageCount": 1,
    "currentPage": 1,
    "items": [
        {
            "id": 1716647245,
            "title": "공지합니다. (수정)",
            "owner": {
                "value": "anonymous",
                "label": "Anonymous User",
                "refId": "user::anonymous"
            },
            "created": "2020-07-30 15:38:09"
        },
        {
            "id": 429034766,
            "title": "ID 있으면 update, 없으면 create",
            "owner": {
                "value": "anonymous",
                "label": "Anonymous User",
                "refId": "user::anonymous"
            },
            "created": "2020-07-30 15:40:11"
        }
    ]
}
  • Paging

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

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

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

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

      • resultCount : Response 결과 카운트

      • pageSize : 페이징 기준 사이즈

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

      • currentPage : 현재 페이지 번호

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "totalCount": 38,
    "totalTypeCount": 489,
    "resultCount": 10,
    "pageSize": 10,
    "pageCount": 4,
    "currentPage": 1,
    "items": [
        {
            "id": 1716647245,
            "title": "공지합니다. (수정)",
            "owner": {
                "value": "anonymous",
                "label": "Anonymous User",
                "refId": "user::anonymous"
            },
            "created": "2020-07-30 15:38:09"
        }
        ...
    ]
}


FRONT 공지사항 조회

GET {{protocol}}://{{hostname}}:{{port}}/svc/notice/read

Api Schema

{
    "typeId": "api",
    "category": "notice",
    "apiId": "read",
    "apiName": "공지사항 조회",
    "apiType": "service",
    "method": "GET",
    "parameters": [
      {
        "parameter": "id",
        "name": "ID",
        "valueType": "STRING",
        "required": true
      }
    ],
    "config": [
      {
        "configId": "root",
        "tid": "noticeBoard",
        "type": "query",
        "resultType": "OBJECT",
        "allowParams": false,
        "orderNo": 1,
        "cacheable": true,
        "cacheTime": 60,
        "query": [
          {
            "method": "matching",
            "field": "enable",
            "value": "true"
          },
          {
            "method": "matching",
            "field": "id",
            "value": "{{:id}}"
          }
        ],
        "response": [
          {
            "field": "_all_",
            "type": "all"
          }
        ]
      }
    ]
  }

ApiType

  • service : context path “svc”를 사용

Parameters

  • id (required)

Config

  • resultType : OBJECT

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

Api Result

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "item": {
        "id": 1716647245,
        "label": "공지합니다. (수정)",
        "title": "공지합니다. (수정)",
        "content": "내용내용 ",
        "file": "http://local.i-on.net:8080/noticeBoard/file/202007/30/143f2cdb-da84-4794-8817-2d0b2f0de994.png",
        "enable": true,
        "owner": {
            "value": "anonymous",
            "label": "Anonymous User",
            "refId": "user::anonymous"
        },
        "created": "2020-07-30 15:38:09",
        "modifier": {
            "value": "anonymous",
            "label": "Anonymous User",
            "refId": "user::anonymous"
        },
        "changed": "2020-07-30 15:38:09"
    }
}


ADMIN 공지사항 리스트

GET {{protocol}}://{{hostname}}:{{port}}/adm/notice/boardList

{
    "typeId": "api",
    "category": "notice",
    "apiId": "boardList",
    "apiName": "공지사항 리스트",
    "apiType": "admin",
    "method": "GET",
    "parameters": [
    ],
    "config": [
      {
        "configId": "root",
        "tid": "noticeBoard",
        "type": "query",
        "allowParams": false,
        "orderNo": 1,
        "cacheable": false,
        "query": [
          {
            "method": "matching",
            "field": "enable",
            "value": "{{:enable}}"
          },
          {
            "method": "matching",
            "field": "title",
            "value": "{{:title}}"
          },
          {
            "method": "sorting",
            "value": "{{:sorting}},id desc"
          },
          {
            "method": "page",
            "value": "{{:page}}"
          },
          {
            "method": "pageSize",
            "value": "{{:pageSize}}"
          }
        ],
        "response": [
          {
            "field": "id",
            "type": "field",
            "value": ""
          },
          {
            "field": "title",
            "type": "field",
            "value": ""
          },
          {
            "field": "title",
            "type": "field",
            "value": ""
          },
          {
            "field": "owner",
            "type": "field",
            "value": ""
          },
          {
            "field": "created",
            "type": "field",
            "value": ""
          }
        ]
      }
    ]
  }

ApiType

  • admin : context path “adm”을 사용

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

{
    "result": "500",
    "resultMessage": "지원하지 않는 API Type 입니다. : admin"
}

Params

  • enable

  • title

  • sorting

  • page

  • pageSize

Config

  • type : query

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


ADMIN 공지사항 상태변경

POST {{protocol}}://{{hostname}}:{{port}}/adm/notice/updateStatus

Api Schema

{
    "typeId": "api",
    "category": "notice",
    "apiId": "updateStatus",
    "apiName": "공지사항 상태 변경",
    "apiType": "admin",
    "method": "POST",
    "parameters": [
      {
        "parameter": "id",
        "name": "ID",
        "valueType": "STRING",
        "required": true
      },
      {
        "parameter": "enable",
        "name": "사용 여부",
        "valueType": "STRING",
        "required": true
      }
    ],
    "config": [
      {
        "configId": "root",
        "tid": "noticeBoard",
        "type": "event",
        "allowParams": false,
        "orderNo": 1,
        "event": "update",
        "data": [
          {
            "field": "id",
            "value": "{{:id}}"
          },
          {
            "field": "enable",
            "value": "{{:enable}}"
          }
        ]
      }
    ]
  }

Params

  • id

  • enable

Config

  • type : event → noticeBoard 의 event call

  • event : update

  • data에 params 를 셋해서 update 실행

Api Result

{
    "result": "200",
    "resultMessage": "SUCCESS",
    "item": {
        "id": "1716647245",
        "lable": "공지합니다. (수정)",
        "title": "공지합니다. (수정)",
        "content": "내용내용 ",
        "file": "http://local.i-on.net:8080/noticeBoard/file/202007/30/143f2cdb-da84-4794-8817-2d0b2f0de994.png",
        "enable": false,
        "owner": {
            "value": "anonymous",
            "label": "Anonymous User",
            "refId": "user::anonymous"
        },
        "created": "2020-07-30 15:38:09",
        "modifier": {
            "value": "anonymous",
            "label": "Anonymous User",
            "refId": "user::anonymous"
        },
        "changed": "2020-07-30 17:19:55"
    }
}


ADMIN 서비스 작성 이벤트 실행

POST {{protocol}}://{{hostname}}:{{port}}/adm/notice/test

Api Schema

{
  "typeId": "api",
  "category": "notice",
  "apiId": "test",
  "apiName": "서비스 작성 이벤트 실행",
  "apiType": "admin",
  "method": "POST",
  "parameters": [
  ],
  "config": [
    {
      "configId": "root",
      "tid": "noticeBoard",
      "type": "event",
      "allowParams": false,
      "orderNo": 1,
      "event": "testEvent"
    }
  ]
}

Config

  • type : event

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

NodeType Schema 에 Event 추가

[
  {
    "typeId": "nodeType",
    "parentId": "root",
    "tid": "noticeBoard",
    "typeName": "게시판",
    "repositoryType": "node",
    "tableName": "",
    "propertyTypes": [
    ],
    "events": [
      {
        "event": "testEvent",
        "name": "테스트 이벤트",
        "noneExecute": true,
        "eventActions": [
          {
            "action": "testAction",
            "actionName": "테스트 이벤트 작성",
            "actionType": "service",
            "actionBody": "noticeBoardService.test",
            "order": 1
          }
        ]
      }
    ]
  }
]

Events

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

EventActions

  • actionType : service

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

Service Java 작성

package net.ion.ice.services.commerce;

import net.ion.ice.core.api.ApiException;
import net.ion.ice.core.context.ExecuteContext;
import net.ion.ice.core.query.QueryResult;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;
import java.util.Map;

@Service("noticeBoardService")
public class NoticeBoardService {

    public void test(ExecuteContext context) {
        Map<String, Object> params = context.getData();


        // 코딩


        //Error 처리
        if (false) {
            throw new ApiException("404", "Not Found Data");
        }

        //Response Result 세팅
        QueryResult result = new QueryResult();
        result.setResult("201");
        result.setResultMessage("서비스 성공");

        Map<String, Object> map = new LinkedHashMap<>();
        map.put("a", "1");
        map.put("b", "2");
        map.put("c", "3");

        result.setItem(map);
        result.put("apple", "사과");

        context.setResult(result);

    }
}

  • Event 에서 사용할 Service

    • @Service annotation 필수

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

    • public void test(ExecuteContext context)

Api Result

{
    "result": "201",
    "resultMessage": "서비스 성공",
    "item": {
        "a": "1",
        "b": "2",
        "c": "3"
    },
    "apple": "사과"
}
{
    "result": "404",
    "resultMessage": "Not Found Data"
}

  • No labels