Skip to end of metadata
Go to start of metadata

Poniższa konfiguracja opiera się na źródle danych na podstawie zapytań do bazy, której implementacja znajduje się we wtyczce com.suncode.plugin.jdbc-datasources. Bez tej wtyczki poniższa konfiguracja nie będzie poprawnie działać.

Konfiguracja dodaje 2 zakładki do menu, które mają różne uprawnienia. Do jednej z nich uprawnienie ma jedynie użytkownik admin, a do drugiej wszyscy z grupy Administrators. We wtyczce zostały zastosowane wszystkie możliwe wykorzystania akcji itp., dlatego może ona pełnić punkt startowy przy tworzeniu własnej konfiguracji.

Import źródeł danych

Najpierw należy zaimportować źródła danych z poniższego pliku JSON. Odbywa się to w zakładce Administracja -> Konfiguracja systemu -> Źródła danych (przycisk Importuj). Po zaimportowaniu należy dla każdego źródła skonfigurować bazę, z jakiej ma pobierać wyniki.

[
  {
    "id": "zrodlo3",
    "name": "Kategorie",
    "description": "sefsef",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "select * from pm_systemparametercategory order by {orderProperty} {orderDirection} LIMIT {limit} OFFSET {start}"
      },
      "countQuery": {
        "type": "string",
        "value": "select count(*) from pm_systemparametercategory"
      },
      "queryParametersId": [],
      "queryParametersName": [],
      "queryParametersType": [],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "id"
        },
        {
          "type": "string",
          "value": "categorykey"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "id"
        },
        {
          "type": "string",
          "value": "Klucz kategorii"
        }
      ]
    },
    "operation": "READ"
  },
  {
    "id": "zrodlo2",
    "name": "Role",
    "description": "sefsef",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "select * from pm_roles order by {orderProperty} {orderDirection} LIMIT {limit} OFFSET {start}"
      },
      "countQuery": {
        "type": "string",
        "value": "select count(*) from pm_roles"
      },
      "queryParametersId": [],
      "queryParametersName": [],
      "queryParametersType": [],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "id"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "id"
        }
      ]
    },
    "operation": "READ"
  },
  {
    "id": "zrodlo1",
    "name": "Parametry systemowe",
    "description": "sefsef",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "select * from pm_systemparameter \nwhere categoryid = {categoryid}\norder by {orderProperty} {orderDirection} LIMIT {limit} OFFSET {start}"
      },
      "countQuery": {
        "type": "string",
        "value": "select count(*) from pm_systemparameter\nwhere categoryid = {categoryid}"
      },
      "queryParametersId": [
        {
          "type": "string",
          "value": "categoryid"
        }
      ],
      "queryParametersName": [
        {
          "type": "string",
          "value": "Id kategorii"
        }
      ],
      "queryParametersType": [
        {
          "type": "string",
          "value": "integer"
        }
      ],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "id"
        },
        {
          "type": "string",
          "value": "parameterkey"
        },
        {
          "type": "string",
          "value": "categoryid"
        },
        {
          "type": "string",
          "value": "valuestring"
        },
        {
          "type": "string",
          "value": "valuelong"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "Id"
        },
        {
          "type": "string",
          "value": "Klucz parametru"
        },
        {
          "type": "string",
          "value": "Klucz kategorii"
        },
        {
          "type": "string",
          "value": "Wartość tekstowa"
        },
        {
          "type": "string",
          "value": "Wartość liczbowa"
        }
      ]
    },
    "operation": "READ"
  },
  {
    "id": "categoriesListSource",
    "name": "Kategorie - typ 'list'",
    "description": "asdf",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "select categorykey as text, id as value\nfrom pm_systemparametercategory\nwhere lower(pm_systemparametercategory.categorykey) like concat('%', lower({query}), '%')"
      },
      "countQuery": {
        "type": "string",
        "value": "select count(*)\nfrom pm_systemparametercategory \nwhere lower(pm_systemparametercategory.categorykey) like concat('%', lower({query}), '%')"
      },
      "queryParametersId": [
        {
          "type": "string",
          "value": "query"
        }
      ],
      "queryParametersName": [
        {
          "type": "string",
          "value": "query"
        }
      ],
      "queryParametersType": [
        {
          "type": "string",
          "value": "string"
        }
      ],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "value"
        },
        {
          "type": "string",
          "value": "text"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "value"
        },
        {
          "type": "string",
          "value": "text"
        }
      ]
    },
    "operation": "READ"
  },
  {
    "id": "widokZadanDataSource",
    "name": "Tabela zadań",
    "description": "sfsef",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "SELECT * FROM activities \nWHERE state = 1000001\norder by {orderProperty} {orderDirection} LIMIT {limit} OFFSET {start}"
      },
      "countQuery": {
        "type": "string",
        "value": "SELECT COUNT(*) FROM activities\nWHERE state = 1000001"
      },
      "queryParametersId": [],
      "queryParametersName": [],
      "queryParametersType": [],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "id"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "id"
        }
      ]
    },
    "operation": "READ"
  },
  {
    "id": "widokZadanPodsumowanie",
    "name": "Tabela zadań - podsumowanie",
    "description": "sfsef",
    "type": "jdbcQueryDatasource",
    "categories": null,
    "parameters": {
      "connection": {
        "type": "string",
        "value": "system"
      },
      "query": {
        "type": "string",
        "value": "SELECT sum(characterscount) as summary FROM (\n\tSELECT char_length(id) AS characterscount\n\tFROM activities \n\tWHERE state = 1000001\n        ORDER BY {orderProperty} {orderDirection} LIMIT {limit} OFFSET {start}\n) _"
      },
      "countQuery": {
        "type": "string",
        "value": "SELECT 1 AS count"
      },
      "queryParametersId": [],
      "queryParametersName": [],
      "queryParametersType": [],
      "queryResultColumnsId": [
        {
          "type": "string",
          "value": "summary"
        }
      ],
      "queryResultColumnsName": [
        {
          "type": "string",
          "value": "Liczba znaków w id"
        }
      ]
    },
    "operation": "READ"
  }
]

 

Import konfiguracji wtyczki DataViewer

Poniższy plik JSON należy wkleić w Administracja -> Konfiguracja systemu -> Konfiguracja widoków danych, a następnie kliknąć przycisk Zapisz.

{
  "menus": [
    {
      "id": "menu1",
      "name": "Parametry systemowe",
      "views": [
        {
          "id": "categories",
          "name": "Kategorie",
          "source": {
            "type": "DATASOURCE",
            "id": "zrodlo3"
          },
          "comments": true,
          "action": {
            "type": "showView",
            "viewId": "params",
            "mappings": [
              {
                "outputId": "id",
                "inputId": "categoryid"
              }
            ]
          },
          "inputs": [],
          "outputs": [
            {
              "id": "id",
              "name": "Id kategorii",
              "alias": "id",
              "primaryKey": true,
              "hidden": true
            },
            {
              "id": "categorykey",
              "name": "Klucz kategorii",
              "alias": "categorykey",
              "primaryKey": false,
              "hidden": false
            }
          ],
          "links": [],
          "default": true
        },
        {
          "id": "params",
          "name": "Parametry",
          "source": {
            "type": "DATASOURCE",
            "id": "zrodlo1"
          },
          "comments": true,
          "inputs": [
            {
              "id": "categoryid",
              "name": "Id kategori",
              "alias": "categoryid"
            }
          ],
          "outputs": [
            {
              "id": "id",
              "name": "Id parametru",
              "alias": "id",
              "primaryKey": true,
              "hidden": true
            },
            {
              "id": "parameterKey",
              "name": "Klucz parametru",
              "alias": "parameterkey",
              "primaryKey": false,
              "hidden": false
            },
            {
              "id": "categoryId",
              "name": "Klucz kategorii",
              "alias": "categoryid",
              "primaryKey": false,
              "hidden": true
            },
            {
              "id": "valuestring",
              "name": "Wartość tekstowa",
              "alias": "valuestring",
              "primaryKey": false,
              "hidden": false
            },
            {
              "id": "valuelong",
              "name": "Wartość liczbowa",
              "alias": "valuelong",
              "primaryKey": false,
              "hidden": false
            }
          ],
          "links": [
            {
              "id": "showCommentsWindowLink",
              "name": "Zarządzaj komentarzami",
              "action": {
                "type": "showComments"
              }
            }
          ],
          "default": false
        }
      ],
      "permissions": {
        "groups": [],
        "users": [
          "admin"
        ]
      }
    },
    {
      "id": "activities",
      "name": "Zadania v2",
      "views": [
        {
          "id": "widokZadan",
          "name": "Widok zadań",
          "source": {
            "type": "DATASOURCE",
            "id": "widokZadanDataSource"
          },
          "comments": true,
          "summary": {
            "loadOnce": false,
            "source": {
              "type": "DATASOURCE",
              "id": "widokZadanPodsumowanie"
            },
            "inputMappings": [
              {
                "inputId": "mockedInput",
                "alias": "mockedAlias"
              }
            ],
            "outputMappings": [
              {
                "outputId": "activityId",
                "alias": "summary"
              }
            ]
          },
          "inputs": [
            {
              "id": "mockedInput",
              "name": "Udawany input string",
              "alias": "mockedAlias",
              "type": "string"
            },
            {
              "id": "mockedInput2",
              "name": "Udawany input integer",
              "alias": "mockedAlias",
              "type": "integer"
            },
            {
              "id": "mockedInput3",
              "name": "Udawany input double",
              "alias": "mockedAlias",
              "type": "double"
            },
            {
              "id": "mockedInput4",
              "name": "Udawany input boolean",
              "alias": "mockedAlias",
              "type": "boolean"
            },
            {
              "id": "mockedInput5",
              "name": "Udawany input date",
              "alias": "mockedAlias",
              "type": "date"
            },
            {
              "id": "mockedInput6",
              "name": "Udawany input list",
              "alias": "mockedAlias",
              "type": "list",
              "source" : {
                "type": "DATASOURCE",
                "id": "categoriesListSource"
              }
            },
            {
              "id": "mockedInput7",
              "name": "Udawany input bez typu",
              "alias": "notExistingAlias"
            }
          ],
          "outputs": [
            {
              "id": "activityId",
              "name": "Id zadania",
              "alias": "id",
              "primaryKey": true,
              "hidden": false,
              "action": {
                "type": "showActivityForm",
                "mapping": {
                  "processId": "processId",
                  "activityId": "activityId"
                }
              }
            },
            {
              "id": "processId",
              "name": "Id procesu",
              "alias": "processid",
              "primaryKey": false,
              "hidden": false
            }
          ],
          "links": [
            {
              "id": "showCommentsWindowLink",
              "name": "Zarządzaj komentarzami",
              "action": {
                "type": "showComments"
              }
            },
            {
              "id": "goToActivityFormLink",
              "name": "Przejdź do formularza zadania",
              "action": {
                "type": "showActivityForm",
                "mapping": {
                  "processId": "processId",
                  "activityId": "activityId"
                }
              }
            },
            {
              "id": "getToActivityDetailsLink",
              "name": "Przejdź do historii zadania",
              "action": {
                "type": "showActivityDetails",
                "mapping": {
                  "processId": "processId",
                  "activityId": "activityId"
                }
              }
            },
            {
              "id": "getToProcessDetailsLink",
              "name": "Przejdź do historii procesu",
              "action": {
                "type": "showProcessDetails",
                "mapping": {
                  "processId": "processId"
                }
              }
            },
            {
              "id": "searchInGoogle",
              "name": "Szukaj w Google",
              "action": {
                "type": "openUrl",
                "url": "https://www.google.com/search",
                "absolute": true,
                "openInNewTab": true,
                "parameters": [
                  {
                    "name": "q",
                    "outputId": "processId"
                  }
                ]
              }
            }
          ],
          "default": true
        }
      ],
      "permissions": {
        "groups": [
          "Administrators"
        ],
        "users": []
      }
    }
  ]
}
  • No labels
Write a comment…