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