...
Tip | ||
---|---|---|
| ||
Polish | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WstępAPI Systemu PlusWorkflow udostępnia zbiór interfejsów i klas umożliwiających wykonywanie operacji systemowych. Najważniejszymi elementami API są usługi (Service) i klasy wyszukujące (Finder). Dostęp do tych elementów uzyskujemy poprzez klasy ServiceFactory oraz FinderFactory. Przykłady:
Gdy mamy stworzoną instancję klasy Service możemy wykonywać dowolne operacje. Lista dostępnych serwisów jest dostępna tutaj: Lista dostępnych serwisów Przykłady użycia usług
Pobieranie powiązanych obiektówWiększość obiektów w systemie ma powiązania z innymi obiektami. Powiązania te obrazują schemat bazy danych. W większości przypadków obiekt podstawowy np. User, Position itd., znajduje się w osobnej tabeli bazy danych dlatego obiekty powiązane nie są domyślnie pobierane, aby zminimalizować czas wykonywania zapytania. Aby umożliwić pobieranie obiektów powiązanych metody służące do pobierania danych tj. get(), getAll(),getBy,,,() są wyposażone w parametr 'joins', określający które elementy mają zostać dołączone do pobieranego obiektu. Każda klasa podstawowa ma zdefiniowane stałe statyczne, których możemy użyć jako wartości parametru 'joins'. Argument 'joins' możemy ustawiać przekazując do funkcji tablicę lub listę wartości oddzielonych przecinkiem (parametr jest typu String). Przykłady:
Jak widać na powyższym przykładzie możemy pobierać obiekty powiązane pośrednio. W przykładzie pobieramy stanowiska użytkownika i dla każdego stanowiska pobieramy również jednostkę organizacyjną.
|
English | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
IntroductionThe API of the PlusWorkflow System provides a set of interfaces and classes for performing system operations. The most important elements of the API are services (Service) and finder classes (Finder). These elements are accessed through the ServiceFactory and FinderFactory classes. Examples:
When we have an instance of the Service class created, we can perform any operations. The list of available services is available here: List of available services Examples of use
Download related objectsMost objects in the system have links to other objects. These relationships illustrate the database schema. In most cases, the primary object, e.g. User, Position, etc., is in a separate database table, so related objects are not fetched by default to minimize query execution time. To enable retrieval of related objects the methods used to retrieve data i.e. get(), getAll(), getBy,,,,() are provided with a parameter 'joins', specifying which elements are to be attached to the retrieved object. Each base class has defined static constants that we can use as values for the 'joins' parameter. We can set the 'joins' argument by passing an array or a comma-separated list of values to the function (the parameter is of type String). Examples:
As you can see from the example above, we can retrieve indirectly related objects. In the example, we retrieve user positions and for each position we also retrieve the organizational unit.
|
...