Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
fa6d100b41
|
@ -11,8 +11,11 @@ import org.opencdmp.authorization.AuthorizationFlags;
|
|||
import org.opencdmp.authorization.Permission;
|
||||
import org.opencdmp.commons.enums.ContactInfoType;
|
||||
import org.opencdmp.commons.scope.user.UserScope;
|
||||
import org.opencdmp.data.DmpUserEntity;
|
||||
import org.opencdmp.data.UserContactInfoEntity;
|
||||
import org.opencdmp.model.UserContactInfo;
|
||||
import org.opencdmp.query.utils.BuildSubQueryInput;
|
||||
import org.opencdmp.query.utils.QueryUtilsService;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -31,11 +34,12 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
|||
private Collection<ContactInfoType> types;
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
private final UserScope userScope;
|
||||
private final AuthorizationService authService;
|
||||
public UserContactInfoQuery(UserScope userScope, AuthorizationService authService) {
|
||||
this.userScope = userScope;
|
||||
public UserContactInfoQuery(QueryUtilsService queryUtilsService, UserScope userScope, AuthorizationService authService) {
|
||||
this.queryUtilsService = queryUtilsService;
|
||||
this.userScope = userScope;
|
||||
this.authService = authService;
|
||||
}
|
||||
|
||||
|
@ -168,7 +172,17 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (userId != null) {
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(userId));
|
||||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(userId), //Creates a false query
|
||||
queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class)
|
||||
.query(queryContext.Query)
|
||||
.criteriaBuilder(queryContext.CriteriaBuilder)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._userId))
|
||||
.filterFunc((subQueryRoot, cb) ->
|
||||
cb.in(subQueryRoot.get(DmpUserEntity._dmpId)).value(this.queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, false))
|
||||
)
|
||||
)))
|
||||
));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
@ -187,6 +201,12 @@ public class UserContactInfoQuery extends QueryBase<UserContactInfoEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.types != null) {
|
||||
CriteriaBuilder.In<ContactInfoType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._type));
|
||||
for (ContactInfoType item : this.types)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.userIds != null) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(UserContactInfoEntity._userId));
|
||||
for (UUID item : this.userIds)
|
||||
|
|
|
@ -75,6 +75,14 @@
|
|||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.url"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.host.support_versioning"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.license"
|
||||
},
|
||||
{
|
||||
"category": "rda",
|
||||
"name": "rda.dataset.distribution.license.license_ref"
|
||||
|
|
|
@ -154,7 +154,7 @@ export class ConfigurationService extends BaseComponent {
|
|||
get authProviders(): AuthProviders {
|
||||
return this._authProviders;
|
||||
}
|
||||
|
||||
|
||||
private _analyticsProviders: AnalyticsProviders;
|
||||
get analyticsProviders(): AnalyticsProviders {
|
||||
return this._analyticsProviders;
|
||||
|
@ -175,6 +175,11 @@ export class ConfigurationService extends BaseComponent {
|
|||
return this._organizationId;
|
||||
}
|
||||
|
||||
private _depositRecordUrlIdPlaceholder: string;
|
||||
get depositRecordUrlIdPlaceholder(): string {
|
||||
return this._depositRecordUrlIdPlaceholder;
|
||||
}
|
||||
|
||||
public loadConfiguration(): Promise<any> {
|
||||
return new Promise((r, e) => {
|
||||
// We need to exclude all interceptors here, for the initial configuration request.
|
||||
|
@ -249,6 +254,7 @@ export class ConfigurationService extends BaseComponent {
|
|||
this._researcherId = config.referenceTypes.researcherId;
|
||||
this._grantId = config.referenceTypes.grantId;
|
||||
this._organizationId = config.referenceTypes.organizationId;
|
||||
this._depositRecordUrlIdPlaceholder = config.deposit.recordUrlIdPlaceholder;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="fieldSet.hasMultiplicity && (fieldSet?.multiplicity?.max - 1) > (propertiesFormGroup.get('items').length)" class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
|
||||
<div *ngIf="fieldSet.hasMultiplicity && (fieldSet?.multiplicity?.max) > (propertiesFormGroup.get('items').length)" class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
|
||||
<span class="d-inline-flex align-items-center" [ngClass]="propertiesFormGroup.disabled ? '' : 'pointer'" (click)="addMultiplicityField()">
|
||||
<button mat-icon-button color="primary" [disabled]="propertiesFormGroup.disabled">
|
||||
<mat-icon>add_circle</mat-icon>
|
||||
|
|
|
@ -572,14 +572,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
//TODO: needs rewriting
|
||||
const repository = this.depositRepos.find(r => r.repositoryId == doiModel.repositoryId);
|
||||
if (typeof repository !== "undefined") {
|
||||
if (doiModel.repositoryId == "Zenodo") {
|
||||
const doiarr = doiModel.doi.split('.');
|
||||
const id = doiarr[doiarr.length - 1];
|
||||
return repository.repositoryRecordUrl + id;
|
||||
}
|
||||
else {
|
||||
return repository.repositoryRecordUrl + doiModel.doi;
|
||||
}
|
||||
return repository.repositoryRecordUrl.replace(this.configurationService.depositRecordUrlIdPlaceholder, doiModel.doi);
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
|
|
|
@ -82,5 +82,8 @@
|
|||
"researcherId": "5a2112e7-ea99-4cfe-98a1-68665e26726e",
|
||||
"grantId": "5b9c284f-f041-4995-96cc-fad7ad13289c",
|
||||
"organizationId": "7eeffb98-58fb-4921-82ec-e27f32f8e738"
|
||||
},
|
||||
"deposit":{
|
||||
"recordUrlIdPlaceholder": "{doi_id}"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue