Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-05-14 15:38:51 +03:00
commit 0955c52da9
26 changed files with 242 additions and 124 deletions

2
.gitignore vendored
View File

@ -56,3 +56,5 @@ backend/target/classes/
backend/core/target/maven-archiver/ backend/core/target/maven-archiver/
backend/node_modules/.yarn-integrity backend/node_modules/.yarn-integrity
dmp-frontend/.nx/ dmp-frontend/.nx/
notification-service/notification-web/src/main/resources/config/app.env
backend/web/src/main/resources/config/app.env

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/> <appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false"> <logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/> <appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>

View File

@ -0,0 +1,4 @@
dashboard:
reference-type-counters:
- "7eeffb98-58fb-4921-82ec-e27f32f8e738"
- "5b9c284f-f041-4995-96cc-fad7ad13289c"

View File

@ -1,4 +1,2 @@
dashboard: dashboard:
reference-type-counters: reference-type-counters: []
- "7eeffb98-58fb-4921-82ec-e27f32f8e738"
- "5b9c284f-f041-4995-96cc-fad7ad13289c"

View File

@ -1,9 +1,3 @@
#database:
# driver-class-name: org.postgresql.Driver
# lock-fail-interval: 120000
# url: ${DB_URL:}
# username: ${DB_USER:}
# password: ${DB_PASS:}
spring: spring:
jpa: jpa:
properties: properties:
@ -19,9 +13,9 @@ spring:
physical-strategy: org.opencdmp.data.namingstrategy.PrefixPhysicalNamingStrategy physical-strategy: org.opencdmp.data.namingstrategy.PrefixPhysicalNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
datasource: datasource:
url: ${DB_URL:} url: ${DB_URL}
username: ${DB_USER:} username: ${DB_USER}
password: ${DB_PASS:} password: ${DB_PASS}
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
hikari: hikari:
connection-timeout: 30000 connection-timeout: 30000

View File

@ -1,10 +1,10 @@
elastic: elastic:
enabled: ${ELASTIC_ENABLED:} enabled: ${ELASTIC_ENABLED}
hosts: hosts:
- ${ELASTIC_HOST:} - ${ELASTIC_HOST}
username: ${ELASTIC_USER:} username: ${ELASTIC_USER}
password: ${ELASTIC_PASS:} password: ${ELASTIC_PASS}
useSSL: ${ELASTIC_USE_SSL:} useSSL: ${ELASTIC_USE_SSL}
socketTimeoutMillis: 30000 socketTimeoutMillis: 30000
connectTimeoutMillis: 30000 connectTimeoutMillis: 30000
defaultResultSize: 100 defaultResultSize: 100
@ -14,8 +14,8 @@ elastic:
defaultCompositeAggregationResultSize: 200000 defaultCompositeAggregationResultSize: 200000
disableHostnameVerifier: false disableHostnameVerifier: false
app-elastic: app-elastic:
enabled: ${ELASTIC_ENABLED:} enabled: ${ELASTIC_ENABLED}
dmpIndexName: ${ELASTIC_DMP_INDEX:} dmpIndexName: ${ELASTIC_DMP_INDEX}
descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX:} descriptionIndexName: ${ELASTIC_DESCRIPTION_INDEX}
enableIcuAnalysisPlugin: false enableIcuAnalysisPlugin: false
resetBatchSize: 1000 resetBatchSize: 1000

View File

@ -1,7 +1,3 @@
pdf:
converter:
url: ${PDF_CONVERTER_URL:}
publicapi: publicapi:
host: devel.opendmp.eu host: devel.opendmp.eu
basePath: /srv basePath: /srv

View File

@ -1,36 +1,2 @@
logging: logging:
config: classpath:logging/logback-${spring.profiles.active}.xml config: classpath:logging/logback-${spring.profiles.active}.xml
context:
request:
requestIdKey: req.id
requestRemoteHostKey: req.remoteHost
requestUriKey: req.requestURI
requestQueryStringKey: req.queryString
requestUrlKey : req.requestURL
requestMethodKey: req.method
requestUserAgentKey: req.userAgent
requestForwardedForKey: req.xForwardedFor
requestSchemeKey: req.scheme
requestRemoteAddressKey: req.remoteAddr
requestRemotePortKey: req.remotePort
requestRemoteUserKey: req.remoteUser
principal:
subjectKey: usr.subject
nameKey: usr.name
clientKey: usr.client
audit:
enable: true
requestRemoteHostKey: req.remoteHost
requestUriKey: req.requestURI
requestQueryStringKey: req.queryString
requestUrlKey : req.requestURL
requestMethodKey: req.method
requestUserAgentKey: req.userAgent
requestForwardedForKey: req.xForwardedFor
requestSchemeKey: req.scheme
requestRemoteAddressKey: req.remoteAddr
requestRemotePortKey: req.remotePort
requestRemoteUserKey: req.remoteUser
principalSubjectKey: usr.subject
principalNameKey: usr.name
principalClientKey: usr.client

View File

@ -0,0 +1,14 @@
notification:
dmpInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4
dmpInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc
dmpModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
dmpFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
descriptionModifiedType: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
descriptionFinalisedType: 33790bad-94d4-488a-8ee2-7f6295ca18ea
mergeAccountConfirmationType: BFE68845-CB05-4C5A-A03D-29161A7C9660
removeCredentialConfirmationType: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
dmpDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612
descriptionTemplateInvitationType: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
contactSupportType: 5B1D6C52-88F9-418B-9B8A-6F1F963D9EAD
publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222
contactSupportEmail: support@dmp.com

View File

@ -1,15 +1,2 @@
notification: notification:
dmpInvitationExternalUserType: 065DEECD-21BB-44AF-9983-E660FDF24BC4
dmpInvitationExistingUserType: 4904dea2-5079-46d3-83be-3a19c9ab45dc
dmpModifiedType: 4542262A-22F8-4BAA-9DB6-1C8E70AC1DBB
dmpFinalisedType: 90DB0B46-42DE-BD89-AEBF-6F27EFEB256E
descriptionModifiedType: 4FDBFA80-7A71-4A69-B854-67CBB70648F1
descriptionFinalisedType: 33790bad-94d4-488a-8ee2-7f6295ca18ea
mergeAccountConfirmationType: BFE68845-CB05-4C5A-A03D-29161A7C9660
removeCredentialConfirmationType: C9BC3F16-057E-4BBA-8A5F-36BD835E5604
dmpDepositType: 55736F7A-83AB-4190-AF43-9D031A6F9612
descriptionTemplateInvitationType: 223BB607-EFA1-4CE7-99EC-4BEABFEF9A8B
contactSupportType: 5B1D6C52-88F9-418B-9B8A-6F1F963D9EAD
publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222
contactSupportEmail: support@dmp.com
emailExpirationTimeSeconds: 14400 emailExpirationTimeSeconds: 14400

View File

@ -0,0 +1,10 @@
public-api:
reference-type-map:
funderTypeId: "538928bb-c7c6-452e-b66d-08e539f5f082"
grantTypeId: "5b9c284f-f041-4995-96cc-fad7ad13289c"
registryTypeId: "2beacaad-3223-43ad-ad99-1e5f21328e7b"
serviceTypeId: "9ec2000d-95c7-452e-b356-755fc8e2574c"
dataRepositoryTypeId: "d26b64ba-fda0-4b14-b3ef-9856a492d55a"
datasetTypeId: "a3ce0fb2-d72c-48bb-b322-7401940cb802"
researcherTypeId: "5a2112e7-ea99-4cfe-98a1-68665e26726e"
organizationTypeId: "7eeffb98-58fb-4921-82ec-e27f32f8e738"

View File

@ -1,10 +1,2 @@
public-api: public-api:
reference-type-map: reference-type-map: []
funderTypeId: "538928bb-c7c6-452e-b66d-08e539f5f082"
grantTypeId: "5b9c284f-f041-4995-96cc-fad7ad13289c"
registryTypeId: "2beacaad-3223-43ad-ad99-1e5f21328e7b"
serviceTypeId: "9ec2000d-95c7-452e-b356-755fc8e2574c"
dataRepositoryTypeId: "d26b64ba-fda0-4b14-b3ef-9856a492d55a"
datasetTypeId: "a3ce0fb2-d72c-48bb-b322-7401940cb802"
researcherTypeId: "5a2112e7-ea99-4cfe-98a1-68665e26726e"
organizationTypeId: "7eeffb98-58fb-4921-82ec-e27f32f8e738"

View File

@ -10,6 +10,6 @@ web:
token-type: JWT #| opaque token-type: JWT #| opaque
jwt: jwt:
claims: [ role, x-role ] claims: [ role, x-role ]
issuer-uri: ${IDP_ISSUER_URI:} issuer-uri: ${IDP_ISSUER_URI}
audiences: [ "dmp_web" ] audiences: [ "dmp_web" ]
validIssuer: ${IDP_ISSUER_URI:} validIssuer: ${IDP_ISSUER_URI}

View File

@ -30,8 +30,8 @@ RABBIT_PASS=guest
#KEYCLOAK #KEYCLOAK
KEYCLOAK_API_SERVER_URL=http://host.docker.internal:8081/keycloak KEYCLOAK_API_SERVER_URL=http://host.docker.internal:8081/keycloak
KEYCLOAK_API_REALM=OpenCDMP KEYCLOAK_API_REALM=OpenCDMP
KEYCLOAK_API_USERNAME=keycloak-admin KEYCLOAK_API_USERNAME=dmp-keycloak-api
KEYCLOAK_API_PASSWORD=admin KEYCLOAK_API_PASSWORD=dmp-api
KEYCLOAK_API_CLIENT_ID=dmp_web KEYCLOAK_API_CLIENT_ID=dmp_web
KEYCLOAK_API_CLIENT_SECRET=web_secret KEYCLOAK_API_CLIENT_SECRET=web_secret

View File

@ -0,0 +1,22 @@
<div class="dmp-delete-dialog">
<div class="row mt-3">
<div mat-dialog-title class="col-12 pr-1 d-flex justify-content-between">
<span class="mr-3 title">{{'DMP-DELETE-DIALOG.WARNING' | translate}}</span>
<mat-icon class="close-icon" (click)="close()">close</mat-icon>
</div>
</div>
<div class="row d-flex flex-row mb-2">
<div class="col message pb-4 pl-3">{{'DMP-DELETE-DIALOG.DELETE-ITEM' | translate}}</div>
</div>
<div class="row mt-3 mr-3 mb-3">
<ng-container *ngIf="descriptions">
<ul class="error-list">
<li *ngFor="let description of descriptions">{{description.label}}</li>
</ul>
</ng-container>
</div>
<div class="row" style="justify-content: space-between;">
<div class="col-auto"><button mat-raised-button type="button" class="cancel-btn" (click)="cancel()">{{'DMP-DELETE-DIALOG.ACTIONS.CANCEL' | translate}}</button></div>
<div class="col-auto"><button mat-raised-button type="button" (click)="confirm()" class="delete-btn">{{'DMP-DELETE-DIALOG.ACTIONS.DELETE' | translate}}</button></div>
</div>
</div>

View File

@ -0,0 +1,55 @@
// ::ng-deep .mat-dialog-container {
// overflow: hidden;
// padding: 20px;
// border-radius: 125px;
// }
.dmp-delete-dialog {
padding: 24px;
overflow: hidden;
.confirmation {
padding-bottom: 20px;
}
.close-btn {
margin-left: auto;
cursor: pointer;
}
.warn-text {
// color: #f44336;
}
.cancel {
background-color: #aaaaaa;
color: #ffffff;
}
.cancel-btn {
min-width: 101px;
height: 43px;
background: #ffffff;
border: 1px solid #b5b5b5;
border-radius: 30px;
opacity: 1;
}
.delete {
background-color: #ba2c2c;
color: #ffffff;
}
.delete-btn {
min-width: 101px;
height: 43px;
background: #ffffff;
color: #ba2c2c;
border: 1px solid #ba2c2c;
border-radius: 30px;
opacity: 1;
}
}

View File

@ -0,0 +1,31 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Description } from '@app/core/model/description/description';
@Component({
selector: 'app-dmp-delete-dialog',
templateUrl: './dmp-delete-dialog.component.html',
styleUrls: ['./dmp-delete-dialog.component.scss']
})
export class DmpDeleteDialogComponent {
descriptions: Description[];
constructor(
public dialogRef: MatDialogRef<DmpDeleteDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.descriptions = data.descriptions;
}
close() {
this.dialogRef.close(false);
}
cancel() {
this.dialogRef.close(false);
}
confirm() {
this.dialogRef.close(true);
}
}

View File

@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonUiModule } from '@common/ui/common-ui.module';
import { DmpDeleteDialogComponent } from './dmp-delete-dialog.component';
@NgModule({
imports: [CommonUiModule, FormsModule],
declarations: [DmpDeleteDialogComponent],
exports: [DmpDeleteDialogComponent]
})
export class DmpDeleteDialogModule {
constructor() { }
}

View File

@ -11,6 +11,7 @@ import { DmpUserFieldModule } from '../dmp-user-field/dmp-user-field.module';
import { DmpEditorComponent } from './dmp-editor.component'; import { DmpEditorComponent } from './dmp-editor.component';
import { DmpEditorRoutingModule } from './dmp-editor.routing'; import { DmpEditorRoutingModule } from './dmp-editor.routing';
import { DmpFormProgressIndicationModule } from './form-progress-indication/dmp-form-progress-indication.module'; import { DmpFormProgressIndicationModule } from './form-progress-indication/dmp-form-progress-indication.module';
import { DmpDeleteDialogModule } from '../dmp-delete-dialog/dmp-delete-dialog.module';
@NgModule({ @NgModule({
imports: [ imports: [
@ -18,6 +19,7 @@ import { DmpFormProgressIndicationModule } from './form-progress-indication/dmp-
CommonFormsModule, CommonFormsModule,
FormattingModule, FormattingModule,
ConfirmationDialogModule, ConfirmationDialogModule,
DmpDeleteDialogModule,
DmpEditorRoutingModule, DmpEditorRoutingModule,
RichTextEditorModule, RichTextEditorModule,
AutoCompleteModule, AutoCompleteModule,

View File

@ -29,6 +29,7 @@ import { NewVersionDmpDialogComponent } from '../../new-version-dialog/dmp-new-v
import { AppPermission } from '@app/core/common/enum/permission.enum'; import { AppPermission } from '@app/core/common/enum/permission.enum';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status'; import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpDeleteDialogComponent } from '../../dmp-delete-dialog/dmp-delete-dialog.component';
@Component({ @Component({
selector: 'app-dmp-listing-item-component', selector: 'app-dmp-listing-item-component',
@ -168,16 +169,28 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
} }
openDeleteDialog(id: Guid) { openDeleteDialog(id: Guid) {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { let dialogRef: any;
maxWidth: '300px',
restoreFocus: false, if (this.dmp.descriptions && this.dmp.descriptions.length > 0){
data: { dialogRef = this.dialog.open(DmpDeleteDialogComponent, {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), maxWidth: '300px',
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'), data: {
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), descriptions: this.dmp.descriptions,
isDeleteConfirmation: true }
} });
}); } else {
dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
restoreFocus: false,
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
}
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) { if (result) {
this.dmpService.delete(id) this.dmpService.delete(id)

View File

@ -48,6 +48,7 @@ import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-fina
import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver';
import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type'; import { FileTransformerEntityType } from '@app/core/common/enum/file-transformer-entity-type';
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status'; import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
import { DmpDeleteDialogComponent } from '../dmp-delete-dialog/dmp-delete-dialog.component';
@Component({ @Component({
selector: 'app-dmp-overview', selector: 'app-dmp-overview',
@ -373,15 +374,26 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
// } // }
deleteClicked() { deleteClicked() {
const dialogRef = this.dialog.open(ConfirmationDialogComponent, { let dialogRef: any;
maxWidth: '300px', if (this.dmp.descriptions && this.dmp.descriptions.length > 0){
data: { dialogRef = this.dialog.open(DmpDeleteDialogComponent, {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'), maxWidth: '300px',
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'), data: {
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'), descriptions: this.dmp.descriptions,
isDeleteConfirmation: true }
} });
}); } else {
dialogRef = this.dialog.open(ConfirmationDialogComponent, {
maxWidth: '300px',
data: {
message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.DELETE-ITEM'),
confirmButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.DELETE'),
cancelButton: this.language.instant('GENERAL.CONFIRMATION-DIALOG.ACTIONS.CANCEL'),
isDeleteConfirmation: true
}
});
}
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
if (result) { if (result) {
this.dmpService.delete(this.dmp.id) this.dmpService.delete(this.dmp.id)

View File

@ -10,12 +10,14 @@ import { NgDialogAnimationService } from 'ng-dialog-animation';
import { DmpFinalizeDialogModule } from '../dmp-finalize-dialog/dmp-finalize-dialog.module'; import { DmpFinalizeDialogModule } from '../dmp-finalize-dialog/dmp-finalize-dialog.module';
import { DmpOverviewRoutingModule } from './dmp-overview.routing'; import { DmpOverviewRoutingModule } from './dmp-overview.routing';
import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module'; import { MultipleChoiceDialogModule } from '@common/modules/multiple-choice-dialog/multiple-choice-dialog.module';
import { DmpDeleteDialogModule } from '../dmp-delete-dialog/dmp-delete-dialog.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonUiModule, CommonUiModule,
CommonFormsModule, CommonFormsModule,
ConfirmationDialogModule, ConfirmationDialogModule,
DmpDeleteDialogModule,
MultipleChoiceDialogModule, MultipleChoiceDialogModule,
FormattingModule, FormattingModule,
AutoCompleteModule, AutoCompleteModule,

View File

@ -643,6 +643,14 @@
}, },
"PLACEHOLDER": "Plan title" "PLACEHOLDER": "Plan title"
}, },
"DMP-DELETE-DIALOG": {
"WARNING": "Warning!",
"DELETE-ITEM": "Are you sure to delete this plan? The following descriptions will also be removed:",
"ACTIONS": {
"DELETE": "Delete",
"CANCEL": "Cancel"
}
},
"DMP-OVERVIEW": { "DMP-OVERVIEW": {
"TITLE": "Plan", "TITLE": "Plan",
"PUBLIC": "Public", "PUBLIC": "Public",

View File

@ -486,5 +486,5 @@ notification:
priority-key: null priority-key: null
cipher-fields: [ ] cipher-fields: [ ]
template-cache: template-cache:
prefix: ${CACHE_DISAMBIGUATION:} prefix: ${CACHE_DISAMBIGUATION}
key-pattern: "{prefix}:Notification_Message_InApp_Template:{key}:v0" key-pattern: "{prefix}:Notification_Message_InApp_Template:{key}:v0"

View File

@ -46,10 +46,6 @@
<appender-ref ref="TROUBLESHOOTING"/> <appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</logger> </logger>
<logger name="org.springframework.data.elasticsearch.client.WIRE" level="TRACE" additivity="false">
<appender-ref ref="TROUBLESHOOTING"/>
<appender-ref ref="STDOUT"/>
</logger>
<logger name="audit" level="INFO" additivity="false"> <logger name="audit" level="INFO" additivity="false">
<appender-ref ref="AUDITING"/> <appender-ref ref="AUDITING"/>
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>

View File

@ -108,20 +108,25 @@ public class MessageBuilderServiceImpl implements MessageInfoBuilderService {
if (messageInfo.getTimeZone() == null || messageInfo.getTimeZone().isBlank()) messageInfo.setTimeZone(this.localeService.timezoneName()); if (messageInfo.getTimeZone() == null || messageInfo.getTimeZone().isBlank()) messageInfo.setTimeZone(this.localeService.timezoneName());
if (this.scope.isMultitenant()) { if (this.scope.isMultitenant()) {
TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class) if (!this.scope.isDefaultTenant()) {
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code)); TenantEntity tenantInfo = this.queryFactory.query(TenantQuery.class)
.isActive(IsActive.Active).firstAs(new BaseFieldSet(TenantEntity._id, TenantEntity._code));
if (tenantInfo == null) { if (tenantInfo == null) {
try { try {
logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant()); logger.error("Could not retrieve tenant info for notification {} in tenant {}", notification.getId(), scope.getTenant());
} catch (InvalidApplicationException e) { } catch (InvalidApplicationException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
} }
throw new MyForbiddenException(this.errors.getMissingTenant().getCode(), this.errors.getMissingTenant().getMessage());
}
messageInfo.setTenantId(tenantInfo.getId()); messageInfo.setTenantId(tenantInfo.getId());
messageInfo.setTenantCode(tenantInfo.getCode()); messageInfo.setTenantCode(tenantInfo.getCode());
} else {
messageInfo.setTenantId(null);
messageInfo.setTenantCode(this.scope.getDefaultTenantCode());
}
} }
return messageInfo; return messageInfo;