@eo-sdk/client 10.0.0-beta.5 → 10.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/app/eo-client/about-state/about-state.component.d.ts +0 -5
  2. package/app/eo-client/about-state/about-state.component.d.ts.map +1 -1
  3. package/app/eo-client/dashboard/dashboard.component.d.ts +23 -30
  4. package/app/eo-client/dashboard/dashboard.component.d.ts.map +1 -1
  5. package/app/eo-client/dashboard/widgets/iframe-widget/iframe-setup/iframe-setup.component.d.ts +19 -0
  6. package/app/eo-client/dashboard/widgets/iframe-widget/iframe-setup/iframe-setup.component.d.ts.map +1 -0
  7. package/app/eo-client/dashboard/widgets/iframe-widget/iframe-widget.component.d.ts +24 -0
  8. package/app/eo-client/dashboard/widgets/iframe-widget/iframe-widget.component.d.ts.map +1 -0
  9. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-setup/info-inbox-setup.component.d.ts +20 -0
  10. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-setup/info-inbox-setup.component.d.ts.map +1 -0
  11. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-widget.component.d.ts +19 -0
  12. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-widget.component.d.ts.map +1 -0
  13. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox.model.d.ts +4 -0
  14. package/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox.model.d.ts.map +1 -0
  15. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-setup/info-intray-setup.component.d.ts +25 -0
  16. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-setup/info-intray-setup.component.d.ts.map +1 -0
  17. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-widget.component.d.ts +20 -0
  18. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-widget.component.d.ts.map +1 -0
  19. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray.model.d.ts +4 -0
  20. package/app/eo-client/dashboard/widgets/info-intray-widget/info-intray.model.d.ts.map +1 -0
  21. package/app/eo-client/dashboard/widgets/last-edited-widget/last-edited-and-created.component.d.ts +28 -0
  22. package/app/eo-client/dashboard/widgets/last-edited-widget/last-edited-and-created.component.d.ts.map +1 -0
  23. package/app/eo-client/dashboard/widgets/search-widget/search-widget.component.d.ts +44 -0
  24. package/app/eo-client/dashboard/widgets/search-widget/search-widget.component.d.ts.map +1 -0
  25. package/app/eo-client/eo-client.module.d.ts +24 -13
  26. package/app/eo-client/eo-client.module.d.ts.map +1 -1
  27. package/app/eo-client/login/login.component.d.ts +8 -3
  28. package/app/eo-client/login/login.component.d.ts.map +1 -1
  29. package/app/eo-framework/actions/action.module.d.ts.map +1 -1
  30. package/app/eo-framework/actions/actions/cancel-signing-action/cancel-signing/cancel-signing.component.d.ts +2 -3
  31. package/app/eo-framework/actions/actions/cancel-signing-action/cancel-signing/cancel-signing.component.d.ts.map +1 -1
  32. package/app/eo-framework/app-shell/app-bar/app-search/app-search.component.d.ts.map +1 -1
  33. package/app/eo-framework/form-elements/organization/organization.component.d.ts +6 -3
  34. package/app/eo-framework/form-elements/organization/organization.component.d.ts.map +1 -1
  35. package/app/eo-framework/grid/filters/organization-filter.component.d.ts +2 -2
  36. package/app/eo-framework/grid/filters/organization-filter.component.d.ts.map +1 -1
  37. package/app/eo-framework/object-details/object-details.component.d.ts +9 -2
  38. package/app/eo-framework/object-details/object-details.component.d.ts.map +1 -1
  39. package/app/eo-framework/result-list/result-list.component.d.ts.map +1 -1
  40. package/app/eo-framework/ui/indexdata-summary/indexdata-summary.component.d.ts +1 -0
  41. package/app/eo-framework/ui/indexdata-summary/indexdata-summary.component.d.ts.map +1 -1
  42. package/assets/_default/i18n/de.json +30 -1
  43. package/assets/_default/i18n/en.json +30 -1
  44. package/assets/_default/svg/ic_noUrl.svg +1 -0
  45. package/assets/dashboard.json +47 -0
  46. package/esm2020/app/eo-client/about-state/about-state.component.mjs +5 -11
  47. package/esm2020/app/eo-client/dashboard/dashboard.component.mjs +133 -91
  48. package/esm2020/app/eo-client/dashboard/widgets/iframe-widget/iframe-setup/iframe-setup.component.mjs +59 -0
  49. package/esm2020/app/eo-client/dashboard/widgets/iframe-widget/iframe-widget.component.mjs +39 -0
  50. package/esm2020/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-setup/info-inbox-setup.component.mjs +53 -0
  51. package/esm2020/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox-widget.component.mjs +42 -0
  52. package/esm2020/app/eo-client/dashboard/widgets/info-inbox-widget/info-inbox.model.mjs +2 -0
  53. package/esm2020/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-setup/info-intray-setup.component.mjs +65 -0
  54. package/esm2020/app/eo-client/dashboard/widgets/info-intray-widget/info-intray-widget.component.mjs +43 -0
  55. package/esm2020/app/eo-client/dashboard/widgets/info-intray-widget/info-intray.model.mjs +2 -0
  56. package/esm2020/app/eo-client/dashboard/widgets/last-edited-widget/last-edited-and-created.component.mjs +117 -0
  57. package/esm2020/app/eo-client/dashboard/widgets/search-widget/search-widget.component.mjs +115 -0
  58. package/esm2020/app/eo-client/eo-client.module.mjs +44 -6
  59. package/esm2020/app/eo-client/favorite-state/favorite-state.component.mjs +2 -2
  60. package/esm2020/app/eo-client/login/login.component.mjs +33 -13
  61. package/esm2020/app/eo-client/settings/settings.component.mjs +3 -3
  62. package/esm2020/app/eo-framework/actions/action.module.mjs +1 -1
  63. package/esm2020/app/eo-framework/actions/actions/cancel-signing-action/cancel-signing/cancel-signing.component.mjs +11 -15
  64. package/esm2020/app/eo-framework/actions/actions/share-object-action/share-object/share-object.component.mjs +3 -3
  65. package/esm2020/app/eo-framework/app-shell/app-bar/app-search/app-search.component.mjs +15 -12
  66. package/esm2020/app/eo-framework/app-shell/app-bar/side-bar/side-bar.component.mjs +3 -3
  67. package/esm2020/app/eo-framework/form-elements/form-input/form-input.component.mjs +3 -3
  68. package/esm2020/app/eo-framework/form-elements/organization/organization.component.mjs +10 -6
  69. package/esm2020/app/eo-framework/form-elements/reference/reference.component.mjs +3 -3
  70. package/esm2020/app/eo-framework/form-elements/string/string.component.mjs +2 -2
  71. package/esm2020/app/eo-framework/frame/frame.component.mjs +2 -2
  72. package/esm2020/app/eo-framework/grid/filters/organization-filter.component.mjs +5 -5
  73. package/esm2020/app/eo-framework/object-details/object-details.component.mjs +27 -13
  74. package/esm2020/app/eo-framework/object-form/object-form/form-element/form-element.component.mjs +1 -1
  75. package/esm2020/app/eo-framework/prepare-details/prepare-details.component.mjs +3 -3
  76. package/esm2020/app/eo-framework/recyclebin-details/recyclebin-details.component.mjs +1 -1
  77. package/esm2020/app/eo-framework/result-list/result-list.component.mjs +4 -2
  78. package/esm2020/app/eo-framework/stored-query/stored-query-details/stored-query-details.component.mjs +3 -3
  79. package/esm2020/app/eo-framework/ui/indexdata-summary/indexdata-summary.component.mjs +20 -12
  80. package/esm2020/app/eo-framework/ui/signature-tab/signature-tab.component.mjs +3 -3
  81. package/esm2020/projects/eo-sdk/core/lib/service/auth/auth.service.mjs +24 -30
  82. package/esm2020/projects/eo-sdk/core/lib/service/capabilities/capabilities.model.mjs +1 -1
  83. package/esm2020/projects/eo-sdk/core/lib/service/capabilities/capabilities.service.mjs +8 -6
  84. package/esm2020/projects/eo-sdk/core/lib/service/config/config.service.mjs +1 -1
  85. package/esm2020/projects/eo-sdk/core/lib/service/signing/signing.service.mjs +12 -6
  86. package/esm2020/projects/eo-sdk/core/lib/service/user/user.service.mjs +11 -1
  87. package/fesm2015/eo-sdk-client-projects-eo-sdk-core.mjs +925 -914
  88. package/fesm2015/eo-sdk-client-projects-eo-sdk-core.mjs.map +1 -1
  89. package/fesm2015/eo-sdk-client.mjs +794 -256
  90. package/fesm2015/eo-sdk-client.mjs.map +1 -1
  91. package/fesm2020/eo-sdk-client-projects-eo-sdk-core.mjs +925 -914
  92. package/fesm2020/eo-sdk-client-projects-eo-sdk-core.mjs.map +1 -1
  93. package/fesm2020/eo-sdk-client.mjs +798 -255
  94. package/fesm2020/eo-sdk-client.mjs.map +1 -1
  95. package/package.json +5 -4
  96. package/projects/eo-sdk/core/lib/service/auth/auth.service.d.ts +14 -20
  97. package/projects/eo-sdk/core/lib/service/auth/auth.service.d.ts.map +1 -1
  98. package/projects/eo-sdk/core/lib/service/capabilities/capabilities.model.d.ts +4 -0
  99. package/projects/eo-sdk/core/lib/service/capabilities/capabilities.model.d.ts.map +1 -1
  100. package/projects/eo-sdk/core/lib/service/capabilities/capabilities.service.d.ts +3 -1
  101. package/projects/eo-sdk/core/lib/service/capabilities/capabilities.service.d.ts.map +1 -1
  102. package/projects/eo-sdk/core/lib/service/config/config.service.d.ts.map +1 -1
  103. package/projects/eo-sdk/core/lib/service/signing/signing.service.d.ts +4 -1
  104. package/projects/eo-sdk/core/lib/service/signing/signing.service.d.ts.map +1 -1
  105. package/projects/eo-sdk/core/lib/service/user/user.service.d.ts +6 -0
  106. package/projects/eo-sdk/core/lib/service/user/user.service.d.ts.map +1 -1
  107. package/scss/_eo-variables.scss +1 -0
  108. package/styles.css +1 -0
@@ -1,21 +1,20 @@
1
- import * as i2 from '@ngx-translate/core';
1
+ import * as i1 from '@ngx-translate/core';
2
2
  import { TranslateModule, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
3
3
  export { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core';
4
4
  import * as i1$1 from '@angular/common/http';
5
5
  import { HttpErrorResponse, HttpHeaders, HttpResponse, HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http';
6
6
  import * as i0 from '@angular/core';
7
7
  import { InjectionToken, Inject, Injectable, NgModule, APP_INITIALIZER, Optional, SkipSelf } from '@angular/core';
8
- import * as i1$2 from 'ngx-toastr';
8
+ import * as i1$3 from 'ngx-toastr';
9
9
  import { ToastrModule } from 'ngx-toastr';
10
10
  import { __decorate, __param } from 'tslib';
11
11
  import { EMPTY, throwError, Subject, of, forkJoin, Observable, ReplaySubject, BehaviorSubject, timer, interval } from 'rxjs';
12
- import { filter, debounceTime, switchMap, map, first, tap, finalize, shareReplay, catchError, expand, skipWhile, mergeMap, takeUntil } from 'rxjs/operators';
13
- import * as i6 from '@angular/common';
12
+ import { filter, map, tap, finalize, shareReplay, debounceTime, switchMap, first, catchError, expand, skipWhile, mergeMap, takeUntil } from 'rxjs/operators';
14
13
  import { DatePipe, registerLocaleData } from '@angular/common';
15
14
  import moment from 'moment';
16
- import * as i1 from '@ngx-pwa/local-storage';
17
- import * as FileSaver from 'file-saver';
18
15
  import * as _ from 'lodash';
16
+ import * as FileSaver from 'file-saver';
17
+ import * as i1$2 from '@ngx-pwa/local-storage';
19
18
  import localeDeCh from '@angular/common/locales/de-CH';
20
19
  import localeExtraDeCh from '@angular/common/locales/extra/de-CH';
21
20
  import localeDe from '@angular/common/locales/de';
@@ -1224,14 +1223,26 @@ class Config {
1224
1223
  return this.cfg['agent'];
1225
1224
  }
1226
1225
  }
1227
- Config.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: Config, deps: [{ token: i2.TranslateService }, { token: EventService }], target: i0.ɵɵFactoryTarget.Injectable });
1226
+ Config.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: Config, deps: [{ token: i1.TranslateService }, { token: EventService }], target: i0.ɵɵFactoryTarget.Injectable });
1228
1227
  Config.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: Config, providedIn: 'root' });
1229
1228
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: Config, decorators: [{
1230
1229
  type: Injectable,
1231
1230
  args: [{
1232
1231
  providedIn: 'root'
1233
1232
  }]
1234
- }], ctorParameters: function () { return [{ type: i2.TranslateService }, { type: EventService }]; } });
1233
+ }], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: EventService }]; } });
1234
+
1235
+ class EnvironmentEnaio {
1236
+ static isWebEnvironment() {
1237
+ return !EnvironmentEnaio.isDesktopEnvironment() && !EnvironmentEnaio.isMobileEnvironment();
1238
+ }
1239
+ static isMobileEnvironment() {
1240
+ return window.hasOwnProperty('cordova');
1241
+ }
1242
+ static isDesktopEnvironment() {
1243
+ return window.hasOwnProperty('process') && window['process'].versions.hasOwnProperty('electron');
1244
+ }
1245
+ }
1235
1246
 
1236
1247
  class EoUser {
1237
1248
  /**
@@ -1319,124 +1330,6 @@ class EoUser {
1319
1330
  }
1320
1331
  }
1321
1332
 
1322
- class EnvironmentEnaio {
1323
- static isWebEnvironment() {
1324
- return !EnvironmentEnaio.isDesktopEnvironment() && !EnvironmentEnaio.isMobileEnvironment();
1325
- }
1326
- static isMobileEnvironment() {
1327
- return window.hasOwnProperty('cordova');
1328
- }
1329
- static isDesktopEnvironment() {
1330
- return window.hasOwnProperty('process') && window['process'].versions.hasOwnProperty('electron');
1331
- }
1332
- }
1333
-
1334
- /**
1335
- * The apps central caching service. It will provide the app with an easy to use cache that
1336
- * is aware of the platform it is running on. So it abstracts the platform-specific implementations
1337
- * of a cache from the application.
1338
- */
1339
- class AppCacheService {
1340
- constructor(storage, storageMap) {
1341
- this.storage = storage;
1342
- this.storageMap = storageMap;
1343
- /**
1344
- * Key for storing system definition
1345
- */
1346
- this.SYSTEM_DEFINITION = 'eo.framework.cache.systemdefinition';
1347
- /**
1348
- * Key for storing system definition
1349
- */
1350
- this.HOSTS = 'eo.framework.cache.hosts';
1351
- /**
1352
- * Key for storing location history
1353
- */
1354
- this.LOCATION_HISTORY = 'eo.framework.cache.locations.history';
1355
- this.itemsMap = new Map();
1356
- // IndexedDB issue after update - refresh function (transform all wrapped items)
1357
- window['_ngStorageRefresh'] = () => this.getStorage().subscribe(storage => this.setStorage(storage).subscribe() && console.log(storage));
1358
- }
1359
- /**
1360
- * Writes an item to the storage.
1361
- * @param key The item's key
1362
- * @param value The value to be stored
1363
- * @param debounce The debounce time (default: 500) to reduce identical storage calls
1364
- * @returns Resolves true if setting the item succeeded, false otherwise
1365
- */
1366
- setItem(key, value, debounce = 500) {
1367
- if (!debounce) {
1368
- return this.storage.setItem(key, value);
1369
- }
1370
- else {
1371
- if (!this.itemsMap.has(key)) {
1372
- const subject = new Subject();
1373
- subject.pipe(debounceTime(debounce), switchMap(val => this.storage.setItem(key, val))).subscribe();
1374
- this.itemsMap.set(key, subject);
1375
- }
1376
- this.itemsMap.get(key).next(value);
1377
- return of(true);
1378
- }
1379
- }
1380
- /**
1381
- * Get a stored item by its key.
1382
- * @param key The item's key
1383
- * @returns The item's value if the key exists, null otherwise
1384
- */
1385
- getItem(key) {
1386
- return this.storage.getItem(key)
1387
- .pipe(map((item) => {
1388
- // IndexedDB issue after update (transform wrapped items)
1389
- return Object.keys(item || {}).join() === 'value' ? item.value : item;
1390
- }));
1391
- }
1392
- /**
1393
- * Removes an item from the storage.
1394
- * @param key The item's key
1395
- * @returns Resolves true if removing the item succeeded, false otherwise
1396
- */
1397
- removeItem(key) {
1398
- return this.storage.removeItem(key);
1399
- }
1400
- /**
1401
- * Deletes all items from local storage
1402
- * @param filter optional - Delete all keys that pass through filter
1403
- * @returns Resolves true if clearing all items succeeded, false otherwise
1404
- */
1405
- clear(filter) {
1406
- return filter
1407
- ? this.getStorageKeys().pipe(switchMap((keys) => {
1408
- const list = keys.filter((k) => filter(k)).map((k) => this.removeItem(k));
1409
- return list.length ? forkJoin(list).pipe(map(() => true)) : of(true);
1410
- }))
1411
- : this.storage.clear();
1412
- }
1413
- getStorageKeys() {
1414
- return new Observable((observer) => {
1415
- const keys = [];
1416
- this.storageMap.keys().subscribe({
1417
- next: (key) => keys.push(key),
1418
- complete: () => observer.next(keys)
1419
- });
1420
- }).pipe(first());
1421
- }
1422
- getStorage() {
1423
- return this.getStorageKeys().pipe(switchMap((keys) => keys.length
1424
- ? forkJoin(Utils.arrayToObject(keys, (o) => o, (k) => this.getItem(k)))
1425
- : of({})));
1426
- }
1427
- setStorage(options) {
1428
- return forkJoin(Object.keys(options || {}).map((k) => this.setItem(k, options[k])));
1429
- }
1430
- }
1431
- AppCacheService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, deps: [{ token: i1.LocalStorage }, { token: i1.StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
1432
- AppCacheService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, providedIn: 'root' });
1433
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, decorators: [{
1434
- type: Injectable,
1435
- args: [{
1436
- providedIn: 'root'
1437
- }]
1438
- }], ctorParameters: function () { return [{ type: i1.LocalStorage }, { type: i1.StorageMap }]; } });
1439
-
1440
1333
  /**
1441
1334
  * Wrapper for Cloud Services through Auth Service
1442
1335
  */
@@ -1594,60 +1487,43 @@ var ClipboardAction;
1594
1487
  })(ClipboardAction || (ClipboardAction = {}));
1595
1488
 
1596
1489
  /**
1597
- * Handles the systems capabilities. Capabilities are settings that enable/disable certain client features.
1490
+ * Representation of an object type. Object types are defined with the system definition and describe
1491
+ * different kind of objects that allowed to be created.
1598
1492
  */
1599
- class CapabilitiesService {
1600
- /**
1601
- * @ignore
1602
- */
1603
- constructor() {
1604
- }
1605
- /**
1606
- * Sets the capabilities based on a given object set by auth.service
1607
- *
1608
- * @param userCapabilities Object containing capabilities properties
1609
- * @param useSingleSingOn Whether or not to set up single signon on capability
1610
- * @returns The newly created capabilities object
1611
- */
1612
- setCapabilities(userCapabilities, useSingleSingOn) {
1613
- this.capabilities = {
1614
- bpm: userCapabilities.bpm,
1615
- favorites: userCapabilities.favorites,
1616
- followup: userCapabilities.followup,
1617
- subscription: userCapabilities.subscription,
1618
- intray: userCapabilities.intray,
1619
- storedqueries: userCapabilities.storedqueries,
1620
- recyclebin: userCapabilities.recyclebin,
1621
- inbox: userCapabilities.bpm || userCapabilities.followup || userCapabilities.subscription,
1622
- notifications: userCapabilities.followup || userCapabilities.subscription,
1623
- template: userCapabilities.template,
1624
- sso: useSingleSingOn || false
1625
- };
1626
- return this.capabilities;
1627
- }
1493
+ class ObjectType {
1628
1494
  /**
1629
- * Getter for the Capabilities
1495
+ * Creates a new instance
1496
+ * @param json The JSON object received from the backend. This will be used to construct the new object type instance
1630
1497
  */
1631
- getCapabilities() {
1632
- return this.capabilities;
1498
+ constructor(json) {
1499
+ this.id = json.id;
1500
+ this.implements = json.implements ? json.implements : [];
1501
+ this.isFolder = json.folder;
1502
+ this.isContextFolder = json.iscontextfolder;
1503
+ this.isAbstract = json.abstract;
1504
+ this.iconId = json.icon ? json.icon.id : null;
1505
+ this.maxFiles = json.maxfiles;
1506
+ this.minFiles = json.minfiles;
1507
+ this.name = json.name;
1508
+ this.qname = json.qname;
1509
+ this.label = json.label;
1510
+ this.description = json.description;
1511
+ this.group = json.group ? json.group.label : "";
1512
+ this.elements = json.elements;
1513
+ this.allowedcontexttypes = json.allowedcontexttypes
1514
+ ? json.allowedcontexttypes
1515
+ : [];
1516
+ this.supertypes = json.supertypes ? json.supertypes.map(t => t.name) : [];
1517
+ this.shareable = json.shareable;
1518
+ this.parenttypes = this.getParentTypes(json.allowedlocations);
1633
1519
  }
1634
- /**
1635
- * Check if Capability is present
1636
- * @param capability Capability to check for
1637
- * @returns True if the capability is set, false otherwise
1638
- */
1639
- hasCapability(capability) {
1640
- return this.capabilities[capability];
1520
+ getParentTypes(allowedlocations) {
1521
+ if (allowedlocations) {
1522
+ return allowedlocations.parenttypes.map(types => types.name);
1523
+ }
1524
+ return [];
1641
1525
  }
1642
1526
  }
1643
- CapabilitiesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1644
- CapabilitiesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, providedIn: 'root' });
1645
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, decorators: [{
1646
- type: Injectable,
1647
- args: [{
1648
- providedIn: 'root'
1649
- }]
1650
- }], ctorParameters: function () { return []; } });
1651
1527
 
1652
1528
  // @ts-ignore
1653
1529
  /**
@@ -1996,218 +1872,713 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
1996
1872
  }] }, { type: Logger }, { type: Config }]; } });
1997
1873
 
1998
1874
  /**
1999
- * Items emitted by the inbox service
1875
+ * The apps central caching service. It will provide the app with an easy to use cache that
1876
+ * is aware of the platform it is running on. So it abstracts the platform-specific implementations
1877
+ * of a cache from the application.
2000
1878
  */
2001
- class InboxItem {
2002
- /**
2003
- * Creates a new instance
2004
- * @param json The JSON object received from the backend. This will be used to construct the new inbox item instance
2005
- */
2006
- constructor(json) {
2007
- // todo: jsut use Object assign when backend changes are done
2008
- // Object.assign(this, json);
2009
- this.id = json.inboxentryid;
2010
- this.title = json.title;
2011
- this.description = json.description;
2012
- this.type = json.type;
2013
- this.sourceId = json.source ? json.source.id : null;
2014
- this.iconId = json.target && json.target.icon ? json.target.icon.id : null;
2015
- this.accepted = json.accepted;
2016
- this.isdeputy = json.isdeputy;
2017
- this.duetime = json.duetime;
2018
- this.received = json.receivetime;
2019
- this.target = json.target;
1879
+ class AppCacheService {
1880
+ constructor(storage, storageMap) {
1881
+ this.storage = storage;
1882
+ this.storageMap = storageMap;
1883
+ /**
1884
+ * Key for storing system definition
1885
+ */
1886
+ this.SYSTEM_DEFINITION = 'eo.framework.cache.systemdefinition';
1887
+ /**
1888
+ * Key for storing system definition
1889
+ */
1890
+ this.HOSTS = 'eo.framework.cache.hosts';
1891
+ /**
1892
+ * Key for storing location history
1893
+ */
1894
+ this.LOCATION_HISTORY = 'eo.framework.cache.locations.history';
1895
+ this.itemsMap = new Map();
1896
+ // IndexedDB issue after update - refresh function (transform all wrapped items)
1897
+ window['_ngStorageRefresh'] = () => this.getStorage().subscribe(storage => this.setStorage(storage).subscribe() && console.log(storage));
2020
1898
  }
2021
1899
  /**
2022
- * Determines whether or not the inbox item is overdue
2023
- * @returns True when inbox item is overdue, false otherwise
1900
+ * Writes an item to the storage.
1901
+ * @param key The item's key
1902
+ * @param value The value to be stored
1903
+ * @param debounce The debounce time (default: 500) to reduce identical storage calls
1904
+ * @returns Resolves true if setting the item succeeded, false otherwise
2024
1905
  */
2025
- isOverdue() {
2026
- return this.duetime && moment(this.duetime).isBefore(moment());
2027
- }
2028
- }
2029
- InboxItem.TYPE_BPM = 'BPM';
2030
- InboxItem.TYPE_RESUBMISSION = 'RESUBMISSION';
2031
- InboxItem.TYPE_SUBSCRIPTION = 'SUBSCRIPTION';
2032
-
2033
- /**
2034
- * InboxService handles interaction with the inbox service on the backend side.
2035
- */
2036
- class InboxService {
2037
- constructor(backend) {
2038
- this.backend = backend;
2039
- // backends maximum page size
2040
- this.MAX_PAGE_SIZE = 1000;
2041
- this.inboxStateSource = new ReplaySubject(1);
2042
- this.inboxState$ = this.inboxStateSource.asObservable();
2043
- this.inboxItemsSource = new ReplaySubject(1);
2044
- this.inboxItemsGridData$ = this.inboxItemsSource.asObservable();
2045
- this.inboxItems$ = this.inboxItemsGridData$.pipe(this.backend.gridDataFilter);
2046
- }
2047
- /**
2048
- * Fetches inbox items from the backend.
2049
- *
2050
- * @returns Observable of inbox items.
2051
- */
2052
- getItems() {
2053
- return this.getAllPages()
2054
- .pipe(map(res => res.map(item => new InboxItem(item))), tap(res => {
2055
- this.inboxItems = res;
2056
- this.inboxItemsSource.next(this.inboxItems);
2057
- }), catchError(Utils.throw(() => this.inboxItemsSource.next([]))));
2058
- }
2059
- getAllPages() {
2060
- let items = [];
2061
- return this.getPage().pipe(expand(res => {
2062
- return !res.last ? this.getPage(res.pageable.pageNumber + 1) : EMPTY;
2063
- }), tap(res => items = [...items, ...res.content]), skipWhile(res => !res.last), map(_ => items));
2064
- }
2065
- getPage(index) {
2066
- return this.backend
2067
- .getJson(`/get?size=${this.MAX_PAGE_SIZE}&page=${index || 0}`, this.backend.getInboxBase());
1906
+ setItem(key, value, debounce = 500) {
1907
+ if (!debounce) {
1908
+ return this.storage.setItem(key, value);
1909
+ }
1910
+ else {
1911
+ if (!this.itemsMap.has(key)) {
1912
+ const subject = new Subject();
1913
+ subject.pipe(debounceTime(debounce), switchMap(val => this.storage.setItem(key, val))).subscribe();
1914
+ this.itemsMap.set(key, subject);
1915
+ }
1916
+ this.itemsMap.get(key).next(value);
1917
+ return of(true);
1918
+ }
2068
1919
  }
2069
1920
  /**
2070
- * Fetches state informations for the users inbox
2071
- *
2072
- * @returns inbox state object
1921
+ * Get a stored item by its key.
1922
+ * @param key The item's key
1923
+ * @returns The item's value if the key exists, null otherwise
2073
1924
  */
2074
- getState() {
2075
- return this.inboxState;
1925
+ getItem(key) {
1926
+ return this.storage.getItem(key)
1927
+ .pipe(map((item) => {
1928
+ // IndexedDB issue after update (transform wrapped items)
1929
+ return Object.keys(item || {}).join() === 'value' ? item.value : item;
1930
+ }));
2076
1931
  }
2077
1932
  /**
2078
- * Public access to fetch inbox
1933
+ * Removes an item from the storage.
1934
+ * @param key The item's key
1935
+ * @returns Resolves true if removing the item succeeded, false otherwise
2079
1936
  */
2080
- refreshInboxState() {
2081
- this.fetchInboxState();
1937
+ removeItem(key) {
1938
+ return this.storage.removeItem(key);
2082
1939
  }
2083
1940
  /**
2084
- * Retrieve inbox state
1941
+ * Deletes all items from local storage
1942
+ * @param filter optional - Delete all keys that pass through filter
1943
+ * @returns Resolves true if clearing all items succeeded, false otherwise
2085
1944
  */
2086
- fetchInboxState() {
2087
- this.backend
2088
- .getJson('/state', this.backend.getInboxBase())
2089
- .pipe(map(res => res))
2090
- .subscribe(res => {
2091
- this.inboxState = res;
2092
- this.inboxStateSource.next(this.inboxState);
2093
- }, Utils.logError(null, 'Failed to fetch inbox state!'));
1945
+ clear(filter) {
1946
+ return filter
1947
+ ? this.getStorageKeys().pipe(switchMap((keys) => {
1948
+ const list = keys.filter((k) => filter(k)).map((k) => this.removeItem(k));
1949
+ return list.length ? forkJoin(list).pipe(map(() => true)) : of(true);
1950
+ }))
1951
+ : this.storage.clear();
2094
1952
  }
2095
- /**
2096
- * Removes an item from the inbox.
2097
- *
2098
- * @param item inbox item to be removed
2099
- * @returns Observable<any>
2100
- */
2101
- removeItem(item) {
2102
- return this.backend
2103
- .del('/' + item.id, this.backend.getInboxBase())
2104
- .pipe(tap(() => this.updateInboxItems(item.id)));
1953
+ getStorageKeys() {
1954
+ return new Observable((observer) => {
1955
+ const keys = [];
1956
+ this.storageMap.keys().subscribe({
1957
+ next: (key) => keys.push(key),
1958
+ complete: () => observer.next(keys)
1959
+ });
1960
+ }).pipe(first());
2105
1961
  }
2106
- /**
2107
- * Soft update for data in the inbox.
2108
- *
2109
- * @param id
2110
- * @param item
2111
- * @param multi
2112
- */
2113
- updateInboxItems(id, item, multi) {
2114
- if (this.backend.update(this.inboxItems, multi || [{ id, item }])) {
2115
- this.inboxItemsSource.next(this.inboxItems);
2116
- }
1962
+ getStorage() {
1963
+ return this.getStorageKeys().pipe(switchMap((keys) => keys.length
1964
+ ? forkJoin(Utils.arrayToObject(keys, (o) => o, (k) => this.getItem(k)))
1965
+ : of({})));
2117
1966
  }
2118
- /**
2119
- * Marks an inbox item as read.
2120
- *
2121
- * @param item the item to be marked as read
2122
- * @returns Observable<any>
2123
- */
2124
- markAsRead(item) {
2125
- return this.backend.put('/read/' + item.id, this.backend.getInboxBase());
1967
+ setStorage(options) {
1968
+ return forkJoin(Object.keys(options || {}).map((k) => this.setItem(k, options[k])));
2126
1969
  }
2127
1970
  }
2128
- InboxService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, deps: [{ token: BackendService }], target: i0.ɵɵFactoryTarget.Injectable });
2129
- InboxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, providedIn: 'root' });
2130
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, decorators: [{
1971
+ AppCacheService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, deps: [{ token: i1$2.LocalStorage }, { token: i1$2.StorageMap }], target: i0.ɵɵFactoryTarget.Injectable });
1972
+ AppCacheService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, providedIn: 'root' });
1973
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AppCacheService, decorators: [{
2131
1974
  type: Injectable,
2132
1975
  args: [{
2133
1976
  providedIn: 'root'
2134
1977
  }]
2135
- }], ctorParameters: function () { return [{ type: BackendService }]; } });
1978
+ }], ctorParameters: function () { return [{ type: i1$2.LocalStorage }, { type: i1$2.StorageMap }]; } });
2136
1979
 
2137
1980
  /**
2138
- * `BpmService` handles interaction related to BPM tasks.
2139
- *
2140
- * The main parts provided and used by this service are Processes and WorkItems.
2141
- * Processes are defined on the backend side. They describe a set of tasks that will be executed by the process.
2142
- * Tasks that require user interaction are referred to as WorkItems.
2143
- *
2144
- * Processes can be related to a special object type, but they don't have to. In addition to that they can refer
2145
- * to dms objects.
1981
+ * Collection of System Services
2146
1982
  */
2147
- class BpmService {
2148
- constructor(capabilities, backend, eventService, inboxService) {
2149
- this.capabilities = capabilities;
1983
+ class SystemService {
1984
+ constructor(backend, logger, eventService, appCache) {
2150
1985
  this.backend = backend;
1986
+ this.logger = logger;
2151
1987
  this.eventService = eventService;
2152
- this.inboxService = inboxService;
2153
- this.processItemsSource = new ReplaySubject(1);
2154
- /**
2155
- * Long term observable emitting the current processes
2156
- */
2157
- this.processItems$ = this.processItemsSource.asObservable();
1988
+ this.appCache = appCache;
1989
+ this.systemSource = new ReplaySubject();
1990
+ this.system$ = this.systemSource.asObservable();
1991
+ // session cache for object type forms
1992
+ this.objectTypeForms = [];
1993
+ this.cachedRoles = [];
1994
+ this.eventService.on(EnaioEvent.SYSTEM_STATUS_SCHEMA_CHANGED).subscribe(() => {
1995
+ this.fetchSystemDefinition(this.user);
1996
+ });
1997
+ }
1998
+ set system(s) {
1999
+ this._system = s;
2000
+ }
2001
+ get system() {
2002
+ return JSON.parse(JSON.stringify(this._system));
2158
2003
  }
2159
2004
  /**
2160
- * Retrieve all processes of the current user.
2005
+ * Gets all ObjectTypes
2161
2006
  *
2162
- * @param size Maximum number of processes to be fetched
2163
- * @returns List of Processes
2007
+ * @returns An array containing all object types
2164
2008
  */
2165
- getProcesses(size = 1000) {
2166
- return this.backend
2167
- .getJson(`/process/user?size=${size}`, this.backend.getBpmBase())
2168
- .pipe(map(response => response.content.map(item => new Process(item))), tap((processes) => {
2169
- this.processItems = processes;
2170
- this.processItemsSource.next(this.processItems);
2171
- }));
2009
+ getObjectTypes() {
2010
+ return this.system.types;
2172
2011
  }
2173
2012
  /**
2174
- * Getter for the executable Processes. If types are provided, you'll get
2175
- * only the processes that are executable for all of them
2176
- * @param types List of dms object types to fetch executable processes for
2177
- * @param useCached If the cached data should be returned rather than requesting again
2178
- * @param additionalData If the additional form data should be also included
2179
- * @param modelid The process model ID to only return the data for one process
2180
- * @returns List of executable processes
2013
+ * Gets an ObjectType by name.
2014
+ *
2015
+ * @param objectTypeName The name of the object type
2016
+ * @returns the ObjectType matching the given name
2181
2017
  */
2182
- getExecutableProcesses(types, useCached, additionalData, modelid, global) {
2183
- if (this.capabilities.hasCapability('bpm')) {
2184
- return (!!this.executableProcesses && useCached) ? of(this.executableProcesses) : this.fetchExecutableProcesses(types, additionalData, modelid, global);
2185
- }
2186
- else {
2187
- return of([]);
2188
- }
2189
- }
2190
- initExecutableProcesses() {
2191
- let uri = '/bpm/process/executable';
2192
- return this.backend.get(uri).pipe(tap(res => this.hasMainExecutableProcesses = res?.length));
2018
+ getObjectType(objectTypeName) {
2019
+ return this.system.types.find(t => t.name === objectTypeName);
2193
2020
  }
2194
2021
  /**
2195
- * Gets executable Processes for a given set of dms object.You'll get
2196
- * only the processes that are executable for all of them.
2197
- * @param dmsObjects List of dms objects to fetch executable processes for
2198
- * @returns List of executable processes
2022
+ * Get form elements from form model. This is useful if you have to fetch them
2023
+ * for a special situation like SEARCH
2024
+ * @param objectTypeName ObjectType to fetch elements for
2025
+ * @param situation Form model situation to be fetched
2026
+ * @param isContextType Flag indicating that the form model should be fetched for a context mode
2199
2027
  */
2200
- getExecutableProcessesForDmsObjects(dmsObjects) {
2201
- return this.getExecutableProcesses(dmsObjects.map(o => o.typeName), false, true);
2028
+ getFormElementsFromFormModel(objectTypeName, situation, isContextType) {
2029
+ return this.getObjectTypeForm(objectTypeName, situation, isContextType ? 'CONTEXT' : null).pipe(switchMap(model => {
2030
+ const elements = [];
2031
+ this.processFormModelElements(model, elements);
2032
+ return of(elements);
2033
+ }));
2034
+ }
2035
+ processFormModelElements(model, elements) {
2036
+ model.elements.forEach(e => {
2037
+ if (e.type !== "o2mGroup" && e.type !== "o2mGroupStack") {
2038
+ elements.push(e);
2039
+ }
2040
+ else if (e.elements && e.elements.length) {
2041
+ this.processFormModelElements(e, elements);
2042
+ }
2043
+ });
2202
2044
  }
2203
2045
  /**
2204
- * Fetches executable Processes from the backend.
2205
- * @param types List of dms object types to fetch executable processes for
2206
- * @param additionalData If the additional form data should be also included
2207
- * @param modelid The process model ID to only return the data for one process
2208
- * @returns List of executable processes
2046
+ * Checks whether or not the given type implements a given supertype
2047
+ * @param type Type to be checked
2048
+ * @param superTypeName Name of the supertype
2209
2049
  */
2210
- fetchExecutableProcesses(types, additionalData, modelid, global) {
2050
+ implementsType(type, superTypeName) {
2051
+ return type.name === superTypeName || (type.implements && type.implements.indexOf(superTypeName) !== -1);
2052
+ }
2053
+ /**
2054
+ * Gets a codesystem
2055
+ *
2056
+ * @param id The codesystems id
2057
+ * @returns The codesystem object matching the given id
2058
+ */
2059
+ getCodesystem(id) {
2060
+ return this.system.codesystems.find(t => t.id === id || t.name === id);
2061
+ }
2062
+ /**
2063
+ * Get the form model of an object type.
2064
+ *
2065
+ * @param objectTypeName The object type name
2066
+ * @param situation The form situation to be fetched
2067
+ * @param mode Form mode to fetch (e.g. CONTEXT)
2068
+ * @returns The object type form model
2069
+ */
2070
+ getObjectTypeForm(objectTypeName, situation, mode) {
2071
+ /** check if we have a cached form first */
2072
+ let cachedForm;
2073
+ let i = 0;
2074
+ while (!cachedForm && i < this.objectTypeForms.length) {
2075
+ if (this.objectTypeForms[i].name === objectTypeName &&
2076
+ this.objectTypeForms[i].mode === mode &&
2077
+ this.objectTypeForms[i].situation === situation) {
2078
+ cachedForm = this.objectTypeForms[i];
2079
+ }
2080
+ i++;
2081
+ }
2082
+ if (cachedForm) {
2083
+ /** return a clone of the cached model as otherwise model changes will be added to the chached model */
2084
+ return of(_.cloneDeep(cachedForm));
2085
+ }
2086
+ else {
2087
+ let uri = `/ui/form/${objectTypeName}?situation=${situation}`;
2088
+ uri += !!mode ? `&formmode=${mode}` : '';
2089
+ /** fetch and cache the requested form, if no cached version was found */
2090
+ return this.backend.getViaTempCache(uri, () => this.backend
2091
+ .getJson(uri)
2092
+ .pipe(tap((model) => this.objectTypeForms.push(_.cloneDeep(model)))));
2093
+ }
2094
+ }
2095
+ /**
2096
+ * Fetches the backends system definition and updates system$ Observable.
2097
+ * Subscribe to the system$ observable instead of calling this function, otherwise you'll trigger fetching the
2098
+ * system definition every time.
2099
+ *
2100
+ * @param user The user to load the system definition for
2101
+ * @returns true when successfull
2102
+ */
2103
+ getSystemDefinition(user) {
2104
+ this.user = user;
2105
+ // todo: temporary: OrgChanges could not be recognized but affect object definition
2106
+ return this.fetchSystemDefinition(user);
2107
+ // todo: enable again when OrgChanges are recognizable (DO NOT DELETE!)
2108
+ // // is there a cached version
2109
+ // return this.appCache
2110
+ // .getItem(this.appCache.SYSTEM_DEFINITION)
2111
+ // .catch((error) => {
2112
+ // this.logger.error('Error fetching cached version of system definition.', error);
2113
+ // return this.fetchSystemDefinition(user);
2114
+ // })
2115
+ // .flatMap((cachedSystemDefinition: any) => {
2116
+ //
2117
+ // // yes? then check if it's up to date
2118
+ // if (cachedSystemDefinition) {
2119
+ //
2120
+ // if (
2121
+ // user.schema.version !== cachedSystemDefinition.info.version ||
2122
+ // user.id !== cachedSystemDefinition.info.user ||
2123
+ // user.getSchemaLocale() !== cachedSystemDefinition.info.locale
2124
+ // ) {
2125
+ // return this.fetchSystemDefinition(user);
2126
+ // } else {
2127
+ // // cache is up to date. return the cached one
2128
+ // this.logger.debug('System definition is up to date, using cached version.', cachedSystemDefinition);
2129
+ // this.system = cachedSystemDefinition;
2130
+ // this.systemSource.next(this.system);
2131
+ // return of(true);
2132
+ // }
2133
+ // } else {
2134
+ // // no cached systemDefinition found
2135
+ // return this.fetchSystemDefinition(user);
2136
+ // }
2137
+ // });
2138
+ }
2139
+ /**
2140
+ * Creates a value depending on a given Type
2141
+ *
2142
+ * @param string valueType
2143
+ * @returns any
2144
+ */
2145
+ getDefaultValue(valueType) {
2146
+ let defaultValue;
2147
+ switch (valueType) {
2148
+ case 'CURRENT_USER': {
2149
+ defaultValue = this.user.name;
2150
+ break;
2151
+ }
2152
+ case 'CURRENT_USER_NAME': {
2153
+ defaultValue = this.user.title;
2154
+ break;
2155
+ }
2156
+ case 'CURRENT_DATETIME': {
2157
+ defaultValue = new Date();
2158
+ break;
2159
+ }
2160
+ case 'CURRENT_DATE': {
2161
+ defaultValue = moment().startOf('day').toDate();
2162
+ break;
2163
+ }
2164
+ case 'YEAR': {
2165
+ defaultValue = moment().year();
2166
+ break;
2167
+ }
2168
+ case 'MONTH': {
2169
+ defaultValue = moment().month() + 1;
2170
+ break;
2171
+ }
2172
+ case 'DAY': {
2173
+ defaultValue = moment().date();
2174
+ break;
2175
+ }
2176
+ case 'HOUR': {
2177
+ defaultValue = moment().hour();
2178
+ break;
2179
+ }
2180
+ case 'MINUTE': {
2181
+ defaultValue = moment().minute();
2182
+ break;
2183
+ }
2184
+ case 'SECOND': {
2185
+ defaultValue = moment().second();
2186
+ break;
2187
+ }
2188
+ case 'WEEK_OF_YEAR': {
2189
+ defaultValue = moment().isoWeek();
2190
+ break;
2191
+ }
2192
+ case 'FIRST_DAY_OF_WEEK': {
2193
+ defaultValue = moment().startOf('isoWeek').toDate();
2194
+ break;
2195
+ }
2196
+ case 'FIRST_DAY_OF_MONTH': {
2197
+ defaultValue = moment().startOf('month').toDate();
2198
+ break;
2199
+ }
2200
+ case 'FIRST_DAY_OF_YEAR': {
2201
+ defaultValue = moment().startOf('year').toDate();
2202
+ break;
2203
+ }
2204
+ }
2205
+ return defaultValue;
2206
+ }
2207
+ /**
2208
+ * Fetches the system definition from the server. Provided params are used for storing the
2209
+ * recent version in cache.
2210
+ *
2211
+ * @param user The user to fetch the system definition for
2212
+ * @return boolean
2213
+ */
2214
+ fetchSystemDefinition(user) {
2215
+ const fetches = [
2216
+ this.backend.getJson('/system/type/list?elements=true&basetypes=true'),
2217
+ this.backend.getJson('/system/cs/list?elements=true')
2218
+ ];
2219
+ return forkJoin(fetches)
2220
+ .pipe(catchError(Utils.catch((error) => {
2221
+ this.logger.error('Error fetching recent version of system definition from server.', error);
2222
+ this.systemSource.error('Error fetching recent version of system definition from server.');
2223
+ })), map((data) => {
2224
+ this.objectTypeForms = [];
2225
+ const system = {
2226
+ /**
2227
+ * info about the current system definition
2228
+ */
2229
+ info: {
2230
+ user: user.id,
2231
+ locale: user.getSchemaLocale(),
2232
+ version: user.schema.version
2233
+ },
2234
+ /**
2235
+ * supported backend locales
2236
+ */
2237
+ locales: user.schema.supportedLocales,
2238
+ /**
2239
+ * object type definitions
2240
+ */
2241
+ types: [],
2242
+ /**
2243
+ * codesystems cache
2244
+ */
2245
+ codesystems: []
2246
+ };
2247
+ const types = data[0];
2248
+ system.types = types.map(t => new ObjectType(t));
2249
+ system.codesystems = data[1];
2250
+ this.system = system;
2251
+ this.systemSource.next(system);
2252
+ this.logger.debug('Fetched new version of system definition (user: ' + user.id + ', version: ' + user.schema.version + ').');
2253
+ this.appCache
2254
+ .setItem(this.appCache.SYSTEM_DEFINITION, system)
2255
+ .subscribe(() => {
2256
+ this.logger.debug('Cached recent version');
2257
+ }, Utils.logError(null, 'Error caching recent version of system definition.'));
2258
+ return true;
2259
+ }));
2260
+ }
2261
+ /**
2262
+ * Retrieve an organization object by its ID
2263
+ * @param id ID of org object
2264
+ */
2265
+ getOrganizationObjectById(id) {
2266
+ return this.backend.getJson(`/organization/id/${id}`);
2267
+ }
2268
+ /**
2269
+ * Fetches the organization object for a given name.
2270
+ *
2271
+ * @param name The name to fetch object for
2272
+ * @returns
2273
+ */
2274
+ getOrganizationObject(name) {
2275
+ return this.getOrganizationObjects([name]).pipe(map(res => res[0]));
2276
+ }
2277
+ /**
2278
+ * Fetches a collection of organization objects
2279
+ *
2280
+ * @param names Array of names to fetch objects for
2281
+ * @returns A Array of Organization Objects
2282
+ */
2283
+ getOrganizationObjects(names) {
2284
+ const toFetch = names.map(name => this.backend.getJson(`/organization/name/${name}`).pipe(catchError(error => of({ id: name, active: false }))));
2285
+ return forkJoin(toFetch);
2286
+ }
2287
+ /**
2288
+ * Fetches a collection of organization roles
2289
+ *
2290
+ * @return A Array of Organization Roles
2291
+ */
2292
+ getRoles() {
2293
+ if (this.cachedRoles.length) {
2294
+ return of(this.cachedRoles);
2295
+ }
2296
+ else {
2297
+ return this.backend
2298
+ .get('/organization/role')
2299
+ .pipe(map(o => o), tap(roles => (this.cachedRoles = roles)));
2300
+ }
2301
+ }
2302
+ }
2303
+ SystemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, deps: [{ token: BackendService }, { token: Logger }, { token: EventService }, { token: AppCacheService }], target: i0.ɵɵFactoryTarget.Injectable });
2304
+ SystemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, providedIn: 'root' });
2305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, decorators: [{
2306
+ type: Injectable,
2307
+ args: [{
2308
+ providedIn: 'root'
2309
+ }]
2310
+ }], ctorParameters: function () { return [{ type: BackendService }, { type: Logger }, { type: EventService }, { type: AppCacheService }]; } });
2311
+
2312
+ /**
2313
+ * Handles the systems capabilities. Capabilities are settings that enable/disable certain client features.
2314
+ */
2315
+ class CapabilitiesService {
2316
+ /**
2317
+ * @ignore
2318
+ */
2319
+ constructor(system) {
2320
+ this.system = system;
2321
+ }
2322
+ /**
2323
+ * Sets the capabilities based on a given object set by auth.service
2324
+ *
2325
+ * @param userCapabilities Object containing capabilities properties
2326
+ * @param useSingleSingOn Whether or not to set up single signon on capability
2327
+ * @returns The newly created capabilities object
2328
+ */
2329
+ setCapabilities(userCapabilities, useSingleSingOn) {
2330
+ this.capabilities = {
2331
+ bpm: userCapabilities.bpm,
2332
+ favorites: userCapabilities.favorites,
2333
+ followup: userCapabilities.followup,
2334
+ subscription: userCapabilities.subscription,
2335
+ intray: userCapabilities.intray,
2336
+ storedqueries: userCapabilities.storedqueries,
2337
+ recyclebin: userCapabilities.recyclebin,
2338
+ inbox: userCapabilities.bpm || userCapabilities.followup || userCapabilities.subscription,
2339
+ notifications: userCapabilities.followup || userCapabilities.subscription,
2340
+ template: userCapabilities.template,
2341
+ sso: useSingleSingOn || false,
2342
+ };
2343
+ return this.capabilities;
2344
+ }
2345
+ /**
2346
+ * Getter for the Capabilities
2347
+ */
2348
+ getCapabilities() {
2349
+ return { ...this.capabilities, signing: !!this.system.getObjectType('yuvsigning') };
2350
+ }
2351
+ /**
2352
+ * Check if Capability is present
2353
+ * @param capability Capability to check for
2354
+ * @returns True if the capability is set, false otherwise
2355
+ */
2356
+ hasCapability(capability) {
2357
+ return this.capabilities[capability];
2358
+ }
2359
+ }
2360
+ CapabilitiesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, deps: [{ token: SystemService }], target: i0.ɵɵFactoryTarget.Injectable });
2361
+ CapabilitiesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, providedIn: 'root' });
2362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: CapabilitiesService, decorators: [{
2363
+ type: Injectable,
2364
+ args: [{
2365
+ providedIn: 'root'
2366
+ }]
2367
+ }], ctorParameters: function () { return [{ type: SystemService }]; } });
2368
+
2369
+ /**
2370
+ * Items emitted by the inbox service
2371
+ */
2372
+ class InboxItem {
2373
+ /**
2374
+ * Creates a new instance
2375
+ * @param json The JSON object received from the backend. This will be used to construct the new inbox item instance
2376
+ */
2377
+ constructor(json) {
2378
+ // todo: jsut use Object assign when backend changes are done
2379
+ // Object.assign(this, json);
2380
+ this.id = json.inboxentryid;
2381
+ this.title = json.title;
2382
+ this.description = json.description;
2383
+ this.type = json.type;
2384
+ this.sourceId = json.source ? json.source.id : null;
2385
+ this.iconId = json.target && json.target.icon ? json.target.icon.id : null;
2386
+ this.accepted = json.accepted;
2387
+ this.isdeputy = json.isdeputy;
2388
+ this.duetime = json.duetime;
2389
+ this.received = json.receivetime;
2390
+ this.target = json.target;
2391
+ }
2392
+ /**
2393
+ * Determines whether or not the inbox item is overdue
2394
+ * @returns True when inbox item is overdue, false otherwise
2395
+ */
2396
+ isOverdue() {
2397
+ return this.duetime && moment(this.duetime).isBefore(moment());
2398
+ }
2399
+ }
2400
+ InboxItem.TYPE_BPM = 'BPM';
2401
+ InboxItem.TYPE_RESUBMISSION = 'RESUBMISSION';
2402
+ InboxItem.TYPE_SUBSCRIPTION = 'SUBSCRIPTION';
2403
+
2404
+ /**
2405
+ * InboxService handles interaction with the inbox service on the backend side.
2406
+ */
2407
+ class InboxService {
2408
+ constructor(backend) {
2409
+ this.backend = backend;
2410
+ // backends maximum page size
2411
+ this.MAX_PAGE_SIZE = 1000;
2412
+ this.inboxStateSource = new ReplaySubject(1);
2413
+ this.inboxState$ = this.inboxStateSource.asObservable();
2414
+ this.inboxItemsSource = new ReplaySubject(1);
2415
+ this.inboxItemsGridData$ = this.inboxItemsSource.asObservable();
2416
+ this.inboxItems$ = this.inboxItemsGridData$.pipe(this.backend.gridDataFilter);
2417
+ }
2418
+ /**
2419
+ * Fetches inbox items from the backend.
2420
+ *
2421
+ * @returns Observable of inbox items.
2422
+ */
2423
+ getItems() {
2424
+ return this.getAllPages()
2425
+ .pipe(map(res => res.map(item => new InboxItem(item))), tap(res => {
2426
+ this.inboxItems = res;
2427
+ this.inboxItemsSource.next(this.inboxItems);
2428
+ }), catchError(Utils.throw(() => this.inboxItemsSource.next([]))));
2429
+ }
2430
+ getAllPages() {
2431
+ let items = [];
2432
+ return this.getPage().pipe(expand(res => {
2433
+ return !res.last ? this.getPage(res.pageable.pageNumber + 1) : EMPTY;
2434
+ }), tap(res => items = [...items, ...res.content]), skipWhile(res => !res.last), map(_ => items));
2435
+ }
2436
+ getPage(index) {
2437
+ return this.backend
2438
+ .getJson(`/get?size=${this.MAX_PAGE_SIZE}&page=${index || 0}`, this.backend.getInboxBase());
2439
+ }
2440
+ /**
2441
+ * Fetches state informations for the users inbox
2442
+ *
2443
+ * @returns inbox state object
2444
+ */
2445
+ getState() {
2446
+ return this.inboxState;
2447
+ }
2448
+ /**
2449
+ * Public access to fetch inbox
2450
+ */
2451
+ refreshInboxState() {
2452
+ this.fetchInboxState();
2453
+ }
2454
+ /**
2455
+ * Retrieve inbox state
2456
+ */
2457
+ fetchInboxState() {
2458
+ this.backend
2459
+ .getJson('/state', this.backend.getInboxBase())
2460
+ .pipe(map(res => res))
2461
+ .subscribe(res => {
2462
+ this.inboxState = res;
2463
+ this.inboxStateSource.next(this.inboxState);
2464
+ }, Utils.logError(null, 'Failed to fetch inbox state!'));
2465
+ }
2466
+ /**
2467
+ * Removes an item from the inbox.
2468
+ *
2469
+ * @param item inbox item to be removed
2470
+ * @returns Observable<any>
2471
+ */
2472
+ removeItem(item) {
2473
+ return this.backend
2474
+ .del('/' + item.id, this.backend.getInboxBase())
2475
+ .pipe(tap(() => this.updateInboxItems(item.id)));
2476
+ }
2477
+ /**
2478
+ * Soft update for data in the inbox.
2479
+ *
2480
+ * @param id
2481
+ * @param item
2482
+ * @param multi
2483
+ */
2484
+ updateInboxItems(id, item, multi) {
2485
+ if (this.backend.update(this.inboxItems, multi || [{ id, item }])) {
2486
+ this.inboxItemsSource.next(this.inboxItems);
2487
+ }
2488
+ }
2489
+ /**
2490
+ * Marks an inbox item as read.
2491
+ *
2492
+ * @param item the item to be marked as read
2493
+ * @returns Observable<any>
2494
+ */
2495
+ markAsRead(item) {
2496
+ return this.backend.put('/read/' + item.id, this.backend.getInboxBase());
2497
+ }
2498
+ }
2499
+ InboxService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, deps: [{ token: BackendService }], target: i0.ɵɵFactoryTarget.Injectable });
2500
+ InboxService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, providedIn: 'root' });
2501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: InboxService, decorators: [{
2502
+ type: Injectable,
2503
+ args: [{
2504
+ providedIn: 'root'
2505
+ }]
2506
+ }], ctorParameters: function () { return [{ type: BackendService }]; } });
2507
+
2508
+ /**
2509
+ * `BpmService` handles interaction related to BPM tasks.
2510
+ *
2511
+ * The main parts provided and used by this service are Processes and WorkItems.
2512
+ * Processes are defined on the backend side. They describe a set of tasks that will be executed by the process.
2513
+ * Tasks that require user interaction are referred to as WorkItems.
2514
+ *
2515
+ * Processes can be related to a special object type, but they don't have to. In addition to that they can refer
2516
+ * to dms objects.
2517
+ */
2518
+ class BpmService {
2519
+ constructor(capabilities, backend, eventService, inboxService) {
2520
+ this.capabilities = capabilities;
2521
+ this.backend = backend;
2522
+ this.eventService = eventService;
2523
+ this.inboxService = inboxService;
2524
+ this.processItemsSource = new ReplaySubject(1);
2525
+ /**
2526
+ * Long term observable emitting the current processes
2527
+ */
2528
+ this.processItems$ = this.processItemsSource.asObservable();
2529
+ }
2530
+ /**
2531
+ * Retrieve all processes of the current user.
2532
+ *
2533
+ * @param size Maximum number of processes to be fetched
2534
+ * @returns List of Processes
2535
+ */
2536
+ getProcesses(size = 1000) {
2537
+ return this.backend
2538
+ .getJson(`/process/user?size=${size}`, this.backend.getBpmBase())
2539
+ .pipe(map(response => response.content.map(item => new Process(item))), tap((processes) => {
2540
+ this.processItems = processes;
2541
+ this.processItemsSource.next(this.processItems);
2542
+ }));
2543
+ }
2544
+ /**
2545
+ * Getter for the executable Processes. If types are provided, you'll get
2546
+ * only the processes that are executable for all of them
2547
+ * @param types List of dms object types to fetch executable processes for
2548
+ * @param useCached If the cached data should be returned rather than requesting again
2549
+ * @param additionalData If the additional form data should be also included
2550
+ * @param modelid The process model ID to only return the data for one process
2551
+ * @returns List of executable processes
2552
+ */
2553
+ getExecutableProcesses(types, useCached, additionalData, modelid, global) {
2554
+ if (this.capabilities.hasCapability('bpm')) {
2555
+ return (!!this.executableProcesses && useCached) ? of(this.executableProcesses) : this.fetchExecutableProcesses(types, additionalData, modelid, global);
2556
+ }
2557
+ else {
2558
+ return of([]);
2559
+ }
2560
+ }
2561
+ initExecutableProcesses() {
2562
+ let uri = '/bpm/process/executable';
2563
+ return this.backend.get(uri).pipe(tap(res => this.hasMainExecutableProcesses = res?.length));
2564
+ }
2565
+ /**
2566
+ * Gets executable Processes for a given set of dms object.You'll get
2567
+ * only the processes that are executable for all of them.
2568
+ * @param dmsObjects List of dms objects to fetch executable processes for
2569
+ * @returns List of executable processes
2570
+ */
2571
+ getExecutableProcessesForDmsObjects(dmsObjects) {
2572
+ return this.getExecutableProcesses(dmsObjects.map(o => o.typeName), false, true);
2573
+ }
2574
+ /**
2575
+ * Fetches executable Processes from the backend.
2576
+ * @param types List of dms object types to fetch executable processes for
2577
+ * @param additionalData If the additional form data should be also included
2578
+ * @param modelid The process model ID to only return the data for one process
2579
+ * @returns List of executable processes
2580
+ */
2581
+ fetchExecutableProcesses(types, additionalData, modelid, global) {
2211
2582
  let uri = '/bpm/process/executable';
2212
2583
  if (additionalData) {
2213
2584
  uri += '?form=true&fields=true';
@@ -2265,610 +2636,239 @@ class BpmService {
2265
2636
  * @param processId ID of the parent process
2266
2637
  * @param itemId ID of the work item itself
2267
2638
  * @param options Options to be added to the backend call
2268
- * @returns a WorkItem
2269
- */
2270
- getWorkItem(processId, itemId, options) {
2271
- const params = options ? options : { form: true, fields: true };
2272
- const tasks = [
2273
- this.backend.getJson(Utils.buildUri(`/bpm/process/${processId}/${itemId}`, params)),
2274
- this.getProcessFile(processId)
2275
- ];
2276
- return forkJoin(tasks).pipe(map(res => {
2277
- const wi = new WorkItem(res[0]);
2278
- wi.setFile(res[1]);
2279
- return wi;
2280
- }));
2281
- }
2282
- /**
2283
- * Saves a work item.
2284
- * @param item The work item to be saved
2285
- * @returns The updated WorkItem
2286
- */
2287
- saveWorkItem(item) {
2288
- const { id, processId, file, data } = item;
2289
- const payload = { contents: file, data };
2290
- const params = { keeplock: true, isautolock: false };
2291
- return this.backend
2292
- .post(Utils.buildUri(`/bpm/process/${processId}/${id}/save`, params), payload)
2293
- .pipe(mergeMap(() => this.getWorkItem(processId, id)));
2294
- }
2295
- /**
2296
- * Forwards a work item. If a WorkItem provides different actions (@link WorkItemAction)
2297
- * you can provide the selected action too.
2298
- * @param item The work item to be forwarded
2299
- * @param action Action used for forwarding
2300
- */
2301
- forwardWorkItem(item, action) {
2302
- const params = { keeplock: false, isautolock: false };
2303
- const payload = {
2304
- action: action,
2305
- contents: item.file,
2306
- data: item.data
2307
- };
2308
- return this.backend
2309
- .post(Utils.buildUri(`/bpm/process/${item.processId}/${item.id}/save`, params), payload)
2310
- .pipe(tap(() => this.inboxService.updateInboxItems(item.id)));
2311
- }
2312
- /**
2313
- * Locks a WorkItem for the current user (personalization), meaning that the
2314
- * current user is now in charge of fulfilling the WorkItem task.
2315
- * @param item The WorkItem to be locked
2316
- * @returns The updated WorkItem
2317
- */
2318
- lockWorkItem(item) {
2319
- return this.backend.put(`/bpm/process/${item.processId}/${item.id}/lock`)
2320
- .pipe(mergeMap(() => this.getWorkItem(item.processId, item.id)));
2321
- }
2322
- /**
2323
- * Releases the lock for a WorkItem.
2324
- * @param item The work item to be unlocked
2325
- * @returns The updated WorkItem
2326
- */
2327
- unlockWorkItem(item) {
2328
- return this.backend.del(`/bpm/process/${item.processId}/${item.id}/lock`).pipe(mergeMap(() => this.getWorkItem(item.processId, item.id)));
2329
- }
2330
- /**
2331
- * Starts an executable process.
2332
- * @param executableProcessId ID of the executable Process to be started
2333
- * @param data Data to be passed to the process (simple object of key/value pairs)
2334
- * @param contents Objects to be attached to the process (process.file).
2335
- */
2336
- startProcess(executableProcessId, data, contents) {
2337
- return this.backend.post(`/bpm/process/?modelid=${executableProcessId}`, {
2338
- data: data,
2339
- contents: contents
2340
- });
2341
- }
2342
- /**
2343
- * Returns the history for a process. Which entries are returned depends on the
2344
- * permissions of the current user.
2345
- * @param processId The ID of the process to fetch history for
2346
- * @returns Observable<WorkItemHistoryEntry[]>
2347
- */
2348
- getProcessHistory(processId) {
2349
- return this.backend
2350
- .getJson(`/bpm/process/${processId}/history`)
2351
- .pipe(map(res => res && res.length ? res.map(item => new WorkItemHistoryEntry(item)) : []));
2352
- }
2353
- /**
2354
- * Removes a content from the work items file.
2355
- * @param processId The ID of the process to remove the item from
2356
- * @param workItemId The ID of the work item containing the file element to be removed
2357
- * @param workItemContentId The the ID of the file element to be removed
2358
- */
2359
- removeFileElement(processId, workItemId, workItemContentId) {
2360
- return this.backend
2361
- .del(`/process/${processId}/file/${workItemContentId}?activityid=${workItemId}`, this.backend.getBpmBase());
2362
- }
2363
- /**
2364
- * Add contents to a work items file.
2365
- * @param processId The ID of the process
2366
- * @param workItemId The ID of the activity
2367
- * @param elements The Elements to be added
2368
- * @returns The updated WorkItem
2369
- */
2370
- addFileElements(processId, workItemId, elements) {
2371
- const tasks = [];
2372
- elements.forEach((e) => {
2373
- tasks.push(this.backend.post(`/process/${processId}/file/${e.id}?type=${e.type.name}&activityid=${workItemId}`, {}, this.backend.getBpmBase()));
2374
- });
2375
- return forkJoin(tasks)
2376
- .pipe(mergeMap(() => this.getWorkItem(processId, workItemId)));
2377
- }
2378
- /**
2379
- * Add a objects from the clipboard to a WorkItem.
2380
- * @param workItem The workItem to add the objects to
2381
- * @param clipboard Clipboard object holding user selected objects
2382
- * @returns The updated WorkItem
2383
- */
2384
- addFileElementsFromClipboard(workItem, clipboard) {
2385
- if ((workItem && workItem.fileEntryPermissions.add) && clipboard && clipboard.elements.length && clipboard.action === ClipboardAction.COPY) {
2386
- let contents;
2387
- if (workItem.file.length) {
2388
- // only add items that are not already part of the attachments
2389
- const attachmentIds = workItem.file.map(e => e.id);
2390
- contents = clipboard.elements.filter(e => attachmentIds.indexOf(e.id) === -1);
2391
- }
2392
- else {
2393
- contents = clipboard.elements;
2394
- }
2395
- return this.addFileElements(workItem.processId, workItem.id, contents);
2396
- }
2397
- else {
2398
- return throwError('error');
2399
- }
2400
- }
2401
- }
2402
- BpmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, deps: [{ token: CapabilitiesService }, { token: BackendService }, { token: EventService }, { token: InboxService }], target: i0.ɵɵFactoryTarget.Injectable });
2403
- BpmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, providedIn: 'root' });
2404
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, decorators: [{
2405
- type: Injectable,
2406
- args: [{
2407
- providedIn: 'root'
2408
- }]
2409
- }], ctorParameters: function () { return [{ type: CapabilitiesService }, { type: BackendService }, { type: EventService }, { type: InboxService }]; } });
2410
-
2411
- /**
2412
- * Representation of an object type. Object types are defined with the system definition and describe
2413
- * different kind of objects that allowed to be created.
2414
- */
2415
- class ObjectType {
2416
- /**
2417
- * Creates a new instance
2418
- * @param json The JSON object received from the backend. This will be used to construct the new object type instance
2419
- */
2420
- constructor(json) {
2421
- this.id = json.id;
2422
- this.implements = json.implements ? json.implements : [];
2423
- this.isFolder = json.folder;
2424
- this.isContextFolder = json.iscontextfolder;
2425
- this.isAbstract = json.abstract;
2426
- this.iconId = json.icon ? json.icon.id : null;
2427
- this.maxFiles = json.maxfiles;
2428
- this.minFiles = json.minfiles;
2429
- this.name = json.name;
2430
- this.qname = json.qname;
2431
- this.label = json.label;
2432
- this.description = json.description;
2433
- this.group = json.group ? json.group.label : "";
2434
- this.elements = json.elements;
2435
- this.allowedcontexttypes = json.allowedcontexttypes
2436
- ? json.allowedcontexttypes
2437
- : [];
2438
- this.supertypes = json.supertypes ? json.supertypes.map(t => t.name) : [];
2439
- this.shareable = json.shareable;
2440
- this.parenttypes = this.getParentTypes(json.allowedlocations);
2441
- }
2442
- getParentTypes(allowedlocations) {
2443
- if (allowedlocations) {
2444
- return allowedlocations.parenttypes.map(types => types.name);
2445
- }
2446
- return [];
2447
- }
2448
- }
2449
-
2450
- /**
2451
- * Representation of a prepared item. A prepared item is an item that is supposed to create a new dms object.
2452
- * Adding a new object to yuuvis<sup>&reg;</sup> RAD starts with a prepared item. If all the required properties are set up, the item
2453
- * will be used to create a new dms object.
2454
- */
2455
- class PreparedItem {
2456
- /**
2457
- * Prepared items title
2458
- */
2459
- get title() {
2460
- return this.selectedtype ? this.selectedtype.label : '';
2461
- }
2462
- /**
2463
- * Creates a new instance
2464
- * @param json The JSON object received from the backend. This will be used to construct the new prepared item instance
2465
- */
2466
- constructor(json) {
2467
- Object.assign(this, json);
2468
- }
2469
- /**
2470
- * Returns true if the preparedItem contains content (template or actual file), false otherwise
2471
- */
2472
- hasContent() {
2473
- return !!this.template || this.contentcount > 0;
2474
- }
2475
- /**
2476
- * Retrieves the prepared items selected type object from the list
2477
- * of available types.
2478
- * @returns The type object that is selected or NULL
2479
- */
2480
- getSelectedTypeObject() {
2481
- return this.types.find(t => t.selected);
2482
- }
2483
- }
2484
-
2485
- class UploadTarget {
2486
- /**
2487
- * Creates a new instance of UploadTarget
2488
- *
2489
- * @param id Upload targets unique id
2490
- * @param type Upload targets type
2491
- */
2492
- constructor(id, type) {
2493
- this.id = id;
2494
- this.type = type;
2495
- }
2496
- /**
2497
- * Return Method if the Upload is Successfull
2498
- *
2499
- * @param target
2500
- * @returns the provided UploadTarget if the Upload was Successfull.
2639
+ * @returns a WorkItem
2501
2640
  */
2502
- onUploadSuccess(target) {
2503
- return target;
2641
+ getWorkItem(processId, itemId, options) {
2642
+ const params = options ? options : { form: true, fields: true };
2643
+ const tasks = [
2644
+ this.backend.getJson(Utils.buildUri(`/bpm/process/${processId}/${itemId}`, params)),
2645
+ this.getProcessFile(processId)
2646
+ ];
2647
+ return forkJoin(tasks).pipe(map(res => {
2648
+ const wi = new WorkItem(res[0]);
2649
+ wi.setFile(res[1]);
2650
+ return wi;
2651
+ }));
2504
2652
  }
2505
2653
  /**
2506
- * Return method if the Upload fails
2507
- *
2508
- * @returns an empty Object if the Upload fails
2654
+ * Saves a work item.
2655
+ * @param item The work item to be saved
2656
+ * @returns The updated WorkItem
2509
2657
  */
2510
- onUploadFail() {
2511
- return {};
2512
- }
2513
- }
2514
- /**
2515
- * general filing target
2516
- */
2517
- UploadTarget.ROOT = 'root';
2518
- /**
2519
- * add file(s) to context folder
2520
- */
2521
- UploadTarget.CONTEXT = 'context';
2522
- /**
2523
- * add file(s) to context folders dynamic structure
2524
- */
2525
- UploadTarget.CONTEXT_TREE = 'contexttree';
2526
- /**
2527
- * set/replace content file of a dms object
2528
- */
2529
- UploadTarget.OBJECT = 'object';
2530
- /**
2531
- * custom targets (e.g. for plugin development)
2532
- */
2533
- UploadTarget.CUSTOM = 'custom';
2534
-
2535
- var Direction;
2536
- (function (Direction) {
2537
- Direction["LTR"] = "ltr";
2538
- Direction["RTL"] = "rtl";
2539
- })(Direction || (Direction = {}));
2540
-
2541
- /**
2542
- * Collection of System Services
2543
- */
2544
- class SystemService {
2545
- constructor(backend, logger, eventService, appCache) {
2546
- this.backend = backend;
2547
- this.logger = logger;
2548
- this.eventService = eventService;
2549
- this.appCache = appCache;
2550
- this.systemSource = new ReplaySubject();
2551
- this.system$ = this.systemSource.asObservable();
2552
- // session cache for object type forms
2553
- this.objectTypeForms = [];
2554
- this.cachedRoles = [];
2555
- this.eventService.on(EnaioEvent.SYSTEM_STATUS_SCHEMA_CHANGED).subscribe(() => {
2556
- this.fetchSystemDefinition(this.user);
2557
- });
2558
- }
2559
- set system(s) {
2560
- this._system = s;
2561
- }
2562
- get system() {
2563
- return JSON.parse(JSON.stringify(this._system));
2658
+ saveWorkItem(item) {
2659
+ const { id, processId, file, data } = item;
2660
+ const payload = { contents: file, data };
2661
+ const params = { keeplock: true, isautolock: false };
2662
+ return this.backend
2663
+ .post(Utils.buildUri(`/bpm/process/${processId}/${id}/save`, params), payload)
2664
+ .pipe(mergeMap(() => this.getWorkItem(processId, id)));
2564
2665
  }
2565
2666
  /**
2566
- * Gets all ObjectTypes
2567
- *
2568
- * @returns An array containing all object types
2667
+ * Forwards a work item. If a WorkItem provides different actions (@link WorkItemAction)
2668
+ * you can provide the selected action too.
2669
+ * @param item The work item to be forwarded
2670
+ * @param action Action used for forwarding
2569
2671
  */
2570
- getObjectTypes() {
2571
- return this.system.types;
2672
+ forwardWorkItem(item, action) {
2673
+ const params = { keeplock: false, isautolock: false };
2674
+ const payload = {
2675
+ action: action,
2676
+ contents: item.file,
2677
+ data: item.data
2678
+ };
2679
+ return this.backend
2680
+ .post(Utils.buildUri(`/bpm/process/${item.processId}/${item.id}/save`, params), payload)
2681
+ .pipe(tap(() => this.inboxService.updateInboxItems(item.id)));
2572
2682
  }
2573
2683
  /**
2574
- * Gets an ObjectType by name.
2575
- *
2576
- * @param objectTypeName The name of the object type
2577
- * @returns the ObjectType matching the given name
2684
+ * Locks a WorkItem for the current user (personalization), meaning that the
2685
+ * current user is now in charge of fulfilling the WorkItem task.
2686
+ * @param item The WorkItem to be locked
2687
+ * @returns The updated WorkItem
2578
2688
  */
2579
- getObjectType(objectTypeName) {
2580
- return this.system.types.find(t => t.name === objectTypeName);
2689
+ lockWorkItem(item) {
2690
+ return this.backend.put(`/bpm/process/${item.processId}/${item.id}/lock`)
2691
+ .pipe(mergeMap(() => this.getWorkItem(item.processId, item.id)));
2581
2692
  }
2582
2693
  /**
2583
- * Get form elements from form model. This is useful if you have to fetch them
2584
- * for a special situation like SEARCH
2585
- * @param objectTypeName ObjectType to fetch elements for
2586
- * @param situation Form model situation to be fetched
2587
- * @param isContextType Flag indicating that the form model should be fetched for a context mode
2694
+ * Releases the lock for a WorkItem.
2695
+ * @param item The work item to be unlocked
2696
+ * @returns The updated WorkItem
2588
2697
  */
2589
- getFormElementsFromFormModel(objectTypeName, situation, isContextType) {
2590
- return this.getObjectTypeForm(objectTypeName, situation, isContextType ? 'CONTEXT' : null).pipe(switchMap(model => {
2591
- const elements = [];
2592
- this.processFormModelElements(model, elements);
2593
- return of(elements);
2594
- }));
2595
- }
2596
- processFormModelElements(model, elements) {
2597
- model.elements.forEach(e => {
2598
- if (e.type !== "o2mGroup" && e.type !== "o2mGroupStack") {
2599
- elements.push(e);
2600
- }
2601
- else if (e.elements && e.elements.length) {
2602
- this.processFormModelElements(e, elements);
2603
- }
2604
- });
2698
+ unlockWorkItem(item) {
2699
+ return this.backend.del(`/bpm/process/${item.processId}/${item.id}/lock`).pipe(mergeMap(() => this.getWorkItem(item.processId, item.id)));
2605
2700
  }
2606
2701
  /**
2607
- * Checks whether or not the given type implements a given supertype
2608
- * @param type Type to be checked
2609
- * @param superTypeName Name of the supertype
2702
+ * Starts an executable process.
2703
+ * @param executableProcessId ID of the executable Process to be started
2704
+ * @param data Data to be passed to the process (simple object of key/value pairs)
2705
+ * @param contents Objects to be attached to the process (process.file).
2610
2706
  */
2611
- implementsType(type, superTypeName) {
2612
- return type.name === superTypeName || (type.implements && type.implements.indexOf(superTypeName) !== -1);
2707
+ startProcess(executableProcessId, data, contents) {
2708
+ return this.backend.post(`/bpm/process/?modelid=${executableProcessId}`, {
2709
+ data: data,
2710
+ contents: contents
2711
+ });
2613
2712
  }
2614
2713
  /**
2615
- * Gets a codesystem
2616
- *
2617
- * @param id The codesystems id
2618
- * @returns The codesystem object matching the given id
2714
+ * Returns the history for a process. Which entries are returned depends on the
2715
+ * permissions of the current user.
2716
+ * @param processId The ID of the process to fetch history for
2717
+ * @returns Observable<WorkItemHistoryEntry[]>
2619
2718
  */
2620
- getCodesystem(id) {
2621
- return this.system.codesystems.find(t => t.id === id || t.name === id);
2719
+ getProcessHistory(processId) {
2720
+ return this.backend
2721
+ .getJson(`/bpm/process/${processId}/history`)
2722
+ .pipe(map(res => res && res.length ? res.map(item => new WorkItemHistoryEntry(item)) : []));
2622
2723
  }
2623
2724
  /**
2624
- * Get the form model of an object type.
2625
- *
2626
- * @param objectTypeName The object type name
2627
- * @param situation The form situation to be fetched
2628
- * @param mode Form mode to fetch (e.g. CONTEXT)
2629
- * @returns The object type form model
2725
+ * Removes a content from the work items file.
2726
+ * @param processId The ID of the process to remove the item from
2727
+ * @param workItemId The ID of the work item containing the file element to be removed
2728
+ * @param workItemContentId The the ID of the file element to be removed
2630
2729
  */
2631
- getObjectTypeForm(objectTypeName, situation, mode) {
2632
- /** check if we have a cached form first */
2633
- let cachedForm;
2634
- let i = 0;
2635
- while (!cachedForm && i < this.objectTypeForms.length) {
2636
- if (this.objectTypeForms[i].name === objectTypeName &&
2637
- this.objectTypeForms[i].mode === mode &&
2638
- this.objectTypeForms[i].situation === situation) {
2639
- cachedForm = this.objectTypeForms[i];
2640
- }
2641
- i++;
2642
- }
2643
- if (cachedForm) {
2644
- /** return a clone of the cached model as otherwise model changes will be added to the chached model */
2645
- return of(_.cloneDeep(cachedForm));
2646
- }
2647
- else {
2648
- let uri = `/ui/form/${objectTypeName}?situation=${situation}`;
2649
- uri += !!mode ? `&formmode=${mode}` : '';
2650
- /** fetch and cache the requested form, if no cached version was found */
2651
- return this.backend.getViaTempCache(uri, () => this.backend
2652
- .getJson(uri)
2653
- .pipe(tap((model) => this.objectTypeForms.push(_.cloneDeep(model)))));
2654
- }
2730
+ removeFileElement(processId, workItemId, workItemContentId) {
2731
+ return this.backend
2732
+ .del(`/process/${processId}/file/${workItemContentId}?activityid=${workItemId}`, this.backend.getBpmBase());
2655
2733
  }
2656
2734
  /**
2657
- * Fetches the backends system definition and updates system$ Observable.
2658
- * Subscribe to the system$ observable instead of calling this function, otherwise you'll trigger fetching the
2659
- * system definition every time.
2660
- *
2661
- * @param user The user to load the system definition for
2662
- * @returns true when successfull
2735
+ * Add contents to a work items file.
2736
+ * @param processId The ID of the process
2737
+ * @param workItemId The ID of the activity
2738
+ * @param elements The Elements to be added
2739
+ * @returns The updated WorkItem
2663
2740
  */
2664
- getSystemDefinition(user) {
2665
- this.user = user;
2666
- // todo: temporary: OrgChanges could not be recognized but affect object definition
2667
- return this.fetchSystemDefinition(user);
2668
- // todo: enable again when OrgChanges are recognizable (DO NOT DELETE!)
2669
- // // is there a cached version
2670
- // return this.appCache
2671
- // .getItem(this.appCache.SYSTEM_DEFINITION)
2672
- // .catch((error) => {
2673
- // this.logger.error('Error fetching cached version of system definition.', error);
2674
- // return this.fetchSystemDefinition(user);
2675
- // })
2676
- // .flatMap((cachedSystemDefinition: any) => {
2677
- //
2678
- // // yes? then check if it's up to date
2679
- // if (cachedSystemDefinition) {
2680
- //
2681
- // if (
2682
- // user.schema.version !== cachedSystemDefinition.info.version ||
2683
- // user.id !== cachedSystemDefinition.info.user ||
2684
- // user.getSchemaLocale() !== cachedSystemDefinition.info.locale
2685
- // ) {
2686
- // return this.fetchSystemDefinition(user);
2687
- // } else {
2688
- // // cache is up to date. return the cached one
2689
- // this.logger.debug('System definition is up to date, using cached version.', cachedSystemDefinition);
2690
- // this.system = cachedSystemDefinition;
2691
- // this.systemSource.next(this.system);
2692
- // return of(true);
2693
- // }
2694
- // } else {
2695
- // // no cached systemDefinition found
2696
- // return this.fetchSystemDefinition(user);
2697
- // }
2698
- // });
2741
+ addFileElements(processId, workItemId, elements) {
2742
+ const tasks = [];
2743
+ elements.forEach((e) => {
2744
+ tasks.push(this.backend.post(`/process/${processId}/file/${e.id}?type=${e.type.name}&activityid=${workItemId}`, {}, this.backend.getBpmBase()));
2745
+ });
2746
+ return forkJoin(tasks)
2747
+ .pipe(mergeMap(() => this.getWorkItem(processId, workItemId)));
2699
2748
  }
2700
2749
  /**
2701
- * Creates a value depending on a given Type
2702
- *
2703
- * @param string valueType
2704
- * @returns any
2750
+ * Add a objects from the clipboard to a WorkItem.
2751
+ * @param workItem The workItem to add the objects to
2752
+ * @param clipboard Clipboard object holding user selected objects
2753
+ * @returns The updated WorkItem
2705
2754
  */
2706
- getDefaultValue(valueType) {
2707
- let defaultValue;
2708
- switch (valueType) {
2709
- case 'CURRENT_USER': {
2710
- defaultValue = this.user.name;
2711
- break;
2712
- }
2713
- case 'CURRENT_USER_NAME': {
2714
- defaultValue = this.user.title;
2715
- break;
2716
- }
2717
- case 'CURRENT_DATETIME': {
2718
- defaultValue = new Date();
2719
- break;
2720
- }
2721
- case 'CURRENT_DATE': {
2722
- defaultValue = moment().startOf('day').toDate();
2723
- break;
2724
- }
2725
- case 'YEAR': {
2726
- defaultValue = moment().year();
2727
- break;
2728
- }
2729
- case 'MONTH': {
2730
- defaultValue = moment().month() + 1;
2731
- break;
2732
- }
2733
- case 'DAY': {
2734
- defaultValue = moment().date();
2735
- break;
2736
- }
2737
- case 'HOUR': {
2738
- defaultValue = moment().hour();
2739
- break;
2740
- }
2741
- case 'MINUTE': {
2742
- defaultValue = moment().minute();
2743
- break;
2744
- }
2745
- case 'SECOND': {
2746
- defaultValue = moment().second();
2747
- break;
2748
- }
2749
- case 'WEEK_OF_YEAR': {
2750
- defaultValue = moment().isoWeek();
2751
- break;
2752
- }
2753
- case 'FIRST_DAY_OF_WEEK': {
2754
- defaultValue = moment().startOf('isoWeek').toDate();
2755
- break;
2756
- }
2757
- case 'FIRST_DAY_OF_MONTH': {
2758
- defaultValue = moment().startOf('month').toDate();
2759
- break;
2755
+ addFileElementsFromClipboard(workItem, clipboard) {
2756
+ if ((workItem && workItem.fileEntryPermissions.add) && clipboard && clipboard.elements.length && clipboard.action === ClipboardAction.COPY) {
2757
+ let contents;
2758
+ if (workItem.file.length) {
2759
+ // only add items that are not already part of the attachments
2760
+ const attachmentIds = workItem.file.map(e => e.id);
2761
+ contents = clipboard.elements.filter(e => attachmentIds.indexOf(e.id) === -1);
2760
2762
  }
2761
- case 'FIRST_DAY_OF_YEAR': {
2762
- defaultValue = moment().startOf('year').toDate();
2763
- break;
2763
+ else {
2764
+ contents = clipboard.elements;
2764
2765
  }
2766
+ return this.addFileElements(workItem.processId, workItem.id, contents);
2767
+ }
2768
+ else {
2769
+ return throwError('error');
2765
2770
  }
2766
- return defaultValue;
2767
2771
  }
2772
+ }
2773
+ BpmService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, deps: [{ token: CapabilitiesService }, { token: BackendService }, { token: EventService }, { token: InboxService }], target: i0.ɵɵFactoryTarget.Injectable });
2774
+ BpmService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, providedIn: 'root' });
2775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: BpmService, decorators: [{
2776
+ type: Injectable,
2777
+ args: [{
2778
+ providedIn: 'root'
2779
+ }]
2780
+ }], ctorParameters: function () { return [{ type: CapabilitiesService }, { type: BackendService }, { type: EventService }, { type: InboxService }]; } });
2781
+
2782
+ /**
2783
+ * Representation of a prepared item. A prepared item is an item that is supposed to create a new dms object.
2784
+ * Adding a new object to yuuvis<sup>&reg;</sup> RAD starts with a prepared item. If all the required properties are set up, the item
2785
+ * will be used to create a new dms object.
2786
+ */
2787
+ class PreparedItem {
2768
2788
  /**
2769
- * Fetches the system definition from the server. Provided params are used for storing the
2770
- * recent version in cache.
2771
- *
2772
- * @param user The user to fetch the system definition for
2773
- * @return boolean
2789
+ * Prepared items title
2774
2790
  */
2775
- fetchSystemDefinition(user) {
2776
- const fetches = [
2777
- this.backend.getJson('/system/type/list?elements=true&basetypes=true'),
2778
- this.backend.getJson('/system/cs/list?elements=true')
2779
- ];
2780
- return forkJoin(fetches)
2781
- .pipe(catchError(Utils.catch((error) => {
2782
- this.logger.error('Error fetching recent version of system definition from server.', error);
2783
- this.systemSource.error('Error fetching recent version of system definition from server.');
2784
- })), map((data) => {
2785
- this.objectTypeForms = [];
2786
- const system = {
2787
- /**
2788
- * info about the current system definition
2789
- */
2790
- info: {
2791
- user: user.id,
2792
- locale: user.getSchemaLocale(),
2793
- version: user.schema.version
2794
- },
2795
- /**
2796
- * supported backend locales
2797
- */
2798
- locales: user.schema.supportedLocales,
2799
- /**
2800
- * object type definitions
2801
- */
2802
- types: [],
2803
- /**
2804
- * codesystems cache
2805
- */
2806
- codesystems: []
2807
- };
2808
- const types = data[0];
2809
- system.types = types.map(t => new ObjectType(t));
2810
- system.codesystems = data[1];
2811
- this.system = system;
2812
- this.systemSource.next(system);
2813
- this.logger.debug('Fetched new version of system definition (user: ' + user.id + ', version: ' + user.schema.version + ').');
2814
- this.appCache
2815
- .setItem(this.appCache.SYSTEM_DEFINITION, system)
2816
- .subscribe(() => {
2817
- this.logger.debug('Cached recent version');
2818
- }, Utils.logError(null, 'Error caching recent version of system definition.'));
2819
- return true;
2820
- }));
2791
+ get title() {
2792
+ return this.selectedtype ? this.selectedtype.label : '';
2821
2793
  }
2822
2794
  /**
2823
- * Retrieve an organization object by its ID
2824
- * @param id ID of org object
2795
+ * Creates a new instance
2796
+ * @param json The JSON object received from the backend. This will be used to construct the new prepared item instance
2825
2797
  */
2826
- getOrganizationObjectById(id) {
2827
- return this.backend.getJson(`/organization/id/${id}`);
2798
+ constructor(json) {
2799
+ Object.assign(this, json);
2828
2800
  }
2829
2801
  /**
2830
- * Fetches the organization object for a given name.
2802
+ * Returns true if the preparedItem contains content (template or actual file), false otherwise
2803
+ */
2804
+ hasContent() {
2805
+ return !!this.template || this.contentcount > 0;
2806
+ }
2807
+ /**
2808
+ * Retrieves the prepared items selected type object from the list
2809
+ * of available types.
2810
+ * @returns The type object that is selected or NULL
2811
+ */
2812
+ getSelectedTypeObject() {
2813
+ return this.types.find(t => t.selected);
2814
+ }
2815
+ }
2816
+
2817
+ class UploadTarget {
2818
+ /**
2819
+ * Creates a new instance of UploadTarget
2831
2820
  *
2832
- * @param name The name to fetch object for
2833
- * @returns
2821
+ * @param id Upload targets unique id
2822
+ * @param type Upload targets type
2834
2823
  */
2835
- getOrganizationObject(name) {
2836
- return this.getOrganizationObjects([name]).pipe(map(res => res[0]));
2824
+ constructor(id, type) {
2825
+ this.id = id;
2826
+ this.type = type;
2837
2827
  }
2838
2828
  /**
2839
- * Fetches a collection of organization objects
2829
+ * Return Method if the Upload is Successfull
2840
2830
  *
2841
- * @param names Array of names to fetch objects for
2842
- * @returns A Array of Organization Objects
2831
+ * @param target
2832
+ * @returns the provided UploadTarget if the Upload was Successfull.
2843
2833
  */
2844
- getOrganizationObjects(names) {
2845
- const toFetch = names.map(name => this.backend.getJson(`/organization/name/${name}`).pipe(catchError(error => of({ id: name, active: false }))));
2846
- return forkJoin(toFetch);
2834
+ onUploadSuccess(target) {
2835
+ return target;
2847
2836
  }
2848
2837
  /**
2849
- * Fetches a collection of organization roles
2838
+ * Return method if the Upload fails
2850
2839
  *
2851
- * @return A Array of Organization Roles
2840
+ * @returns an empty Object if the Upload fails
2852
2841
  */
2853
- getRoles() {
2854
- if (this.cachedRoles.length) {
2855
- return of(this.cachedRoles);
2856
- }
2857
- else {
2858
- return this.backend
2859
- .get('/organization/role')
2860
- .pipe(map(o => o), tap(roles => (this.cachedRoles = roles)));
2861
- }
2842
+ onUploadFail() {
2843
+ return {};
2862
2844
  }
2863
2845
  }
2864
- SystemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, deps: [{ token: BackendService }, { token: Logger }, { token: EventService }, { token: AppCacheService }], target: i0.ɵɵFactoryTarget.Injectable });
2865
- SystemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, providedIn: 'root' });
2866
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SystemService, decorators: [{
2867
- type: Injectable,
2868
- args: [{
2869
- providedIn: 'root'
2870
- }]
2871
- }], ctorParameters: function () { return [{ type: BackendService }, { type: Logger }, { type: EventService }, { type: AppCacheService }]; } });
2846
+ /**
2847
+ * general filing target
2848
+ */
2849
+ UploadTarget.ROOT = 'root';
2850
+ /**
2851
+ * add file(s) to context folder
2852
+ */
2853
+ UploadTarget.CONTEXT = 'context';
2854
+ /**
2855
+ * add file(s) to context folders dynamic structure
2856
+ */
2857
+ UploadTarget.CONTEXT_TREE = 'contexttree';
2858
+ /**
2859
+ * set/replace content file of a dms object
2860
+ */
2861
+ UploadTarget.OBJECT = 'object';
2862
+ /**
2863
+ * custom targets (e.g. for plugin development)
2864
+ */
2865
+ UploadTarget.CUSTOM = 'custom';
2866
+
2867
+ var Direction;
2868
+ (function (Direction) {
2869
+ Direction["LTR"] = "ltr";
2870
+ Direction["RTL"] = "rtl";
2871
+ })(Direction || (Direction = {}));
2872
2872
 
2873
2873
  /**
2874
2874
  * Applications user service.
@@ -3198,15 +3198,25 @@ class UserService {
3198
3198
  this.refreshCurrentUser().subscribe();
3199
3199
  }));
3200
3200
  }
3201
+ /**
3202
+ * Save or change the workspace of the current user
3203
+ * @param workspaceConfig The value to set the saved workspace or create a new workspace
3204
+ */
3205
+ saveChangeWorkspace(workspaceConfig) {
3206
+ this.user.userSettings.workspaceOptions = workspaceConfig;
3207
+ return this.backend.put('/user/config/web', this.user.userSettings).pipe(map(() => {
3208
+ this.refreshCurrentUser().subscribe();
3209
+ }));
3210
+ }
3201
3211
  }
3202
- UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: UserService, deps: [{ token: BackendService }, { token: i2.TranslateService }, { token: Logger }, { token: EventService }, { token: SystemService }, { token: i1$1.HttpClient }, { token: Config }], target: i0.ɵɵFactoryTarget.Injectable });
3212
+ UserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: UserService, deps: [{ token: BackendService }, { token: i1.TranslateService }, { token: Logger }, { token: EventService }, { token: SystemService }, { token: i1$1.HttpClient }, { token: Config }], target: i0.ɵɵFactoryTarget.Injectable });
3203
3213
  UserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: UserService, providedIn: 'root' });
3204
3214
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: UserService, decorators: [{
3205
3215
  type: Injectable,
3206
3216
  args: [{
3207
3217
  providedIn: 'root'
3208
3218
  }]
3209
- }], ctorParameters: function () { return [{ type: BackendService }, { type: i2.TranslateService }, { type: Logger }, { type: EventService }, { type: SystemService }, { type: i1$1.HttpClient }, { type: Config }]; } });
3219
+ }], ctorParameters: function () { return [{ type: BackendService }, { type: i1.TranslateService }, { type: Logger }, { type: EventService }, { type: SystemService }, { type: i1$1.HttpClient }, { type: Config }]; } });
3210
3220
 
3211
3221
  /**
3212
3222
  * The Upload Service is provides access to Upload data (files)
@@ -3750,17 +3760,14 @@ class AuthService {
3750
3760
  /**
3751
3761
  * @ignore
3752
3762
  */
3753
- constructor(config, coreConfig, appCache, envService, http, bpmService, ngZone, location, capabilitiesService, logger, inboxService, prepareService, backend, systemService, userService, eventService, systemStatusService, storage, local) {
3763
+ constructor(config, coreConfig, envService, http, bpmService, ngZone, capabilitiesService, inboxService, prepareService, backend, systemService, userService, eventService, systemStatusService, storage, local) {
3754
3764
  this.config = config;
3755
3765
  this.coreConfig = coreConfig;
3756
- this.appCache = appCache;
3757
3766
  this.envService = envService;
3758
3767
  this.http = http;
3759
3768
  this.bpmService = bpmService;
3760
3769
  this.ngZone = ngZone;
3761
- this.location = location;
3762
3770
  this.capabilitiesService = capabilitiesService;
3763
- this.logger = logger;
3764
3771
  this.inboxService = inboxService;
3765
3772
  this.prepareService = prepareService;
3766
3773
  this.backend = backend;
@@ -4069,7 +4076,7 @@ class AuthService {
4069
4076
  return forkJoin(todo).pipe(map(() => currUser));
4070
4077
  }
4071
4078
  }
4072
- AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AuthService, deps: [{ token: Config }, { token: CORE_CONFIG }, { token: AppCacheService }, { token: EnvironmentService }, { token: i1$1.HttpClient }, { token: BpmService }, { token: i0.NgZone }, { token: i6.PlatformLocation }, { token: CapabilitiesService }, { token: Logger }, { token: InboxService }, { token: PrepareService }, { token: BackendService }, { token: SystemService }, { token: UserService }, { token: EventService }, { token: SystemStatusService }, { token: i1.LocalStorage }, { token: LocalStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
4079
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AuthService, deps: [{ token: Config }, { token: CORE_CONFIG }, { token: EnvironmentService }, { token: i1$1.HttpClient }, { token: BpmService }, { token: i0.NgZone }, { token: CapabilitiesService }, { token: InboxService }, { token: PrepareService }, { token: BackendService }, { token: SystemService }, { token: UserService }, { token: EventService }, { token: SystemStatusService }, { token: i1$2.LocalStorage }, { token: LocalStorageService }], target: i0.ɵɵFactoryTarget.Injectable });
4073
4080
  AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AuthService, providedIn: 'root' });
4074
4081
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: AuthService, decorators: [{
4075
4082
  type: Injectable,
@@ -4079,7 +4086,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
4079
4086
  }], ctorParameters: function () { return [{ type: Config }, { type: CoreConfig, decorators: [{
4080
4087
  type: Inject,
4081
4088
  args: [CORE_CONFIG]
4082
- }] }, { type: AppCacheService }, { type: EnvironmentService }, { type: i1$1.HttpClient }, { type: BpmService }, { type: i0.NgZone }, { type: i6.PlatformLocation }, { type: CapabilitiesService }, { type: Logger }, { type: InboxService }, { type: PrepareService }, { type: BackendService }, { type: SystemService }, { type: UserService }, { type: EventService }, { type: SystemStatusService }, { type: i1.LocalStorage }, { type: LocalStorageService }]; } });
4089
+ }] }, { type: EnvironmentService }, { type: i1$1.HttpClient }, { type: BpmService }, { type: i0.NgZone }, { type: CapabilitiesService }, { type: InboxService }, { type: PrepareService }, { type: BackendService }, { type: SystemService }, { type: UserService }, { type: EventService }, { type: SystemStatusService }, { type: i1$2.LocalStorage }, { type: LocalStorageService }]; } });
4083
4090
 
4084
4091
  /**
4085
4092
  * Main initialization service of the eoFrameworkCore module. The `load()` function will contain
@@ -4368,7 +4375,7 @@ class EoCoreModule {
4368
4375
  }
4369
4376
  }
4370
4377
  EoCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: EoCoreModule, deps: [{ token: EoCoreModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
4371
- EoCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.2", ngImport: i0, type: EoCoreModule, imports: [HttpClientModule, i2.TranslateModule, i1$2.ToastrModule], exports: [EoSharedModule] });
4378
+ EoCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.2", ngImport: i0, type: EoCoreModule, imports: [HttpClientModule, i1.TranslateModule, i1$3.ToastrModule], exports: [EoSharedModule] });
4372
4379
  EoCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: EoCoreModule, providers: [
4373
4380
  {
4374
4381
  /**
@@ -5293,14 +5300,14 @@ class NotificationsService {
5293
5300
  }
5294
5301
  }
5295
5302
  }
5296
- NotificationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: NotificationsService, deps: [{ token: i1$2.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
5303
+ NotificationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: NotificationsService, deps: [{ token: i1$3.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
5297
5304
  NotificationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: NotificationsService, providedIn: 'root' });
5298
5305
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: NotificationsService, decorators: [{
5299
5306
  type: Injectable,
5300
5307
  args: [{
5301
5308
  providedIn: 'root'
5302
5309
  }]
5303
- }], ctorParameters: function () { return [{ type: i1$2.ToastrService }]; } });
5310
+ }], ctorParameters: function () { return [{ type: i1$3.ToastrService }]; } });
5304
5311
 
5305
5312
  /**
5306
5313
  * Collection of Search Services
@@ -6124,10 +6131,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
6124
6131
  * Collection of Signing Services
6125
6132
  */
6126
6133
  class SigningService {
6127
- constructor(backend, translate) {
6134
+ constructor(backend, capabilities, translate) {
6128
6135
  this.backend = backend;
6136
+ this.capabilities = capabilities;
6129
6137
  this.translate = translate;
6130
6138
  }
6139
+ canSign() {
6140
+ return this.capabilities.getCapabilities().signing;
6141
+ }
6131
6142
  /**
6132
6143
  * Sign the document of a DMS Object
6133
6144
  * @param id the id of the dms object
@@ -6136,7 +6147,7 @@ class SigningService {
6136
6147
  */
6137
6148
  signDocument(id, signingData) {
6138
6149
  const uri = `/request/${id}`;
6139
- return this.backend.post(uri, signingData, '/signing');
6150
+ return this.canSign ? this.backend.post(uri, signingData, '/signing') : of(null);
6140
6151
  }
6141
6152
  /**
6142
6153
  * Cancels the signing process of a DMS Object
@@ -6223,14 +6234,14 @@ class SigningService {
6223
6234
  return item.data.yuvsigstatus === 'inprocess';
6224
6235
  }
6225
6236
  }
6226
- SigningService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SigningService, deps: [{ token: BackendService }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
6237
+ SigningService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SigningService, deps: [{ token: BackendService }, { token: CapabilitiesService }, { token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
6227
6238
  SigningService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SigningService, providedIn: 'root' });
6228
6239
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: SigningService, decorators: [{
6229
6240
  type: Injectable,
6230
6241
  args: [{
6231
6242
  providedIn: 'root'
6232
6243
  }]
6233
- }], ctorParameters: function () { return [{ type: BackendService }, { type: i2.TranslateService }]; } });
6244
+ }], ctorParameters: function () { return [{ type: BackendService }, { type: CapabilitiesService }, { type: i1.TranslateService }]; } });
6234
6245
 
6235
6246
  class UploadFileItem {
6236
6247
  /**