Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
99a870ff84
|
@ -12,6 +12,10 @@ public class PublicReferenceType {
|
||||||
public static final String _name = "name";
|
public static final String _name = "name";
|
||||||
|
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
public static final String _code = "code";
|
||||||
|
|
||||||
|
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -27,4 +31,12 @@ public class PublicReferenceType {
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class PublicReferenceTypeBuilder extends BaseBuilder<PublicReferenceType,
|
||||||
PublicReferenceType m = new PublicReferenceType();
|
PublicReferenceType m = new PublicReferenceType();
|
||||||
if (fields.hasField(this.asIndexer(PublicReferenceType._id))) m.setId(d.getId());
|
if (fields.hasField(this.asIndexer(PublicReferenceType._id))) m.setId(d.getId());
|
||||||
if (fields.hasField(this.asIndexer(PublicReferenceType._name))) m.setName(d.getName());
|
if (fields.hasField(this.asIndexer(PublicReferenceType._name))) m.setName(d.getName());
|
||||||
|
if (fields.hasField(this.asIndexer(PublicReferenceType._code))) m.setCode(d.getCode());
|
||||||
models.add(m);
|
models.add(m);
|
||||||
}
|
}
|
||||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||||
|
|
|
@ -188,14 +188,14 @@ public class DmpReferenceQuery extends QueryBase<DmpReferenceEntity> {
|
||||||
inClause.value(item);
|
inClause.value(item);
|
||||||
predicates.add(inClause);
|
predicates.add(inClause);
|
||||||
}
|
}
|
||||||
// if (this.dmpQuery != null) {
|
if (this.dmpQuery != null) {
|
||||||
// QueryContext<DmpEntity, UUID> subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(DmpEntity._id));
|
QueryContext<DmpEntity, UUID> subQuery = this.applySubQuery(this.dmpQuery, queryContext, UUID.class, dmpEntityRoot -> dmpEntityRoot.get(DmpEntity._id));
|
||||||
// predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(subQuery.Query));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._dmpId)).value(subQuery.Query));
|
||||||
// }
|
}
|
||||||
// if (this.referenceQuery != null) {
|
if (this.referenceQuery != null) {
|
||||||
// QueryContext<ReferenceEntity, UUID> subQuery = this.applySubQuery(this.referenceQuery, queryContext, UUID.class, root -> root.get(ReferenceEntity._id));
|
QueryContext<ReferenceEntity, UUID> subQuery = this.applySubQuery(this.referenceQuery, queryContext, UUID.class, root -> root.get(ReferenceEntity._id));
|
||||||
// predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._referenceId)).value(subQuery.Query));
|
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpReferenceEntity._referenceId)).value(subQuery.Query));
|
||||||
// }
|
}
|
||||||
if (!predicates.isEmpty()) {
|
if (!predicates.isEmpty()) {
|
||||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||||
|
|
|
@ -135,24 +135,20 @@ public class DashboardServiceImpl implements DashboardService {
|
||||||
|
|
||||||
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.userScope.getUserId().toString().toLowerCase(Locale.ROOT)));
|
DashboardStatisticsCacheService.DashboardStatisticsCacheValue cacheValue = this.dashboardStatisticsCacheService.lookup(this.dashboardStatisticsCacheService.buildKey(this.userScope.getUserId().toString().toLowerCase(Locale.ROOT)));
|
||||||
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
if (cacheValue == null || cacheValue.getDashboardStatistics() == null) {
|
||||||
DmpUserQuery dmpUserLookup = this.queryFactory.query(DmpUserQuery.class);
|
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).versionStatuses(DmpVersionStatus.Current);
|
||||||
dmpUserLookup.userIds(this.userScope.getUserId());
|
|
||||||
dmpUserLookup.isActives(IsActive.Active);
|
|
||||||
|
|
||||||
DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(DmpVersionStatus.Current);
|
|
||||||
|
|
||||||
DashboardStatistics statistics = new DashboardStatistics();
|
DashboardStatistics statistics = new DashboardStatistics();
|
||||||
statistics.setDmpCount(dmpQuery.authorize(EnumSet.of(AuthorizationFlags.DmpAssociated)).count());
|
statistics.setDmpCount(dmpQuery.authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
||||||
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).dmpSubQuery(dmpQuery).statuses(DescriptionStatus.Finalized).authorize(EnumSet.of(AuthorizationFlags.DmpAssociated)).count());
|
statistics.setDescriptionCount(this.queryFactory.query(DescriptionQuery.class).isActive(IsActive.Active).dmpSubQuery(dmpQuery).statuses(DescriptionStatus.Finalized).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count());
|
||||||
|
|
||||||
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
statistics.setReferenceTypeStatistics(new ArrayList<>());
|
||||||
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
if (!this.conventionService.isListNullOrEmpty(this.config.getReferenceTypeCounters())){
|
||||||
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
for (UUID typeId : this.config.getReferenceTypeCounters()){
|
||||||
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
DashboardReferenceTypeStatistics referenceTypeStatistics = new DashboardReferenceTypeStatistics();
|
||||||
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(EnumSet.of(Owner))
|
referenceTypeStatistics.setCount(this.queryFactory.query(ReferenceQuery.class).isActive(IsActive.Active).typeIds(typeId).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
||||||
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
.dmpReferenceSubQuery(this.queryFactory.query(DmpReferenceQuery.class).isActives(IsActive.Active)
|
||||||
.dmpSubQuery(dmpQuery)).count());
|
.dmpSubQuery(dmpQuery)).count());
|
||||||
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._name), this.queryFactory.query(ReferenceTypeQuery.class).ids(typeId).first()));
|
referenceTypeStatistics.setReferenceType(this.builderFactory.builder(PublicReferenceTypeBuilder.class).build(new BaseFieldSet().ensure(PublicReferenceType._code), this.queryFactory.query(ReferenceTypeQuery.class).ids(typeId).first()));
|
||||||
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
statistics.getReferenceTypeStatistics().add(referenceTypeStatistics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
|
||||||
// this.registerFormListeners();
|
// this.registerFormListeners();
|
||||||
});
|
});
|
||||||
} else if (dmpId != null && dmpSectionId != null) {
|
} else if (dmpId != null && dmpSectionId != null) {
|
||||||
|
this.isNew = true;
|
||||||
const dialogRef = this.dialog.open(PrefillDescriptionDialogComponent, {
|
const dialogRef = this.dialog.open(PrefillDescriptionDialogComponent, {
|
||||||
width: '590px',
|
width: '590px',
|
||||||
minHeight: '200px',
|
minHeight: '200px',
|
||||||
|
|
Loading…
Reference in New Issue